Remove some more MH-E compat code

* lisp/mh-e/mh-acros.el (defun-mh, defmacro-mh): Make obsolete.

* lisp/mh-e/mh-gnus.el (mh-gnus-local-map-property): Make obsolete.
* lisp/mh-e/mh-mime.el (mh-insert-mime-security-button)
(mh-insert-mime-button): Don't use above obsolete function.

* lisp/mh-e/mh-gnus.el (mh-mm-text-html-renderer): Make obsolete.
* lisp/mh-e/mh-mime.el (mh-mm-inline-media-tests)
(mh-signature-highlight): Remove references to removed Gnus
variable 'mm-inline-text-html-renderer'.

* lisp/mh-e/mh-letter.el (mh-letter-complete): Make into obsolete
function alias for 'completion-at-point'.  Update callers.

* lisp/mh-e/mh-e.el (mh-inc-spool-list, mh-show-use-xface-flag):
* lisp/mh-e/mh-comp.el (mh-ascii-buffer-p):
* lisp/mh-e/mh-show.el:
* lisp/mh-e/mh-utils.el: Remove some references to XEmacs.

* lisp/mh-e/mh-comp.el (mh-send-letter): Remove XEmacs and Emacs
compat code.

* lisp/mh-e/mh-compat.el (mh-display-completion-list): Remove
compat code for Emacs 22 and earlier.

* lisp/mh-e/mh-e.el (mh-inherit-face-flag)
(mh-min-colors-defined-flag): Make XEmacs and Emacs 21 compat
variables obsolete.
(mh-face-data): Adjust to assume above variables are always t.

* lisp/mh-e/mh-mime.el (mh-mime-button-map): Remove XEmacs and
Emacs 20 compat code.

* lisp/mh-e/mh-utils.el (mh-mapc): Make Emacs 20 compat function
into obsolete function alias for mapc.  Update callers.

* lisp/mh-e/mh-xface.el (mh-show-xface-function, mh-show-xface):
Remove Emacs 20 compat code.
This commit is contained in:
Stefan Kangas 2021-10-11 23:58:24 +02:00
parent 76d75df8e7
commit f8d750135e
12 changed files with 86 additions and 180 deletions

View file

