all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#27502: 25.2; auto-revert adds lambda to find-file-hook
@ 2017-06-26 19:53 Pierre Neidhardt
  2017-07-02  9:45 ` Michael Albinus
  0 siblings, 1 reply; 2+ messages in thread
From: Pierre Neidhardt @ 2017-06-26 19:53 UTC (permalink / raw)
  To: 27502

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





^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#27502: 25.2; auto-revert adds lambda to find-file-hook
  2017-06-26 19:53 bug#27502: 25.2; auto-revert adds lambda to find-file-hook Pierre Neidhardt
@ 2017-07-02  9:45 ` Michael Albinus
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Albinus @ 2017-07-02  9:45 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: 27502-done

Version: 26.1 
Pierre Neidhardt <ambrevar@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.





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-07-02  9:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-26 19:53 bug#27502: 25.2; auto-revert adds lambda to find-file-hook Pierre Neidhardt
2017-07-02  9:45 ` Michael Albinus

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.