;;; future-interactive.el --- Forward compatibility for `interactive' in Emacs 28. -*- lexical-binding: t; -*- ;; Copyright (C) 2021 Free Software Foundation, Inc. ;; Author: Stefan Kangas ;; 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 . ;;; 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