changeset 110034:c87f89486bb7

Use `declare' in defmacros. * lisp/window.el (save-selected-window): * lisp/subr.el (with-temp-file, with-temp-message, with-syntax-table): * lisp/progmodes/python.el (def-python-skeleton): * lisp/net/dbus.el (dbus-ignore-errors): * lisp/jka-cmpr-hook.el (with-auto-compression-mode): * lisp/international/mule.el (with-category-table): * lisp/emacs-lisp/timer.el (with-timeout): * lisp/emacs-lisp/lisp-mnt.el (lm-with-file): * lisp/emacs-lisp/eieio.el (with-slots): * lisp/emacs-lisp/easymenu.el (easy-menu-define): * lisp/emacs-lisp/debug.el (debugger-env-macro): * lisp/emacs-lisp/cl-compat.el (Multiple-value-bind, Multiple-value-setq) (Multiple-value-call, Multiple-value-prog1): * lisp/emacs-lisp/cl-seq.el (cl-parsing-keywords, cl-check-key) (cl-check-test-nokey, cl-check-test, cl-check-match): Move indent and edebug rule to definition. * lisp/emacs-lisp/lisp-mode.el (save-selected-window) (with-current-buffer, combine-after-change-calls) (with-output-to-string, with-temp-file, with-temp-buffer) (with-temp-message, with-syntax-table, read-if, eval-after-load) (dolist, dotimes, when, unless): * lisp/emacs-lisp/byte-run.el (inline): Remove indent rule, redundant.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Mon, 30 Aug 2010 15:03:05 +0200
parents 2c9ea5d32862
children 619b4d494232
files lisp/ChangeLog lisp/emacs-lisp/byte-run.el lisp/emacs-lisp/cl-compat.el lisp/emacs-lisp/cl-seq.el lisp/emacs-lisp/debug.el lisp/emacs-lisp/easymenu.el lisp/emacs-lisp/eieio.el lisp/emacs-lisp/lisp-mnt.el lisp/emacs-lisp/lisp-mode.el lisp/emacs-lisp/timer.el lisp/international/mule.el lisp/jka-cmpr-hook.el lisp/net/dbus.el lisp/progmodes/python.el lisp/subr.el lisp/window.el
diffstat 16 files changed, 52 insertions(+), 51 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Mon Aug 30 14:47:49 2010 +0200
+++ b/lisp/ChangeLog	Mon Aug 30 15:03:05 2010 +0200
@@ -1,3 +1,29 @@
+2010-08-30  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	Use `declare' in defmacros.
+	* window.el (save-selected-window):
+	* subr.el (with-temp-file, with-temp-message, with-syntax-table):
+	* progmodes/python.el (def-python-skeleton):
+	* net/dbus.el (dbus-ignore-errors):
+	* jka-cmpr-hook.el (with-auto-compression-mode):
+	* international/mule.el (with-category-table):
+	* emacs-lisp/timer.el (with-timeout):
+	* emacs-lisp/lisp-mnt.el (lm-with-file):
+	* emacs-lisp/eieio.el (with-slots):
+	* emacs-lisp/easymenu.el (easy-menu-define):
+	* emacs-lisp/debug.el (debugger-env-macro):
+	* emacs-lisp/cl-compat.el (Multiple-value-bind, Multiple-value-setq)
+	(Multiple-value-call, Multiple-value-prog1):
+	* emacs-lisp/cl-seq.el (cl-parsing-keywords, cl-check-key)
+	(cl-check-test-nokey, cl-check-test, cl-check-match): Move indent and
+	edebug rule to definition.
+	* emacs-lisp/lisp-mode.el (save-selected-window)
+	(with-current-buffer, combine-after-change-calls)
+	(with-output-to-string, with-temp-file, with-temp-buffer)
+	(with-temp-message, with-syntax-table, read-if, eval-after-load)
+	(dolist, dotimes, when, unless):
+	* emacs-lisp/byte-run.el (inline): Remove indent rule, redundant.
+
 2010-08-29  Chong Yidong  <cyd@stupidchicken.com>
 
 	* finder.el: Require `package'.
@@ -7,8 +33,8 @@
 	(finder-compile-keywords): Compute package--builtins and
 	finder-keywords-hash instead of finder-keywords-hash, respecting
 	the "Package" header.
-	(finder-unknown-keywords, finder-list-matches): Use
-	finder-keywords-hash and package--list-packages.
+	(finder-unknown-keywords, finder-list-matches):
+	Use finder-keywords-hash and package--list-packages.
 	(finder-mode): Don't set font-lock-defaults.
 	(finder-exit): We don't use "*Finder-package*" and "*Finder
 	Category*" buffers anymore.
--- a/lisp/emacs-lisp/byte-run.el	Mon Aug 30 14:47:49 2010 +0200
+++ b/lisp/emacs-lisp/byte-run.el	Mon Aug 30 15:03:05 2010 +0200
@@ -66,7 +66,6 @@
 ;; Redefined in byte-optimize.el.
 ;; This is not documented--it's not clear that we should promote it.
 (fset 'inline 'progn)
-(put 'inline 'lisp-indent-function 0)
 
 ;;; Interface to inline functions.
 
--- a/lisp/emacs-lisp/cl-compat.el	Mon Aug 30 14:47:49 2010 +0200
+++ b/lisp/emacs-lisp/cl-compat.el	Mon Aug 30 15:03:05 2010 +0200
@@ -71,11 +71,6 @@
 ;;; by capitalizing the first letter: Values, Multiple-value-*,
 ;;; to avoid conflict with the new-style definitions in cl-macs.
 
-(put 'Multiple-value-bind  'lisp-indent-function 2)
-(put 'Multiple-value-setq  'lisp-indent-function 2)
-(put 'Multiple-value-call  'lisp-indent-function 1)
-(put 'Multiple-value-prog1 'lisp-indent-function 1)
-
 (defvar *mvalues-values* nil)
 
 (defun Values (&rest val-forms)
@@ -91,18 +86,22 @@
 	     (list *mvalues-temp*))))
 
 (defmacro Multiple-value-call (function &rest args)
+  (declare (indent 1))
   (list 'apply function
 	(cons 'append
 	      (mapcar (function (lambda (x) (list 'Multiple-value-list x)))
 		      args))))
 
 (defmacro Multiple-value-bind (vars form &rest body)
+  (declare (indent 2))
   (list* 'multiple-value-bind vars (list 'Multiple-value-list form) body))
 
 (defmacro Multiple-value-setq (vars form)
+  (declare (indent 2))
   (list 'multiple-value-setq vars (list 'Multiple-value-list form)))
 
 (defmacro Multiple-value-prog1 (form &rest body)
+  (declare (indent 1))
   (list 'prog1 form (list* 'let '((*mvalues-values* nil)) body)))
 
 
--- a/lisp/emacs-lisp/cl-seq.el	Mon Aug 30 14:47:49 2010 +0200
+++ b/lisp/emacs-lisp/cl-seq.el	Mon Aug 30 15:03:05 2010 +0200
@@ -48,6 +48,7 @@
 ;;; this file independent from cl-macs.
 
 (defmacro cl-parsing-keywords (kwords other-keys &rest body)
+  (declare (indent 2) (debug (sexp sexp &rest form)))
   (cons
    'let*
    (cons (mapcar
@@ -84,13 +85,13 @@
 					  (car cl-keys-temp)))
 			    '(setq cl-keys-temp (cdr (cdr cl-keys-temp)))))))
 	  body))))
-(put 'cl-parsing-keywords 'lisp-indent-function 2)
-(put 'cl-parsing-keywords 'edebug-form-spec '(sexp sexp &rest form))
 
 (defmacro cl-check-key (x)
+  (declare (debug edebug-forms))
   (list 'if 'cl-key (list 'funcall 'cl-key x) x))
 
 (defmacro cl-check-test-nokey (item x)
+  (declare (debug edebug-forms))
   (list 'cond
 	(list 'cl-test
 	      (list 'eq (list 'not (list 'funcall 'cl-test item x))
@@ -101,20 +102,17 @@
 		       (list 'equal item x) (list 'eq item x)))))
 
 (defmacro cl-check-test (item x)
+  (declare (debug edebug-forms))
   (list 'cl-check-test-nokey item (list 'cl-check-key x)))
 
 (defmacro cl-check-match (x y)
+  (declare (debug edebug-forms))
   (setq x (list 'cl-check-key x) y (list 'cl-check-key y))
   (list 'if 'cl-test
 	(list 'eq (list 'not (list 'funcall 'cl-test x y)) 'cl-test-not)
 	(list 'if (list 'numberp x)
 	      (list 'equal x y) (list 'eq x y))))
 
-(put 'cl-check-key 'edebug-form-spec 'edebug-forms)
-(put 'cl-check-test 'edebug-form-spec 'edebug-forms)
-(put 'cl-check-test-nokey 'edebug-form-spec 'edebug-forms)
-(put 'cl-check-match 'edebug-form-spec 'edebug-forms)
-
 (defvar cl-test) (defvar cl-test-not)
 (defvar cl-if) (defvar cl-if-not)
 (defvar cl-key)
--- a/lisp/emacs-lisp/debug.el	Mon Aug 30 14:47:49 2010 +0200
+++ b/lisp/emacs-lisp/debug.el	Mon Aug 30 15:03:05 2010 +0200
@@ -514,9 +514,9 @@
 	(insert ? )))
   (beginning-of-line))
 
-(put 'debugger-env-macro 'lisp-indent-function 0)
 (defmacro debugger-env-macro (&rest body)
   "Run BODY in original environment."
+  (declare (indent 0))
   `(save-excursion
     (if (null (buffer-name debugger-old-buffer))
         ;; old buffer deleted
--- a/lisp/emacs-lisp/easymenu.el	Mon Aug 30 14:47:49 2010 +0200
+++ b/lisp/emacs-lisp/easymenu.el	Mon Aug 30 15:03:05 2010 +0200
@@ -44,8 +44,6 @@
   (if (stringp s) (intern s) s))
 
 ;;;###autoload
-(put 'easy-menu-define 'lisp-indent-function 'defun)
-;;;###autoload
 (defmacro easy-menu-define (symbol maps doc menu)
   "Define a menu bar submenu in maps MAPS, according to MENU.
 
@@ -151,6 +149,7 @@
 as a solid horizontal line.
 
 A menu item can be a list with the same format as MENU.  This is a submenu."
+  (declare (indent defun))
   `(progn
      ,(if symbol `(defvar ,symbol nil ,doc))
      (easy-menu-do-define (quote ,symbol) ,maps ,doc ,menu)))
