[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: register use
From: |
Greg Hill |
Subject: |
Re: register use |
Date: |
Thu, 12 Sep 2002 12:03:24 -0700 |
Richard,
In general, whenever apropos identifies a routine as a
"Command" that means you can execute it from the minibuffer
using M-x
When apropos identifies a routine as a "Function,"
M-x does not work; but you can still execute it from the
minibuffer as a typed-in lisp function call using M-:
For example, you could set register 'a' to the string
"hello" by typing
M-:
Eval: (set-register ?a "hello")
You could make your own interactive M-x command
called set-reg-string to prompt you in
the minibuffer for a register name and a string to be stored in that
register by adding this to your .emacs file:
(defun set-reg-string (reg
string)
(interactive
"cRegister: \nsString: ")
(set-register reg
string))
If you try this, you will find that as soon as you type a
character in response to the "Register: " prompt it
advances immediately to the "String: " prompt without
giving you a chance to see or edit the register name. You could
fix this by changing your command definition to:
(defun set-reg-string (reg
string)
(interactive
"sRegister: \nsString: ")
(set-register (elt reg
0) string))
To learn more about creating your own interactive commands,
consult the "Command Loop" chapter in the GNU Emacs Lisp
Reference Manual, available for download in many formats at:
http://www.sunsite.ualberta.ca/Documentation/Gnu/emacs-lisp-ref-21-2.7/emacs-lisp-ref.html
--Greg
At 5:57 PM +0100 9/12/02, lawrence mitchell wrote:
Richard White wrote:
> I'm trying to make use of the registers in GNU Emacs but when I
run
> the command set-register the minibuffer says there is no
match
> (Despite apropos listing it). I'm using version 20.2.1;
does this
> version have register use enabled and if so how do I get it to
work
> (please)?
set-register isn't an interactive function, i.e. you can't call
it via M-x or through a keybinding. The Emacs manual
describes
how to use registers in far more detail than I ever could, see
the Info node "(emacs)Registers", you can get there by
evaluating
(Info-goto-node "(emacs)Registers") in Emacs.
--
lawrence mitchell
<wence@gmx.li>