* Emacs registers above 255 @ 2010-05-19 14:04 Štěpán Němec 2010-05-19 14:15 ` David Kastrup 2010-05-19 17:18 ` Stefan Monnier 0 siblings, 2 replies; 4+ messages in thread From: Štěpán Němec @ 2010-05-19 14:04 UTC (permalink / raw) To: emacs-devel Hello, 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)? Štěpán ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Emacs registers above 255 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 1 sibling, 0 replies; 4+ messages in thread From: David Kastrup @ 2010-05-19 14:15 UTC (permalink / raw) To: emacs-devel Štěpán Němec <stepnem@gmail.com> writes: > Hello, > > 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. Huh? (defun weird-check (c) (interactive "c") c) (call-interactively 'weird-check) => 265 [after inputting ĉ using an X11 input method rather than an Emacs one] > 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)? You are assuming that a keyboard can only deliver single-byte characters, namely that Emacs is the only multi-byte capable environment on a given computer. That's simply wrong. -- David Kastrup ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Emacs registers above 255 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 1 sibling, 1 reply; 4+ messages in thread From: Stefan Monnier @ 2010-05-19 17:18 UTC (permalink / raw) To: Štěpán Němec; +Cc: emacs-devel > 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. 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. Stefan ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Emacs registers above 255 2010-05-19 17:18 ` Stefan Monnier @ 2010-05-20 8:46 ` Štěpán Němec 0 siblings, 0 replies; 4+ messages in thread From: Štěpán Němec @ 2010-05-20 8:46 UTC (permalink / raw) To: Stefan Monnier; +Cc: emacs-devel 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 ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-05-20 8:46 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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
Code repositories for project(s) associated with this public inbox https://git.savannah.gnu.org/cgit/emacs.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).