* is the after-save-hook changed?
@ 2024-01-10 20:30 Uwe Brauer via Emacs development discussions.
2024-01-11 6:43 ` Eli Zaretskii
0 siblings, 1 reply; 5+ messages in thread
From: Uwe Brauer via Emacs development discussions. @ 2024-01-10 20:30 UTC (permalink / raw)
To: emacs-devel
Hi
I have used backup-each-save some years ago quite extensively.
Now I wanted, at least for some files, to use it again.
So I again started to use
(require 'backup-each-save)
and locally in LaTeX file
--8<---------------cut here---------------start------------->8---
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% vc-make-backup-files: t
%%% eval: (add-hook (make-local-variable 'after-save-hook) 'backup-each-save)
%%% End:
--8<---------------cut here---------------end--------------->8---
However describe variable after-save-hook shows me in this file
,----
|
| after-save-hook is a variable defined in ‘files.el’.
|
| Its value is (diff-hl-update t)
| Original value was nil
| Local in buffer test.tex; global value is (backup-each-save)
`----
So who is the culprit here?
Thanks and regards
Uwe Brauer
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: is the after-save-hook changed?
2024-01-10 20:30 is the after-save-hook changed? Uwe Brauer via Emacs development discussions.
@ 2024-01-11 6:43 ` Eli Zaretskii
2024-01-11 6:55 ` Uwe Brauer
0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2024-01-11 6:43 UTC (permalink / raw)
To: Uwe Brauer; +Cc: emacs-devel
> Date: Wed, 10 Jan 2024 21:30:51 +0100
> From: Uwe Brauer via "Emacs development discussions." <emacs-devel@gnu.org>
>
> I have used backup-each-save some years ago quite extensively.
>
> Now I wanted, at least for some files, to use it again.
>
> So I again started to use
> (require 'backup-each-save)
> and locally in LaTeX file
>
> --8<---------------cut here---------------start------------->8---
> %%% Local Variables:
> %%% mode: latex
> %%% TeX-master: t
> %%% vc-make-backup-files: t
> %%% eval: (add-hook (make-local-variable 'after-save-hook) 'backup-each-save)
> %%% End:
> --8<---------------cut here---------------end--------------->8---
>
>
>
>
>
> However describe variable after-save-hook shows me in this file
>
> ,----
> |
> | after-save-hook is a variable defined in ‘files.el’.
> |
> | Its value is (diff-hl-update t)
> | Original value was nil
> | Local in buffer test.tex; global value is (backup-each-save)
> `----
>
>
> So who is the culprit here?
If you want a local hook setting, use the LOCAL argument of add-hook.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: is the after-save-hook changed?
2024-01-11 6:43 ` Eli Zaretskii
@ 2024-01-11 6:55 ` Uwe Brauer
2024-01-11 8:58 ` Eli Zaretskii
0 siblings, 1 reply; 5+ messages in thread
From: Uwe Brauer @ 2024-01-11 6:55 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Uwe Brauer, emacs-devel
[-- Attachment #1: Type: text/plain, Size: 745 bytes --]
> If you want a local hook setting, use the LOCAL argument of add-hook.
Well
this
%%% eval: (add-hook (make-local-variable 'after-save-hook) 'backup-each-save)
Worked nicely in the past (and is still recommended in the documentation
of this package)
However I found out that now the syntax
%%% eval: (add-hook (make-local-variable 'after-save-hook) 'backup-each-save nil t)
Makes it work again.
Maybe the doc-string of after-save-hook could say something about it?
--
I strongly condemn Hamas heinous despicable pogroms/atrocities on Israel
I strongly condemn Putin's war of aggression against Ukraine.
I support to deliver weapons to Ukraine's military.
I support the EU and NATO membership of Ukraine.
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: is the after-save-hook changed?
2024-01-11 6:55 ` Uwe Brauer
@ 2024-01-11 8:58 ` Eli Zaretskii
2024-01-11 10:00 ` Uwe Brauer
0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2024-01-11 8:58 UTC (permalink / raw)
To: Uwe Brauer; +Cc: emacs-devel
> From: Uwe Brauer <oub@mat.ucm.es>
> Cc: Uwe Brauer <oub@mat.ucm.es>, emacs-devel@gnu.org
> Date: Thu, 11 Jan 2024 07:55:01 +0100
>
> > If you want a local hook setting, use the LOCAL argument of add-hook.
>
> Well
> this
> %%% eval: (add-hook (make-local-variable 'after-save-hook) 'backup-each-save)
>
> Worked nicely in the past (and is still recommended in the documentation
> of this package)
>
> However I found out that now the syntax
>
> %%% eval: (add-hook (make-local-variable 'after-save-hook) 'backup-each-save nil t)
>
> Makes it work again.
>
> Maybe the doc-string of after-save-hook could say something about it?
There's nothing special about after-save-hook, the LOCAL argument is a
standard feature of add-hook and is documented in its doc string.
Btw, I don't understand why you use make-local-variable here. I don't
think it's needed.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: is the after-save-hook changed?
2024-01-11 8:58 ` Eli Zaretskii
@ 2024-01-11 10:00 ` Uwe Brauer
0 siblings, 0 replies; 5+ messages in thread
From: Uwe Brauer @ 2024-01-11 10:00 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Uwe Brauer, emacs-devel
[-- Attachment #1: Type: text/plain, Size: 652 bytes --]
> There's nothing special about after-save-hook, the LOCAL argument is a
> standard feature of add-hook and is documented in its doc string.
> Btw, I don't understand why you use make-local-variable here. I don't
> think it's needed.
(add-hook (make-local-variable 'after-save-hook) 'backup-each-save)
Worked, aeh, 10 years ago. So maybe I did not use this package since 10
years.
--
I strongly condemn Hamas heinous despicable pogroms/atrocities on Israel
I strongly condemn Putin's war of aggression against Ukraine.
I support to deliver weapons to Ukraine's military.
I support the EU and NATO membership of Ukraine.
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-01-11 10:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-10 20:30 is the after-save-hook changed? Uwe Brauer via Emacs development discussions.
2024-01-11 6:43 ` Eli Zaretskii
2024-01-11 6:55 ` Uwe Brauer
2024-01-11 8:58 ` Eli Zaretskii
2024-01-11 10:00 ` Uwe Brauer
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.