branch: elpa/vm
commit 508752603ace80639a08d33a9ba16079a4c61cf3
Author: Stefan Monnier <monn...@iro.umontreal.ca>
Commit: Stefan Monnier <monn...@iro.umontreal.ca>

    * lisp/vm-macro.el (vm-interactive-p): Move to top-level.  Use everywhere
---
 lisp/vm-macro.el   | 17 ++++++++---------
 lisp/vm-pcrisis.el |  9 +++++----
 lisp/vm-vars.el    |  5 +++--
 lisp/vm-version.el |  4 +++-
 4 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/lisp/vm-macro.el b/lisp/vm-macro.el
index 767a3138c1..cf241c1e98 100644
--- a/lisp/vm-macro.el
+++ b/lisp/vm-macro.el
@@ -41,15 +41,14 @@
     (defmacro defvaralias (&rest args)))
 
   (unless (fboundp 'declare-function)
-    (defmacro declare-function (fn file &optional arglist fileonly)))
-
-  (defmacro vm-interactive-p ()
-    (if (featurep 'xemacs)
-       `(interactive-p)
-      (if (> emacs-major-version 23)
-         `(called-interactively-p 'interactive)
-       `(interactive-p))))
-  )
+    (defmacro declare-function (fn file &optional arglist fileonly))))
+
+(defmacro vm-interactive-p ()
+  (if (featurep 'xemacs)
+      `(interactive-p)
+    (if (fboundp 'called-interactively-p) ;; (> emacs-major-version 23)
+       `(called-interactively-p 'interactive)
+      `(interactive-p))))
 
 (declare-function vm-check-for-killed-summary "vm-misc" ())
 (declare-function vm-check-for-killed-presentation "vm-misc" ())
diff --git a/lisp/vm-pcrisis.el b/lisp/vm-pcrisis.el
index bc5fd3f790..1fb5ff2a89 100644
--- a/lisp/vm-pcrisis.el
+++ b/lisp/vm-pcrisis.el
@@ -42,6 +42,7 @@
 (require 'vm-motion)
 (require 'vm-reply)
 (eval-when-compile (vm-load-features '(regexp-opt bbdb bbdb-com)))
+(eval-when-compile (require 'vm-macro))
 
 (declare-function set-extent-face "vm-xemacs" (extent face))
 (declare-function timezone-absolute-from-gregorian "ext:timezone" 
@@ -1526,7 +1527,7 @@ recursion nor concurrent calls."
 (defun vmpc--mail (orig-fun &rest args)
   "Start a new message with pcrisis voodoo."
   (vm-follow-summary-cursor)
-  (vm-select-folder-buffer-and-validate 1 (interactive-p))
+  (vm-select-folder-buffer-and-validate 1 (vm-interactive-p))
   (vmpc-init-vars 'mail)
   (vmpc-build-true-conditions-list)
   (vmpc-build-actions-to-run-list)
@@ -1565,7 +1566,7 @@ recursion nor concurrent calls."
   "Forward a message with pcrisis voodoo."
   ;; this stuff is already done when replying, but not here:
   (vm-follow-summary-cursor)
-  (vm-select-folder-buffer-and-validate 1 (interactive-p))
+  (vm-select-folder-buffer-and-validate 1 (vm-interactive-p))
   ;;  the rest is almost exactly the same as replying:
   (vmpc-init-vars 'forward)
   (vmpc-build-true-conditions-list)
@@ -1581,7 +1582,7 @@ recursion nor concurrent calls."
   "Forward a message in plain text with pcrisis voodoo."
   ;; this stuff is already done when replying, but not here:
   (vm-follow-summary-cursor)
-  (vm-select-folder-buffer-and-validate 1 (interactive-p))
+  (vm-select-folder-buffer-and-validate 1 (vm-interactive-p))
   ;;  the rest is almost exactly the same as replying:
   (vmpc-init-vars 'forward)
   (vmpc-build-true-conditions-list)
@@ -1597,7 +1598,7 @@ recursion nor concurrent calls."
   "Resent a message with pcrisis voodoo."
   ;; this stuff is already done when replying, but not here:
   (vm-follow-summary-cursor)
-  (vm-select-folder-buffer-and-validate 1 (interactive-p))
+  (vm-select-folder-buffer-and-validate 1 (vm-interactive-p))
   ;; the rest is almost exactly the same as replying:
   (vmpc-init-vars 'resend)
   (vmpc-build-true-conditions-list)
diff --git a/lisp/vm-vars.el b/lisp/vm-vars.el
index ed0e50b381..1042bccce6 100644
--- a/lisp/vm-vars.el
+++ b/lisp/vm-vars.el
@@ -22,6 +22,7 @@
 ;;; Code:
 
 (require 'vm-version)
+(require 'vm-macro)
 
 (declare-function vm-parse "vm-misc" (string regexp &optional matchn matches))
 (declare-function vm-delete-directory-names "vm-misc" (list))
@@ -7549,9 +7550,9 @@ preferences file).
 The file names may be customized via the variables `vm-init-file' and
 `vm-preferences-file'. "
   (interactive "P")
-  (when (or (not vm-init-file-loaded) (interactive-p))
+  (when (or (not vm-init-file-loaded) (vm-interactive-p))
     (when vm-init-file
-      (load vm-init-file (not (interactive-p)) (not (interactive-p)) t))
+      (load vm-init-file (not (vm-interactive-p)) (not (vm-interactive-p)) t))
     (when (and vm-preferences-file (not init-only))
       (load vm-preferences-file t t t)))
   (setq vm-init-file-loaded t)
diff --git a/lisp/vm-version.el b/lisp/vm-version.el
index 71ba832dd4..d4fdc82f77 100644
--- a/lisp/vm-version.el
+++ b/lisp/vm-version.el
@@ -19,6 +19,8 @@
 
 ;;; Code:
 
+(require 'vm-macro)
+
 ;; Don't use vm-device-type here because it may not not be loaded yet.
 (declare-function device-type "vm-xemacs" ())
 (declare-function device-matching-specifier-tag-list "vm-xemacs" ())
@@ -37,7 +39,7 @@
 (defun vm-version ()
   "Return the value of the variable `vm-version'."
   (interactive)
-  (when (interactive-p)
+  (when (vm-interactive-p)
     (or (and (stringp vm-version)
             (string-match "[0-9]" vm-version))
        (error "Cannot determine VM version!"))

Reply via email to