unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#37155: 26.2; `describe-register-1' should not say "Garbage" for (get-register...) -> nil
@ 2019-08-23  6:06 Drew Adams
  2019-09-20 22:19 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 2+ messages in thread
From: Drew Adams @ 2019-08-23  6:06 UTC (permalink / raw)
  To: 37155

`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'





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

* bug#37155: 26.2; `describe-register-1' should not say "Garbage" for (get-register...) -> nil
  2019-08-23  6:06 bug#37155: 26.2; `describe-register-1' should not say "Garbage" for (get-register...) -> nil Drew Adams
@ 2019-09-20 22:19 ` Lars Ingebrigtsen
  0 siblings, 0 replies; 2+ messages in thread
From: Lars Ingebrigtsen @ 2019-09-20 22:19 UTC (permalink / raw)
  To: Drew Adams; +Cc: 37155

Drew Adams <drew.adams@oracle.com> writes:

> In short, previewing should use `get-register'.  It should respect
> alist behavior, recognizing an empty register per `get-register'.

Makes sense.  I've now done this on the Emacs trunk.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

end of thread, other threads:[~2019-09-20 22:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-23  6:06 bug#37155: 26.2; `describe-register-1' should not say "Garbage" for (get-register...) -> nil Drew Adams
2019-09-20 22:19 ` Lars Ingebrigtsen

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).