--- a/lisp/emacs-lisp/eieio.el	Mon Aug 30 14:47:49 2010 +0200
+++ b/lisp/emacs-lisp/eieio.el	Mon Aug 30 15:03:05 2010 +0200
@@ -1610,6 +1610,7 @@
 Where each VAR is the local variable given to the associated
 SLOT.  A slot specified without a variable name is given a
 variable name of the same name as the slot."
+  (declare (indent 2))
   ;; Transform the spec-list into a symbol-macrolet spec-list.
   (let ((mappings (mapcar (lambda (entry)
 			    (let ((var  (if (listp entry) (car entry) entry))
@@ -1618,8 +1619,6 @@
 			  spec-list)))
     (append (list 'symbol-macrolet mappings)
 	    body)))
-(put 'with-slots 'lisp-indent-function 2)
-
 
 ;;; Simple generators, and query functions.  None of these would do
 ;;  well embedded into an object.
--- a/lisp/emacs-lisp/lisp-mnt.el	Mon Aug 30 14:47:49 2010 +0200
+++ b/lisp/emacs-lisp/lisp-mnt.el	Mon Aug 30 15:03:05 2010 +0200
@@ -298,6 +298,7 @@
 (defmacro lm-with-file (file &rest body)
   "Execute BODY in a buffer containing the contents of FILE.
 If FILE is nil, execute BODY in the current buffer."
+  (declare (indent 1) (debug t))
   (let ((filesym (make-symbol "file")))
     `(let ((,filesym ,file))
        (if ,filesym
@@ -311,9 +312,6 @@
 	   (with-syntax-table emacs-lisp-mode-syntax-table
 	     ,@body))))))
 
-(put 'lm-with-file 'lisp-indent-function 1)
-(put 'lm-with-file 'edebug-form-spec t)
-
 ;; Fixme: Probably this should be amalgamated with copyright.el; also
 ;; we need a check for ranges in copyright years.
 
--- a/lisp/emacs-lisp/lisp-mode.el	Mon Aug 30 14:47:49 2010 +0200
+++ b/lisp/emacs-lisp/lisp-mode.el	Mon Aug 30 15:03:05 2010 +0200
@@ -1210,31 +1210,17 @@
 (put 'prog2 'lisp-indent-function 2)
 (put 'save-excursion 'lisp-indent-function 0)
 (put 'save-window-excursion 'lisp-indent-function 0)
-(put 'save-selected-window 'lisp-indent-function 0)
 (put 'save-restriction 'lisp-indent-function 0)
 (put 'save-match-data 'lisp-indent-function 0)
 (put 'save-current-buffer 'lisp-indent-function 0)
-(put 'with-current-buffer 'lisp-indent-function 1)
-(put 'combine-after-change-calls 'lisp-indent-function 0)
-(put 'with-output-to-string 'lisp-indent-function 0)
-(put 'with-temp-file 'lisp-indent-function 1)
-(put 'with-temp-buffer 'lisp-indent-function 0)
-(put 'with-temp-message 'lisp-indent-function 1)
-(put 'with-syntax-table 'lisp-indent-function 1)
 (put 'let 'lisp-indent-function 1)
 (put 'let* 'lisp-indent-function 1)
 (put 'while 'lisp-indent-function 1)
 (put 'if 'lisp-indent-function 2)
-(put 'read-if 'lisp-indent-function 2)
 (put 'catch 'lisp-indent-function 1)
 (put 'condition-case 'lisp-indent-function 2)
 (put 'unwind-protect 'lisp-indent-function 1)
 (put 'with-output-to-temp-buffer 'lisp-indent-function 1)
-(put 'eval-after-load 'lisp-indent-function 1)
-(put 'dolist 'lisp-indent-function 1)
-(put 'dotimes 'lisp-indent-function 1)
-(put 'when 'lisp-indent-function 1)
-(put 'unless 'lisp-indent-function 1)
 
 (defun indent-sexp (&optional endpos)
   "Indent each line of the list starting just after point.
--- a/lisp/emacs-lisp/timer.el	Mon Aug 30 14:47:49 2010 +0200
+++ b/lisp/emacs-lisp/timer.el	Mon Aug 30 15:03:05 2010 +0200
@@ -443,8 +443,6 @@
   "This is the timer function used for the timer made by `with-timeout'."
   (throw tag 'timeout))
 
-(put 'with-timeout 'lisp-indent-function 1)
-
 (defvar with-timeout-timers nil
   "List of all timers used by currently pending `with-timeout' calls.")
 
@@ -456,6 +454,7 @@
 if the program loops without waiting in any way, the timeout will not
 be detected.
 \n(fn (SECONDS TIMEOUT-FORMS...) BODY)"
+  (declare (indent 1))
   (let ((seconds (car list))
 	(timeout-forms (cdr list)))
     `(let ((with-timeout-tag (cons nil nil))
--- a/lisp/international/mule.el	Mon Aug 30 14:47:49 2010 +0200
+++ b/lisp/international/mule.el	Mon Aug 30 15:03:05 2010 +0200
@@ -2297,13 +2297,12 @@
 	(setq table val)))
   (translate-region-internal start end table))
 
-(put 'with-category-table 'lisp-indent-function 1)
-
 (defmacro with-category-table (table &rest body)
   "Execute BODY like `progn' with TABLE the current category table.
 The category table of the current buffer is saved, BODY is evaluated,
 then the saved table is restored, even in case of an abnormal exit.
 Value is what BODY returns."
+  (declare (indent 1) (debug t))
   (let ((old-table (make-symbol "old-table"))
 	(old-buffer (make-symbol "old-buffer")))
     `(let ((,old-table (category-table))
--- a/lisp/jka-cmpr-hook.el	Mon Aug 30 14:47:49 2010 +0200
+++ b/lisp/jka-cmpr-hook.el	Mon Aug 30 15:03:05 2010 +0200
@@ -335,6 +335,7 @@
 
 (defmacro with-auto-compression-mode (&rest body)
   "Evalute BODY with automatic file compression and uncompression enabled."
+  (declare (indent 0))
   (let ((already-installed (make-symbol "already-installed")))
     `(let ((,already-installed (jka-compr-installed-p)))
        (unwind-protect
@@ -344,8 +345,6 @@
 	     ,@body)
 	 (unless ,already-installed
 	   (jka-compr-uninstall))))))
-(put 'with-auto-compression-mode 'lisp-indent-function 0)
-
 
 ;; This is what we need to know about jka-compr-handler
 ;; in order to decide when to call it.
--- a/lisp/net/dbus.el	Mon Aug 30 14:47:49 2010 +0200
+++ b/lisp/net/dbus.el	Mon Aug 30 15:03:05 2010 +0200
@@ -92,12 +92,10 @@
 (defmacro dbus-ignore-errors (&rest body)
   "Execute BODY; signal D-Bus error when `dbus-debug' is non-nil.
 Otherwise, return result of last form in BODY, or all other errors."
+  (declare (indent 0) (debug t))
   `(condition-case err
        (progn ,@body)
      (dbus-error (when dbus-debug (signal (car err) (cdr err))))))
-
-(put 'dbus-ignore-errors 'lisp-indent-function 0)
-(put 'dbus-ignore-errors 'edebug-form-spec '(form body))
 (font-lock-add-keywords 'emacs-lisp-mode '("\\<dbus-ignore-errors\\>"))
 
 (defvar dbus-event-error-hooks nil
--- a/lisp/progmodes/python.el	Mon Aug 30 14:47:49 2010 +0200
+++ b/lisp/progmodes/python.el	Mon Aug 30 15:03:05 2010 +0200
@@ -2285,6 +2285,7 @@
 (eval-when-compile
   ;; Define a user-level skeleton and add it to the abbrev table.
 (defmacro def-python-skeleton (name &rest elements)
+  (declare (indent 2))
   (let* ((name (symbol-name name))
 	 (function (intern (concat "python-insert-" name))))
     `(progn
@@ -2297,7 +2298,6 @@
        (define-skeleton ,function
 	 ,(format "Insert Python \"%s\" template." name)
 	 ,@elements)))))
-(put 'def-python-skeleton 'lisp-indent-function 2)
 
 ;; From `skeleton-further-elements' set below:
 ;;  `<': outdent a level;
--- a/lisp/subr.el	Mon Aug 30 14:47:49 2010 +0200
+++ b/lisp/subr.el	Mon Aug 30 15:03:05 2010 +0200
@@ -1630,6 +1630,7 @@
 	      load-elt (and loads (car loads)))))
     load-elt))
 
