1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-24 22:40:51 -08:00
emacs/lisp/mh-e/mh-compat.el
Eli Zaretskii dcd76bd48d Merge from origin/emacs-28
836be7a112 ; * etc/refcards/ru-refcard.tex: Update Copyright year.
86cbc6ee4a * lisp/net/tramp-sh.el: Adapt copyright year
ebe8772f65 ; Minor fixes related to copyright years
23c1ee6989 ; * test/manual/etags/ETAGS.good_N: Adjust to copyright ye...
8d3fc7ec89 * src/xfaces.c (face_for_font): Make 'hash' be uintptr_t.
19dcb237b5 ; Add 2022 to copyright years.

# Conflicts:
#	etc/NEWS
#	etc/refcards/ru-refcard.tex
#	lib/cdefs.h
#	lisp/erc/erc-dcc.el
#	lisp/erc/erc-imenu.el
#	lisp/erc/erc-replace.el
#	lisp/image-dired.el
#	lisp/progmodes/xref.el
#	m4/alloca.m4
#	m4/byteswap.m4
#	m4/errno_h.m4
#	m4/getopt.m4
#	m4/gnulib-common.m4
#	m4/inttypes.m4
#	m4/stddef_h.m4
#	m4/stdint.m4
#	m4/sys_socket_h.m4
2022-01-01 07:03:03 -05:00

151 lines
5.3 KiB
EmacsLisp

;;; mh-compat.el --- make MH-E compatible with various versions of Emacs -*- lexical-binding: t; -*-
;; Copyright (C) 2006-2022 Free Software Foundation, Inc.
;; Author: Bill Wohler <wohler@newt.com>
;; Keywords: mail
;; See: mh-e.el
;; This file is part of GNU Emacs.
;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;;; Code:
;; This is a good place to gather code that is used for compatibility
;; between different versions of Emacs. Please document which versions
;; of Emacs that the defsubst, defalias, or defmacro applies. That
;; way, it's easy to occasionally go through this file and see which
;; macros we can retire.
;; Please use mh-gnus.el when providing compatibility with different
;; versions of Gnus.
;; Items are listed alphabetically.
(eval-when-compile (require 'mh-acros))
(define-obsolete-function-alias 'mh-require #'require "29.1")
(define-obsolete-function-alias 'mh-assoc-string #'assoc-string "29.1")
(define-obsolete-function-alias 'mh-cancel-timer #'cancel-timer "29.1")
;; Emacs 24 made flet obsolete and suggested either cl-flet or
;; cl-letf. This macro is based upon gmm-flet from Gnus.
(defmacro mh-flet (bindings &rest body)
"Make temporary overriding function definitions.
That is, temporarily rebind the functions listed in BINDINGS and then
execute BODY. BINDINGS is a list containing one or more lists of the
form (FUNCNAME ARGLIST BODY...), similar to defun."
(declare (indent 1) (debug ((&rest (sexp sexp &rest form)) &rest form)))
(if (fboundp 'cl-letf)
`(cl-letf ,(mapcar (lambda (binding)
`((symbol-function ',(car binding))
(lambda ,@(cdr binding))))
bindings)
,@body)
`(flet ,bindings ,@body)))
(define-obsolete-function-alias 'mh-display-color-cells
#'display-color-cells "29.1")
(defmacro mh-display-completion-list (completions &optional common-substring)
"Display the list of COMPLETIONS.
See documentation for `display-completion-list' for a description of the
arguments COMPLETIONS.
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."
`(display-completion-list
(completion-hilit-commonality ,completions
,(length common-substring) nil)))
(define-obsolete-function-alias 'mh-face-foreground
#'face-foreground "29.1")
(define-obsolete-function-alias 'mh-face-background
#'face-background "29.1")
(define-obsolete-function-alias 'mh-font-lock-add-keywords
#'font-lock-add-keywords "29.1")
;; Not preloaded in without-x builds.
(declare-function image-load-path-for-library "image")
(define-obsolete-function-alias 'mh-image-load-path-for-library
#'image-load-path-for-library "29.1")
;; Not preloaded in without-x builds.
(declare-function image-search-load-path "image")
(define-obsolete-function-alias 'mh-image-search-load-path
#'image-search-load-path "29.1")
(define-obsolete-function-alias 'mh-line-beginning-position
#'line-beginning-position "29.1")
(define-obsolete-function-alias 'mh-line-end-position
#'line-end-position "29.1")
(require 'mailabbrev nil t)
(define-obsolete-function-alias 'mh-mail-abbrev-make-syntax-table
#'mail-abbrev-make-syntax-table "29.1")
(define-obsolete-function-alias 'mh-define-obsolete-variable-alias
#'define-obsolete-variable-alias "29.1")
(define-obsolete-function-alias 'mh-make-obsolete-variable
#'make-obsolete-variable "29.1")
(define-obsolete-function-alias 'mh-match-string-no-properties
#'match-string-no-properties "29.1")
(define-obsolete-function-alias 'mh-replace-regexp-in-string
#'replace-regexp-in-string "29.1")
(define-obsolete-function-alias 'mh-test-completion
#'test-completion "29.1")
(defconst mh-url-unreserved-chars
'(
?a ?b ?c ?d ?e ?f ?g ?h ?i ?j ?k ?l ?m ?n ?o ?p ?q ?r ?s ?t ?u ?v ?w ?x ?y ?z
?A ?B ?C ?D ?E ?F ?G ?H ?I ?J ?K ?L ?M ?N ?O ?P ?Q ?R ?S ?T ?U ?V ?W ?X ?Y ?Z
?0 ?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9
?- ?_ ?. ?! ?~ ?* ?' ?\( ?\))
"A list of characters that are _NOT_ reserved in the URL spec.
This is taken from RFC 2396.")
(make-obsolete-variable 'mh-url-unreserved-chars 'url-unreserved-chars "29.1")
(define-obsolete-function-alias 'mh-url-hexify-string
#'url-hexify-string "29.1")
(define-obsolete-function-alias 'mh-view-mode-enter
#'view-mode-enter "29.1")
(define-obsolete-function-alias 'mh-window-full-height-p
#'window-full-height-p "29.1")
(defmacro mh-write-file-functions ()
"Return `write-file-functions'."
(declare (obsolete nil "29.1"))
''write-file-functions)
(provide 'mh-compat)
;; Local Variables:
;; indent-tabs-mode: nil
;; sentence-end-double-space: nil
;; End:
;;; mh-compat.el ends here