+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.
(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.")
(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)
`(,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
(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)
\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.
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>
}
}
-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;
do_mouse_tracking = Qt;
- val = Fprogn (args);
+ val = call0 (bodyfun);
return unbind_to (count, val);
}