diff options
author | Stefan Kangas <stefan@marxist.se> | 2021-10-07 17:02:05 +0200 |
---|---|---|
committer | Stefan Kangas <stefan@marxist.se> | 2021-10-07 17:07:38 +0200 |
commit | 25d4cb7e687cdb9d8fca36961d3bc6d0f3cd66f5 (patch) | |
tree | a97062211150f7de55a347f1077d427a7bffa1b2 /lisp/mh-e | |
parent | 9d14e410dac11990cf0e95a1a77e83827323530d (diff) | |
download | emacs-25d4cb7e687cdb9d8fca36961d3bc6d0f3cd66f5.tar.gz emacs-25d4cb7e687cdb9d8fca36961d3bc6d0f3cd66f5.tar.bz2 emacs-25d4cb7e687cdb9d8fca36961d3bc6d0f3cd66f5.zip |
Revert "Declare compat macro mh-do-in-gnu-emacs obsolete"
This reverts commit 148b136651413d8eca0f805c786fb04b9c5878b8.
This commit led to some build failures that I don't yet understand, so
I'm reverting it for now so as not to leave master in a broken state.
Diffstat (limited to 'lisp/mh-e')
-rw-r--r-- | lisp/mh-e/mh-acros.el | 2 | ||||
-rw-r--r-- | lisp/mh-e/mh-compat.el | 3 | ||||
-rw-r--r-- | lisp/mh-e/mh-folder.el | 9 | ||||
-rw-r--r-- | lisp/mh-e/mh-letter.el | 9 | ||||
-rw-r--r-- | lisp/mh-e/mh-mime.el | 26 | ||||
-rw-r--r-- | lisp/mh-e/mh-show.el | 5 | ||||
-rw-r--r-- | lisp/mh-e/mh-tool-bar.el | 145 | ||||
-rw-r--r-- | lisp/mh-e/mh-utils.el | 28 | ||||
-rw-r--r-- | lisp/mh-e/mh-xface.el | 30 |
9 files changed, 137 insertions, 120 deletions
diff --git a/lisp/mh-e/mh-acros.el b/lisp/mh-e/mh-acros.el index f4815ecd6f0..5ea7bca6f9f 100644 --- a/lisp/mh-e/mh-acros.el +++ b/lisp/mh-e/mh-acros.el @@ -47,7 +47,7 @@ ;;;###mh-autoload (defmacro mh-do-in-gnu-emacs (&rest body) "Execute BODY if in GNU Emacs." - (declare (obsolete progn "29.1") (debug t) (indent defun)) + (declare (debug t) (indent defun)) (unless (featurep 'xemacs) `(progn ,@body))) ;;;###mh-autoload diff --git a/lisp/mh-e/mh-compat.el b/lisp/mh-e/mh-compat.el index 4d4c9965703..26e5576fe64 100644 --- a/lisp/mh-e/mh-compat.el +++ b/lisp/mh-e/mh-compat.el @@ -39,7 +39,8 @@ (eval-when-compile (require 'mh-acros)) -(defalias 'mh-require #'require) +(mh-do-in-gnu-emacs + (defalias 'mh-require #'require)) (defun-mh mh-assoc-string assoc-string (key list case-fold) "Like `assoc' but specifically for strings. diff --git a/lisp/mh-e/mh-folder.el b/lisp/mh-e/mh-folder.el index 494dee6f3b4..5fbaf12ef97 100644 --- a/lisp/mh-e/mh-folder.el +++ b/lisp/mh-e/mh-folder.el @@ -580,10 +580,11 @@ region in the MH-Folder buffer, then the MH-E command will perform the operation on all messages in that region. \\{mh-folder-mode-map}" - (unless mh-folder-tool-bar-map - (mh-tool-bar-folder-buttons-init)) - (if (boundp 'tool-bar-map) - (set (make-local-variable 'tool-bar-map) mh-folder-tool-bar-map)) + (mh-do-in-gnu-emacs + (unless mh-folder-tool-bar-map + (mh-tool-bar-folder-buttons-init)) + (if (boundp 'tool-bar-map) + (set (make-local-variable 'tool-bar-map) mh-folder-tool-bar-map))) (make-local-variable 'font-lock-defaults) (setq font-lock-defaults '(mh-folder-font-lock-keywords t)) (make-local-variable 'desktop-save-buffer) diff --git a/lisp/mh-e/mh-letter.el b/lisp/mh-e/mh-letter.el index 0c2936f65bb..493749577b9 100644 --- a/lisp/mh-e/mh-letter.el +++ b/lisp/mh-e/mh-letter.el @@ -291,10 +291,11 @@ order). (make-local-variable 'mh-previous-window-config) (make-local-variable 'mh-sent-from-folder) (make-local-variable 'mh-sent-from-msg) - (unless mh-letter-tool-bar-map - (mh-tool-bar-letter-buttons-init)) - (if (boundp 'tool-bar-map) - (set (make-local-variable 'tool-bar-map) mh-letter-tool-bar-map)) + (mh-do-in-gnu-emacs + (unless mh-letter-tool-bar-map + (mh-tool-bar-letter-buttons-init)) + (if (boundp 'tool-bar-map) + (set (make-local-variable 'tool-bar-map) mh-letter-tool-bar-map))) ;; Set the local value of mh-mail-header-separator according to what is ;; present in the buffer... (set (make-local-variable 'mh-mail-header-separator) diff --git a/lisp/mh-e/mh-mime.el b/lisp/mh-e/mh-mime.el index 76f0d323703..dfd984118b1 100644 --- a/lisp/mh-e/mh-mime.el +++ b/lisp/mh-e/mh-mime.el @@ -187,7 +187,8 @@ Set from last use.") (unless (>= (string-to-number emacs-version) 21) ;; XEmacs doesn't care. (set-keymap-parent map mh-show-mode-map)) - (define-key map [mouse-2] #'mh-push-button) + (mh-do-in-gnu-emacs + (define-key map [mouse-2] #'mh-push-button)) (dolist (c mh-mime-button-commands) (define-key map (cadr c) (car c))) map)) @@ -210,7 +211,8 @@ Set from last use.") (unless (>= (string-to-number emacs-version) 21) (set-keymap-parent map mh-show-mode-map)) (define-key map "\r" #'mh-press-button) - (define-key map [mouse-2] #'mh-push-button) + (mh-do-in-gnu-emacs + (define-key map [mouse-2] #'mh-push-button)) map)) @@ -771,12 +773,13 @@ This is only useful if a Content-Disposition header is not present." ; this only tells us if the image is ; something that emacs can display (let ((image (mm-get-image handle))) - (let ((size (and (fboundp 'image-size) (image-size image)))) - (and size - (< (cdr size) (or mh-max-inline-image-height - (1- (window-height)))) - (< (car size) (or mh-max-inline-image-width - (window-width))))))))) + (mh-do-in-gnu-emacs + (let ((size (and (fboundp 'image-size) (image-size image)))) + (and size + (< (cdr size) (or mh-max-inline-image-height + (1- (window-height)))) + (< (car size) (or mh-max-inline-image-width + (window-width)))))))))) (defun mh-inline-vcard-p (handle) "Decide if HANDLE is a vcard that must be displayed inline." @@ -804,9 +807,10 @@ being used to highlight the signature in a MIME part." (save-excursion (goto-char (point-max)) (when (re-search-backward regexp nil t) - (let ((ov (make-overlay (point) (point-max)))) - (overlay-put ov 'face 'mh-show-signature) - (overlay-put ov 'evaporate t)))))) + (mh-do-in-gnu-emacs + (let ((ov (make-overlay (point) (point-max)))) + (overlay-put ov 'face 'mh-show-signature) + (overlay-put ov 'evaporate t))))))) diff --git a/lisp/mh-e/mh-show.el b/lisp/mh-e/mh-show.el index 614a8255136..9dfce215e47 100644 --- a/lisp/mh-e/mh-show.el +++ b/lisp/mh-e/mh-show.el @@ -836,8 +836,9 @@ The hook `mh-show-mode-hook' is called upon entry to this mode. See also `mh-folder-mode'. \\{mh-show-mode-map}" - (if (boundp 'tool-bar-map) - (set (make-local-variable 'tool-bar-map) mh-show-tool-bar-map)) + (mh-do-in-gnu-emacs + (if (boundp 'tool-bar-map) + (set (make-local-variable 'tool-bar-map) mh-show-tool-bar-map))) (set (make-local-variable 'mail-header-separator) mh-mail-header-separator) (setq paragraph-start (default-value 'paragraph-start)) (setq buffer-invisibility-spec '((vanish . t) t)) diff --git a/lisp/mh-e/mh-tool-bar.el b/lisp/mh-e/mh-tool-bar.el index 1eca5a275d4..4e795d96000 100644 --- a/lisp/mh-e/mh-tool-bar.el +++ b/lisp/mh-e/mh-tool-bar.el @@ -27,7 +27,8 @@ ;;; Code: (require 'mh-e) -(require 'tool-bar) +(mh-do-in-gnu-emacs + (require 'tool-bar)) ;;; Tool Bar Commands @@ -204,77 +205,79 @@ where, (unless (memq x letter-buttons) (error "Letter defaults contains unknown button %s" x))) `(eval-and-compile - (defun mh-buffer-exists-p (mode) - "Test whether a buffer with major mode MODE is present." - (cl-loop for buf in (buffer-list) - when (with-current-buffer buf - (eq major-mode mode)) - return t)) - ;; Tool bar initialization functions - (defun mh-tool-bar-folder-buttons-init () - (when (mh-buffer-exists-p 'mh-folder-mode) - (let* ((load-path (mh-image-load-path-for-library "mh-e" - "mh-logo.xpm")) - (image-load-path (cons (car load-path) - (when (boundp 'image-load-path) - image-load-path)))) - (setq mh-folder-tool-bar-map - (let ((tool-bar-map (make-sparse-keymap))) - ,@(nreverse folder-button-setter) - tool-bar-map)) - (setq mh-folder-seq-tool-bar-map - (let ((tool-bar-map (copy-keymap mh-folder-tool-bar-map))) - ,@(nreverse sequence-button-setter) - tool-bar-map)) - (setq mh-show-tool-bar-map - (let ((tool-bar-map (make-sparse-keymap))) - ,@(nreverse show-button-setter) - tool-bar-map)) - (setq mh-show-seq-tool-bar-map - (let ((tool-bar-map (copy-keymap mh-show-tool-bar-map))) - ,@(nreverse show-seq-button-setter) - tool-bar-map))))) - (defun mh-tool-bar-letter-buttons-init () - (when (mh-buffer-exists-p 'mh-letter-mode) - (let* ((load-path (mh-image-load-path-for-library "mh-e" - "mh-logo.xpm")) - (image-load-path (cons (car load-path) - (when (boundp 'image-load-path) - image-load-path)))) - (setq mh-letter-tool-bar-map - (let ((tool-bar-map (make-sparse-keymap))) - ,@(nreverse letter-button-setter) - tool-bar-map))))) - ;; Custom setter functions - (defun mh-tool-bar-update (mode default-map sequence-map) - "Update `tool-bar-map' in all buffers of MODE. + ;; GNU Emacs tool bar specific code + (mh-do-in-gnu-emacs + (defun mh-buffer-exists-p (mode) + "Test whether a buffer with major mode MODE is present." + (cl-loop for buf in (buffer-list) + when (with-current-buffer buf + (eq major-mode mode)) + return t)) + ;; Tool bar initialization functions + (defun mh-tool-bar-folder-buttons-init () + (when (mh-buffer-exists-p 'mh-folder-mode) + (let* ((load-path (mh-image-load-path-for-library "mh-e" + "mh-logo.xpm")) + (image-load-path (cons (car load-path) + (when (boundp 'image-load-path) + image-load-path)))) + (setq mh-folder-tool-bar-map + (let ((tool-bar-map (make-sparse-keymap))) + ,@(nreverse folder-button-setter) + tool-bar-map)) + (setq mh-folder-seq-tool-bar-map + (let ((tool-bar-map (copy-keymap mh-folder-tool-bar-map))) + ,@(nreverse sequence-button-setter) + tool-bar-map)) + (setq mh-show-tool-bar-map + (let ((tool-bar-map (make-sparse-keymap))) + ,@(nreverse show-button-setter) + tool-bar-map)) + (setq mh-show-seq-tool-bar-map + (let ((tool-bar-map (copy-keymap mh-show-tool-bar-map))) + ,@(nreverse show-seq-button-setter) + tool-bar-map))))) + (defun mh-tool-bar-letter-buttons-init () + (when (mh-buffer-exists-p 'mh-letter-mode) + (let* ((load-path (mh-image-load-path-for-library "mh-e" + "mh-logo.xpm")) + (image-load-path (cons (car load-path) + (when (boundp 'image-load-path) + image-load-path)))) + (setq mh-letter-tool-bar-map + (let ((tool-bar-map (make-sparse-keymap))) + ,@(nreverse letter-button-setter) + tool-bar-map))))) + ;; Custom setter functions + (defun mh-tool-bar-update (mode default-map sequence-map) + "Update `tool-bar-map' in all buffers of MODE. Use SEQUENCE-MAP if display is limited; DEFAULT-MAP otherwise." - (cl-loop for buf in (buffer-list) - do (with-current-buffer buf - (when (eq mode major-mode) ;FIXME: derived-mode-p? - (let ((map (if mh-folder-view-stack - sequence-map - default-map))) - ;; Yes, make-local-variable is necessary since we - ;; get here during initialization when loading - ;; mh-e.el, after the +inbox buffer has been - ;; created, but before mh-folder-mode has run and - ;; created the local map. - (set (make-local-variable 'tool-bar-map) map)))))) - (defun mh-tool-bar-folder-buttons-set (symbol value) - "Construct tool bar for `mh-folder-mode' and `mh-show-mode'." - (set-default symbol value) - (mh-tool-bar-folder-buttons-init) - (mh-tool-bar-update 'mh-folder-mode mh-folder-tool-bar-map - mh-folder-seq-tool-bar-map) - (mh-tool-bar-update 'mh-show-mode mh-show-tool-bar-map - mh-show-seq-tool-bar-map)) - (defun mh-tool-bar-letter-buttons-set (symbol value) - "Construct tool bar for `mh-letter-mode'." - (set-default symbol value) - (mh-tool-bar-letter-buttons-init) - (mh-tool-bar-update 'mh-letter-mode mh-letter-tool-bar-map - mh-letter-tool-bar-map)) + (cl-loop for buf in (buffer-list) + do (with-current-buffer buf + (when (eq mode major-mode) ;FIXME: derived-mode-p? + (let ((map (if mh-folder-view-stack + sequence-map + default-map))) + ;; Yes, make-local-variable is necessary since we + ;; get here during initialization when loading + ;; mh-e.el, after the +inbox buffer has been + ;; created, but before mh-folder-mode has run and + ;; created the local map. + (set (make-local-variable 'tool-bar-map) map)))))) + (defun mh-tool-bar-folder-buttons-set (symbol value) + "Construct tool bar for `mh-folder-mode' and `mh-show-mode'." + (set-default symbol value) + (mh-tool-bar-folder-buttons-init) + (mh-tool-bar-update 'mh-folder-mode mh-folder-tool-bar-map + mh-folder-seq-tool-bar-map) + (mh-tool-bar-update 'mh-show-mode mh-show-tool-bar-map + mh-show-seq-tool-bar-map)) + (defun mh-tool-bar-letter-buttons-set (symbol value) + "Construct tool bar for `mh-letter-mode'." + (set-default symbol value) + (mh-tool-bar-letter-buttons-init) + (mh-tool-bar-update 'mh-letter-mode mh-letter-tool-bar-map + mh-letter-tool-bar-map))) ;; Declare customizable tool bars (custom-declare-variable 'mh-tool-bar-folder-buttons diff --git a/lisp/mh-e/mh-utils.el b/lisp/mh-e/mh-utils.el index 6d9a3afe283..49302e16879 100644 --- a/lisp/mh-e/mh-utils.el +++ b/lisp/mh-e/mh-utils.el @@ -127,18 +127,19 @@ Ignores case when searching for OLD." ;;;###mh-autoload (defun mh-logo-display () "Modify mode line to display MH-E logo." - (let* ((load-path (mh-image-load-path-for-library "mh-e" "mh-logo.xpm")) - (image-load-path (cons (car load-path) - (when (boundp 'image-load-path) - image-load-path)))) - (add-text-properties - 0 2 - `(display ,(or mh-logo-cache - (setq mh-logo-cache - (mh-funcall-if-exists - find-image '((:type xpm :ascent center - :file "mh-logo.xpm")))))) - (car mode-line-buffer-identification)))) + (mh-do-in-gnu-emacs + (let* ((load-path (mh-image-load-path-for-library "mh-e" "mh-logo.xpm")) + (image-load-path (cons (car load-path) + (when (boundp 'image-load-path) + image-load-path)))) + (add-text-properties + 0 2 + `(display ,(or mh-logo-cache + (setq mh-logo-cache + (mh-funcall-if-exists + find-image '((:type xpm :ascent center + :file "mh-logo.xpm")))))) + (car mode-line-buffer-identification))))) @@ -912,7 +913,8 @@ Handle RFC 822 (or later) continuation lines." (defvar mh-hidden-header-keymap (let ((map (make-sparse-keymap))) - (define-key map [mouse-2] #'mh-letter-toggle-header-field-display-button) + (mh-do-in-gnu-emacs + (define-key map [mouse-2] #'mh-letter-toggle-header-field-display-button)) map)) ;;;###mh-autoload diff --git a/lisp/mh-e/mh-xface.el b/lisp/mh-e/mh-xface.el index 73406f09811..9d3f0f4a624 100644 --- a/lisp/mh-e/mh-xface.el +++ b/lisp/mh-e/mh-xface.el @@ -74,16 +74,18 @@ in this order is used." (when type (goto-char (point-min)) (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 - raw type t - :foreground - (mh-face-foreground 'mh-show-xface nil t) - :background - (mh-face-background 'mh-show-xface nil t)) - " "))))))) + ;; GNU Emacs + (mh-do-in-gnu-emacs + (if (eq type 'url) + (mh-x-image-url-display url) + (mh-funcall-if-exists + insert-image (create-image + raw type t + :foreground + (mh-face-foreground 'mh-show-xface nil t) + :background + (mh-face-background 'mh-show-xface nil t)) + " ")))))))) (defun mh-face-to-png (data) "Convert base64 encoded DATA to png image." @@ -142,8 +144,9 @@ The directories are searched for in the order they appear in the list.") (defvar mh-picon-image-types (cl-loop for type in '(xpm xbm gif) - when (or (ignore-errors - (mh-funcall-if-exists image-type-available-p type))) + when (or (mh-do-in-gnu-emacs + (ignore-errors + (mh-funcall-if-exists image-type-available-p type)))) collect type)) (autoload 'message-tokenize-header "sendmail") @@ -368,7 +371,8 @@ filenames. In addition, replaces * with %2a. See URL (when (and (file-readable-p image) (not (file-symlink-p image)) (eq marker mh-x-image-marker)) (goto-char marker) - (mh-funcall-if-exists insert-image (create-image image 'png))) + (mh-do-in-gnu-emacs + (mh-funcall-if-exists insert-image (create-image image 'png)))) (set-buffer-modified-p buffer-modified-flag))))) (defun mh-x-image-url-fetch-image (url cache-file marker sentinel) |