emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 3be2a6b 1/2: Make mh-funcall-if-exists obsolete


From: Stefan Kangas
Subject: master 3be2a6b 1/2: Make mh-funcall-if-exists obsolete
Date: Wed, 17 Nov 2021 00:26:36 -0500 (EST)

branch: master
commit 3be2a6b8b4098e5cf118d196e4cba37054d8292b
Author: Stefan Kangas <stefan@marxist.se>
Commit: Stefan Kangas <stefan@marxist.se>

    Make mh-funcall-if-exists obsolete
    
    * lisp/mh-e/mh-acros.el (mh-funcall-if-exists): Make obsolete.
    * lisp/mh-e/mh-alias.el (mh-read-address):
    * lisp/mh-e/mh-folder.el (mh-folder-mode):
    * lisp/mh-e/mh-mime.el (mh-mm-display-part):
    * lisp/mh-e/mh-show.el (mh-defun-show-buffer):
    * lisp/mh-e/mh-speed.el (mh-speedbar-change-expand-button-char):
    * lisp/mh-e/mh-tool-bar.el (mh-tool-bar-define):
    * lisp/mh-e/mh-utils.el (mh-logo-display):
    * lisp/mh-e/mh-xface.el (mh-face-display-function): Don't use
    above obsolete macro.
---
 lisp/mh-e/mh-acros.el    |  3 ++-
 lisp/mh-e/mh-alias.el    | 10 +---------
 lisp/mh-e/mh-folder.el   |  2 +-
 lisp/mh-e/mh-mime.el     |  3 +--
 lisp/mh-e/mh-show.el     |  3 ++-
 lisp/mh-e/mh-speed.el    |  4 ++--
 lisp/mh-e/mh-tool-bar.el |  3 +--
 lisp/mh-e/mh-utils.el    |  3 +--
 lisp/mh-e/mh-xface.el    |  3 +--
 9 files changed, 12 insertions(+), 22 deletions(-)

