emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacs registers above 255


From: Štěpán Němec
Subject: Re: Emacs registers above 255
Date: Thu, 20 May 2010 10:46:38 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>> according to the documentation, registers are characters up to 255.
>> But the actual implementation is very simple and permits storing
>> "anything" in `register-alist' using `set-register'; it's just that the
>> UI functions use the "c" interactive spec, so you can't really enter
>> anything other than a character inputtable without an input method.
>
>> My question is: would you consider it too much of a hack if a package
>> used registers above 255 to not clobber the standard registers, but on
>> the other hand be able to use the existing infrastructure (my example
>> use case would be implementing Vim-compatible registers in an emulation
>> package)? 
>
> It would probably be a hack, but it would seem like a fair hack to me.

;-)

> The main limitation I can see is that the "names" of registers are
> compared with `eq', so cons cells wouldn't work too well, but symbols or
> negative numbers would work.

Yeah; I was really thinking about some numeric range above 255.

> This said, I'm not sure why you'd want to use separate registers: I'd
> expect it would rather be better if the Vim emulation is integrated with
> the rest of Emacs's infrastructure, so being able to set a register with
> Vim-emulation and then get it back using Emacs commands would seem like
> a desirable feature.

That's certainly one way to look at it. OTOH, there are notable
differences between Vim and Emacs registers. What Vim calls "registers"
includes alphabetic (ASCII) registers of which lower-case ones are
overwritten every time you store anything in them and the upper-case
ones are really only an "appending interface" to the corresponding
lower-case ones. Then there are a few non-alphabetic registers with even
more specific purpose/behaviour.

Then there is what Vim calls "marks", which, again, are mostly
alphabetic registers (storing file positions) and several non-alphabetic
ones, also with specific purposes (for a change, the upper-case Vim
"marks" are global, the lower-case ones are buffer-local).

Because of these differences I think it makes more sense to leave the
standard Emacs registers alone.

(Viper, for example, only permits lower-case "marks", and does 

  (- char ?a)

on them, so they end up being Emacs' control-char registers.)

(Also, register-alist is obviously not a solution for buffer-local
"marks", anyway. I'll have to think about it a bit more.)

Thank you for the feedback,

Štěpán



reply via email to

[Prev in Thread] Current Thread [Next in Thread]