[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] fix/bootstrap-build-minimize dc99b79 3/3: Add error handli
From: |
Phillip Lord |
Subject: |
[Emacs-diffs] fix/bootstrap-build-minimize dc99b79 3/3: Add error handling to magic-mode-alist |
Date: |
Sat, 21 Jan 2017 20:00:39 +0000 (UTC) |
branch: fix/bootstrap-build-minimize
commit dc99b790099986300fedf9e7d341569534faf013
Author: Phillip Lord <address@hidden>
Commit: Phillip Lord <address@hidden>
Add error handling to magic-mode-alist
* lisp/files.el (set-auto-mode): Add explicit error handling in two
places.
---
lisp/files.el | 27 ++++++++++++++++++++-------
1 file changed, 20 insertions(+), 7 deletions(-)
diff --git a/lisp/files.el b/lisp/files.el
index b57e35b..d766dcb 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -2911,9 +2911,15 @@ we don't actually set it to the same mode the buffer
already has."
(+ (point-min)
magic-mode-regexp-match-limit)))
(assoc-default nil magic-mode-alist
(lambda (re _dummy)
- (if (functionp re)
- (funcall re)
- (looking-at re)))))))
+ (cond
+ ((functionp re)
+ (funcall re))
+ ((stringp re)
+ (looking-at re))
+ (t
+ (error
+ "Problem in magic-mode-alist with
element %s" re))
+ ))))))
(set-auto-mode-0 done keep-mode-if-same)))
;; Next compare the filename against the entries in auto-mode-alist.
(unless done
@@ -2965,10 +2971,17 @@ we don't actually set it to the same mode the buffer
already has."
(min (point-max)
(+ (point-min)
magic-mode-regexp-match-limit)))
(assoc-default nil magic-fallback-mode-alist
- (lambda (re _dummy)
- (if (functionp re)
- (funcall re)
- (looking-at re)))))))
+ (lambda (re _dummy)
+ (cond
+ ((functionp re)
+ (funcall re))
+ ((stringp re)
+ (looking-at re))
+ (t
+ (error
+ "Problem with
magic-fallback-mode-alist element: %s"
+ re))
+ ))))))
(set-auto-mode-0 done keep-mode-if-same)))
(unless done
(set-buffer-major-mode (current-buffer)))))