Article View: gnu.emacs.bug
Article #906Re: name-last-kbd-macro accepts SPC as terminator
From: Kevin Rodgers
Date: Tue, 15 Dec 1992 19:24
Date: Tue, 15 Dec 1992 19:24
66 lines
2874 bytes
2874 bytes
In article <9212102239.AA03344@banach> jerry@math.ep.utexas.EDU (Jerry) writes:
> M-x name-last-kbd-macro RET
>
>followed by
>
> macro-name-not-finished-because SPC
>
>and the last macro will be given the unfinished (?) name. I had
>generated a number of macros, giving them all similar names, e.g.,
>latex-macro-1, latex-macro-2, etc. Upon doing
>
> M-x name-last-kbd-macro RET lat SPC (to complete, oops)
>
>and my macro was named "lat" instead. Is there no way to require a
>newline to terminate a prompted input when using the (interactive
>"SPrompt:") construct?
No. Here's an excerpt from the elisp manual 'Interactive Codes' info
node:
|`S'
| An interned symbol whose name is read in the minibuffer. Any
| whitespace character terminates the input. (Use `C-q' to
| include whitespace in the string.) Other characters that
| normally terminate a symbol (e.g., parentheses and brackets) do
| not do so here. Prompt.
That interpretation of whitespace also prevents completion of the macro
name from being done.
>---------------- offending function from macros.el ------------------------
>
>
>(defun name-last-kbd-macro (symbol)
> "Assign a name to the last keyboard macro defined.
>One arg, a symbol, which is the name to define.
>The symbol's function definition becomes the keyboard macro string.
>Such a \"function\" cannot be called from Lisp, but it is a valid command
>definition for the editor command loop."
> (interactive "SName for last kbd macro: ")
> (or last-kbd-macro
> (error "No keyboard macro defined"))
> (and (fboundp symbol)
> (not (stringp (symbol-function symbol)))
> (error "Function %s is already defined and not a keyboard macro."
> symbol))
> (fset symbol last-kbd-macro))
Perhaps it would be more useful if the interactive form were replaced
by:
(interactive
(list (completing-read "Name for last kbd macro: "
obarray
(function
(lambda (symbol-name)
(let ((symbol (intern symbol-name)))
(and (fboundp symbol)
(stringp (symbol-function symbol))))))
nil ; allow a new name
)))
--
Kevin Rodgers kevin@traffic.den.mmc.com
Martin Marietta MS A16401 (303) 790-3971
116 Inverness Dr. East
Englewood CO 80112 USA GO BUFFS!
Technical Details
Message-ID:
<1992Dec15.192415.256@den.mmc.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!traffic.den.mmc.com!kevinReferences:
<9212102239.AA03344@banach>Show Full Headers
Complete Article Headers
Newsgroups: gnu.emacs.bug Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!traffic.den.mmc.com!kevin From: kevin@traffic.den.mmc.com (Kevin Rodgers) Subject: Re: name-last-kbd-macro accepts SPC as terminator Message-ID: <1992Dec15.192415.256@den.mmc.com> Sender: gnulists@ai.mit.edu Organization: Martin Marietta Western Internal Systems, Technical Operations References: <9212102239.AA03344@banach> Distribution: gnu Date: Tue, 15 Dec 1992 19:24:15 GMT Approved: bug-gnu-emacs@prep.ai.mit.edu Lines: 67