From: Drew Adams <drew.adams@oracle.com>
To: 37155@debbugs.gnu.org
Subject: bug#37155: 26.2; `describe-register-1' should not say "Garbage" for (get-register...) -> nil
Date: Thu, 22 Aug 2019 23:06:58 -0700 (PDT) [thread overview]
Message-ID: <b599dcde-6812-4eb8-9e56-8b6382bd1458@default> (raw)
`register-alist' is an alist. It behaves like one and it should behave
like one. It should be usable as one.
`(get-register ?a)' returns nil for an alist entry of `(?a)', as it
should. And, per the doc, `get-register' returning nil means the
register has NO content - it's empty.
`M-x list-registers' handles such empty-register elements of the alist
correctly: it does not list them at all. Those registers have no
content.
That's all as it should be.
However, register previewing, and in particular
`register-describe-oneline', is faulty/misleading when it comes to
registers with no content. Like `list-registers' previewing should
not list them at all. Instead, it lists them as having "Garbage:"
as their content. This is wrong (and it's doubly wrong to include
the `:' char with nothing following it).
`view-register' is OK. It correctly says a register is empty when it
is. Functions that use `describe-register-1' without testing with
`get-register' to handle the empty case do the wrong thing.
Example:
(set-register ?a "aaa")
(set-register ?b "bbb")
(setq register-alist (append '((?a)) register-alist)) correctly empties
register ?a. It gives ((?a) (?b . "bbb") (?a . "aaa")), which correctly
has ?a as an empty register: (get-register ?a) returns nil.
But `register-preview' and similar, which use
`register-preview-default', which uses `register-describe-oneline', do
the wrong thing. They show empty registers as being full of "Garbage:"
rather than having no content. And they show two occurrences for
register ?a, both with "Garbage:". Instead, they should show zero
occurrences of register ?a.
In short, previewing should use `get-register'. It should respect
alist behavior, recognizing an empty register per `get-register'.
In GNU Emacs 26.2 (build 1, x86_64-w64-mingw32)
of 2019-04-13
Repository revision: fd1b34bfba8f3f6298df47c8e10b61530426f749
Windowing system distributor `Microsoft Corp.', version 10.0.17763
Configured using:
`configure --without-dbus --host=x86_64-w64-mingw32
--without-compress-install 'CFLAGS=-O2 -static -g3'
next reply other threads:[~2019-08-23 6:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-23 6:06 Drew Adams [this message]
2019-09-20 22:19 ` bug#37155: 26.2; `describe-register-1' should not say "Garbage" for (get-register...) -> nil Lars Ingebrigtsen
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=b599dcde-6812-4eb8-9e56-8b6382bd1458@default \
--to=drew.adams@oracle.com \
--cc=37155@debbugs.gnu.org \
/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.