aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhillip Lord2017-01-21 16:43:38 +0000
committerPhillip Lord2017-01-29 16:36:08 +0000
commit0f07c30b6af3d9aa0a6a034099aa384daf0a10d6 (patch)
tree30420445b4aa75ebb50cee6831dde58a6a3fe4c1
parentad07fe2ca8e3e1e8685248e9ebc144a12bae3a55 (diff)
downloademacs-0f07c30b6af3d9aa0a6a034099aa384daf0a10d6.tar.gz
emacs-0f07c30b6af3d9aa0a6a034099aa384daf0a10d6.zip
Add error handling to magic-mode-alistfix/bootstrap-build-minimize-squash
* lisp/files.el (set-auto-mode): Add explicit error handling in two places.
-rw-r--r--lisp/files.el32
1 files changed, 23 insertions, 9 deletions
diff --git a/lisp/files.el b/lisp/files.el
index b57e35b9a0a..6a68c631549 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -2909,11 +2909,18 @@ we don't actually set it to the same mode the buffer already has."
2909 (narrow-to-region (point-min) 2909 (narrow-to-region (point-min)
2910 (min (point-max) 2910 (min (point-max)
2911 (+ (point-min) magic-mode-regexp-match-limit))) 2911 (+ (point-min) magic-mode-regexp-match-limit)))
2912 (assoc-default nil magic-mode-alist 2912 (assoc-default
2913 (lambda (re _dummy) 2913 nil magic-mode-alist
2914 (if (functionp re) 2914 (lambda (re _dummy)
2915 (funcall re) 2915 (cond
2916 (looking-at re))))))) 2916 ((functionp re)
2917 (funcall re))
2918 ((stringp re)
2919 (looking-at re))
2920 (t
2921 (error
2922 "Problem in magic-mode-alist with element %s"
2923 re))))))))
2917 (set-auto-mode-0 done keep-mode-if-same))) 2924 (set-auto-mode-0 done keep-mode-if-same)))
2918 ;; Next compare the filename against the entries in auto-mode-alist. 2925 ;; Next compare the filename against the entries in auto-mode-alist.
2919 (unless done 2926 (unless done
@@ -2965,10 +2972,17 @@ we don't actually set it to the same mode the buffer already has."
2965 (min (point-max) 2972 (min (point-max)
2966 (+ (point-min) magic-mode-regexp-match-limit))) 2973 (+ (point-min) magic-mode-regexp-match-limit)))
2967 (assoc-default nil magic-fallback-mode-alist 2974 (assoc-default nil magic-fallback-mode-alist
2968 (lambda (re _dummy) 2975 (lambda (re _dummy)
2969 (if (functionp re) 2976 (cond
2970 (funcall re) 2977 ((functionp re)
2971 (looking-at re))))))) 2978 (funcall re))
2979 ((stringp re)
2980 (looking-at re))
2981 (t
2982 (error
2983 "Problem with magic-fallback-mode-alist element: %s"
2984 re))
2985 ))))))
2972 (set-auto-mode-0 done keep-mode-if-same))) 2986 (set-auto-mode-0 done keep-mode-if-same)))
2973 (unless done 2987 (unless done
2974 (set-buffer-major-mode (current-buffer))))) 2988 (set-buffer-major-mode (current-buffer)))))