@ -75,7 +75,8 @@
"Create function NAME.
If FUNCTION exists, then NAME becomes an alias for FUNCTION.
Otherwise, create function NAME with ARG-LIST and BODY."
(declare (indent defun) (doc-string 4)
(declare (obsolete defun "29.1")
(indent defun) (doc-string 4)
(debug (&define name symbolp sexp def-body)))
`(defalias ',name
(if (fboundp ',function)
@ -87,7 +88,8 @@ Otherwise, create function NAME with ARG-LIST and BODY."
"Create macro NAME.
If MACRO exists, then NAME becomes an alias for MACRO.
Otherwise, create macro NAME with ARG-LIST and BODY."
(declare (indent defun) (doc-string 4)
(declare (obsolete defmacro "29.1")
(indent defun) (doc-string 4)
(debug (&define name symbolp sexp def-body)))
(let ((defined-p (fboundp macro)))
(if defined-p

View file

@ -304,21 +304,7 @@ message and scan line."
(let ((draft-buffer (current-buffer))
(file-name buffer-file-name)
(config mh-previous-window-config)
;; FIXME this is subtly different to select-message-coding-system.
(coding-system-for-write
(if (fboundp 'select-message-coding-system)
(select-message-coding-system) ; Emacs has this since at least 21.1
(if (and (local-variable-p 'buffer-file-coding-system
(current-buffer)) ;XEmacs needs two args
;; We're not sure why, but buffer-file-coding-system
;; tends to get set to undecided-unix.
(not (memq buffer-file-coding-system
'(undecided undecided-unix undecided-dos))))
buffer-file-coding-system
(or (and (boundp 'sendmail-coding-system) sendmail-coding-system)
(and (default-boundp 'buffer-file-coding-system)
(default-value 'buffer-file-coding-system))
'utf-8)))))
(coding-system-for-write (select-message-coding-system)))
;; Older versions of spost do not support -msgid and -mime.
(unless mh-send-uses-spost-flag
;; Adding a Message-ID field looks good, makes it easier to search for
@ -433,7 +419,7 @@ See also `mh-send'."
(mh-clean-msg-header (point-min) mh-new-draft-cleaned-headers nil)
(mh-insert-header-separator)
;; Merge in components
(mh-mapc
(mapc
(lambda (header-field)
(let ((field (car header-field))
(value (cdr header-field))
@ -697,7 +683,7 @@ message and scan line."
;; For "From", the first value wins, with the identity's "From"
;; trumping anything in the distcomps file.
(let ((components-file (mh-bare-components mh-dist-formfile)))
(mh-mapc
(mapc
(lambda (header-field)
(let ((field (car header-field))
(value (cdr header-field))
@ -1276,11 +1262,8 @@ discarded."
(set-syntax-table old-syntax-table))))
(defun mh-ascii-buffer-p ()
"Check if current buffer is entirely composed of ASCII.
The function doesn't work for XEmacs since `find-charset-region'
doesn't exist there."
(cl-loop for charset in (mh-funcall-if-exists
find-charset-region (point-min) (point-max))
"Check if current buffer is entirely composed of ASCII."
(cl-loop for charset in (find-charset-region (point-min) (point-max))
unless (eq charset 'ascii) return nil
finally return t))

View file

@ -70,13 +70,9 @@ The optional argument COMMON-SUBSTRING, if non-nil, should be a string
specifying a common substring for adding the faces
`completions-first-difference' and `completions-common-part' to
the completions."
(cond ((< emacs-major-version 22) `(display-completion-list ,completions))
((fboundp 'completion-hilit-commonality) ; Emacs 23.1 and later
`(display-completion-list
(completion-hilit-commonality ,completions
,(length common-substring) nil)))
(t ; Emacs 22
`(display-completion-list ,completions ,common-substring))))
`(display-completion-list
(completion-hilit-commonality ,completions
,(length common-substring) nil)))
(define-obsolete-function-alias 'mh-face-foreground
#'face-foreground "29.1")

View file

@ -656,9 +656,6 @@ Set mark after inserted text."
;;; MH-E Customization Support Routines
;; Shush compiler (Emacs 21 and XEmacs).
(defvar customize-package-emacs-version-alist)
;; Temporary function and data structure used customization.
;; These will be unbound after the options are defined.
(defmacro mh-strip-package-version (args)
@ -1655,10 +1652,7 @@ using the Emacs 22 command \"emacsclient\" as follows:
origMode
polltime 10
headertime 0
command emacsclient --eval \\='(mh-inc-spool-mh-e)\\='
In XEmacs, the command \"gnuclient\" is used in a similar
fashion."
command emacsclient --eval \\='(mh-inc-spool-mh-e)\\='"
:type '(repeat (list (file :tag "Spool File")
(string :tag "Folder")
(character :tag "Key Binding")))
@ -1813,7 +1807,7 @@ flavors of `mh-yank-behavior' or you have added a
"Function to call when completing outside of address or folder fields.
In the body of the message,
\\<mh-letter-mode-map>\\[mh-letter-complete] runs this function,
\\<mh-letter-mode-map>\\[completion-at-point] runs this function,
which is set to \"ispell-complete-word\" by default."
:type '(choice function (const nil))
:group 'mh-letter
@ -3022,15 +3016,12 @@ and off. This feature will be turned on by default if your system
supports it.
The first header field used, if present, is the Gnus-specific
\"Face:\" field. The \"Face:\" field appeared in GNU Emacs 21 and
XEmacs. For more information, see URL
\"Face:\" field. The \"Face:\" field appeared in Emacs 21.
For more information, see URL
`https://quimby.gnus.org/circus/face/'. Next is the traditional
\"X-Face:\" header field. The display of this field requires the
\"uncompface\" program (see URL
`ftp://ftp.cs.indiana.edu/pub/faces/compface/compface.tar.z'). Recent
versions of XEmacs have internal support for \"X-Face:\" images. If
your version of XEmacs does not, then you'll need both \"uncompface\"
and the x-face package (see URL `https://www.jpl.org/ftp/pub/elisp/').
`ftp://ftp.cs.indiana.edu/pub/faces/compface/compface.tar.z').
Finally, MH-E will display images referenced by the \"X-Image-URL:\"
header field if neither the \"Face:\" nor the \"X-Face:\" fields are
@ -3522,14 +3513,13 @@ consumed by `defface-mh'.")
(require 'cus-face)
(defvar mh-inherit-face-flag (assq :inherit custom-face-attributes)
"Non-nil means that the `defface' :inherit keyword is available.
The :inherit keyword is available on all supported versions of
GNU Emacs and XEmacs from at least 21.5.23 on.")
(defvar mh-inherit-face-flag t
"Non-nil means that the `defface' :inherit keyword is available.")
(make-obsolete-variable 'mh-inherit-face-flag nil "29.1")
(defvar mh-min-colors-defined-flag (and (not (featurep 'xemacs))
(>= emacs-major-version 22))
(defvar mh-min-colors-defined-flag t
"Non-nil means `defface' supports min-colors display requirement.")
(make-obsolete-variable 'mh-min-colors-defined-flag nil "29.1")
(defun mh-face-data (face &optional inherit)
"Return spec for FACE.
@ -3540,37 +3530,10 @@ keyword, return INHERIT literally; otherwise, return spec for
FACE from the variable `mh-face-data'. This isn't a perfect
implementation. In the case that the :inherit keyword is not
supported, any additional attributes in the inherit parameter are
not added to the returned spec.
Furthermore, when `mh-min-colors-defined-flag' is nil, this
function finds display entries with \"min-colors\" requirements
and either removes the \"min-colors\" requirement or strips the
display entirely if the display does not support the number of
specified colors."
(let ((spec
(if (and inherit mh-inherit-face-flag)
inherit
(or (cadr (assq face mh-face-data))
(error "Could not find %s in mh-face-data" face)))))
(if mh-min-colors-defined-flag
spec
(let ((cells (display-color-cells))
new-spec)
;; Remove entries with min-colors, or delete them if we have
;; fewer colors than they specify.
(cl-loop
for entry in (reverse spec) do
(let ((requirement (if (eq (car entry) t)
nil
(assq 'min-colors (car entry)))))
(if requirement
(when (>= cells (nth 1 requirement))
(setq new-spec (cons (cons (delq requirement (car entry))
(cdr entry))
new-spec)))
(setq new-spec (cons entry new-spec)))))
new-spec))))
not added to the returned spec."
(or inherit
(cadr (assq face mh-face-data))
(error "Could not find %s in mh-face-data" face)))
(defface-mh mh-folder-address
(mh-face-data 'mh-folder-subject '((t (:inherit mh-folder-subject))))

View file

@ -1545,35 +1545,35 @@ after the commands are processed."
(append folders-changed (mh-index-execute-commands))))
;; Then refile messages
(mh-mapc #'(lambda (folder-msg-list)
(let* ((dest-folder (symbol-name (car folder-msg-list)))
(last (car (mh-translate-range dest-folder "last")))
(msgs (cdr folder-msg-list)))
(push dest-folder folders-changed)
(setq redraw-needed-flag t)
(apply #'mh-exec-cmd
"refile" "-src" folder dest-folder
(mh-coalesce-msg-list msgs))
(mh-delete-scan-msgs msgs)
;; Preserve sequences in destination folder...
(when mh-refile-preserves-sequences-flag
(clrhash dest-map)
(cl-loop
for i from (1+ (or last 0))
for msg in (sort (copy-sequence msgs) #'<)
do (cl-loop for seq-name in (gethash msg seq-map)
do (push i (gethash seq-name dest-map))))
(maphash
#'(lambda (seq msgs)
;; Can't be run in the background, since the
;; current folder is changed by mark this could
;; lead to a race condition with the next refile.
(apply #'mh-exec-cmd "mark"
"-sequence" (symbol-name seq) dest-folder
"-add" (mapcar #'(lambda (x) (format "%s" x))
(mh-coalesce-msg-list msgs))))
dest-map))))
mh-refile-list)
(mapc #'(lambda (folder-msg-list)
(let* ((dest-folder (symbol-name (car folder-msg-list)))
(last (car (mh-translate-range dest-folder "last")))
(msgs (cdr folder-msg-list)))
(push dest-folder folders-changed)
(setq redraw-needed-flag t)
(apply #'mh-exec-cmd
"refile" "-src" folder dest-folder
(mh-coalesce-msg-list msgs))
(mh-delete-scan-msgs msgs)
;; Preserve sequences in destination folder...
(when mh-refile-preserves-sequences-flag
(clrhash dest-map)
(cl-loop
for i from (1+ (or last 0))
for msg in (sort (copy-sequence msgs) #'<)
do (cl-loop for seq-name in (gethash msg seq-map)
do (push i (gethash seq-name dest-map))))
(maphash
#'(lambda (seq msgs)
;; Can't be run in the background, since the
;; current folder is changed by mark this could
;; lead to a race condition with the next refile.
(apply #'mh-exec-cmd "mark"
"-sequence" (symbol-name seq) dest-folder
"-add" (mapcar #'(lambda (x) (format "%s" x))
(mh-coalesce-msg-list msgs))))
dest-map))))
mh-refile-list)
(setq mh-refile-list ())
;; Now delete messages

View file

@ -35,10 +35,9 @@
(require 'mm-view nil t)
(require 'mml nil t))
;; Copy of function from gnus-util.el.
;; TODO This is not in Gnus 5.11.
(defun-mh mh-gnus-local-map-property gnus-local-map-property (map)
(defun mh-gnus-local-map-property (map)
"Return a list suitable for a text property list specifying keymap MAP."
(declare (obsolete nil "29.1"))
(list 'keymap map))
(define-obsolete-function-alias 'mh-mm-merge-handles
@ -103,8 +102,8 @@ PROMPT overrides the default one used to ask user for a file name."
(defun mh-mm-text-html-renderer ()
"Find the renderer Gnus is using to display text/html MIME parts."
(or (and (boundp 'mm-inline-text-html-renderer) mm-inline-text-html-renderer)
(and (boundp 'mm-text-html-renderer) mm-text-html-renderer)))
(declare (obsolete mm-text-html-renderer "29.1"))
mm-text-html-renderer)
(provide 'mh-gnus)

View file

@ -173,7 +173,7 @@
"\C-c\C-w" #'mh-check-whom
"\C-c\C-y" #'mh-yank-cur-msg
"\C-c\M-d" #'mh-insert-auto-fields
"\M-\t" #'mh-letter-complete
"\M-\t" #'completion-at-point
"\t" #'mh-letter-next-header-field-or-indent
[backtab] #'mh-letter-previous-header-field)
@ -479,29 +479,8 @@ This provides alias and folder completion in header fields according to
(or (funcall func) #'ignore)
mh-letter-complete-function)))
;; TODO Now that completion-at-point performs the task of
;; mh-letter-complete, perhaps mh-letter-complete along with
;; mh-complete-word should be rewritten as a more general function for
;; XEmacs, renamed to mh-completion-at-point, and moved to
;; mh-compat.el.
(defun-mh mh-letter-complete completion-at-point ()
"Perform completion on header field or word preceding point.
If the field contains addresses (for example, \"To:\" or \"Cc:\")
or folders (for example, \"Fcc:\") then this command will provide
alias completion. In the body of the message, this command runs
`mh-letter-complete-function' instead, which is set to
`ispell-complete-word' by default."
(interactive)
(let ((data (mh-letter-completion-at-point)))
(cond
((functionp data) (funcall data))
((consp data)
(let ((start (nth 0 data))
(end (nth 1 data))
(table (nth 2 data)))
(mh-complete-word (buffer-substring-no-properties start end)
table start end))))))
(define-obsolete-function-alias 'mh-letter-complete
#'completion-at-point "29.1")
(defun mh-letter-complete-or-space (arg)
"Perform completion or insert space.
@ -521,7 +500,7 @@ one space."
((> (point) end-of-prev) (self-insert-command arg))
((let ((mh-letter-complete-function nil))
(mh-letter-completion-at-point))
(mh-letter-complete))
(completion-at-point))
(t (self-insert-command arg)))))
(defun mh-letter-confirm-address ()

View file

@ -137,9 +137,7 @@
("text/html"
,(if (fboundp 'mm-inline-text-html) 'mm-inline-text-html 'mm-inline-text)
(lambda (handle)
(or (and (boundp 'mm-inline-text-html-renderer)
mm-inline-text-html-renderer)
(and (boundp 'mm-text-html-renderer) mm-text-html-renderer))))
mm-text-html-renderer))
("text/x-vcard"
mm-inline-text-vcard
(lambda (handle)
@ -184,9 +182,6 @@ Set from last use.")
'((mh-press-button "\r" "Toggle Display")))
(defvar mh-mime-button-map
(let ((map (make-sparse-keymap)))
(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)
(dolist (c mh-mime-button-commands)
(define-key map (cadr c) (car c)))
@ -799,7 +794,7 @@ being used to highlight the signature in a MIME part."
((not (and (equal (mm-handle-media-supertype handle) "text")
(equal (mm-handle-media-subtype handle) "html")))
"^-- $")
((eq (mh-mm-text-html-renderer) 'lynx) "^ --$")
((eq mm-text-html-renderer 'lynx) "^ --$")
(t "^--$"))))
(save-excursion
(goto-char (point-max))
@ -843,10 +838,10 @@ by commands like \"K v\" which operate on individual MIME parts."
(setq begin (point))
(gnus-eval-format
mh-mime-button-line-format mh-mime-button-line-format-alist
`(,@(mh-gnus-local-map-property mh-mime-button-map)
mh-callback mh-mm-display-part
mh-part ,index
mh-data ,handle)))
`(keymap ,mh-mime-button-map
mh-callback mh-mm-display-part
mh-part ,index
mh-data ,handle)))
(setq end (point))
(widget-convert-button
'link begin end
@ -885,11 +880,11 @@ by commands like \"K v\" which operate on individual MIME parts."
(gnus-eval-format
mh-mime-security-button-line-format
mh-mime-security-button-line-format-alist
`(,@(mh-gnus-local-map-property mh-mime-security-button-map)
mh-button-pressed ,mh-mime-security-button-pressed
mh-callback mh-mime-security-press-button
mh-line-format ,mh-mime-security-button-line-format
mh-data ,handle))
`(keymap ,mh-mime-security-button-map
mh-button-pressed ,mh-mime-security-button-pressed
mh-callback mh-mime-security-press-button
mh-line-format ,mh-mime-security-button-line-format
mh-data ,handle))
(setq end (point))
(widget-convert-button 'link begin end
:mime-handle handle

View file

@ -781,10 +781,10 @@ If SAVE-REFILES is non-nil, then keep the sequences
that note messages to be refiled."
(let ((seqs ()))
(cond (save-refiles
(mh-mapc (lambda (seq) ; Save the refiling sequences
(if (mh-folder-name-p (mh-seq-name seq))
(setq seqs (cons seq seqs))))
mh-seq-list)))
(mapc (lambda (seq) ; Save the refiling sequences
(if (mh-folder-name-p (mh-seq-name seq))
(setq seqs (cons seq seqs))))
mh-seq-list)))
(save-excursion
(if (eq 0 (mh-exec-cmd-quiet nil "mark" folder "-list"))
(progn

View file

@ -335,10 +335,9 @@ The current frame height is taken into consideration."
;; Infrastructure to generate show-buffer functions from folder functions
;; XEmacs does not have deactivate-mark? What is the equivalent of
;; transient-mark-mode for XEmacs? Should we be restoring the mark in the
;; folder buffer after the operation has been carried out.
;; Infrastructure to generate show-buffer functions from folder functions.
;; Should we be restoring the mark in the folder buffer after the
;; operation has been carried out?
(defmacro mh-defun-show-buffer (function original-function
&optional dont-return)
"Define FUNCTION to run ORIGINAL-FUNCTION in folder buffer.

View file

@ -83,11 +83,7 @@ used in lieu of `search' in the CL package."
(setq pairs (cdr (cdr pairs)))))
;;;###mh-autoload
(defun mh-mapc (function list)
"Apply FUNCTION to each element of LIST for side effects only."
(while list
(funcall function (car list))
(setq list (cdr list))))
(define-obsolete-function-alias 'mh-mapc #'mapc "29.1")
(defvar mh-pick-regexp-chars ".*$["
"List of special characters in pick regular expressions.")
@ -716,16 +712,12 @@ See Info node `(elisp) Programmed Completion' for details."
((equal path mh-user-path) nil)
(t (file-directory-p path))))))))
;; Shush compiler.
(defvar completion-root-regexp) ;; Apparently used in XEmacs
(defun mh-folder-completing-read (prompt default allow-root-folder-flag)
"Read folder name with PROMPT and default result DEFAULT.
If ALLOW-ROOT-FOLDER-FLAG is non-nil then \"+\" is allowed to be
a folder name corresponding to `mh-user-path'."
(mh-normalize-folder-name
(let ((completion-root-regexp "^[+/]") ;FIXME: Who/what uses that?
(minibuffer-local-completion-map mh-folder-completion-map)
(let ((minibuffer-local-completion-map mh-folder-completion-map)
(mh-allow-root-folder-flag allow-root-folder-flag))
(completing-read prompt 'mh-folder-completion-function nil nil nil
'mh-folder-hist default))

View file

@ -30,11 +30,9 @@
(autoload 'mail-header-parse-address "mail-parse")
(autoload 'message-fetch-field "message")
(defvar mh-show-xface-function
(cond ((>= emacs-major-version 21)
#'mh-face-display-function)
(t #'ignore))
(defvar mh-show-xface-function #'mh-face-display-function
"Determine at run time what function should be called to display X-Face.")
(make-obsolete-variable 'mh-show-xface-function nil "29.1")
(defvar mh-uncompface-executable
(and (fboundp 'executable-find) (executable-find "uncompface")))
@ -49,7 +47,7 @@
(when (and window-system mh-show-use-xface-flag
(or mh-decode-mime-flag mh-mhl-format-file
mh-clean-message-header-flag))
(funcall mh-show-xface-function)))
(mh-face-display-function)))
(defun mh-face-display-function ()
"Display a Face, X-Face, or X-Image-URL header field.