diff options
author | João Távora <joaotavora@gmail.com> | 2021-10-03 16:05:40 +0100 |
---|---|---|
committer | João Távora <joaotavora@gmail.com> | 2021-10-04 00:17:12 +0100 |
commit | d3a832a61ab5766b6ec879cee9ab75bbbc62034a (patch) | |
tree | 79a63185ad966b7fe4ede306efaba3eef82b8532 /lisp/international/mule.el | |
parent | 483142615864e990b2ec45e61681d7ab44096335 (diff) | |
download | emacs-d3a832a61ab5766b6ec879cee9ab75bbbc62034a.tar.gz |
Simplify hack-read-symbol-shorthands again (bug#50946)
* lisp/loadup.el (load-source-file-function): Don't set twice.
* lisp/shorthands.el (hack-read-symbol-shorthands): Simplify.
(load-with-shorthands-and-code-conversion): Remove.
* lisp/international/mule.el (load-with-code-conversion): Call
hack-read-symbol-shorthands-function. Set up shorthands.
(hack-read-symbol-shorthands-function): New variable.
Diffstat (limited to 'lisp/international/mule.el')
-rw-r--r-- | lisp/international/mule.el | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/lisp/international/mule.el b/lisp/international/mule.el index 2a855b56736..5022a17db5a 100644 --- a/lisp/international/mule.el +++ b/lisp/international/mule.el @@ -294,6 +294,9 @@ attribute." (apply 'define-charset-internal name (mapcar 'cdr attrs)))) +(defvar hack-read-symbol-shorthands-function nil + "Holds function to compute `read-symbol-shorthands'.") + (defun load-with-code-conversion (fullname file &optional noerror nomessage) "Execute a file of Lisp code named FILE whose absolute name is FULLNAME. The file contents are decoded before evaluation if necessary. @@ -319,7 +322,8 @@ Return t if file exists." (let ((load-true-file-name fullname) (load-file-name fullname) (set-auto-coding-for-load t) - (inhibit-file-name-operation nil)) + (inhibit-file-name-operation nil) + shorthands) (with-current-buffer buffer ;; So that we don't get completely screwed if the ;; file is encoded in some complicated character set, @@ -328,6 +332,13 @@ Return t if file exists." ;; Don't let deactivate-mark remain set. (let (deactivate-mark) (insert-file-contents fullname)) + (setq shorthands + ;; We need this indirection because hacking local + ;; variables in too early seems to have cause + ;; recursive load loops (bug#50946). Thus it + ;; remains nil until it is save to do so. + (and hack-read-symbol-shorthands-function + (funcall hack-read-symbol-shorthands-function))) ;; If the loaded file was inserted with no-conversion or ;; raw-text coding system, make the buffer unibyte. ;; Otherwise, eval-buffer might try to interpret random @@ -338,11 +349,13 @@ Return t if file exists." (set-buffer-multibyte nil)) ;; Make `kill-buffer' quiet. (set-buffer-modified-p nil)) - ;; Have the original buffer current while we eval. - (eval-buffer buffer nil - ;; This is compatible with what `load' does. - (if dump-mode file fullname) - nil t)) + ;; 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))) (let (kill-buffer-hook kill-buffer-query-functions) (kill-buffer buffer))) (do-after-load-evaluation fullname) |