GNU bug report logs - #35131
27.0.50; desktop-save no longer saves register containing frameset

Previous Next

Package: emacs;

Reported by: Tadeus Prastowo <tadeus.prastowo <at> unitn.it>

Date: Wed, 3 Apr 2019 22:17:02 UTC

Severity: normal

Found in version 27.0.50

Done: Stefan Monnier <monnier <at> IRO.UMontreal.CA>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 35131 in the body.
You can then email your comments to 35131 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#35131; Package emacs. (Wed, 03 Apr 2019 22:17:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Tadeus Prastowo <tadeus.prastowo <at> unitn.it>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 03 Apr 2019 22:17:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Tadeus Prastowo <tadeus.prastowo <at> unitn.it>
To: bug-gnu-emacs <at> gnu.org
Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>,
 emacs-devel <emacs-devel <at> gnu.org>
Subject: 27.0.50; desktop-save no longer saves register containing frameset
Date: Thu, 4 Apr 2019 00:15:41 +0200
$ emacs -Q
C-x C-f x.txt
Hello world!
C-x C-s
C-x 3
C-x 2
C-x r f =
C-x 1
M-x desktop-save RET RET yes RET
C-x C-c
$ emacs -Q
M-x desktop-read RET
C-x r j =
The echo area says: Register doesn’t contain a buffer position or configuration

Compare this with Emacs 26.1 that has the correct behavior:
$ emacs-26.1 -Q
C-x C-f x.txt
Another hello world!
C-x C-s
C-x 3
C-x 2
C-x r f =
C-x 1
M-x desktop-save RET RET yes RET
C-x C-c
$ emacs-26.1 -Q
M-x desktop-read RET
C-x r j =
I get the saved frameset back, which contains three windows.

The problem can be traced to the following commit (the committer is CC-ed):
-- 8< -----------------------------
commit cd1d9e79f74f137511d49eb9b0ae7ba750ba6c3c
Author: Stefan Monnier <monnier <at> iro.umontreal.ca>
Date:   Mon Dec 25 22:51:23 2017 -0500

    * lisp/register.el: Use cl-generic

    (registerv): Make it a "normal"struct.
    (registerv-make): Declare obsolete.
    (register-val-jump-to, register-val-describe, register-val-insert):
    New generic functions.
    (jump-to-register, describe-register-1, insert-register): Use them.

    * lisp/emacs-lisp/cl-generic.el: Prefill a combination of struct+typeof.
    (cl--generic-prefill-dispatchers): Allow a list of specializers.
-- 8< -----------------------------

The offending diff is shown below:
-- 8< -----------------------------
diff --git a/lisp/register.el b/lisp/register.el
index 23eefd0..0fdcd51 100644
--- a/lisp/register.el
+++ b/lisp/register.el
@@ -39,9 +39,7 @@
   (registerv (:constructor nil)
          (:constructor registerv--make (&optional data print-func
                               jump-func insert-func))
-         (:copier nil)
-         (:type vector)
-         :named)
+         (:copier nil))
   (data        nil :read-only t)
   (print-func  nil :read-only t)
   (jump-func   nil :read-only t)
-- 8< -----------------------------

