]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/subr.el (track-mouse): New macro.
authorStefan Monnier <monnier@iro.umontreal.ca>
Sat, 27 Sep 2014 15:52:28 +0000 (11:52 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Sat, 27 Sep 2014 15:52:28 +0000 (11:52 -0400)
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv-analyse-form):
Remove track-mouse case.
* lisp/emacs-lisp/bytecomp.el (byte-compile-track-mouse): Remove.
* src/keyboard.c (track-mouse): Rename to internal--track-mouse.
Make it into a function and change arg to be a function.

lisp/ChangeLog
lisp/emacs-lisp/bytecomp.el
lisp/emacs-lisp/cconv.el
lisp/subr.el
src/ChangeLog
src/keyboard.c

index a1a453abd7dbac537a94219f326be2e9c72fb45e..f5a188b2417da510f71fcdfbd2082e2a367f1d9c 100644 (file)
@@ -1,3 +1,10 @@
+2014-09-27  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * subr.el (track-mouse): New macro.
+       * emacs-lisp/cconv.el (cconv-convert, cconv-analyse-form):
+       Remove track-mouse case.
+       * emacs-lisp/bytecomp.el (byte-compile-track-mouse): Remove.
+
 2014-09-27  Leo Liu  <sdl.web@gmail.com>
 
        * progmodes/elisp-mode.el (elisp--eldoc-last-data): Use defvar.
index d21b39fd268744d549223125ea4976da0a927afd..0e96ba93f442ab7cb56abcd2c111c9ce69a20f72 100644 (file)
@@ -4072,7 +4072,6 @@ binding slots have been popped."
 (byte-defop-compiler-1 save-restriction)
 ;; (byte-defop-compiler-1 save-window-excursion)      ;Obsolete: now a macro.
 ;; (byte-defop-compiler-1 with-output-to-temp-buffer) ;Obsolete: now a macro.
-(byte-defop-compiler-1 track-mouse)
 
 (defvar byte-compile--use-old-handlers t
   "If nil, use new byte codes introduced in Emacs-24.4.")
@@ -4107,12 +4106,6 @@ binding slots have been popped."
   (byte-compile-form-do-effect (car (cdr form)))
   (byte-compile-out 'byte-unbind 1))
 
-(defun byte-compile-track-mouse (form)
-  (byte-compile-form
-   (pcase form
-     (`(,_ :fun-body ,f) `(eval (list 'track-mouse (list 'funcall ,f))))
-     (_ `(eval '(track-mouse ,@(byte-compile-top-level-body (cdr form))))))))
-
 (defun byte-compile-condition-case (form)
   (if byte-compile--use-old-handlers
       (byte-compile-condition-case--old form)
index 40f1531e0f70a115aeccdb2f8a23270838ba4e9b..98eef11a6584b9abc4b5de4f476a6cfe15bb1b17 100644 (file)
@@ -462,10 +462,6 @@ places where they originally did not directly appear."
      `(,head ,(cconv-convert form env extend)
         :fun-body ,(cconv--convert-function () body env form)))
 
-    (`(track-mouse . ,body)
-     `(track-mouse
-        :fun-body ,(cconv--convert-function () body env form)))
-
     (`(setq . ,forms)                   ; setq special form
      (let ((prognlist ()))
        (while forms
@@ -701,11 +697,6 @@ and updates the data stored in ENV."
      (cconv-analyse-form form env)
      (cconv--analyse-function () body env form))
 
-    ;; FIXME: The lack of bytecode for track-mouse forces us to wrap the body.
-    ;; `track-mouse' really should be made into a macro.
-    (`(track-mouse . ,body)
-     (cconv--analyse-function () body env form))
-
     (`(defvar ,var) (push var byte-compile-bound-variables))
     (`(,(or `defconst `defvar) ,var ,value . ,_)
      (push var byte-compile-bound-variables)
index 56b46b4fbf10b05287a35545d1ceef5bcd6f0a8e..2bbc01d4533dc2eb16f7f2b7d95d5b910c6e95e5 100644 (file)
@@ -2945,6 +2945,14 @@ Similar to `call-process-shell-command', but calls `process-file'."
 \f
 ;;;; Lisp macros to do various things temporarily.
 
+(defmacro track-mouse (&rest body)
+  "Evaluate BODY with mouse movement events enabled.
+Within a `track-mouse' form, mouse motion generates input events that
+ you can read with `read-event'.
+Normally, mouse motion is ignored."
+  (declare (debug t) (indent 0))
+  `(internal--track-mouse (lambda () ,@body)))
+
 (defmacro with-current-buffer (buffer-or-name &rest body)
   "Execute the forms in BODY with BUFFER-OR-NAME temporarily current.
 BUFFER-OR-NAME must be a buffer or the name of an existing buffer.
index 3afd5ee6e2002ddb30c49b08ba070b4a44e2c207..53353ffc096fd6c13167204a78c1df366f7dd4d2 100644 (file)
@@ -1,5 +1,8 @@
 2014-09-27  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+       * keyboard.c (track-mouse): Rename to internal--track-mouse.
+       Make it into a function and change arg to be a function.
+
        * lisp.mk (lisp): Add elisp-mode.elc.
 
 2014-09-26  Paul Eggert  <eggert@cs.ucla.edu>
index e242a886f05bdcfdd55d92fdc3a84a63b6fca555..fcba475e5eed028c74c5feace7abc3328c9ee5b1 100644 (file)
@@ -1287,13 +1287,9 @@ tracking_off (Lisp_Object old_value)
     }
 }
 
-DEFUN ("track-mouse", Ftrack_mouse, Strack_mouse, 0, UNEVALLED, 0,
-       doc: /* Evaluate BODY with mouse movement events enabled.
-Within a `track-mouse' form, mouse motion generates input events that
-you can read with `read-event'.
-Normally, mouse motion is ignored.
-usage: (track-mouse BODY...)  */)
-  (Lisp_Object args)
+DEFUN ("internal--track-mouse", Ftrack_mouse, Strack_mouse, 1, 1, 0,
+       doc: /* Call BODYFUN with mouse movement events enabled.  */)
+  (Lisp_Object bodyfun)
 {
   ptrdiff_t count = SPECPDL_INDEX ();
   Lisp_Object val;
@@ -1302,7 +1298,7 @@ usage: (track-mouse BODY...)  */)
 
   do_mouse_tracking = Qt;
 
-  val = Fprogn (args);
+  val = call0 (bodyfun);
   return unbind_to (count, val);
 }