@@ -1977,29 +1977,30 @@ Return FALLBACK if non-nil, otherwise the value of
1977
1977
(mname (if (string-match-p " -mode$" str)
1978
1978
str
1979
1979
(concat str " -mode" ))))
1980
- (or
1981
- ; ; direct search
1982
- (let ((mode (intern mname)))
1983
- (when (and (fboundp mode) (functionp mode))
1984
- mode))
1985
- ; ; downcase
1986
- (let ((mode (intern (downcase mname))))
1987
- (when (and (fboundp mode) (functionp mode))
1988
- mode))
1989
- ; ; auto-mode alist
1990
- (let ((dummy-file (concat " a." str)))
1991
- (cl-loop for (k . v) in auto-mode-alist
1992
- if (and (string-match-p k dummy-file)
1993
- (not (string-match-p " ^poly-" (symbol-name v))))
1994
- return v))
1995
- (when (or (eq polymode-default-inner-mode 'host )
1996
- (and (fboundp polymode-default-inner-mode)
1997
- (functionp polymode-default-inner-mode)))
1998
- polymode-default-inner-mode)
1999
- (when (or (eq fallback 'host )
2000
- (and (fboundp fallback) (functionp fallback)))
2001
- fallback)
2002
- 'poly-fallback-mode ))))))
1980
+ (major-mode-remap
1981
+ (or
1982
+ ; ; direct search
1983
+ (let ((mode (intern mname)))
1984
+ (when (and (fboundp mode) (functionp mode))
1985
+ mode))
1986
+ ; ; downcase
1987
+ (let ((mode (intern (downcase mname))))
1988
+ (when (and (fboundp mode) (functionp mode))
1989
+ mode))
1990
+ ; ; auto-mode alist
1991
+ (let ((dummy-file (concat " a." str)))
1992
+ (cl-loop for (k . v) in auto-mode-alist
1993
+ if (and (string-match-p k dummy-file)
1994
+ (not (string-match-p " ^poly-" (symbol-name v))))
1995
+ return v))
1996
+ (when (or (eq polymode-default-inner-mode 'host )
1997
+ (and (fboundp polymode-default-inner-mode)
1998
+ (functionp polymode-default-inner-mode)))
1999
+ polymode-default-inner-mode)
2000
+ (when (or (eq fallback 'host )
2001
+ (and (fboundp fallback) (functionp fallback)))
2002
+ fallback)
2003
+ 'poly-fallback-mode )))))))
2003
2004
2004
2005
(defun pm--oref-with-parents (object slot )
2005
2006
" Merge slots SLOT from the OBJECT and all its parent instances."
0 commit comments