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

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

bug#37155: 26.2; `describe-register-1' should not say "Garbage" for (get


From: Drew Adams
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)

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





reply via email to

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