* before-save-hook not run by 'compile'?
@ 2018-01-02 13:53 Stephen Leake
2018-01-05 14:21 ` Eli Zaretskii
0 siblings, 1 reply; 2+ messages in thread
From: Stephen Leake @ 2018-01-02 13:53 UTC (permalink / raw)
To: emacs-devel
I have 'delete-trailing-whitespace' in 'before-save-hook'; the Ada
compiler I'm using complains if there is trailing whitespace.
However, sometimes when I edit a file and then invoke 'compile', the
file is save, but 'delete-trailing-whitespace' is _not_ run.
If I invoke 'save-some-buffers' directly, 'delete-trailing-whitespace'
is run.
I'm running emacs-26, built from the branch.
I've looked thru the code for compile, and it appears to call
'save-buffer', which appears to run the hook.
I've tried to instrument save-buffer for edebug, but then running
'compile' crashes emacs (with no helpful messages).
Can anyone shed any light on this?
--
-- Stephe
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: before-save-hook not run by 'compile'?
2018-01-02 13:53 before-save-hook not run by 'compile'? Stephen Leake
@ 2018-01-05 14:21 ` Eli Zaretskii
0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2018-01-05 14:21 UTC (permalink / raw)
To: Stephen Leake; +Cc: emacs-devel
> From: Stephen Leake <stephen_leake@stephe-leake.org>
> Date: Tue, 02 Jan 2018 07:53:54 -0600
>
> I have 'delete-trailing-whitespace' in 'before-save-hook'; the Ada
> compiler I'm using complains if there is trailing whitespace.
>
> However, sometimes when I edit a file and then invoke 'compile', the
> file is save, but 'delete-trailing-whitespace' is _not_ run.
>
> If I invoke 'save-some-buffers' directly, 'delete-trailing-whitespace'
> is run.
>
> I'm running emacs-26, built from the branch.
>
> I've looked thru the code for compile, and it appears to call
> 'save-buffer', which appears to run the hook.
That call to 'before-save-hook' is made under some condition, so maybe
that condition is false in those cases? Also, the hook is run
with-demoted-errors, so maybe it signals an error before actually
doing its job?
> I've tried to instrument save-buffer for edebug, but then running
> 'compile' crashes emacs (with no helpful messages).
You could put a hook in write-contents-functions that just announced
itself to some special buffer, and then see whether it is called on
those cases where before-save-hook seems not to work. The hooks in
write-contents-functions are called immediately after
before-save-hook, so they could be evidence for whether
before-save-hook ran normally.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-01-05 14:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-02 13:53 before-save-hook not run by 'compile'? Stephen Leake
2018-01-05 14:21 ` Eli Zaretskii
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).