* weird bogosity relating to "copyright-update"
@ 2011-02-07 7:07 Miles Bader
2011-02-07 9:37 ` Lars Ingebrigtsen
0 siblings, 1 reply; 4+ messages in thread
From: Miles Bader @ 2011-02-07 7:07 UTC (permalink / raw)
To: emacs-devel
I use Emacs' copyright-updating stuff, which is generally really nice,
but for a few months it's been misbehaving in a way I found very
confusing... I can't seem to reproduce it using a minimal
configuration.
Basically I enable it in my .emacs mode like this:
(add-hook 'write-file-hooks 'copyright-update)
the `copyright-update' function is autoloaded by default from
"copyright.el".
This worked fine for years, but recently it's started giving an error
when saving a file:
run-hook-with-args-until-success: Symbol's value as variable is void: copyright-update
... making the file-write fail.
Oddly, examining the state of Emacs afterwards, it's clear that
"copyright.el" _has_ been loaded by the autoload, but for some reason
the `copyright-update' variable -- which is defvar'd in copyright.el --
has become unbound, making the copyright-update function code always
fail thereafter.
The only way I can then save files, is to manually do "M-x load-library
RET copyright RET", upon which everything starts working properly.
However today I noticed another message which I hadn't before:
Warning: defvar ignored because copyright-update is let-bound
... emitted while Gnus was saving some mail via FCC.
Now I can see what's going on: Gnus ("lisp/gnus/nnfolder.el":1094) is
let-binding `copyright-update' _around_ the file write which results in
"copyright.el" being autoloaded, but the let-binding suppresses the
global binding, screwing up all writes once the original let-binding
exits.
So... what change tickled this problem, and what's the right way to fix
it...? It doesn't seem a bad thing that Gnus is doing that let-binding
(you probably _don't_ want your mail FCCs to get copyright-updated), but
it's clearly bad that the let-binding is screwing things up...
Thanks,
-Miles
--
Admiration, n. Our polite recognition of another's resemblance to ourselves.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: weird bogosity relating to "copyright-update"
2011-02-07 7:07 weird bogosity relating to "copyright-update" Miles Bader
@ 2011-02-07 9:37 ` Lars Ingebrigtsen
2011-02-07 10:44 ` Miles Bader
2011-02-07 15:57 ` Stefan Monnier
0 siblings, 2 replies; 4+ messages in thread
From: Lars Ingebrigtsen @ 2011-02-07 9:37 UTC (permalink / raw)
To: emacs-devel
Miles Bader <miles.bader.fz@renesas.com> writes:
> So... what change tickled this problem, and what's the right way to fix
> it...? It doesn't seem a bad thing that Gnus is doing that let-binding
> (you probably _don't_ want your mail FCCs to get copyright-updated), but
> it's clearly bad that the let-binding is screwing things up...
Yes, that seems like the wrong way to do this. If nnfolder wants to
let-bind `copyright-updated', it also has to require copyright. But I
think it would make more sense for nnfolder to bind `write-file-hooks'
to nil, wouldn't it?
But it is puzzling that this has started happening lately. That code in
nnfolder seems to have been committed in 2005, but it only started
erroring out quite recently.
--
(domestic pets only, the antidote for overdose, milk.)
larsi@gnus.org * Lars Magne Ingebrigtsen
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: weird bogosity relating to "copyright-update"
2011-02-07 9:37 ` Lars Ingebrigtsen
@ 2011-02-07 10:44 ` Miles Bader
2011-02-07 15:57 ` Stefan Monnier
1 sibling, 0 replies; 4+ messages in thread
From: Miles Bader @ 2011-02-07 10:44 UTC (permalink / raw)
To: emacs-devel
Lars Ingebrigtsen <larsi@gnus.org> writes:
> But it is puzzling that this has started happening lately. That code in
> nnfolder seems to have been committed in 2005, but it only started
> erroring out quite recently.
Hmm, there's the additional twist that `copyright-update' is a
buffer-local variable, which might make things even more messy.
Don't really know tho...
-Miles
--
Genealogy, n. An account of one's descent from an ancestor who did not
particularly care to trace his own.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: weird bogosity relating to "copyright-update"
2011-02-07 9:37 ` Lars Ingebrigtsen
2011-02-07 10:44 ` Miles Bader
@ 2011-02-07 15:57 ` Stefan Monnier
1 sibling, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2011-02-07 15:57 UTC (permalink / raw)
To: emacs-devel
>> So... what change tickled this problem, and what's the right way to fix
>> it...? It doesn't seem a bad thing that Gnus is doing that let-binding
>> (you probably _don't_ want your mail FCCs to get copyright-updated), but
>> it's clearly bad that the let-binding is screwing things up...
> Yes, that seems like the wrong way to do this. If nnfolder wants to
> let-bind `copyright-updated', it also has to require copyright.
Indeed.
> But I think it would make more sense for nnfolder to bind
> `write-file-hooks' to nil, wouldn't it?
Actually, the recommended hook to use for copyright-update nowadays is
not write-file-hooks (which has been marked obsolete since Emacs-22.1)
but before-save-hook.
So it should maybe bind write-file-functions, write-contents-functions,
and before-save-hook, or and maybe after-save-hook as well.
Or maybe a better way would be to use write-region rather than save-buffer.
Stefan
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-02-07 15:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-07 7:07 weird bogosity relating to "copyright-update" Miles Bader
2011-02-07 9:37 ` Lars Ingebrigtsen
2011-02-07 10:44 ` Miles Bader
2011-02-07 15:57 ` Stefan Monnier
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.