emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lisp/kmacro.el [lexbind]


From: Miles Bader
Subject: [Emacs-diffs] Changes to emacs/lisp/kmacro.el [lexbind]
Date: Wed, 06 Oct 2004 01:43:36 -0400

Index: emacs/lisp/kmacro.el
diff -c emacs/lisp/kmacro.el:1.16.2.4 emacs/lisp/kmacro.el:1.16.2.5
*** emacs/lisp/kmacro.el:1.16.2.4       Thu Sep 16 00:14:58 2004
--- emacs/lisp/kmacro.el        Wed Oct  6 05:23:53 2004
***************
*** 740,745 ****
--- 740,769 ----
  ;; letters and digits, provided that we inhibit the keymap while
  ;; executing the macro later on (but that's controversial...)
  
+ (defun kmacro-lambda-form (mac &optional counter format)
+   "Create lambda form for macro bound to symbol or key."
+   (if counter
+       (setq mac (list mac counter format)))
+   `(lambda (&optional arg)
+      "Keyboard macro."
+      (interactive "p")
+      (kmacro-exec-ring-item ',mac arg)))
+ 
+ (defun kmacro-extract-lambda (mac)
+   "Extract kmacro from a kmacro lambda form."
+   (and (consp mac)
+        (eq (car mac) 'lambda)
+        (setq mac (assoc 'kmacro-exec-ring-item mac))
+        (consp (cdr mac))
+        (consp (car (cdr mac)))
+        (consp (cdr (car (cdr mac))))
+        (setq mac (car (cdr (car (cdr mac)))))
+        (listp mac)
+        (= (length mac) 3)
+        (arrayp (car mac))
+        mac))
+ 
+ 
  (defun kmacro-bind-to-key (arg)
    "When not defining or executing a macro, offer to bind last macro to a key.
  The key sequences [C-x C-k 0] through [C-x C-k 9] and [C-x C-k A]
***************
*** 775,784 ****
                                          (format-kbd-macro key-seq)
                                          cmd))))
        (define-key global-map key-seq
!         `(lambda (&optional arg)
!            "Keyboard macro."
!            (interactive "p")
!            (kmacro-exec-ring-item ',(kmacro-ring-head) arg)))
        (message "Keyboard macro bound to %s" (format-kbd-macro key-seq))))))
  
  
--- 799,805 ----
                                          (format-kbd-macro key-seq)
                                          cmd))))
        (define-key global-map key-seq
!         (kmacro-lambda-form (kmacro-ring-head)))
        (message "Keyboard macro bound to %s" (format-kbd-macro key-seq))))))
  
  
***************
*** 798,808 ****
              symbol))
    (if (string-equal symbol "")
        (error "No command name given"))
!   (fset symbol
!       `(lambda (&optional arg)
!          "Keyboard macro."
!          (interactive "p")
!          (kmacro-exec-ring-item ',(kmacro-ring-head) arg)))
    (put symbol 'kmacro t))
  
  
--- 819,825 ----
              symbol))
    (if (string-equal symbol "")
        (error "No command name given"))
!   (fset symbol (kmacro-lambda-form (kmacro-ring-head)))
    (put symbol 'kmacro t))
  
  




reply via email to

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