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

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

bug#24576: 25.1; desktop.el does not fully preserve registers with macro


From: Matthew Newton
Subject: bug#24576: 25.1; desktop.el does not fully preserve registers with macros
Date: Fri, 10 May 2019 13:53:54 -0700

Apologies for reviving a stale bug but it appears to not be resolved yet.

Here is my experience with this, running my own build from a recent master:
GNU Emacs 27.0.50 (build 1, x86_64-apple-darwin18.5.0, NS appkit-1671.40 
Version 10.14.4 (Build 18E226)) of 2019-04-22

;; .emacs
(require ‘desktop)
(desktop-save-mode 1)


;; before killing Emacs
(pp register-alist)
((107 . #s(registerv ""
                     #[257 "\300\301\302\303!\"!\207"
                           [princ format "a keyboard macro:\n   %s" 
format-kbd-macro]
                           6 "\n\n(fn K)"]
                     kmacro-execute-from-register
                     #[257 "\300!c\207"
                           [format-kbd-macro]
                           3 "\n\n(fn K)"])))

`M-x list-registers`
Register k contains a keyboard macro:
   C-e
Register p contains a buffer position:
    buffer t.el, position 21


;; after killing Emacs and running it again
(pp register-alist)
((107 . #s(registerv "" "Unprintable entity" kmacro-execute-from-register 
"Unprintable entity")))

`M-x list-registers`
Invalid function: "Unprintable entity”

;; Abbreviated stack trace
Debugger entered--Lisp error: (invalid-function "Unprintable entity")
  "Unprintable entity"("\5")
  #f(compiled-function (val verbose) #<bytecode 0x44180705>)(#s(registerv :data 
"\5" :print-func "Unprintable entity" :jump-func kmacro-execute-from-register 
:insert-func "Unprintable entity") nil)
  apply(#f(compiled-function (val verbose) #<bytecode 0x44180705>) #s(registerv 
:data "\5" :print-func "Unprintable entity" :jump-func 
kmacro-execute-from-register :insert-func "Unprintable entity") nil)
  register-val-describe(#s(registerv :data "\5" :print-func "Unprintable 
entity" :jump-func kmacro-execute-from-register :insert-func "Unprintable 
entity") nil)
  describe-register-1(107)
  list-registers()
  funcall-interactively(list-registers)
  call-interactively(list-registers record nil)
  command-execute(list-registers record)
  (closure ((externs) (initial-input) smex-ido-cache smex-initialized-p 
amx-cache amx-initialized info-lookup-mode t) (cmd) (setq cmd (intern cmd)) 
(cond ((and (boundp 'amx-initialized) amx-initialized) (amx-rank cmd)) ((and 
(boundp 'smex-initialized-p) smex-initialized-p) (smex-rank cmd))) (setq 
prefix-arg current-prefix-arg) (setq this-command cmd) (setq real-this-command 
cmd) (command-execute cmd 'record))("list-registers")
  #f(compiled-function (x) #<bytecode 0x1ff2b34c45a5>)("list-registers")



So there seem to be two bugs:

1. `desktop-save-mode` doesn’t serialize/deserialize keyboard macros properly 
(is it difficult to serialize a function object?)
2. Either :print-func and :insert-func should never be set to “Unprintable 
entity” or `register-val-describe` should handle the case where they are set to 
that value instead of a function. I’ve also seen “Unprintable entity” show up 
when a buffer position register points to a nonexistent buffer. Not sure how to 
reproduce that one.

I could probably dive deeper and see if I can fix this. But I would appreciate 
some thoughts from experienced Emacs devs about whether I understand the 
problem correctly. Any hints as to the best solution would also be great.

Cheers,
Matt




reply via email to

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