diff --git a/lisp/mh-e/mh-acros.el b/lisp/mh-e/mh-acros.el
index 0669f5b..25fff6a 100644
--- a/lisp/mh-e/mh-acros.el
+++ b/lisp/mh-e/mh-acros.el
@@ -59,7 +59,8 @@
 ;;;###mh-autoload
 (defmacro mh-funcall-if-exists (function &rest args)
   "Call FUNCTION with ARGS as parameters if it exists."
-  (declare (debug (symbolp body)))
+  (declare (obsolete "use `(when (fboundp 'foo) (foo))' instead." "29.1")
+           (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 :-(
diff --git a/lisp/mh-e/mh-alias.el b/lisp/mh-e/mh-alias.el
index 5761df5..8087df9 100644
--- a/lisp/mh-e/mh-alias.el
+++ b/lisp/mh-e/mh-alias.el
@@ -258,15 +258,7 @@ Blind aliases or users from /etc/passwd are not expanded."
       (read-string prompt)
     (let* ((minibuffer-local-completion-map mh-alias-read-address-map)
            (completion-ignore-case mh-alias-completion-ignore-case-flag)
-           (the-answer
-            (cond ((fboundp 'completing-read-multiple)
-                   (mh-funcall-if-exists
-                    completing-read-multiple prompt mh-alias-alist nil nil))
-                  ((featurep 'multi-prompt)
-                   (mh-funcall-if-exists
-                    multi-prompt "," nil prompt mh-alias-alist nil nil))
-                  (t (split-string
-                      (completing-read prompt mh-alias-alist nil nil) ",")))))
+           (the-answer (completing-read-multiple prompt mh-alias-alist nil 
nil)))
       (if (not mh-alias-expand-aliases-flag)
           (mapconcat #'identity the-answer ", ")
         ;; Loop over all elements, checking if in passwd alias or blind first
diff --git a/lisp/mh-e/mh-folder.el b/lisp/mh-e/mh-folder.el
index ddf13d1..132ac33 100644
--- a/lisp/mh-e/mh-folder.el
+++ b/lisp/mh-e/mh-folder.el
@@ -631,7 +631,7 @@ perform the operation on all messages in that region.
   (add-hook 'write-file-functions #'mh-execute-commands nil t)
   (make-local-variable 'revert-buffer-function)
   (make-local-variable 'hl-line-mode)   ; avoid pollution
-  (mh-funcall-if-exists hl-line-mode 1)
+  (hl-line-mode 1)
   (setq revert-buffer-function #'mh-undo-folder)
   (add-to-list 'minor-mode-alist '(mh-showing-mode " Show"))
   (mh-inc-spool-make)
diff --git a/lisp/mh-e/mh-mime.el b/lisp/mh-e/mh-mime.el
index 0b58d7b..3698dd3 100644
--- a/lisp/mh-e/mh-mime.el
+++ b/lisp/mh-e/mh-mime.el
@@ -700,8 +700,7 @@ buttons for alternative parts that are usually suppressed."
                   ;; Delete the button and displayed part (if any)
                   (let ((region (get-text-property point 'mh-region)))
                     (when region
-                      (mh-funcall-if-exists
-                       remove-images (car region) (cdr region)))
+                      (remove-images (car region) (cdr region)))
                     (mm-display-part handle)
                     (when region
                       (delete-region (car region) (cdr region))))
diff --git a/lisp/mh-e/mh-show.el b/lisp/mh-e/mh-show.el
index 0f85cd6..16489bf 100644
--- a/lisp/mh-e/mh-show.el
+++ b/lisp/mh-e/mh-show.el
@@ -367,7 +367,8 @@ still visible.\n")
                (setq normal-exit t))
            (deactivate-mark)
            (when (eq major-mode 'mh-folder-mode)
-             (mh-funcall-if-exists hl-line-highlight))
+             (when (fboundp 'hl-line-highlight)
+               (hl-line-highlight)))
            (cond ((not normal-exit)
                   (set-window-configuration config))
                  ,(if dont-return
diff --git a/lisp/mh-e/mh-speed.el b/lisp/mh-e/mh-speed.el
index bf3a9e5..d9909a0 100644
--- a/lisp/mh-e/mh-speed.el
+++ b/lisp/mh-e/mh-speed.el
@@ -535,8 +535,8 @@ be handled next."
           (insert-char char 1 t)
           (put-text-property (point) (1- (point)) 'invisible nil)
           ;; make sure we fix the image on the text here.
-          (mh-funcall-if-exists
-           speedbar-insert-image-button-maybe (- (point) 2) 3)))))
+          (when (fboundp 'speedbar-insert-image-button-maybe)
+            (speedbar-insert-image-button-maybe (- (point) 2) 3))))))
 
 ;;;###mh-autoload
 (defun mh-speed-add-folder (folder)
diff --git a/lisp/mh-e/mh-tool-bar.el b/lisp/mh-e/mh-tool-bar.el
index 0200d23..d451ae3 100644
--- a/lisp/mh-e/mh-tool-bar.el
+++ b/lisp/mh-e/mh-tool-bar.el
@@ -182,8 +182,7 @@ where,
             (add-to-list vector-list `(vector nil ',function t ,full-doc))
             (add-to-list
              setter `(when (member ',name ,list)
-                       (mh-funcall-if-exists
-                        tool-bar-add-item ,icon ',function ',key
+                       (tool-bar-add-item ,icon ',function ',key
                         :help ,doc :enable ',enable-expr)))
             (add-to-list mbuttons name)
             (if docs (add-to-list docs doc))))))
diff --git a/lisp/mh-e/mh-utils.el b/lisp/mh-e/mh-utils.el
index 1c322b8..992943e 100644
--- a/lisp/mh-e/mh-utils.el
+++ b/lisp/mh-e/mh-utils.el
@@ -139,8 +139,7 @@ Ignores case when searching for OLD."
      0 2
      `(display ,(or mh-logo-cache
                     (setq mh-logo-cache
-                          (mh-funcall-if-exists
-                           find-image '(( :type xpm :ascent center
+                          (find-image '(( :type xpm :ascent center
                                           :file "mh-logo.xpm" ))))))
      (car mode-line-buffer-identification))))
 
diff --git a/lisp/mh-e/mh-xface.el b/lisp/mh-e/mh-xface.el
index 0c1bcdf..8350f3d 100644
--- a/lisp/mh-e/mh-xface.el
+++ b/lisp/mh-e/mh-xface.el
@@ -73,8 +73,7 @@ in this order is used."
         (when (re-search-forward "^from:" (point-max) t)
           (if (eq type 'url)
               (mh-x-image-url-display url)
-            (mh-funcall-if-exists
-             insert-image (create-image
+            (insert-image (create-image
                            raw type t
                            :foreground
                            (face-foreground 'mh-show-xface nil t)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]