dotemacs

My Emacs configuration
git clone git://git.entf.net/dotemacs
Log | Files | Refs | LICENSE

compat.el (2510B)


      1 ;;; compat.el --- Emacs Lisp Compatibility Library -*- lexical-binding: t; -*-
      2 
      3 ;; Copyright (C) 2021, 2022 Free Software Foundation, Inc.
      4 
      5 ;; Author: Philip Kaludercic <philipk@posteo.net>
      6 ;; Maintainer: Compat Development <~pkal/compat-devel@lists.sr.ht>
      7 ;; Version: 28.1.2.2
      8 ;; URL: https://sr.ht/~pkal/compat
      9 ;; Package-Requires: ((emacs "24.3") (nadvice "0.3"))
     10 ;; Keywords: lisp
     11 
     12 ;; This program is free software; you can redistribute it and/or modify
     13 ;; it under the terms of the GNU General Public License as published by
     14 ;; the Free Software Foundation, either version 3 of the License, or
     15 ;; (at your option) any later version.
     16 
     17 ;; This program is distributed in the hope that it will be useful,
     18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
     19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     20 ;; GNU General Public License for more details.
     21 
     22 ;; You should have received a copy of the GNU General Public License
     23 ;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
     24 
     25 ;;; Commentary:
     26 
     27 ;; To allow for the usage of Emacs functions and macros that are
     28 ;; defined in newer versions of Emacs, compat.el provides definitions
     29 ;; that are installed ONLY if necessary.  These reimplementations of
     30 ;; functions and macros are at least subsets of the actual
     31 ;; implementations.  Be sure to read the documentation string to make
     32 ;; sure.
     33 ;;
     34 ;; Not every function provided in newer versions of Emacs is provided
     35 ;; here.  Some depend on new features from the core, others cannot be
     36 ;; implemented to a meaningful degree.  Please consult the Compat
     37 ;; manual for details.  The main audience for this library are not
     38 ;; regular users, but package maintainers.  Therefore commands and
     39 ;; user options are usually not implemented here.
     40 
     41 ;;; Code:
     42 
     43 (defvar compat--inhibit-prefixed)
     44 (let ((compat--inhibit-prefixed (not (bound-and-true-p compat-testing))))
     45   ;; Instead of using `require', we manually check `features' and call
     46   ;; `load' to avoid the issue of not using `provide' at the end of
     47   ;; the file (which is disabled by `compat--inhibit-prefixed', so
     48   ;; that the file can be loaded again at some later point when the
     49   ;; prefixed definitions are needed).
     50   (dolist (vers '(24 25 26 27 28))
     51     (unless (memq (intern (format "compat-%d" vers)) features)
     52       (load (format "compat-%d%s" vers
     53                     (if (bound-and-true-p compat-testing)
     54                         ".el" ""))
     55             nil t))))
     56 
     57 (provide 'compat)
     58 ;;; compat.el ends here