help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: xref in GNU ELPA broken on Emacs 26


From: Dmitry Gutov
Subject: Re: xref in GNU ELPA broken on Emacs 26
Date: Tue, 19 Oct 2021 16:18:53 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0

Hi!

On 19.10.2021 13:55, Yuri Khan wrote:
I foolishly did a M-x package-list-packages RET U x RET and got an
xref package version 1.3.0. It attempts to use the cl-defstruct option
:noinline, which is not supported in cl-macs.el that comes with Emacs
26.3 that comes with Ubuntu 20.04.

xref 1.3.0 declares dependency on Emacs 26.1.

I seem to have managed to repair my local installation by manually
downloading xref-1.2.1.tar.lz from the GNU ELPA site and telling
‘package-install-file’ to install from the directory I got by
unpacking it, then exiting Emacs and removing
~/.emacs.d/elpa/xref-1.3.0.

Sorry about this.

I'm not sure how to fix it best, but could you try the following patch?

Applying it to the installed package, latest version (1.3.0), not to Emacs sources.

diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index 52a4e0c543..fa026ae072 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -195,18 +195,27 @@ xref-location-group
 
 ;;; Cross-reference

-(cl-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))
-  "A match xref item describes a search result."
-  length)
+(eval-and-compile
+  (eval
+   (let ((ni-supported (version< "27" emacs-version)))
+     `(progn
+        (cl-defstruct (xref-item
+                       (:constructor xref-make (summary location))
+                       ,@(if ni-supported
+                             '((:noinline t))
+                           nil))
+          "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))
+                       ,@(if ni-supported
+                             '((:noinline t))
+                           nil))
+          "A match xref item describes a search result."
+          length))))
+ t)

 (cl-defgeneric xref-match-length ((item xref-match-item))
   "Return the length of the match."



reply via email to

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