Specifically, because type vector is dropped, frameset.el in its using
of registerv-make to save a frameset results in register-alist item
that is no longer a vector (C-h v register-alist shows `(61 .
#s(registerv :data [[frameset 1...' in 27.0.50, not `(61 . [registerv
[[frameset 1...' that is shown in Emacs 26.1).  Since it is no longer
a vector, desktop.el upon desktop-save does not serialize the item in
a format that can be recognized by register.el after desktop-read.

Since the offending commit deprecates the use of registerv-make, this
bug can be easily be killed by making frameset.el define function
`register-val-insert' that saves a frameset as a vector, modifying
function `frameset-to-register' accordingly.

@Stefan: could you do that, please?  Thank you.

-- 
Best regards,
Tadeus




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35131; Package emacs. (Wed, 03 Apr 2019 22:33:02 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Tadeus Prastowo <tadeus.prastowo <at> unitn.it>, bug-gnu-emacs <at> gnu.org
Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>,
 emacs-devel <emacs-devel <at> gnu.org>
Subject: RE: 27.0.50; desktop-save no longer saves register containing frameset
Date: Wed, 3 Apr 2019 15:31:21 -0700 (PDT)
Please do not send this to both the bug list and emacs-devel.
Choose one.




Reply sent to Stefan Monnier <monnier <at> IRO.UMontreal.CA>:
You have taken responsibility. (Thu, 04 Apr 2019 17:49:02 GMT) Full text and rfc822 format available.

Notification sent to Tadeus Prastowo <tadeus.prastowo <at> unitn.it>:
bug acknowledged by developer. (Thu, 04 Apr 2019 17:49:02 GMT) Full text and rfc822 format available.

Message #13 received at 35131-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Tadeus Prastowo <tadeus.prastowo <at> unitn.it>
Cc: 35131-done <at> debbugs.gnu.org
Subject: Re: bug#35131: 27.0.50;
 desktop-save no longer saves register containing frameset
Date: Thu, 04 Apr 2019 13:48:16 -0400
Tadeus Prastowo <tadeus.prastowo <at> unitn.it> writes:
> $ emacs -Q
> C-x C-f x.txt
> Hello world!
> C-x C-s
> C-x 3
> C-x 2
> C-x r f =
> C-x 1
> M-x desktop-save RET RET yes RET
> C-x C-c
> $ emacs -Q
> M-x desktop-read RET
> C-x r j =
> The echo area says: Register doesn’t contain a buffer position or configuration

Thanks for the straightforward testcase.
I installed the patch below which seems to fix it,


        Stefan


diff --git a/lisp/desktop.el b/lisp/desktop.el
index acabde5eb2..97c057e201 100644
--- a/lisp/desktop.el
+++ b/lisp/desktop.el
@@ -856,6 +856,19 @@ desktop--v2s
                                        `',(cdr el) (cdr el)))
                                  pass1)))
 	 (cons 'may `[,@(mapcar #'cdr pass1)]))))
+    ((and (recordp value) (symbolp (aref value 0)))
+     (let* ((pass1 (let ((res ()))
+                     (dotimes (i (length value))
+                       (push (desktop--v2s (aref value i)) res))
+                     (nreverse res)))
+	    (special (assq nil pass1)))
+       (if special
+	   (cons nil `(record
+                       ,@(mapcar (lambda (el)
+                                   (if (eq (car el) 'must)
+                                       `',(cdr el) (cdr el)))
+                                 pass1)))
+	 (cons 'may (apply #'record (mapcar #'cdr pass1))))))
     ((consp value)
      (let ((p value)
 	   newlist




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35131; Package emacs. (Thu, 04 Apr 2019 17:58:02 GMT) Full text and rfc822 format available.

Message #16 received at 35131 <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> gmail.com>
To: 35131 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>, 
 tadeus.prastowo <at> unitn.it
Subject: Re: bug#35131: 27.0.50; desktop-save no longer saves register
 containing frameset
Date: Thu, 4 Apr 2019 13:57:20 -0400
On Thu, 4 Apr 2019 at 13:49, Stefan Monnier <monnier <at> iro.umontreal.ca> wrote:

> +     (let* ((pass1 (let ((res ()))
> +                     (dotimes (i (length value))
> +                       (push (desktop--v2s (aref value i)) res))
> +                     (nreverse res)))

Isn't this just (mapcar #'desktop--v2s value)?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35131; Package emacs. (Thu, 04 Apr 2019 18:38:02 GMT) Full text and rfc822 format available.

Message #19 received at 35131-done <at> debbugs.gnu.org (full text, mbox):

From: Tadeus Prastowo <tadeus.prastowo <at> unitn.it>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 35131-done <at> debbugs.gnu.org
Subject: Re: bug#35131: 27.0.50; desktop-save no longer saves register
 containing frameset
Date: Thu, 4 Apr 2019 20:37:03 +0200
On Thu, Apr 4, 2019 at 7:48 PM Stefan Monnier <monnier <at> iro.umontreal.ca> wrote:
> I installed the patch below which seems to fix it,
>
>
>         Stefan
>
>
> diff --git a/lisp/desktop.el b/lisp/desktop.el
> index acabde5eb2..97c057e201 100644
> --- a/lisp/desktop.el
> +++ b/lisp/desktop.el
> @@ -856,6 +856,19 @@ desktop--v2s
>                                         `',(cdr el) (cdr el)))
>                                   pass1)))
>          (cons 'may `[,@(mapcar #'cdr pass1)]))))
> +    ((and (recordp value) (symbolp (aref value 0)))
> +     (let* ((pass1 (let ((res ()))
> +                     (dotimes (i (length value))
> +                       (push (desktop--v2s (aref value i)) res))
> +                     (nreverse res)))
> +           (special (assq nil pass1)))
> +       (if special
> +          (cons nil `(record
> +                       ,@(mapcar (lambda (el)
> +                                   (if (eq (car el) 'must)
> +                                       `',(cdr el) (cdr el)))
> +                                 pass1)))
> +        (cons 'may (apply #'record (mapcar #'cdr pass1))))))
>      ((consp value)
>       (let ((p value)
>            newlist

I confirm that the patch solves the reported bug.  Thank you very much
for your quick response, Stefan.  I really appreciate it.

-- 
Best regards,
Tadeus




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35131; Package emacs. (Thu, 04 Apr 2019 20:31:02 GMT) Full text and rfc822 format available.

Message #22 received at 35131 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: 35131 <at> debbugs.gnu.org, tadeus.prastowo <at> unitn.it
Subject: Re: bug#35131: 27.0.50;
 desktop-save no longer saves register containing frameset
Date: Thu, 04 Apr 2019 16:30:15 -0400
>> +     (let* ((pass1 (let ((res ()))
>> +                     (dotimes (i (length value))
>> +                       (push (desktop--v2s (aref value i)) res))
>> +                     (nreverse res)))
> Isn't this just (mapcar #'desktop--v2s value)?

    (mapcar #'identity (record 'sm-foo 1 2 3))  ==>  nil


-- Stefan




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 03 May 2019 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 133 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.