unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* register use
@ 2002-09-12 16:39 Richard White
  0 siblings, 0 replies; 5+ messages in thread
From: Richard White @ 2002-09-12 16:39 UTC (permalink / raw)


Hi,

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)?

Cheers,
--Richard
-- 
--------------------------
Richard White, DVD Division (x2328)
STMicroelectronics Limited
1000 Aztec West
Almondsbury
BRISTOL. BS32 4SQ
     
Tel: 01454 462328
Switchboard: 01454 616616

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: register use
       [not found] <mailman.1031849234.4862.help-gnu-emacs@gnu.org>
@ 2002-09-12 16:57 ` lawrence mitchell
  2002-09-12 19:03   ` Greg Hill
       [not found]   ` <mailman.1031857451.1869.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 5+ messages in thread
From: lawrence mitchell @ 2002-09-12 16:57 UTC (permalink / raw)


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>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: register use
  2002-09-12 16:57 ` lawrence mitchell
@ 2002-09-12 19:03   ` Greg Hill
       [not found]   ` <mailman.1031857451.1869.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 5+ messages in thread
From: Greg Hill @ 2002-09-12 19:03 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 2138 bytes --]

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>

[-- Attachment #2: Type: text/html, Size: 3382 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: register use
@ 2002-09-12 19:33 Bingham, Jay
  0 siblings, 0 replies; 5+ messages in thread
From: Bingham, Jay @ 2002-09-12 19:33 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 3499 bytes --]

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:ghill@synergymicro.com]
Sent: Thursday, September 12, 2002 2:03 PM
To: lawrence mitchell; help-gnu-emacs@gnu.org
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 <wence@gmx.li>

[-- Attachment #2: Type: text/html, Size: 21476 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: register use
       [not found]   ` <mailman.1031857451.1869.help-gnu-emacs@gnu.org>
@ 2002-09-12 23:44     ` Kevin Rodgers
  0 siblings, 0 replies; 5+ messages in thread
From: Kevin Rodgers @ 2002-09-12 23:44 UTC (permalink / raw)


Greg Hill wrote:

> 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))


Or just make set-register interactive via advice.el:


(defadvice set-register (before interactive activate)
   "Now an `interactive' command."
   (interactive "cRegister: \nsString: "))

Or you could allow the user to enter any Emacs Lisp form (including
a string constant) to be evalutated, which is more congruent with
the original function:

(defadvice set-register (before interactive activate)
   "Now an `interactive' command."
   (interactive "cRegister: \nXValue: "))

-- 
Kevin Rodgers <kevinr@ihs.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2002-09-12 23:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-09-12 19:33 register use Bingham, Jay
     [not found] <mailman.1031849234.4862.help-gnu-emacs@gnu.org>
2002-09-12 16:57 ` lawrence mitchell
2002-09-12 19:03   ` Greg Hill
     [not found]   ` <mailman.1031857451.1869.help-gnu-emacs@gnu.org>
2002-09-12 23:44     ` Kevin Rodgers
  -- strict thread matches above, loose matches on Subject: below --
2002-09-12 16:39 Richard White

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).