[Arcana] emacs file encoding question, plus a bonus question
carlton at bactrian.org
Mon Jun 2 13:06:25 CDT 2008
On Sun, 1 Jun 2008 20:48:46 -0700, "Jim Blandy" <jimb at red-bean.com> said:
> On Sun, Jun 1, 2008 at 8:13 PM, David Carlton <carlton at bactrian.org> wrote:
>> Another problem with my XEmacs->GNU Emacs switch: every time I save my
>> .bbdb file, I get a complaint about a coding mismatch.
> Do you have non-ASCII characters in your BBDB?
Probably. Hmm, what's the easiest way to check for that? There
should be some one-line way of doing it, I'm just not coming up with
one off the top of my head...
> If not, have you tried exiting Emacs, deleting the "coding" line (I
> think that's what's called the "coding cookie"), and then restarting
> Emacs and using BBDB?
Yes, I have done that.
> If you do have non-ASCII characters in your BBDB, then I'm not quite
> sure what to do. Perhaps start with a fresh Emacs, visit the file
> (letting the coding cookie set the file's encoding), get the buffer
> marked modified, and then save it again?
No, that doesn't work. (Also, just a sanity check - "coding cookie"
just means the -*-coding: line at the top of the .bbdb file, right?)
And bbdb seems fairly opinionated about the matter:
;; iso-2022-7bit should be OK (but not optimal for Emacs, at least --
;; emacs-mule would be better) with both Emacs 21 and XEmacs.
(if (fboundp 'coding-system-p)
(cond ((coding-system-p 'utf-8-emacs)
"Coding system used for reading and writing `bbdb-file'.
This should not be changed by users.")
I don't know where utf-8-emacs was ever defined as a valid coding
system, but it isn't in current GNU Emacs versions. And I don't know
how to define a new coding system offhand, and the info pages didn't
seem to help. I tried redefining bbdb-file-coding-system, but that
didn't work, for reasons that may or may not have to do with the fact
htat it's a defconst instead of defvar?
I guess the next thing I was planning to try was to edit the above to
use the coding system that I want; I've gotten out of the habit of
installing my own version of elisp packages when my distro packages
them for me, but that's pure laziness. Well, not _pure_ laziness,
because I do like being on automated upgrade paths. But at least
partial laziness. :-)
>> Another question (which isn't related to my XEmacs->GNU Emacs switch,
>> but which has been bugging me for a while): say I do C-y M-y M-y M-y.
>> Then I type some more, then do C-y again. What I wish would happen is
>> that the same text was inserted that was inserted the first time I did
>> C-y; in fact, though the text from my last M-y was inserted.
>> I guess I can do something like C-y C-u-3M-y; I don't suppose there's
>> a way to get the kill ring to reset like I want, is there?
> The code doesn't seem to show any allowance for that. 'current-kill'
> is the function that decides which text to return; it always consults
> and updates kill-ring-yank-pointer, unless it's passed the optional
> do-not-move argument --- which none of the normal yanking commands
> ever do. Killing a new string does reset the yank pointer, though, if
> that helps.
Thanks for the info.
carlton at bactrian.org
More information about the Arcana