emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master cd4bb98: Fix Emacs 26 support in xref.el


From: Dmitry Gutov
Subject: master cd4bb98: Fix Emacs 26 support in xref.el
Date: Tue, 19 Oct 2021 10:35:52 -0400 (EDT)

branch: master
commit cd4bb985406e66e9cd1a5424b49d48818a99311d
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: Dmitry Gutov <dgutov@yandex.ru>

    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 52a4e0c..8c8687c 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)
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]