diff options
| author | Stefan Monnier | 2013-06-14 00:11:00 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2013-06-14 00:11:00 -0400 |
| commit | bf1e6ae81df3a2a8f2ba4027c9e96a0097acddc5 (patch) | |
| tree | 31078fc3b8a88972a7c0aba4c611ebd31f510e36 | |
| parent | 0a36080d55e106f043fe5b1cabdb605f054e38e1 (diff) | |
| download | emacs-bf1e6ae81df3a2a8f2ba4027c9e96a0097acddc5.tar.gz emacs-bf1e6ae81df3a2a8f2ba4027c9e96a0097acddc5.zip | |
* lisp/subr.el (eval-after-load, set-temporary-overlay-map): Use indirection
through a symbol rather than letrec.
| -rw-r--r-- | lisp/ChangeLog | 3 | ||||
| -rw-r--r-- | lisp/subr.el | 52 |
2 files changed, 32 insertions, 23 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 67e361cc320..38b4d7b7854 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,8 @@ | |||
| 1 | 2013-06-14 Stefan Monnier <monnier@iro.umontreal.ca> | 1 | 2013-06-14 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 2 | ||
| 3 | * subr.el (eval-after-load, set-temporary-overlay-map): Use indirection | ||
| 4 | through a symbol rather than letrec. | ||
| 5 | |||
| 3 | * emacs-lisp/package.el: Don't recompute dir. Use pkg-descs more. | 6 | * emacs-lisp/package.el: Don't recompute dir. Use pkg-descs more. |
| 4 | (package-desc): Add `dir' field. | 7 | (package-desc): Add `dir' field. |
| 5 | (package-desc-full-name): New function. | 8 | (package-desc-full-name): New function. |
diff --git a/lisp/subr.el b/lisp/subr.el index 05f9167c699..eba99b839e6 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -3794,12 +3794,15 @@ This function makes or adds to an entry on `after-load-alist'." | |||
| 3794 | (if (not load-file-name) | 3794 | (if (not load-file-name) |
| 3795 | ;; Not being provided from a file, run func right now. | 3795 | ;; Not being provided from a file, run func right now. |
| 3796 | (funcall func) | 3796 | (funcall func) |
| 3797 | (let ((lfn load-file-name)) | 3797 | (let ((lfn load-file-name) |
| 3798 | (letrec ((fun (lambda (file) | 3798 | ;; Don't use letrec, because equal (in |
| 3799 | (when (equal file lfn) | 3799 | ;; add/remove-hook) would get trapped in a cycle. |
| 3800 | (remove-hook 'after-load-functions fun) | 3800 | (fun (make-symbol "eval-after-load-helper"))) |
| 3801 | (funcall func))))) | 3801 | (fset fun (lambda (file) |
| 3802 | (add-hook 'after-load-functions fun)))))))) | 3802 | (when (equal file lfn) |
| 3803 | (remove-hook 'after-load-functions fun) | ||
| 3804 | (funcall func)))) | ||
| 3805 | (add-hook 'after-load-functions fun))))))) | ||
| 3803 | ;; Add FORM to the element unless it's already there. | 3806 | ;; Add FORM to the element unless it's already there. |
| 3804 | (unless (member delayed-func (cdr elt)) | 3807 | (unless (member delayed-func (cdr elt)) |
| 3805 | (nconc elt (list delayed-func))))))) | 3808 | (nconc elt (list delayed-func))))))) |
| @@ -4282,23 +4285,26 @@ non-nil then MAP stays active. | |||
| 4282 | 4285 | ||
| 4283 | Optional ON-EXIT argument is a function that is called after the | 4286 | Optional ON-EXIT argument is a function that is called after the |
| 4284 | deactivation of MAP." | 4287 | deactivation of MAP." |
| 4285 | (letrec ((clearfun | 4288 | (let ((clearfun (make-symbol "clear-temporary-overlay-map"))) |
| 4286 | (lambda () | 4289 | ;; Don't use letrec, because equal (in add/remove-hook) would get trapped |
| 4287 | ;; FIXME: Handle the case of multiple temporary-overlay-maps | 4290 | ;; in a cycle. |
| 4288 | ;; E.g. if isearch and C-u both use temporary-overlay-maps, Then | 4291 | (fset clearfun |
| 4289 | ;; the lifetime of the C-u should be nested within the isearch | 4292 | (lambda () |
| 4290 | ;; overlay, so the pre-command-hook of isearch should be | 4293 | ;; FIXME: Handle the case of multiple temporary-overlay-maps |
| 4291 | ;; suspended during the C-u one so we don't exit isearch just | 4294 | ;; E.g. if isearch and C-u both use temporary-overlay-maps, Then |
| 4292 | ;; because we hit 1 after C-u and that 1 exits isearch whereas it | 4295 | ;; the lifetime of the C-u should be nested within the isearch |
| 4293 | ;; doesn't exit C-u. | 4296 | ;; overlay, so the pre-command-hook of isearch should be |
| 4294 | (unless (cond ((null keep-pred) nil) | 4297 | ;; suspended during the C-u one so we don't exit isearch just |
| 4295 | ((eq t keep-pred) | 4298 | ;; because we hit 1 after C-u and that 1 exits isearch whereas it |
| 4296 | (eq this-command | 4299 | ;; doesn't exit C-u. |
| 4297 | (lookup-key map (this-command-keys-vector)))) | 4300 | (unless (cond ((null keep-pred) nil) |
| 4298 | (t (funcall keep-pred))) | 4301 | ((eq t keep-pred) |
| 4299 | (remove-hook 'pre-command-hook clearfun) | 4302 | (eq this-command |
| 4300 | (internal-pop-keymap map 'overriding-terminal-local-map) | 4303 | (lookup-key map (this-command-keys-vector)))) |
| 4301 | (when on-exit (funcall on-exit)))))) | 4304 | (t (funcall keep-pred))) |
| 4305 | (remove-hook 'pre-command-hook clearfun) | ||
| 4306 | (internal-pop-keymap map 'overriding-terminal-local-map) | ||
| 4307 | (when on-exit (funcall on-exit))))) | ||
| 4302 | (add-hook 'pre-command-hook clearfun) | 4308 | (add-hook 'pre-command-hook clearfun) |
| 4303 | (internal-push-keymap map 'overriding-terminal-local-map))) | 4309 | (internal-push-keymap map 'overriding-terminal-local-map))) |
| 4304 | 4310 | ||