/[emacs]/emacs/lisp/kmacro.el
ViewVC logotype

Diff of /emacs/lisp/kmacro.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.16.6.2 by miles, Wed Sep 15 08:59:56 2004 UTC revision 1.16.6.3 by miles, Mon Oct 4 01:04:16 2004 UTC
# Line 740  If kbd macro currently being defined end Line 740  If kbd macro currently being defined end
740  ;; letters and digits, provided that we inhibit the keymap while  ;; letters and digits, provided that we inhibit the keymap while
741  ;; executing the macro later on (but that's controversial...)  ;; executing the macro later on (but that's controversial...)
742    
743    (defun kmacro-lambda-form (mac &optional counter format)
744      "Create lambda form for macro bound to symbol or key."
745      (if counter
746          (setq mac (list mac counter format)))
747      `(lambda (&optional arg)
748         "Keyboard macro."
749         (interactive "p")
750         (kmacro-exec-ring-item ',mac arg)))
751    
752    (defun kmacro-extract-lambda (mac)
753      "Extract kmacro from a kmacro lambda form."
754      (and (consp mac)
755           (eq (car mac) 'lambda)
756           (setq mac (assoc 'kmacro-exec-ring-item mac))
757           (consp (cdr mac))
758           (consp (car (cdr mac)))
759           (consp (cdr (car (cdr mac))))
760           (setq mac (car (cdr (car (cdr mac)))))
761           (listp mac)
762           (= (length mac) 3)
763           (arrayp (car mac))
764           mac))
765    
766    
767  (defun kmacro-bind-to-key (arg)  (defun kmacro-bind-to-key (arg)
768    "When not defining or executing a macro, offer to bind last macro to a key.    "When not defining or executing a macro, offer to bind last macro to a key.
769  The key sequences [C-x C-k 0] through [C-x C-k 9] and [C-x C-k A]  The key sequences [C-x C-k 0] through [C-x C-k 9] and [C-x C-k A]
# Line 775  may be shaded by a local key binding." Line 799  may be shaded by a local key binding."
799                                            (format-kbd-macro key-seq)                                            (format-kbd-macro key-seq)
800                                            cmd))))                                            cmd))))
801          (define-key global-map key-seq          (define-key global-map key-seq
802            `(lambda (&optional arg)            (kmacro-lambda-form (kmacro-ring-head)))
              "Keyboard macro."  
              (interactive "p")  
              (kmacro-exec-ring-item ',(kmacro-ring-head) arg)))  
803          (message "Keyboard macro bound to %s" (format-kbd-macro key-seq))))))          (message "Keyboard macro bound to %s" (format-kbd-macro key-seq))))))
804    
805    
# Line 798  Such a \"function\" cannot be called fro Line 819  Such a \"function\" cannot be called fro
819                symbol))                symbol))
820    (if (string-equal symbol "")    (if (string-equal symbol "")
821        (error "No command name given"))        (error "No command name given"))
822    (fset symbol    (fset symbol (kmacro-lambda-form (kmacro-ring-head)))
         `(lambda (&optional arg)  
            "Keyboard macro."  
            (interactive "p")  
            (kmacro-exec-ring-item ',(kmacro-ring-head) arg)))  
823    (put symbol 'kmacro t))    (put symbol 'kmacro t))
824    
825    

Legend:
Removed from v.1.16.6.2  
changed lines
  Added in v.1.16.6.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26