[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r112984: * lisp/subr.el (eval-after-load, set-tempor
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] trunk r112984: * lisp/subr.el (eval-after-load, set-temporary-overlay-map): Use indirection |
Date: |
Fri, 14 Jun 2013 04:11:08 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 112984
revision-id: address@hidden
parent: address@hidden
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Fri 2013-06-14 00:11:00 -0400
message:
* lisp/subr.el (eval-after-load, set-temporary-overlay-map): Use indirection
through a symbol rather than letrec.
modified:
lisp/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1432
lisp/subr.el subr.el-20091113204419-o5vbwnq5f7feedwu-151
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2013-06-14 03:20:18 +0000
+++ b/lisp/ChangeLog 2013-06-14 04:11:00 +0000
@@ -1,5 +1,8 @@
2013-06-14 Stefan Monnier <address@hidden>
+ * subr.el (eval-after-load, set-temporary-overlay-map): Use indirection
+ through a symbol rather than letrec.
+
* emacs-lisp/package.el: Don't recompute dir. Use pkg-descs more.
(package-desc): Add `dir' field.
(package-desc-full-name): New function.
=== modified file 'lisp/subr.el'
--- a/lisp/subr.el 2013-06-13 22:24:52 +0000
+++ b/lisp/subr.el 2013-06-14 04:11:00 +0000
@@ -3794,12 +3794,15 @@
(if (not load-file-name)
;; Not being provided from a file, run func right now.
(funcall func)
- (let ((lfn load-file-name))
- (letrec ((fun (lambda (file)
- (when (equal file lfn)
- (remove-hook 'after-load-functions fun)
- (funcall func)))))
- (add-hook 'after-load-functions fun))))))))
+ (let ((lfn load-file-name)
+ ;; Don't use letrec, because equal (in
+ ;; add/remove-hook) would get trapped in a cycle.
+ (fun (make-symbol "eval-after-load-helper")))
+ (fset fun (lambda (file)
+ (when (equal file lfn)
+ (remove-hook 'after-load-functions fun)
+ (funcall func))))
+ (add-hook 'after-load-functions fun)))))))
;; Add FORM to the element unless it's already there.
(unless (member delayed-func (cdr elt))
(nconc elt (list delayed-func)))))))
@@ -4282,23 +4285,26 @@
Optional ON-EXIT argument is a function that is called after the
deactivation of MAP."
- (letrec ((clearfun
- (lambda ()
- ;; FIXME: Handle the case of multiple temporary-overlay-maps
- ;; E.g. if isearch and C-u both use temporary-overlay-maps, Then
- ;; the lifetime of the C-u should be nested within the isearch
- ;; overlay, so the pre-command-hook of isearch should be
- ;; suspended during the C-u one so we don't exit isearch just
- ;; because we hit 1 after C-u and that 1 exits isearch whereas it
- ;; doesn't exit C-u.
- (unless (cond ((null keep-pred) nil)
- ((eq t keep-pred)
- (eq this-command
- (lookup-key map (this-command-keys-vector))))
- (t (funcall keep-pred)))
- (remove-hook 'pre-command-hook clearfun)
- (internal-pop-keymap map 'overriding-terminal-local-map)
- (when on-exit (funcall on-exit))))))
+ (let ((clearfun (make-symbol "clear-temporary-overlay-map")))
+ ;; Don't use letrec, because equal (in add/remove-hook) would get trapped
+ ;; in a cycle.
+ (fset clearfun
+ (lambda ()
+ ;; FIXME: Handle the case of multiple temporary-overlay-maps
+ ;; E.g. if isearch and C-u both use temporary-overlay-maps, Then
+ ;; the lifetime of the C-u should be nested within the isearch
+ ;; overlay, so the pre-command-hook of isearch should be
+ ;; suspended during the C-u one so we don't exit isearch just
+ ;; because we hit 1 after C-u and that 1 exits isearch whereas it
+ ;; doesn't exit C-u.
+ (unless (cond ((null keep-pred) nil)
+ ((eq t keep-pred)
+ (eq this-command
+ (lookup-key map (this-command-keys-vector))))
+ (t (funcall keep-pred)))
+ (remove-hook 'pre-command-hook clearfun)
+ (internal-pop-keymap map 'overriding-terminal-local-map)
+ (when on-exit (funcall on-exit)))))
(add-hook 'pre-command-hook clearfun)
(internal-push-keymap map 'overriding-terminal-local-map)))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r112984: * lisp/subr.el (eval-after-load, set-temporary-overlay-map): Use indirection,
Stefan Monnier <=