* ;; -*-coding: emacs-mule;-*- ???
@ 2003-11-03 12:46 Stefan Reichör
2003-11-03 14:22 ` Sacha Chua
2003-11-03 14:48 ` Stefan Monnier
0 siblings, 2 replies; 6+ messages in thread
From: Stefan Reichör @ 2003-11-03 12:46 UTC (permalink / raw)
Hi!
Today I upgraded to the latest cvs version of emacs.
Now I get the unwanted behaviour, that emacs inserts the following
cookie in many files I want to save:
;; -*-coding: emacs-mule;-*-
This did not happen before.
How can I stop this again?
Stefan.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ;; -*-coding: emacs-mule;-*- ???
2003-11-03 12:46 ;; -*-coding: emacs-mule;-*- ??? Stefan Reichör
@ 2003-11-03 14:22 ` Sacha Chua
2003-11-03 14:48 ` Stefan Monnier
1 sibling, 0 replies; 6+ messages in thread
From: Sacha Chua @ 2003-11-03 14:22 UTC (permalink / raw)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=iso-2022-jp-2, Size: 2082 bytes --]
Stefan Reich^[.A^[Nvr <xsteve@riic.at> writes:
> Today I upgraded to the latest cvs version of emacs.
> Now I get the unwanted behaviour, that emacs inserts the following
> cookie in many files I want to save:
> ;; -*-coding: emacs-mule;-*-
I noticed that local-write-file-hooks (which is supposed to be
automatically buffer-local) gets globally modified when it's
add-hooked. This interacts badly with BBDB because BBDB addsbbdb-write-file-hook-fn to local-write-file-hooks, and then this
becomes a global hook. Here's the code responsible for inserting the
cookie.
(unless (looking-at ";; *-\\*-coding:")
(insert-before-markers (format ";; -*-coding: %s;-*-\n"
bbdb-file-coding-system))))
I've written a small test script to check. If everything worked
properly, this should not produce errors. On my system (emacs -q
--no-site-file, Emacs 21.3.50), it passes the
local-variable-that-works test, but fails the local-write-file-hooks
test. I suspect that obsolete permanently local variables are not
treated as permanently local when add-hook is used.
The workaround I use is
;; Run the offending function so that the records are loaded
(bbdb-records)
;; Restore my local write file hooks to nil
(setq-default local-write-file-hooks nil)
Here's the test script:
(progn
(defvar local-variable-that-works nil)
(setq local-variable-that-works nil)
(make-variable-buffer-local 'local-variable-that-works)
(setq-default local-write-file-hooks nil)
(with-temp-buffer (add-hook 'local-write-file-hooks 'foo)
(add-hook 'local-variable-that-works 'foo))
(when local-variable-that-works
(error "Failed test. Even the local variable that was supposed to work was modified."))
(when local-write-file-hooks
(error "Failed test. local-write-file-hooks was modified in this buffer. Perhaps obsolete buffer-local variables aren't buffer-local when add-hooked?")))
Hope that helps!
--
Sacha Chua <sacha@free.net.ph> - Ateneo CS faculty geekette
interests: emacs, gnu/linux, wearables, teaching compsci
http://sacha.free.net.ph/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ;; -*-coding: emacs-mule;-*- ???
2003-11-03 12:46 ;; -*-coding: emacs-mule;-*- ??? Stefan Reichör
2003-11-03 14:22 ` Sacha Chua
@ 2003-11-03 14:48 ` Stefan Monnier
2003-11-03 15:21 ` Stefan Reichör
1 sibling, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2003-11-03 14:48 UTC (permalink / raw)
Cc: emacs-devel
> This did not happen before.
> How can I stop this again?
You're probably using something like BBDB some other package that uses
`add-hook' to modify a variable buffer-locally but without passing the
`local' argument.
Please try and get this package fixed. Also upgrade to the latest CVS
where the problem should be fixed,
Stefan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ;; -*-coding: emacs-mule;-*- ???
2003-11-03 14:48 ` Stefan Monnier
@ 2003-11-03 15:21 ` Stefan Reichör
2003-11-04 14:25 ` Richard Stallman
0 siblings, 1 reply; 6+ messages in thread
From: Stefan Reichör @ 2003-11-03 15:21 UTC (permalink / raw)
Cc: emacs-devel
Hi Stefan!
>> This did not happen before.
>> How can I stop this again?
>
> You're probably using something like BBDB some other package that uses
> `add-hook' to modify a variable buffer-locally but without passing the
> `local' argument.
>
> Please try and get this package fixed. Also upgrade to the latest CVS
> where the problem should be fixed,
>
>
> Stefan
You are right!
It is the bbdb package.
I have the following in my .emacs:
(setq bbdb-file-coding-system 'emacs-mule)
This yields in a call to bbdb-write-file-hook-fn every time I want to
save a buffer.
This function inserts the unwanted cookie, it is specified in bbdb-write-file-hooks
I will investigate the problem further.
Thanks for your help,
Stefan.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ;; -*-coding: emacs-mule;-*- ???
2003-11-03 15:21 ` Stefan Reichör
@ 2003-11-04 14:25 ` Richard Stallman
2003-11-04 15:31 ` Stefan Reichör
0 siblings, 1 reply; 6+ messages in thread
From: Richard Stallman @ 2003-11-04 14:25 UTC (permalink / raw)
Cc: monnier, emacs-devel
What change in Emacs caused the unmodified code in bbdb to start
having this effect?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ;; -*-coding: emacs-mule;-*- ???
2003-11-04 14:25 ` Richard Stallman
@ 2003-11-04 15:31 ` Stefan Reichör
0 siblings, 0 replies; 6+ messages in thread
From: Stefan Reichör @ 2003-11-04 15:31 UTC (permalink / raw)
Cc: monnier, emacs-devel
Hi Richard!
> What change in Emacs caused the unmodified code in bbdb to start
> having this effect?
I think it is some change in the semantics of add-hook:
The original code in bbdb.el looks like this:
(bbdb-mapc (lambda (ff) (add-hook 'local-write-file-hooks ff))
bbdb-write-file-hooks)
When I change it to this, it works again:
(bbdb-mapc (lambda (ff) (add-hook 'local-write-file-hooks ff nil t))
bbdb-write-file-hooks)
Stefan.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2003-11-04 15:31 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-11-03 12:46 ;; -*-coding: emacs-mule;-*- ??? Stefan Reichör
2003-11-03 14:22 ` Sacha Chua
2003-11-03 14:48 ` Stefan Monnier
2003-11-03 15:21 ` Stefan Reichör
2003-11-04 14:25 ` Richard Stallman
2003-11-04 15:31 ` Stefan Reichör
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.