GNU bug report logs - #27502
25.2; auto-revert adds lambda to find-file-hook

Previous Next

Package: emacs;

Reported by: Pierre Neidhardt <ambrevar <at> gmail.com>

Date: Mon, 26 Jun 2017 19:54:01 UTC

Severity: minor

Found in version 25.2

Fixed in version 26.1

Done: Michael Albinus <michael.albinus <at> gmx.de>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Pierre Neidhardt <ambrevar <at> gmail.com>
Subject: bug#27502: closed (Re: bug#27502: 25.2; auto-revert adds lambda
 to find-file-hook)
Date: Sun, 02 Jul 2017 09:46:02 +0000
[Message part 1 (text/plain, inline)]
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 27502 <at> debbugs.gnu.org.

-- 
27502: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=27502
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Michael Albinus <michael.albinus <at> gmx.de>
To: Pierre Neidhardt <ambrevar <at> gmail.com>
Cc: 27502-done <at> debbugs.gnu.org
Subject: Re: bug#27502: 25.2; auto-revert adds lambda to find-file-hook
Date: Sun, 02 Jul 2017 11:45:17 +0200
Version: 26.1 
Pierre Neidhardt <ambrevar <at> gmail.com> 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.

[Message part 3 (message/rfc822, inline)]
From: Pierre Neidhardt <ambrevar <at> gmail.com>
To: GNU Emacs bug Tracking System <bug-gnu-emacs <at> gnu.org>
Subject: 25.2; auto-revert adds lambda to find-file-hook
Date: Mon, 26 Jun 2017 20:53:19 +0100
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



This bug report was last modified 7 years and 329 days ago.

Previous Next


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