all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Štěpán Němec" <stepnem@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: Emacs registers above 255
Date: Thu, 20 May 2010 10:46:38 +0200	[thread overview]
Message-ID: <87aarvneoh.fsf@gmail.com> (raw)
In-Reply-To: <jwvhbm3olus.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Wed, 19 May 2010 13:18:33 -0400")

Stefan Monnier <monnier@iro.umontreal.ca> 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	other threads:[~2010-05-20  8:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-19 14:04 Emacs registers above 255 Štěpán Němec
2010-05-19 14:15 ` David Kastrup
2010-05-19 17:18 ` Stefan Monnier
2010-05-20  8:46   ` Štěpán Němec [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87aarvneoh.fsf@gmail.com \
    --to=stepnem@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.