summaryrefslogtreecommitdiff
path: root/lisp/international/mule.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2022-02-10 13:44:55 +0100
committerLars Ingebrigtsen <larsi@gnus.org>2022-02-10 13:44:55 +0100
commit53da8c50fca98b5a7d0418f6030181df50af8876 (patch)
tree83d90e494cc2dcbe3298c8d0b19bb21f3ecf5dca /lisp/international/mule.el
parent15781beda80fffa6c2dca1b5b32da8f0b4b3b306 (diff)
downloademacs-53da8c50fca98b5a7d0418f6030181df50af8876.tar.gz
Don't signal a backtrace on empty --script files
* lisp/startup.el (command-line--load-script): New function that avoids erroring out if it turns out there's no forms in the buffer (bug#4616). * lisp/subr.el (delete-line): New utility function. * lisp/international/mule.el (load-with-code-conversion): Accept an eval function.
Diffstat (limited to 'lisp/international/mule.el')
-rw-r--r--lisp/international/mule.el29
1 files changed, 20 insertions, 9 deletions
diff --git a/lisp/international/mule.el b/lisp/international/mule.el
index 0758359e154..1596cdb4817 100644
--- a/lisp/international/mule.el
+++ b/lisp/international/mule.el
@@ -298,13 +298,21 @@ attribute."
(defvar hack-read-symbol-shorthands-function nil
"Holds function to compute `read-symbol-shorthands'.")
-(defun load-with-code-conversion (fullname file &optional noerror nomessage)
+(defun load-with-code-conversion (fullname file &optional noerror nomessage
+ eval-function)
"Execute a file of Lisp code named FILE whose absolute name is FULLNAME.
The file contents are decoded before evaluation if necessary.
-If optional third arg NOERROR is non-nil,
- report no error if FILE doesn't exist.
-Print messages at start and end of loading unless
- optional fourth arg NOMESSAGE is non-nil.
+
+If optional third arg NOERROR is non-nil, report no error if FILE
+doesn't exist.
+
+Print messages at start and end of loading unless optional fourth
+arg NOMESSAGE is non-nil.
+
+If EVAL-FUNCTION, call that instead of calling `eval-buffer'
+directly. It is called with two paramameters: The buffer object
+and the file name.
+
Return t if file exists."
(if (null (file-readable-p fullname))
(and (null noerror)
@@ -353,10 +361,13 @@ Return t if file exists."
;; Have the original buffer current while we eval,
;; but consider shorthands of the eval'ed one.
(let ((read-symbol-shorthands shorthands))
- (eval-buffer buffer nil
- ;; This is compatible with what `load' does.
- (if dump-mode file fullname)
- nil t)))
+ (if eval-function
+ (funcall eval-function buffer
+ (if dump-mode file fullname))
+ (eval-buffer buffer nil
+ ;; This is compatible with what `load' does.
+ (if dump-mode file fullname)
+ nil t))))
(let (kill-buffer-hook kill-buffer-query-functions)
(kill-buffer buffer)))
(do-after-load-evaluation fullname)