unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
blob fe12924194264d4549f551964716a2ce4a4aaaee 2100 bytes (raw)
name: lisp/emacs-lisp/future-interactive.el 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
 
;;; future-interactive.el --- Forward compatibility for `interactive' in Emacs 28.  -*- lexical-binding: t; -*-

;; Copyright (C) 2021 Free Software Foundation, Inc.

;; Author: Stefan Kangas <stefankangas@gmail.com>
;; Keywords: lisp, compatibility

;; 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:

;; This is a forward compatibility package to allow maintaining
;; support for older versions of Emacs while also using the new third
;; argument to the `interactive'form added in Emacs 28.
;;
;; To use this in a package, just add a dependency on this package and
;; replace `interactive' with `future-interactive':
;;
;;     (require 'future-interactive)
;;
;;     (defun foo-command ()
;;       (future-interactive nil foo-mode)
;;       ... )
;;
;; See the `future-interactive' macro for more information.

;;; Code:

;; This is a GNU ELPA :core package to be able to easily use this in
;; other :core packages.

(defmacro future-interactive (arg-descriptor &rest modes)
  "Use the correct `interactive' form for any Emacs version.

This is a forward compatibility macro that allows packages to
provide the third argument to `interactive' (added in Emacs 28)
while still working on older versions of Emacs.

To use it, simply replace `interactive' with `future-interactive'."
  (if (< emacs-major-version 28)
      `(interactive ,arg-descriptor)
    `(interactive ,arg-descriptor ,@modes)))

(provide 'future-interactive)
;;; future-interactive.el ends here

debug log:

solving fe12924194 ...
found fe12924194 in https://yhetil.org/emacs-devel/CADwFkmmabGLP1Pqnt8O_6RZ53bM_eHBXgA5bKW=Hec5FyVvXPA@mail.gmail.com/

applying [1/1] https://yhetil.org/emacs-devel/CADwFkmmabGLP1Pqnt8O_6RZ53bM_eHBXgA5bKW=Hec5FyVvXPA@mail.gmail.com/
diff --git a/lisp/emacs-lisp/future-interactive.el b/lisp/emacs-lisp/future-interactive.el
new file mode 100644
index 0000000000..fe12924194

Checking patch lisp/emacs-lisp/future-interactive.el...
Applied patch lisp/emacs-lisp/future-interactive.el cleanly.

index at:
100644 fe12924194264d4549f551964716a2ce4a4aaaee	lisp/emacs-lisp/future-interactive.el

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).