Subject: bug#27502: closed (Re: bug#27502: 25.2; auto-revert adds lambda to find-file-hook)

From: [email-masked] (GNU bug Tracking System)
Date: Sun, 02 Jul 2017 09:46:02 +0000

Your bug report

#27502: 25.2; auto-revert adds lambda to find-file-hook

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
27502: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=27502
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#27502: 25.2; auto-revert adds lambda to find-file-hook
From: Michael Albinus <[email-masked]>
To: Pierre Neidhardt <[email-masked]>
Cc: [email-masked]
Date: Sun, 02 Jul 2017 11:45:17 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Version: 26.1 
Pierre Neidhardt <[email-masked]> writes:

Hi Pierre,

> It seems that autorevert.el:316 adds a lambda to `find-file-hook':
>
> (add-hook 'find-file-hook
> 	  (lambda ()
> 	    (setq-local auto-revert-tail-pos
>                         (nth 7 (file-attributes buffer-file-name)))))
>
> It's bad practice to add lambdas to hooks as it makes it harder to remove them.
> We should use a named function instead.

I've fixed this (and a similar problem with `kill-buffer-hook') in the trunk.

Best regards, Michael.

Subject: 25.2; auto-revert adds lambda to find-file-hook
From: Pierre Neidhardt <[email-masked]>
To: GNU Emacs bug Tracking System <[email-masked]>
Date: Mon, 26 Jun 2017 20:53:19 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

It seems that autorevert.el:316 adds a lambda to `find-file-hook':

(add-hook 'find-file-hook
	  (lambda ()
	    (setq-local auto-revert-tail-pos
                        (nth 7 (file-attributes buffer-file-name)))))

It's bad practice to add lambdas to hooks as it makes it harder to remove them.
We should use a named function instead.

In GNU Emacs 25.2.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.22.10)
 of 2017-04-22 built on juergen
Windowing system distributor 'The X.Org Foundation', version 11.0.11903000
System Description:	Arch Linux