emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r117965: * lisp/subr.el (track-mouse): New macro.


From: Stefan Monnier
Subject: [Emacs-diffs] trunk r117965: * lisp/subr.el (track-mouse): New macro.
Date: Sat, 27 Sep 2014 15:52:40 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117965
revision-id: address@hidden
parent: address@hidden
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Sat 2014-09-27 11:52:28 -0400
message:
  * lisp/subr.el (track-mouse): New macro.
  * 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.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/emacs-lisp/bytecomp.el    bytecomp.el-20091113204419-o5vbwnq5f7feedwu-492
  lisp/emacs-lisp/cconv.el       cconv.el-20101015215845-f7w7g0kxa4xzdjdx-1
  lisp/subr.el                   subr.el-20091113204419-o5vbwnq5f7feedwu-151
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/keyboard.c                 keyboard.c-20091113204419-o5vbwnq5f7feedwu-449
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2014-09-27 10:08:59 +0000
+++ b/lisp/ChangeLog    2014-09-27 15:52:28 +0000
@@ -1,3 +1,10 @@
+2014-09-27  Stefan Monnier  <address@hidden>
+
+       * 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  <address@hidden>
 
        * progmodes/elisp-mode.el (elisp--eldoc-last-data): Use defvar.

=== modified file 'lisp/emacs-lisp/bytecomp.el'
--- a/lisp/emacs-lisp/bytecomp.el       2014-09-22 13:47:47 +0000
+++ b/lisp/emacs-lisp/bytecomp.el       2014-09-27 15:52:28 +0000
@@ -4072,7 +4072,6 @@
 (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 @@
   (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)

=== modified file 'lisp/emacs-lisp/cconv.el'
--- a/lisp/emacs-lisp/cconv.el  2014-02-10 01:34:22 +0000
+++ b/lisp/emacs-lisp/cconv.el  2014-09-27 15:52:28 +0000
@@ -462,10 +462,6 @@
      `(,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 @@
      (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)

=== modified file 'lisp/subr.el'
--- a/lisp/subr.el      2014-09-08 06:00:58 +0000
+++ b/lisp/subr.el      2014-09-27 15:52:28 +0000
@@ -2945,6 +2945,14 @@
 
 ;;;; 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.

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-09-27 03:57:41 +0000
+++ b/src/ChangeLog     2014-09-27 15:52:28 +0000
@@ -1,5 +1,8 @@
 2014-09-27  Stefan Monnier  <address@hidden>
 
+       * 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  <address@hidden>

=== modified file 'src/keyboard.c'
--- a/src/keyboard.c    2014-09-25 02:01:14 +0000
+++ b/src/keyboard.c    2014-09-27 15:52:28 +0000
@@ -1287,13 +1287,9 @@
     }
 }
 
-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 @@
 
   do_mouse_tracking = Qt;
 
-  val = Fprogn (args);
+  val = call0 (bodyfun);
   return unbind_to (count, val);
 }
 


reply via email to

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