all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Matthew Newton <matt@knosis.org>
To: 24576@debbugs.gnu.org
Cc: dpaduchikh@gmail.com
Subject: bug#24576: 25.1; desktop.el does not fully preserve registers with macros
Date: Fri, 10 May 2019 13:53:54 -0700	[thread overview]
Message-ID: <B03E99E7-B088-456D-BBCA-E133CCC88F29@knosis.org> (raw)
In-Reply-To: <874m4wwu6n.fsf@gmail.com>

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 "\x05"
                     #[257 "\300\301\302\303\x04!\"!\207"
                           [princ format "a keyboard macro:\n   %s" format-kbd-macro]
                           6 "\n\n(fn K)"]
                     kmacro-execute-from-register
                     #[257 "\300\x01!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 "\x05" "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	other threads:[~2019-05-10 20:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-01  4:48 bug#24576: 25.1; desktop.el does not fully preserve registers with macros Dmitri Paduchikh
2019-05-10 20:53 ` Matthew Newton [this message]
2019-05-11 12:15   ` Noam Postavsky
2019-05-22 20:58     ` Matthew Newton
2019-05-23  3:43       ` Noam Postavsky
2019-05-29 17:41         ` Dmitri Paduchikh
2019-06-12 17:43         ` npostavs

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=B03E99E7-B088-456D-BBCA-E133CCC88F29@knosis.org \
    --to=matt@knosis.org \
    --cc=24576@debbugs.gnu.org \
    --cc=dpaduchikh@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.