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

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

Re: How make C-m turn macro recording phase on AND off??? (a TOGGLE SWIT


From: Michael P. Soulier
Subject: Re: How make C-m turn macro recording phase on AND off??? (a TOGGLE SWITCH!!!)
Date: Tue, 11 Dec 2001 22:28:23 -0500
User-agent: Mutt/1.3.24i

On Tue, Dec 11, 2001 at 02:45:34PM -0800, Chris Seberino wrote:
> >From previous email but more specific question posted...
> 
> 
> How make C-m turn off AND on macro recording!!!???!!!
> A recording on/off TOGGLE switch would be easier and better
> than a command for each.
> 
> Thanks in advance,

Hmm. Neat idea. 

How about this?

(defvar kbd-macro-recording nil
  "Boolean for whether or not a macro is currently being recorded.")

(defun toggle-kbd-macro ()
  "Toggle macro recording on and off."
  (interactive)
  (if kbd-macro-recording
      (progn
        (setq kbd-macro-recording nil)
        (end-kbd-macro))
    (progn
      (setq kbd-macro-recording t)
      (start-kbd-macro nil))))

(global-set-key "\C-x\C-r" 'toggle-kbd-macro)

I bound it to C-x C-r instead, since C-m conflicts with my return key. 

Mike

-- 
Michael P. Soulier <msoulier@mcss.mcmaster.ca>, GnuPG pub key: 5BC8BE08
"...the word HACK is used as a verb to indicate a massive amount
of nerd-like effort."  -Harley Hahn, A Student's Guide to Unix

Attachment: pgpq2rwoqixBn.pgp
Description: PGP signature


reply via email to

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