[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Another changelog rant



Tollef Fog Heen wrote:

> * Peter S Galbraith 
> 
> | Tollef Fog Heen wrote:
> | 
> | > Something like:
> | > 
> | > (setq find-file-hooks
> | >       (cons #'(lambda ()
> | > 	       ;; Invoke proper modes when we don't know file extensions
> | > 	       (cond ((looking-at "#!.*/perl") (perl-mode))
> | > 		     ((looking-at "#!.*/tclsh") (tcl-mode))
> | > 		     ((looking-at "#!.*/wish") (tcl-mode))))
> | > 	    find-file-hooks))
> | > 
> | > And add the proper regexp for Debian changelogs.
> | 
> | Done with add-hook instead of setq, this is an interesting answer.
> | :-)
> 
> You don't need add-hook, since the setq has find-file-hooks at the end
> as well. 

Sorry.  I didn't mean to offend.  You don't need `add-hook', but
add-hook is cleaner, easier for people to understand, and was
written for this purpose.

>           I copied the source off somebody else, and don't really know
> why it uses setq and cons instead of add-hook.

Most likely it's code that predates add-hook.  It was the
standard way to write that before add-hook was added to Emacs.

Peter



Reply to: