GNU bug report logs - #23933
25.1.50; Run a buffer-local hook with mapc

Previous Next

Package: emacs;

Reported by: Tino Calancha <tino.calancha <at> gmail.com>

Date: Sun, 10 Jul 2016 10:19:02 UTC

Severity: minor

Found in version 25.1.50

Done: Tino Calancha <tino.calancha <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Tino Calancha <tino.calancha <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: npostavs <at> users.sourceforge.net, kifer <at> cs.stonybrook.edu, 23933 <at> debbugs.gnu.org, monnier <at> iro.umontreal.ca, Tino Calancha <tino.calancha <at> gmail.com>
Subject: bug#23933: 25.1.50; Run a buffer-local hook with mapc
Date: Mon, 11 Jul 2016 03:14:48 +0900 (JST)

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?




This bug report was last modified 9 years and 4 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.