From: Stefan Kangas Date: Wed, 17 Nov 2021 05:05:12 +0000 (+0100) Subject: Make mh-funcall-if-exists obsolete X-Git-Tag: emacs-29.0.90~2852^2~243 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=3be2a6b8b4098e5cf118d196e4cba37054d8292b;p=emacs.git 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. --- diff --git a/lisp/mh-e/mh-acros.el b/lisp/mh-e/mh-acros.el index 0669f5bb22c..25fff6a8e1b 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 5761df5297c..8087df97c94 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 ddf13d193ed..132ac33d269 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 0b58d7ba1f4..3698dd33ec9 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 0f85cd6f69a..16489bf0172 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 bf3a9e5774b..d9909a034d9 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 0200d232c33..d451ae34d29 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 1c322b80340..992943e3042 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 0c1bcdfefd5..8350f3d0fbb 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)