summaryrefslogtreecommitdiff
path: root/lisp/mh-e/mh-acros.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2021-02-22 11:54:17 -0500
committerStefan Monnier <monnier@iro.umontreal.ca>2021-02-22 11:54:17 -0500
commit8d5dfafab7dc40d4b74dc0b56d1b314fd8cac390 (patch)
tree2636e29dac1db9cd4adbc1908bafe9e389f10876 /lisp/mh-e/mh-acros.el
parentf1fa35f0914f5de6d0dbfde9cd00cc7ab1b20ebd (diff)
downloademacs-8d5dfafab7dc40d4b74dc0b56d1b314fd8cac390.tar.gz
Prefer `declare` over a `put` of `list-indent-function`.
While at it, I enabled lexical-binding in the affected files. * lisp/cedet/semantic/sb.el: Enable lexical-binding. (semantic-sb-with-tag-buffer): Use `declare`. * lisp/cedet/semantic/bovine/el.el: Enable lexical-binding. (semantic-elisp-setup-form-parser): Use `declare`. * lisp/emacs-lisp/ert.el: * lisp/emacs-lisp/ert-x.el: Remove redundant `put`. * lisp/emulation/cua-rect.el: Enable lexical-binding. (cua--rectangle-operation, cua--rectangle-aux-replace): Use `declare`. * lisp/mh-e/mh-acros.el: Enable lexical-binding. (mh-do-in-gnu-emacs, mh-do-in-xemacs, mh-funcall-if-exists, defun-mh) (defmacro-mh, with-mh-folder-updating, mh-in-show-buffer) (mh-do-at-event-location, mh-iterate-on-messages-in-region) (mh-iterate-on-range): Use `declare`. * lisp/mh-e/mh-compat.el: Enable lexical-binding. (mh-flet): Use `declare`. * lisp/mh-e/mh-e.el: Enable lexical-binding. (defgroup-mh, defcustom-mh, defface-mh): Use `declare`. * lisp/net/sieve.el: Enable lexical-binding. Remove redundant :group args. (sieve-activate, sieve-remove, sieve-edit-script): Remove unused arg from the interactive spec. (sieve-deactivate-all): Remove unused var `name`. (sieve-change-region): Use `declare`. * lisp/obsolete/fast-lock.el: Enable lexical-binding. Remove redundant :group args. Remove XEmacs compat code. (save-buffer-state): Remove macro. (fast-lock-add-properties): Use `with-silent-modifications` instead. * lisp/obsolete/lazy-lock.el: Enable lexical-binding. Remove redundant :group args. (do-while): Use `declare`. (save-buffer-state): Remove macro. (lazy-lock-fontify-rest-after-change, lazy-lock-defer-line-after-change) (lazy-lock-defer-rest-after-change, lazy-lock-after-fontify-buffer) (lazy-lock-after-unfontify-buffer, lazy-lock-fontify-region): Use `with-silent-modifications` instead. * lisp/obsolete/pgg.el: Enable lexical-binding. Remove XEmacs compat code. (pgg-save-coding-system, pgg-as-lbt, pgg-process-when-success): Use `declare`. (pgg-add-passphrase-to-cache): Remove unused var `new-timer`. (pgg-decrypt-region): Remove unused var `buf`. * lisp/org/org-agenda.el (org-let, org-let2): Move from org-macs and use `declare`. * lisp/org/org-macs.el (org-let, org-let2): Move these functions that are inherently harmful to your karma to the only package that uses them. (org-scroll): Use `pcase` to avoid `eval` and use more readable syntax for those integers standing for events. * lisp/progmodes/antlr-mode.el: Enable lexical-binding. (save-buffer-state-x): Use `declare` and `with-silent-modifications`. * lisp/international/mule-util.el (with-coding-priority): * lisp/cedet/ede/proj-comp.el (proj-comp-insert-variable-once): * lisp/org/org-element.el (org-element-map): * test/lisp/emacs-lisp/bytecomp-tests.el (test-byte-comp-compile-and-load): * test/lisp/emacs-lisp/generator-tests.el (cps-testcase): Use `declare`.
Diffstat (limited to 'lisp/mh-e/mh-acros.el')
-rw-r--r--lisp/mh-e/mh-acros.el33
1 files changed, 13 insertions, 20 deletions
diff --git a/lisp/mh-e/mh-acros.el b/lisp/mh-e/mh-acros.el
index af6f2f1ab02..dd953ee9df7 100644
--- a/lisp/mh-e/mh-acros.el
+++ b/lisp/mh-e/mh-acros.el
@@ -1,4 +1,4 @@
-;;; mh-acros.el --- macros used in MH-E
+;;; mh-acros.el --- macros used in MH-E -*- lexical-binding: t; -*-
;; Copyright (C) 2004, 2006-2021 Free Software Foundation, Inc.
@@ -49,20 +49,19 @@
;;;###mh-autoload
(defmacro mh-do-in-gnu-emacs (&rest body)
"Execute BODY if in GNU Emacs."
- (declare (debug t))
+ (declare (debug t) (indent defun))
(unless (featurep 'xemacs) `(progn ,@body)))
-(put 'mh-do-in-gnu-emacs 'lisp-indent-hook 'defun)
;;;###mh-autoload
(defmacro mh-do-in-xemacs (&rest body)
"Execute BODY if in XEmacs."
- (declare (debug t))
+ (declare (debug t) (indent defun))
(when (featurep 'xemacs) `(progn ,@body)))
-(put 'mh-do-in-xemacs 'lisp-indent-hook 'defun)
;;;###mh-autoload
(defmacro mh-funcall-if-exists (function &rest args)
"Call FUNCTION with ARGS as parameters if it exists."
+ (declare (debug (symbolp body)))
;; FIXME: Not clear when this should be used. If the function happens
;; not to exist at compile-time (e.g. because the corresponding package
;; wasn't loaded), then it won't ever be used :-(
@@ -75,25 +74,24 @@
"Create function NAME.
If FUNCTION exists, then NAME becomes an alias for FUNCTION.
Otherwise, create function NAME with ARG-LIST and BODY."
+ (declare (indent defun) (doc-string 4)
+ (debug (&define name symbolp sexp def-body)))
`(defalias ',name
(if (fboundp ',function)
',function
(lambda ,arg-list ,@body))))
-(put 'defun-mh 'lisp-indent-function 'defun)
-(put 'defun-mh 'doc-string-elt 4)
;;;###mh-autoload
(defmacro defmacro-mh (name macro arg-list &rest body)
"Create macro NAME.
If MACRO exists, then NAME becomes an alias for MACRO.
Otherwise, create macro NAME with ARG-LIST and BODY."
+ (declare (indent defun) (doc-string 4)
+ (debug (&define name symbolp sexp def-body)))
(let ((defined-p (fboundp macro)))
(if defined-p
`(defalias ',name ',macro)
`(defmacro ,name ,arg-list ,@body))))
-(put 'defmacro-mh 'lisp-indent-function 'defun)
-(put 'defmacro-mh 'doc-string-elt 4)
-
;;; Miscellaneous
@@ -127,7 +125,7 @@ Execute BODY, which can modify the folder buffer without having to
worry about file locking or the read-only flag, and return its result.
If SAVE-MODIFICATION-FLAG is non-nil, the buffer's modification flag
is unchanged, otherwise it is cleared."
- (declare (debug t))
+ (declare (debug t) (indent defun))
(setq save-modification-flag (car save-modification-flag)) ; CL style
`(prog1
(let ((mh-folder-updating-mod-flag (buffer-modified-p))
@@ -139,14 +137,13 @@ is unchanged, otherwise it is cleared."
(mh-set-folder-modified-p mh-folder-updating-mod-flag)))
,@(if (not save-modification-flag)
'((mh-set-folder-modified-p nil)))))
-(put 'with-mh-folder-updating 'lisp-indent-hook 'defun)
;;;###mh-autoload
(defmacro mh-in-show-buffer (show-buffer &rest body)
"Format is (mh-in-show-buffer (SHOW-BUFFER) &body BODY).
Display buffer SHOW-BUFFER in other window and execute BODY in it.
Stronger than `save-excursion', weaker than `save-window-excursion'."
- (declare (debug t))
+ (declare (debug t) (indent defun))
(setq show-buffer (car show-buffer)) ; CL style
`(let ((mh-in-show-buffer-saved-window (selected-window)))
(switch-to-buffer-other-window ,show-buffer)
@@ -155,7 +152,6 @@ Stronger than `save-excursion', weaker than `save-window-excursion'."
(progn
,@body)
(select-window mh-in-show-buffer-saved-window))))
-(put 'mh-in-show-buffer 'lisp-indent-hook 'defun)
;;;###mh-autoload
(defmacro mh-do-at-event-location (event &rest body)
@@ -163,7 +159,7 @@ Stronger than `save-excursion', weaker than `save-window-excursion'."
After BODY has been executed return to original window.
The modification flag of the buffer in the event window is
preserved."
- (declare (debug t))
+ (declare (debug t) (indent defun))
(let ((event-window (make-symbol "event-window"))
(event-position (make-symbol "event-position"))
(original-window (make-symbol "original-window"))
@@ -190,7 +186,6 @@ preserved."
(goto-char ,original-position)
(set-marker ,original-position nil)
(select-window ,original-window))))))
-(put 'mh-do-at-event-location 'lisp-indent-hook 'defun)
@@ -209,7 +204,7 @@ VAR is bound to the message on the current line as we loop
starting from BEGIN till END. In each step BODY is executed.
If VAR is nil then the loop is executed without any binding."
- (declare (debug (symbolp body)))
+ (declare (debug (symbolp body)) (indent defun))
(unless (symbolp var)
(error "Can not bind the non-symbol %s" var))
(let ((binding-needed-flag var))
@@ -221,7 +216,6 @@ If VAR is nil then the loop is executed without any binding."
(let ,(if binding-needed-flag `((,var (mh-get-msg-num t))) ())
,@body))
(forward-line 1)))))
-(put 'mh-iterate-on-messages-in-region 'lisp-indent-hook 'defun)
;;;###mh-autoload
(defmacro mh-iterate-on-range (var range &rest body)
@@ -235,7 +229,7 @@ a string. In each iteration, BODY is executed.
The parameter RANGE is usually created with
`mh-interactive-range' in order to provide a uniform interface to
MH-E functions."
- (declare (debug (symbolp body)))
+ (declare (debug (symbolp body)) (indent defun))
(unless (symbolp var)
(error "Can not bind the non-symbol %s" var))
(let ((binding-needed-flag var)
@@ -263,7 +257,6 @@ MH-E functions."
(when (gethash v ,seq-hash-table)
(let ,(if binding-needed-flag `((,var v)) ())
,@body))))))))
-(put 'mh-iterate-on-range 'lisp-indent-hook 'defun)
(defmacro mh-dlet* (binders &rest body)
"Like `let*' but always dynamically scoped."