]> code.delx.au - gnu-emacs/blobdiff - lisp/mh-e/mh-acros.el
Fix typos.
[gnu-emacs] / lisp / mh-e / mh-acros.el
index 313d3f19a2dc379feb5441a7f0e15402cf20f4cb..d4fd2cccb3ba71ceb35a903a66d7c84efd63be9c 100644 (file)
@@ -1,6 +1,6 @@
 ;;; mh-acros.el --- macros used in MH-E
 
-;; Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+;; Copyright (C) 2004, 2006, 2007, 2008 Free Software Foundation, Inc.
 
 ;; Author: Satyaki Das <satyaki@theforce.stanford.edu>
 ;; Maintainer: Bill Wohler <wohler@newt.com>
@@ -9,10 +9,10 @@
 
 ;; This file is part of GNU Emacs.
 
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -20,9 +20,7 @@
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
@@ -65,12 +63,14 @@ loads \"cl\" appropriately."
 ;;;###mh-autoload
 (defmacro mh-do-in-gnu-emacs (&rest body)
   "Execute BODY if in GNU Emacs."
+  (declare (debug t))
   (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))
   (when (featurep 'xemacs) `(progn ,@body)))
 (put 'mh-do-in-xemacs 'lisp-indent-hook 'defun)
 
@@ -82,26 +82,28 @@ loads \"cl\" appropriately."
        (funcall ',function ,@args))))
 
 ;;;###mh-autoload
-(defmacro mh-defun-compat (function arg-list &rest body)
-  "This is a macro to define functions which are not defined.
-It is used for functions which were added to Emacs recently.
-If FUNCTION is not defined then it is defined to have argument
-list, ARG-LIST and body, BODY."
+(defmacro defun-mh (name function arg-list &rest body)
+  "Create function NAME.
+If FUNCTION exists, then NAME becomes an alias for FUNCTION.
+Otherwise, create function NAME with ARG-LIST and BODY."
   (let ((defined-p (fboundp function)))
-    (unless defined-p
-      `(defun ,function ,arg-list ,@body))))
-(put 'mh-defun-compat 'lisp-indent-function 'defun)
+    (if defined-p
+        `(defalias ',name ',function)
+      `(defun ,name ,arg-list ,@body))))
+(put 'defun-mh 'lisp-indent-function 'defun)
+(put 'defun-mh 'doc-string-elt 4)
 
 ;;;###mh-autoload
-(defmacro mh-defmacro-compat (function arg-list &rest body)
-  "This is a macro to define functions which are not defined.
-It is used for macros which were added to Emacs recently.
-If FUNCTION is not defined then it is defined to have argument
-list, ARG-LIST and body, BODY."
-  (let ((defined-p (fboundp function)))
-    (unless defined-p
-      `(defmacro ,function ,arg-list ,@body))))
-(put 'mh-defmacro-compat 'lisp-indent-function 'defun)
+(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."
+  (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)
 
 \f
 
@@ -130,7 +132,9 @@ check if variable `transient-mark-mode' is active."
                (boundp 'mark-active) mark-active))))
 
 ;; Shush compiler.
-(eval-when-compile (mh-do-in-xemacs (defvar struct) (defvar x) (defvar y)))
+(defvar struct)                         ; XEmacs
+(defvar x)                              ; XEmacs
+(defvar y)                              ; XEmacs
 
 ;;;###mh-autoload
 (defmacro mh-defstruct (name-spec &rest fields)
@@ -176,6 +180,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))
   (setq save-modification-flag (car save-modification-flag)) ; CL style
   `(prog1
        (let ((mh-folder-updating-mod-flag (buffer-modified-p))
@@ -194,6 +199,7 @@ is unchanged, otherwise it is cleared."
   "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))
   (setq show-buffer (car show-buffer))  ; CL style
   `(let ((mh-in-show-buffer-saved-window (selected-window)))
      (switch-to-buffer-other-window ,show-buffer)
@@ -210,6 +216,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))
   (let ((event-window (make-symbol "event-window"))
         (event-position (make-symbol "event-position"))
         (original-window (make-symbol "original-window"))
@@ -243,9 +250,9 @@ preserved."
 ;;; Sequences and Ranges
 
 ;;;###mh-autoload
-(defmacro mh-seq-msgs (sequence)
+(defsubst mh-seq-msgs (sequence)
   "Extract messages from the given SEQUENCE."
-  (list 'cdr sequence))
+  (cdr sequence))
 
 ;;;###mh-autoload
 (defmacro mh-iterate-on-messages-in-region (var begin end &rest body)
@@ -255,6 +262,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)))
   (unless (symbolp var)
     (error "Can not bind the non-symbol %s" var))
   (let ((binding-needed-flag var))
@@ -280,6 +288,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)))
   (unless (symbolp var)
     (error "Can not bind the non-symbol %s" var))
   (let ((binding-needed-flag var)