GNU bug report logs - #37155
26.2; `describe-register-1' should not say "Garbage" for (get-register...) -> nil

Previous Next

Package: emacs;

Reported by: Drew Adams <drew.adams <at> oracle.com>

Date: Fri, 23 Aug 2019 06:08:02 UTC

Severity: minor

Tags: fixed

Found in version 26.2

Fixed in version 27.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Drew Adams <drew.adams <at> oracle.com>
To: 37155 <at> 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)
`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'




This bug report was last modified 5 years and 245 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.