all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* edmacro.el
@ 2004-12-04  3:30 Luc Teirlinck
  0 siblings, 0 replies; only message in thread
From: Luc Teirlinck @ 2004-12-04  3:30 UTC (permalink / raw)


I propose the following changes to edmacro.el.

There are two problems with editing a keyboard macro with `C-x C-k e'.

The first is that if the macro is already bound to a key sequence and
you just use C-x C-k e and then do C-c C-c in the *Edit Macro* buffer
without making any changes, you get warned that this key sequence is
already bound to a non-keyboard-macro.  The `(get b 'kmacro)' in the
patch below eliminates this bug.

The second bug concerns Meta characters.  If you do say: 

C-x ( M-4 a RET C-x )

and then name that macro and try to edit it with `C-x C-k e', then
instead of `M-4' the Meta version of some strange character gets
inserted in the *Edit Macro* buffer.  If you do C-c C-c without making
any changes and then try to execute the macro you get an error.  The
reason is that "M-" gets inserted before the M-a without getting rid
of the Meta bit to correctly produce a `4' in the buffer.  The patch
below fixes this.

I can install the patch if desired.

===File ~/edmacro.el-diff===================================
*** edmacro.el	30 Sep 2004 08:24:50 -0500	1.33
--- edmacro.el	03 Dec 2004 20:20:03 -0600	
***************
*** 1,6 ****
  ;;; edmacro.el --- keyboard macro editor
  
! ;; Copyright (C) 1993, 1994 Free Software Foundation, Inc.
  
  ;; Author: Dave Gillespie <daveg@synaptics.com>
  ;; Maintainer: Dave Gillespie <daveg@synaptics.com>
--- 1,6 ----
  ;;; edmacro.el --- keyboard macro editor
  
! ;; Copyright (C) 1993, 1994, 2004 Free Software Foundation, Inc.
  
  ;; Author: Dave Gillespie <daveg@synaptics.com>
  ;; Maintainer: Dave Gillespie <daveg@synaptics.com>
***************
*** 28,34 ****
  
  ;;; Usage:
  ;;
! ;; The `C-x C-k' (`edit-kbd-macro') command edits a keyboard macro
  ;; in a special buffer.  It prompts you to type a key sequence,
  ;; which should be one of:
  ;;
--- 28,34 ----
  
  ;;; Usage:
  ;;
! ;; The `C-x C-k e' (`edit-kbd-macro') command edits a keyboard macro
  ;; in a special buffer.  It prompts you to type a key sequence,
  ;; which should be one of:
  ;;
***************
*** 266,272 ****
  			    (and b (commandp b) (not (arrayp b))
  				 (not (kmacro-extract-lambda b))
  				 (or (not (fboundp b))
! 				     (not (arrayp (symbol-function b))))
  				 (not (y-or-n-p
  				       (format "Key %s is already defined; %s"
  					       (edmacro-format-keys key 1)
--- 266,273 ----
  			    (and b (commandp b) (not (arrayp b))
  				 (not (kmacro-extract-lambda b))
  				 (or (not (fboundp b))
! 				     (not (or (arrayp (symbol-function b))
! 					      (get b 'kmacro))))
  				 (not (y-or-n-p
  				       (format "Key %s is already defined; %s"
  					       (edmacro-format-keys key 1)
***************
*** 458,464 ****
  			 (while (memq (aref rest-mac i) (cdr mdigs))
  			   (incf i))
  			 (and (not (memq (aref rest-mac i) pkeys))
! 			      (prog1 (vconcat "M-" (edmacro-subseq rest-mac 0 i) " ")
  				(callf edmacro-subseq rest-mac i)))))
  		  (and (eq (aref rest-mac 0) ?\C-u)
  		       (eq (key-binding [?\C-u]) 'universal-argument)
--- 459,472 ----
  			 (while (memq (aref rest-mac i) (cdr mdigs))
  			   (incf i))
  			 (and (not (memq (aref rest-mac i) pkeys))
! 			      (prog1 (vconcat "M-"
! 					      (mapcar
! 					       (lambda (char)
! 						 ;; Eliminate Meta bit.
! 						 (logand char
! 							 (lognot (lsh 1 27))))
! 					       (edmacro-subseq rest-mac 0 i))
! 					      " ")
  				(callf edmacro-subseq rest-mac i)))))
  		  (and (eq (aref rest-mac 0) ?\C-u)
  		       (eq (key-binding [?\C-u]) 'universal-argument)
============================================================

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-12-04  3:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-12-04  3:30 edmacro.el Luc Teirlinck

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.