From cd4bb985406e66e9cd1a5424b49d48818a99311d Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Tue, 19 Oct 2021 17:32:35 +0300 Subject: [PATCH] Fix Emacs 26 support in xref.el * lisp/progmodes/xref.el (xref--defstruct): New macro. (xref-item, xref-match-item): Use it in definitions. --- lisp/progmodes/xref.el | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 52a4e0c5435..8c8687c0d6b 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -195,16 +195,23 @@ is not known." ;;; Cross-reference -(cl-defstruct (xref-item - (:constructor xref-make (summary location)) - (:noinline t)) +(defmacro xref--defstruct (name &rest fields) + (declare (indent 1)) + `(cl-defstruct ,(if (>= emacs-major-version 27) + name + (remq (assq :noinline name) name)) + ,@fields)) + +(xref--defstruct (xref-item + (:constructor xref-make (summary location)) + (:noinline t)) "An xref item describes a reference to a location somewhere." summary location) -(cl-defstruct (xref-match-item - (:include xref-item) - (:constructor xref-make-match (summary location length)) - (:noinline t)) +(xref--defstruct (xref-match-item + (:include xref-item) + (:constructor xref-make-match (summary location length)) + (:noinline t)) "A match xref item describes a search result." length) -- 2.39.2