bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#23933: 25.1.50; Run a buffer-local hook with mapc


From: Tino Calancha
Subject: bug#23933: 25.1.50; Run a buffer-local hook with mapc
Date: Mon, 11 Jul 2016 03:14:48 +0900 (JST)
User-agent: Alpine 2.20 (DEB 67 2015-01-07)



On Sun, 10 Jul 2016, Eli Zaretskii wrote:

Can't we simply remove the t?  If not, why not?
Yes, we can and it is more readable:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

diff --git a/lisp/vc/ediff-util.el b/lisp/vc/ediff-util.el
index a6b88d5..f98c2f4 100644
--- a/lisp/vc/ediff-util.el
+++ b/lisp/vc/ediff-util.el
@@ -2522,7 +2522,7 @@ ediff-really-quit
                            (frame-selected-window warp-frame))
                          2 1))

-  (mapc #'funcall after-quit-hook-internal)
+  (mapc #'funcall (delq t after-quit-hook-internal))
   ))

 ;; Returns frame under mouse, if this frame is not a minibuffer

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

I also tried Noam suggestion about using push instead of add-hook on
ediff-after-quit-hook-internal, that works also OK:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

diff --git a/lisp/vc/ediff-mult.el b/lisp/vc/ediff-mult.el
index 7f0db5d..a092218 100644
--- a/lisp/vc/ediff-mult.el
+++ b/lisp/vc/ediff-mult.el
@@ -1904,13 +1904,12 @@ ediff-filegroup-action
                  file1 file2
                  ;; provide startup hooks
                  `(list (lambda ()
-                            (add-hook
-                             'ediff-after-quit-hook-internal
+                            (push
                              (lambda ()
(if (ediff-buffer-live-p ,(current-buffer))
                                    (ediff-show-meta-buffer
                                     ,(current-buffer) ,session-number)))
-                             nil 'local)
+                             ediff-after-quit-hook-internal)
                             (setq ediff-meta-buffer ,(current-buffer)
                                   ediff-meta-session-number
                                   ,session-number)
@@ -1933,15 +1932,14 @@ ediff-filegroup-action
                      file1
                      ;; provide startup hooks
                      `(list (lambda ()
-                              (add-hook
-                               'ediff-after-quit-hook-internal
+                              (push
                                (lambda ()
                                  (if (ediff-buffer-live-p
                                       ,(current-buffer))
                                      (ediff-show-meta-buffer
                                       ,(current-buffer)
                                       ,session-number)))
-                               nil 'local)
+                               ediff-after-quit-hook-internal)
                               (setq ediff-meta-buffer ,(current-buffer)
                                     ediff-meta-session-number
                                     ,session-number)
@@ -1962,15 +1960,14 @@ ediff-filegroup-action
                      file1 file2
                      ;; provide startup hooks
                      `(list (lambda ()
-                              (add-hook
-                               'ediff-after-quit-hook-internal
+                              (push
                                (lambda ()
                                  (if (ediff-buffer-live-p
                                       ,(current-buffer))
                                      (ediff-show-meta-buffer
                                       ,(current-buffer)
                                       ,session-number)))
-                               nil 'local)
+                               ediff-after-quit-hook-internal)
                               (setq ediff-meta-buffer ,(current-buffer)
                                     ediff-meta-session-number
                                     ,session-number)
@@ -1991,15 +1988,14 @@ ediff-filegroup-action
                      file1 file2 file3
                      ;; arrange startup hooks
                      `(list (lambda ()
-                              (add-hook
-                               'ediff-after-quit-hook-internal
+                              (push
                                (lambda ()
                                  (if (ediff-buffer-live-p
                                       ,(current-buffer))
                                      (ediff-show-meta-buffer
                                       ,(current-buffer)
                                       ,session-number)))
-                               nil 'local)
+                               ediff-after-quit-hook-internal)
                               (setq ediff-merge-store-file
                                     ,(if (ediff-nonempty-string-p
                                           merge-autostore-dir)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

What aproach looks better?





reply via email to

[Prev in Thread] Current Thread [Next in Thread]