emacs-devel
[Top][All Lists]
Advanced

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

edmacro.el


From: Luc Teirlinck
Subject: edmacro.el
Date: Fri, 3 Dec 2004 21:30:09 -0600 (CST)

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 <address@hidden>
  ;; Maintainer: Dave Gillespie <address@hidden>
--- 1,6 ----
  ;;; edmacro.el --- keyboard macro editor
  
! ;; Copyright (C) 1993, 1994, 2004 Free Software Foundation, Inc.
  
  ;; Author: Dave Gillespie <address@hidden>
  ;; Maintainer: Dave Gillespie <address@hidden>
***************
*** 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)
============================================================




reply via email to

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