all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* xref in GNU ELPA broken on Emacs 26
@ 2021-10-19 10:55 Yuri Khan
  2021-10-19 13:18 ` Dmitry Gutov
  0 siblings, 1 reply; 6+ messages in thread
From: Yuri Khan @ 2021-10-19 10:55 UTC (permalink / raw)
  To: help-gnu-emacs

Hello,

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.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: xref in GNU ELPA broken on Emacs 26
  2021-10-19 10:55 xref in GNU ELPA broken on Emacs 26 Yuri Khan
@ 2021-10-19 13:18 ` Dmitry Gutov
  2021-10-19 13:27   ` Stefan Monnier via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 6+ messages in thread
From: Dmitry Gutov @ 2021-10-19 13:18 UTC (permalink / raw)
  To: Yuri Khan, help-gnu-emacs

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
  \f
  ;;; 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."



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: xref in GNU ELPA broken on Emacs 26
  2021-10-19 13:18 ` Dmitry Gutov
@ 2021-10-19 13:27   ` Stefan Monnier via Users list for the GNU Emacs text editor
  2021-10-19 14:23     ` Dmitry Gutov
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier via Users list for the GNU Emacs text editor @ 2021-10-19 13:27 UTC (permalink / raw)
  To: help-gnu-emacs

> -(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."

I suspect that you can get the same without `eval` with something like:

    (defmacro xref--defstruct (name &rest fields)
      (declare (indent 1))
      `(cl-defstruct ,(if (>= 27 emacs-major-version) name
                        (remq (assq :noinline name) name))
         ,@fields))

    (xref--defstruct (xref-item
                      (:noinline t)
                      (:constructor xref-make (summary location)))
      "An xref item describes a reference to a location somewhere."
      summary location)

    (xref--defstruct (xref-match-item
                      (:noinline t)
                      (:include xref-item)
                      (:constructor xref-make-match (summary location length)))
       "A match xref item describes a search result."
       length))))


-- Stefan




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: xref in GNU ELPA broken on Emacs 26
  2021-10-19 13:27   ` Stefan Monnier via Users list for the GNU Emacs text editor
@ 2021-10-19 14:23     ` Dmitry Gutov
  2021-10-19 16:07       ` Yuri Khan
  0 siblings, 1 reply; 6+ messages in thread
From: Dmitry Gutov @ 2021-10-19 14:23 UTC (permalink / raw)
  To: Stefan Monnier, help-gnu-emacs, Yuri Khan

On 19.10.2021 16:27, Stefan Monnier via Users list for the GNU Emacs 
text editor wrote:
> I suspect that you can get the same without `eval` with something like:
> 
>      (defmacro xref--defstruct (name &rest fields)
>        (declare (indent 1))
>        `(cl-defstruct ,(if (>= 27 emacs-major-version) name
>                          (remq (assq :noinline name) name))
>           ,@fields))
> 
>      (xref--defstruct (xref-item
>                        (:noinline t)
>                        (:constructor xref-make (summary location)))
>        "An xref item describes a reference to a location somewhere."
>        summary location)
> 
>      (xref--defstruct (xref-match-item
>                        (:noinline t)
>                        (:include xref-item)
>                        (:constructor xref-make-match (summary location length)))
>         "A match xref item describes a search result."
>         length))))

Nice! Thanks, Stefan.

Yuri,

I'm going to push this change now (with a couple of tweaks), to get the 
fix out sooner. But let me know if the soon-to-be-released version 1.3.1 
still has problems.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: xref in GNU ELPA broken on Emacs 26
  2021-10-19 14:23     ` Dmitry Gutov
@ 2021-10-19 16:07       ` Yuri Khan
  2021-10-20 10:45         ` Yuri Khan
  0 siblings, 1 reply; 6+ messages in thread
From: Yuri Khan @ 2021-10-19 16:07 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: help-gnu-emacs, Stefan Monnier

On Tue, 19 Oct 2021 at 21:23, Dmitry Gutov <dgutov@yandex.ru> wrote:

> I'm going to push this change now (with a couple of tweaks), to get the
> fix out sooner. But let me know if the soon-to-be-released version 1.3.1
> still has problems.

Thanks, I’ll try not to forget to update and test soon.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: xref in GNU ELPA broken on Emacs 26
  2021-10-19 16:07       ` Yuri Khan
@ 2021-10-20 10:45         ` Yuri Khan
  0 siblings, 0 replies; 6+ messages in thread
From: Yuri Khan @ 2021-10-20 10:45 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: help-gnu-emacs

> On Tue, 19 Oct 2021 at 21:23, Dmitry Gutov <dgutov@yandex.ru> wrote:
>
> > I'm going to push this change now (with a couple of tweaks), to get the
> > fix out sooner. But let me know if the soon-to-be-released version 1.3.1
> > still has problems.

Got 1.3.2. The issue no longer reproduces. Thank you.



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-10-20 10:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-19 10:55 xref in GNU ELPA broken on Emacs 26 Yuri Khan
2021-10-19 13:18 ` Dmitry Gutov
2021-10-19 13:27   ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-10-19 14:23     ` Dmitry Gutov
2021-10-19 16:07       ` Yuri Khan
2021-10-20 10:45         ` Yuri Khan

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.