+(put 'eval-after-load 'lisp-indent-function 1)
 (defun eval-after-load (file form)
   "Arrange that, if FILE is ever loaded, FORM will be run at that time.
 If FILE is already loaded, evaluate FORM right now.
@@ -2713,7 +2714,7 @@
   "Create a new buffer, evaluate BODY there, and write the buffer to FILE.
 The value returned is the value of the last form in BODY.
 See also `with-temp-buffer'."
-  (declare (debug t))
+  (declare (indent 1) (debug t))
   (let ((temp-file (make-symbol "temp-file"))
 	(temp-buffer (make-symbol "temp-buffer")))
     `(let ((,temp-file ,file)
@@ -2735,7 +2736,7 @@
 MESSAGE is written to the message log buffer if `message-log-max' is non-nil.
 If MESSAGE is nil, the echo area and message log buffer are unchanged.
 Use a MESSAGE of \"\" to temporarily clear the echo area."
-  (declare (debug t))
+  (declare (debug t) (indent 1))
   (let ((current-message (make-symbol "current-message"))
 	(temp-message (make-symbol "with-temp-message")))
     `(let ((,temp-message ,message)
@@ -2765,7 +2766,7 @@
                 (kill-buffer ,temp-buffer)))))))
 
 (defmacro with-silent-modifications (&rest body)
-  "Execute BODY, pretending it does not modifies the buffer.
+  "Execute BODY, pretending it does not modify the buffer.
 If BODY performs real modifications to the buffer's text, other
 than cosmetic ones, undo data may become corrupted.
 Typically used around modifications of text-properties which do not really
@@ -3227,7 +3228,7 @@
 The syntax table of the current buffer is saved, BODY is evaluated, and the
 saved table is restored, even in case of an abnormal exit.
 Value is what BODY returns."
-  (declare (debug t))
+  (declare (debug t) (indent 1))
   (let ((old-table (make-symbol "table"))
 	(old-buffer (make-symbol "buffer")))
     `(let ((,old-table (syntax-table))
--- a/lisp/window.el	Mon Aug 30 14:47:49 2010 +0200
+++ b/lisp/window.el	Mon Aug 30 15:03:05 2010 +0200
@@ -55,6 +55,7 @@
 its normal operation could make a different buffer current.  The
 order of recently selected windows and the buffer list ordering
 are not altered by this macro (unless they are altered in BODY)."
+  (declare (indent 0) (debug t))
   `(let ((save-selected-window-window (selected-window))
 	 ;; It is necessary to save all of these, because calling
 	 ;; select-window changes frame-selected-window for whatever