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.