diff options
| -rw-r--r-- | lisp/emacs-lisp/lisp-mnt.el | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lisp/emacs-lisp/lisp-mnt.el b/lisp/emacs-lisp/lisp-mnt.el index 893d95db05c..aeb7fb2258d 100644 --- a/lisp/emacs-lisp/lisp-mnt.el +++ b/lisp/emacs-lisp/lisp-mnt.el | |||
| @@ -297,12 +297,14 @@ The returned value is a list of strings, one per line." | |||
| 297 | 297 | ||
| 298 | (defmacro lm-with-file (file &rest body) | 298 | (defmacro lm-with-file (file &rest body) |
| 299 | "Execute BODY in a buffer containing the contents of FILE. | 299 | "Execute BODY in a buffer containing the contents of FILE. |
| 300 | If FILE is nil, just return nil." | 300 | If FILE is nil, execute BODY in the current buffer." |
| 301 | (let ((filesym (make-symbol "file"))) | 301 | (let ((filesym (make-symbol "file"))) |
| 302 | `(let ((,filesym ,file)) | 302 | `(let ((,filesym ,file)) |
| 303 | (when ,filesym | 303 | (if ,filesym |
| 304 | (with-temp-buffer | 304 | (with-temp-buffer |
| 305 | (insert-file-contents ,filesym) | 305 | (insert-file-contents ,filesym) |
| 306 | ,@body) | ||
| 307 | (save-excursion | ||
| 306 | ,@body))))) | 308 | ,@body))))) |
| 307 | (put 'lm-with-file 'lisp-indent-function 1) | 309 | (put 'lm-with-file 'lisp-indent-function 1) |
| 308 | (put 'lm-with-file 'edebug-form-spec t) | 310 | (put 'lm-with-file 'edebug-form-spec t) |