help-gnu-emacs
[Top][All Lists]
Advanced

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

RE: register use


From: Bingham, Jay
Subject: RE: register use
Date: Thu, 12 Sep 2002 14:33:53 -0500

Richard,

 

You do not say what it is that you are trying to do with the registers.  The general tone of the responses assumes that you are trying to use the registers programmatically.  On the chance that that is not what you want to do I offer the following information:

 

There are several functions already present in emacs that store various kinds of information in the registers, e.g.: copy the contents of a region to a register and copy the contents of a register to the buffer.  You can obtain a complete list of these functions via the help apropos (C-h a).  Which displays a list of all the interactive functions (i.e. commands) that match a regular _expression_ entered at a prompt, as well as a description of how to invoke them and what they do.

To see the list/descriptions of the commands containing “register” in the name type: C-h a register

 

Good luck.

-_

J_)

C_)ingham

.    HP - NonStop Austin Software & Services - Software Product Assurance

.    Austin, TX

. Language is the apparel in which your thoughts parade in public.

. Never clothe them in vulgar and shoddy attire.          -Dr. George W. Crane-

 

-----Original Message-----
From: Greg Hill [mailto:address@hidden
Sent: Thursday, September 12, 2002 2:03 PM
To: lawrence mitchell; address@hidden
Subject: Re: register use

 

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 <address@hidden>


reply via email to

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