diff options
| author | Artur Malabarba | 2015-11-04 13:00:04 +0000 |
|---|---|---|
| committer | Artur Malabarba | 2015-11-04 13:00:04 +0000 |
| commit | 2fef1fc823bc14957fa624e501dd3b739809d525 (patch) | |
| tree | a3b71857ddd105f718be85c827ec5000c5868449 | |
| parent | 8e843831eaf271801836b7a3e4dd3b4fb0bb72b8 (diff) | |
| download | emacs-2fef1fc823bc14957fa624e501dd3b739809d525.tar.gz emacs-2fef1fc823bc14957fa624e501dd3b739809d525.zip | |
* lisp/files.el (report-errors): Obsolete
(normal-mode, hack-local-variables, dir-locals-find-file): Use
`with-demoted-errors' instead.
| -rw-r--r-- | lisp/files.el | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/lisp/files.el b/lisp/files.el index b25994c0c92..9de9ac09f48 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -2283,18 +2283,7 @@ unless NOMODES is non-nil." | |||
| 2283 | (view-mode-enter)) | 2283 | (view-mode-enter)) |
| 2284 | (run-hooks 'find-file-hook))) | 2284 | (run-hooks 'find-file-hook))) |
| 2285 | 2285 | ||
| 2286 | (defmacro report-errors (format &rest body) | 2286 | (define-obsolete-function-alias 'report-errors 'with-demoted-errors "25.1") |
| 2287 | "Eval BODY and turn any error into a FORMAT message. | ||
| 2288 | FORMAT can have a %s escape which will be replaced with the actual error. | ||
| 2289 | If `debug-on-error' is set, errors are not caught, so that you can | ||
| 2290 | debug them. | ||
| 2291 | Avoid using a large BODY since it is duplicated." | ||
| 2292 | (declare (debug t) (indent 1)) | ||
| 2293 | `(if debug-on-error | ||
| 2294 | (progn . ,body) | ||
| 2295 | (condition-case err | ||
| 2296 | (progn . ,body) | ||
| 2297 | (error (message ,format (prin1-to-string err)))))) | ||
| 2298 | 2287 | ||
| 2299 | (defun normal-mode (&optional find-file) | 2288 | (defun normal-mode (&optional find-file) |
| 2300 | "Choose the major mode for this buffer automatically. | 2289 | "Choose the major mode for this buffer automatically. |
| @@ -2315,9 +2304,9 @@ in that case, this function acts as if `enable-local-variables' were t." | |||
| 2315 | (let ((enable-local-variables (or (not find-file) enable-local-variables))) | 2304 | (let ((enable-local-variables (or (not find-file) enable-local-variables))) |
| 2316 | ;; FIXME this is less efficient than it could be, since both | 2305 | ;; FIXME this is less efficient than it could be, since both |
| 2317 | ;; s-a-m and h-l-v may parse the same regions, looking for "mode:". | 2306 | ;; s-a-m and h-l-v may parse the same regions, looking for "mode:". |
| 2318 | (report-errors "File mode specification error: %s" | 2307 | (with-demoted-errors "File mode specification error: %s" |
| 2319 | (set-auto-mode)) | 2308 | (set-auto-mode)) |
| 2320 | (report-errors "File local-variables error: %s" | 2309 | (with-demoted-errors "File local-variables error: %s" |
| 2321 | (hack-local-variables))) | 2310 | (hack-local-variables))) |
| 2322 | ;; Turn font lock off and on, to make sure it takes account of | 2311 | ;; Turn font lock off and on, to make sure it takes account of |
| 2323 | ;; whatever file local variables are relevant to it. | 2312 | ;; whatever file local variables are relevant to it. |
| @@ -3316,7 +3305,7 @@ local variables, but directory-local variables may still be applied." | |||
| 3316 | result) | 3305 | result) |
| 3317 | (unless mode-only | 3306 | (unless mode-only |
| 3318 | (setq file-local-variables-alist nil) | 3307 | (setq file-local-variables-alist nil) |
| 3319 | (report-errors "Directory-local variables error: %s" | 3308 | (with-demoted-errors "Directory-local variables error: %s" |
| 3320 | ;; Note this is a no-op if enable-local-variables is nil. | 3309 | ;; Note this is a no-op if enable-local-variables is nil. |
| 3321 | (hack-dir-local-variables))) | 3310 | (hack-dir-local-variables))) |
| 3322 | ;; This entire function is basically a no-op if enable-local-variables | 3311 | ;; This entire function is basically a no-op if enable-local-variables |