mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
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.
This commit is contained in:
parent
cd196f1256
commit
f291fe60fb
16 changed files with 52 additions and 51 deletions
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -66,7 +66,6 @@ The return value of this function is not used."
|
|||
;; 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.
|
||||
|
||||
|
|
|
|||
|
|
@ -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)))
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -514,9 +514,9 @@ Applies to the frame whose line point is on in the backtrace."
|
|||
(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
|
||||
|
|
|
|||
|
|
@ -43,8 +43,6 @@ menus, turn this variable off, otherwise it is probably better to keep it on.")
|
|||
(defsubst easy-menu-intern (s)
|
||||
(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 @@ unselectable text. A string consisting solely of hyphens is displayed
|
|||
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)))
|
||||
|
|
|
|||
|
|
@ -1610,6 +1610,7 @@ SPEC-LIST is of a form similar to `let'. For example:
|
|||
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 @@ variable name of the same name as the slot."
|
|||
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.
|
||||
|
|
|
|||
|
|
@ -298,6 +298,7 @@ The returned value is a list of strings, one per line."
|
|||
(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 @@ If FILE is nil, execute BODY in the current buffer."
|
|||
(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.
|
||||
|
||||
|
|
|
|||
|
|
@ -1210,31 +1210,17 @@ This function also returns nil meaning don't specify the indentation."
|
|||
(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.
|
||||
|
|
|
|||
|
|
@ -443,8 +443,6 @@ This function returns a timer object which you can use in `cancel-timer'."
|
|||
"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 @@ event (such as keyboard input, input from subprocesses, or a certain time);
|
|||
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))
|
||||
|
|
|
|||
|
|
@ -2297,13 +2297,12 @@ It returns the number of characters changed."
|
|||
(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))
|
||||
|
|
|
|||
|
|
@ -335,6 +335,7 @@ Return the new status of auto compression (non-nil means on)."
|
|||
|
||||
(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 @@ Return the new status of auto compression (non-nil means on)."
|
|||
,@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.
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -2285,6 +2285,7 @@ the if condition."
|
|||
(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 @@ the if condition."
|
|||
(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;
|
||||
|
|
|
|||
|
|
@ -1630,6 +1630,7 @@ Return nil if there isn't one."
|
|||
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 @@ nor the buffer list."
|
|||
"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 @@ The value returned is the value of the last form in BODY.
|
|||
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 @@ See also `with-temp-file' and `with-output-to-string'."
|
|||
(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 @@ that can be added."
|
|||
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))
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ This macro saves and restores the current buffer, since otherwise
|
|||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue