help-gnu-emacs
[Top][All Lists]
Advanced

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

RE: [External] : 2 different initialization strategies


From: Drew Adams
Subject: RE: [External] : 2 different initialization strategies
Date: Wed, 18 Jan 2023 00:24:14 +0000

> I have the following hook defined.
> 
> (defun dmp-php-hook ()
>   (when (eq major-mode 'html-mode)
>     (save-excursion
>       (goto-char (point-min))
>       (while (re-search-forward "\\([ \t]+$\\)" nil t)
>         (delete-region (match-beginning 1) (match-end 1))
>         ))
>     nil))
> 
> I have two different initialisation strategies:
> 
> (1) (add-hook 'write-file-functions 'dmp-write-mode-function
> 
> (2) (setq write-file-functions (cons 'dmp-write-mode-function
> 'write-file-functions))
> 
> With add-hook I can specify the optional variable DEPTH
> for that version so I prefer this strategy over the other
> one, if it is allowed.

(What's the question?)

Yes, use `add-hook' to add a hook function.
Don't use `setq'.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]