unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#35131: 27.0.50; desktop-save no longer saves register containing frameset
@ 2019-04-03 22:15 Tadeus Prastowo
  2019-04-03 22:31 ` Drew Adams
  2019-04-04 17:48 ` bug#35131: " Stefan Monnier
  0 siblings, 2 replies; 6+ messages in thread
From: Tadeus Prastowo @ 2019-04-03 22:15 UTC (permalink / raw)
  To: 35131; +Cc: Stefan Monnier, emacs-devel

$ 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@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





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

* RE: 27.0.50; desktop-save no longer saves register containing frameset
  2019-04-03 22:15 bug#35131: 27.0.50; desktop-save no longer saves register containing frameset Tadeus Prastowo
@ 2019-04-03 22:31 ` Drew Adams
  2019-04-04 17:48 ` bug#35131: " Stefan Monnier
  1 sibling, 0 replies; 6+ messages in thread
From: Drew Adams @ 2019-04-03 22:31 UTC (permalink / raw)
  To: Tadeus Prastowo, bug-gnu-emacs; +Cc: Stefan Monnier, emacs-devel

Please do not send this to both the bug list and emacs-devel.
Choose one.



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

* bug#35131: 27.0.50; desktop-save no longer saves register containing frameset
  2019-04-03 22:15 bug#35131: 27.0.50; desktop-save no longer saves register containing frameset Tadeus Prastowo
  2019-04-03 22:31 ` Drew Adams
@ 2019-04-04 17:48 ` Stefan Monnier
  2019-04-04 17:57   ` Noam Postavsky
  2019-04-04 18:37   ` Tadeus Prastowo
  1 sibling, 2 replies; 6+ messages in thread
From: Stefan Monnier @ 2019-04-04 17:48 UTC (permalink / raw)
  To: Tadeus Prastowo; +Cc: 35131-done

Tadeus Prastowo <tadeus.prastowo@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





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

* bug#35131: 27.0.50; desktop-save no longer saves register containing frameset
  2019-04-04 17:48 ` bug#35131: " Stefan Monnier
@ 2019-04-04 17:57   ` Noam Postavsky
  2019-04-04 20:30     ` Stefan Monnier
  2019-04-04 18:37   ` Tadeus Prastowo
  1 sibling, 1 reply; 6+ messages in thread
From: Noam Postavsky @ 2019-04-04 17:57 UTC (permalink / raw)
  To: 35131, Stefan Monnier, tadeus.prastowo

On Thu, 4 Apr 2019 at 13:49, Stefan Monnier <monnier@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)?





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

* bug#35131: 27.0.50; desktop-save no longer saves register containing frameset
  2019-04-04 17:48 ` bug#35131: " Stefan Monnier
  2019-04-04 17:57   ` Noam Postavsky
@ 2019-04-04 18:37   ` Tadeus Prastowo
  1 sibling, 0 replies; 6+ messages in thread
From: Tadeus Prastowo @ 2019-04-04 18:37 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 35131-done

On Thu, Apr 4, 2019 at 7:48 PM Stefan Monnier <monnier@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





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

* bug#35131: 27.0.50; desktop-save no longer saves register containing frameset
  2019-04-04 17:57   ` Noam Postavsky
@ 2019-04-04 20:30     ` Stefan Monnier
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2019-04-04 20:30 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: 35131, tadeus.prastowo

>> +     (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





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

end of thread, other threads:[~2019-04-04 20:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-03 22:15 bug#35131: 27.0.50; desktop-save no longer saves register containing frameset Tadeus Prastowo
2019-04-03 22:31 ` Drew Adams
2019-04-04 17:48 ` bug#35131: " Stefan Monnier
2019-04-04 17:57   ` Noam Postavsky
2019-04-04 20:30     ` Stefan Monnier
2019-04-04 18:37   ` Tadeus Prastowo

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).