GNU bug report logs - #55943
Cannot insert registers in calc

Previous Next

Package: emacs;

Reported by: Kuba Orlik <kontakt <at> kuba-orlik.name>

Date: Mon, 13 Jun 2022 14:21:01 UTC

Severity: normal

Done: Michael Heerdegen <michael_heerdegen <at> web.de>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 55943 in the body.
You can then email your comments to 55943 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#55943; Package emacs. (Mon, 13 Jun 2022 14:21:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Kuba Orlik <kontakt <at> kuba-orlik.name>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 13 Jun 2022 14:21:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Kuba Orlik <kontakt <at> kuba-orlik.name>
To: bug-gnu-emacs <at> gnu.org
Subject: Cannot insert registers in calc
Date: Mon, 13 Jun 2022 12:33:14 +0200
1. Run emacs -Q
2. Type the number 20 into the buffer
3. Move the point to the "2" in the "20"
4. Run M-x number-to-register
5. Pick a letter for the register (I picked "a")
6. Run M-x calc
7. Type "r i" and pick the same register
8. It rings a bell and shows "Bad format in register data"


In GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.24, cairo version 1.16.0)
 of 2021-03-28, modified by Debian built on x86-conova-01
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Debian GNU/Linux 11 (bullseye)

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
You can run the command ‘number-to-register’ with C-x r n
Welcome to the GNU Emacs Calculator!  Press ‘?’ or ‘h’ for help, ‘q’ to quit
r-
calc-do: Bad format in register data
Configured using:
 'configure --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/lib
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --enable-libsystemd --with-pop=yes
 --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/27.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/27.1/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils --build
 x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib
 --libexecdir=/usr/lib --localstatedir=/var/lib
 --infodir=/usr/share/info --mandir=/usr/share/man --enable-libsystemd
 --with-pop=yes
 --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/27.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/27.1/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils --with-cairo
 --with-x=yes --with-x-toolkit=gtk3 --with-toolkit-scroll-bars
 'CFLAGS=-g -O2
 -ffile-prefix-map=/build/emacs-LlFm6W/emacs-27.1+1=. -fstack-protector-strong
 -Wformat -Werror=format-security -Wall' 'CPPFLAGS=-Wdate-time
 -D_FORTIFY_SOURCE=2' LDFLAGS=-Wl,-z,relro'

Configured features:
XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND GPM DBUS GSETTINGS GLIB NOTIFY
INOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF
ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS LIBSYSTEMD
JSON PDUMPER LCMS2 GMP

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Calculator

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
format-spec rfc822 mml mml-sec password-cache epa derived epg epg-config
gnus-util rmail rmail-loaddefs text-property-search time-date subr-x seq
byte-opt gv bytecomp byte-compile cconv mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils calc-yank calc-ext
calc-misc cl-loaddefs cl-lib calc-menu easymenu calc calc-loaddefs
calc-macs tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode elisp-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core term/tty-colors frame minibuffer cl-generic
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote threads dbusbind
inotify lcms2 dynamic-setting system-font-setting font-render-setting
cairo move-toolbar gtk x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 73649 8293)
 (symbols 48 8721 1)
 (strings 32 20611 2050)
 (string-bytes 1 604578)
 (vectors 16 12708)
 (vector-slots 8 154643 9372)
 (floats 8 29 41)
 (intervals 56 257 0)
 (buffers 1000 13))

-- 
Kuba Orlik




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55943; Package emacs. (Mon, 13 Jun 2022 15:15:02 GMT) Full text and rfc822 format available.

Message #8 received at 55943 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Kuba Orlik <kontakt <at> kuba-orlik.name>
Cc: 55943 <at> debbugs.gnu.org
Subject: Re: bug#55943: Cannot insert registers in calc
Date: Mon, 13 Jun 2022 17:14:31 +0200
Kuba Orlik <kontakt <at> kuba-orlik.name> writes:

> 1. Run emacs -Q
> 2. Type the number 20 into the buffer
> 3. Move the point to the "2" in the "20"
> 4. Run M-x number-to-register
> 5. Pick a letter for the register (I picked "a")
> 6. Run M-x calc
> 7. Type "r i" and pick the same register
> 8. It rings a bell and shows "Bad format in register data"

Registers in Calc have nothing to do with the normal Emacs-wide
registers -- you can only insert with `r i' in Calc stuff you've save
with `r s' in Calc.  But I see that the doc strings here don't actually
say this, so I've fixed this for Emacs 28.2.

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




bug marked as fixed in version 28.2, send any further explanations to 55943 <at> debbugs.gnu.org and Kuba Orlik <kontakt <at> kuba-orlik.name> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 13 Jun 2022 15:15:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55943; Package emacs. (Mon, 13 Jun 2022 15:32:02 GMT) Full text and rfc822 format available.

Message #13 received at 55943 <at> debbugs.gnu.org (full text, mbox):

From: Kuba Orlik <kontakt <at> kuba-orlik.name>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 55943 <at> debbugs.gnu.org
Subject: Re: bug#55943: Cannot insert registers in calc
Date: Mon, 13 Jun 2022 17:31:04 +0200
> Registers in Calc have nothing to do with the normal Emacs-wide
registers

Is it then also a bug that when I press "r i" in Calc and wait for a
second then it suggests me the registers (along with their values) that
I created outside of Calc?

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

> Kuba Orlik <kontakt <at> kuba-orlik.name> writes:
>
>> 1. Run emacs -Q
>> 2. Type the number 20 into the buffer
>> 3. Move the point to the "2" in the "20"
>> 4. Run M-x number-to-register
>> 5. Pick a letter for the register (I picked "a")
>> 6. Run M-x calc
>> 7. Type "r i" and pick the same register
>> 8. It rings a bell and shows "Bad format in register data"
>
> Registers in Calc have nothing to do with the normal Emacs-wide
> registers -- you can only insert with `r i' in Calc stuff you've save
> with `r s' in Calc.  But I see that the doc strings here don't actually
> say this, so I've fixed this for Emacs 28.2.


-- 
Kuba Orlik




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55943; Package emacs. (Mon, 13 Jun 2022 15:33:02 GMT) Full text and rfc822 format available.

Message #16 received at 55943 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Kuba Orlik <kontakt <at> kuba-orlik.name>
Cc: 55943 <at> debbugs.gnu.org
Subject: Re: bug#55943: Cannot insert registers in calc
Date: Mon, 13 Jun 2022 17:32:36 +0200
Kuba Orlik <kontakt <at> kuba-orlik.name> writes:

> Is it then also a bug that when I press "r i" in Calc and wait for a
> second then it suggests me the registers (along with their values) that
> I created outside of Calc?

Yes, that looks like a bug.

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




bug No longer marked as fixed in versions 28.2 and reopened. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 13 Jun 2022 15:40:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55943; Package emacs. (Tue, 14 Jun 2022 07:21:01 GMT) Full text and rfc822 format available.

Message #21 received at 55943 <at> debbugs.gnu.org (full text, mbox):

From: Kuba Orlik <kontakt <at> kuba-orlik.name>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 55943 <at> debbugs.gnu.org
Subject: Re: bug#55943: Cannot insert registers in calc
Date: Tue, 14 Jun 2022 09:21:44 +0200
Should I report it separately?

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

> Kuba Orlik <kontakt <at> kuba-orlik.name> writes:
>
>> Is it then also a bug that when I press "r i" in Calc and wait for a
>> second then it suggests me the registers (along with their values) that
>> I created outside of Calc?
>
> Yes, that looks like a bug.


-- 
Kuba Orlik




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55943; Package emacs. (Tue, 14 Jun 2022 11:06:02 GMT) Full text and rfc822 format available.

Message #24 received at 55943 <at> debbugs.gnu.org (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 55943 <at> debbugs.gnu.org, Kuba Orlik <kontakt <at> kuba-orlik.name>
Subject: Re: bug#55943: Cannot insert registers in calc
Date: Tue, 14 Jun 2022 13:05:09 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Registers in Calc have nothing to do with the normal Emacs-wide
> registers -- you can only insert with `r i' in Calc stuff you've save
> with `r s' in Calc.  But I see that the doc strings here don't actually
> say this, so I've fixed this for Emacs 28.2.

Hmm - I think I don't agree - see what

  (info "(calc) Inserting From Registers")

tells.  String valued registers work fine.  So this change:

+Note that this command only works with Calc registers, and they
+have nothing to do with the Emacs-wide register mechanism.

is not justified in my opinion.  Calc uses the normal register
mechanism, but enhances registers that save regions from Calc by saving
additional data in a separate variable.

Wouldn't it make sense to make "calc-insert-register" work with number
valued registers?

Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55943; Package emacs. (Tue, 14 Jun 2022 11:09:02 GMT) Full text and rfc822 format available.

Message #27 received at 55943 <at> debbugs.gnu.org (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 55943 <at> debbugs.gnu.org, Kuba Orlik <kontakt <at> kuba-orlik.name>
Subject: Re: bug#55943: Cannot insert registers in calc
Date: Tue, 14 Jun 2022 13:07:51 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Kuba Orlik <kontakt <at> kuba-orlik.name> writes:
>
> > Is it then also a bug that when I press "r i" in Calc and wait for a
> > second then it suggests me the registers (along with their values) that
> > I created outside of Calc?
>
> Yes, that looks like a bug.

It's normal that not all register value types support insertion.  Calc
changes a bit which value types can be - but I don't see a bug here.

Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55943; Package emacs. (Tue, 14 Jun 2022 11:31:01 GMT) Full text and rfc822 format available.

Message #30 received at 55943 <at> debbugs.gnu.org (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Kuba Orlik <kontakt <at> kuba-orlik.name>, 55943 <at> debbugs.gnu.org
Subject: Re: bug#55943: Cannot insert registers in calc
Date: Tue, 14 Jun 2022 13:29:58 +0200
[Message part 1 (text/plain, inline)]
Michael Heerdegen <michael_heerdegen <at> web.de> writes:

> Wouldn't it make sense to make "calc-insert-register" work with number
> valued registers?

This seems to work:

[0001-WIP-Allow-number-register-value-insertion-in-Calc.patch (text/x-diff, inline)]
From 3368ead9b62e822e7e3927149c67c09caf17d55f Mon Sep 17 00:00:00 2001
From: Michael Heerdegen <michael_heerdegen <at> web.de>
Date: Tue, 14 Jun 2022 13:26:06 +0200
Subject: [PATCH] WIP: Allow number register value insertion in Calc

---
 lisp/calc/calc-yank.el | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/lisp/calc/calc-yank.el b/lisp/calc/calc-yank.el
index e0ed098b70..8346061239 100644
--- a/lisp/calc/calc-yank.el
+++ b/lisp/calc/calc-yank.el
@@ -266,14 +266,16 @@ calc-get-register
   "Return the CALCVAL portion of the contents of the Calc register REG,
 unless the TEXT portion doesn't match the contents of the Emacs register REG,
 in which case either return the contents of the Emacs register (if it is
-text) or nil."
+text or a number) or nil."
   (let ((cval (cdr (assq reg calc-register-alist)))
         (val (cdr (assq reg register-alist))))
-    (if (stringp val)
-        (if (and (stringp (car cval))
-                 (string= (car cval) val))
-            (cdr cval)
-          val))))
+    (cond
+     ((stringp val)
+      (if (and (stringp (car cval))
+               (string= (car cval) val))
+          (cdr cval)
+        val))
+     ((numberp val) (number-to-string val)))))

 (defun calc-copy-to-register (register start end &optional delete-flag)
   "Copy the lines in the region into register REGISTER.
--
2.30.2

[Message part 3 (text/plain, inline)]
Would this make sense?  Are there any number values that could cause
problems?

Michael.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55943; Package emacs. (Tue, 14 Jun 2022 11:58:02 GMT) Full text and rfc822 format available.

Message #33 received at 55943 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Michael Heerdegen <michael_heerdegen <at> web.de>
Cc: Kuba Orlik <kontakt <at> kuba-orlik.name>, 55943 <at> debbugs.gnu.org
Subject: Re: bug#55943: Cannot insert registers in calc
Date: Tue, 14 Jun 2022 13:57:10 +0200
Michael Heerdegen <michael_heerdegen <at> web.de> writes:

> Subject: [PATCH] WIP: Allow number register value insertion in Calc

Makes sense to me.  I've now reverted the doc change in Emacs 28 about
this.

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55943; Package emacs. (Tue, 14 Jun 2022 11:58:02 GMT) Full text and rfc822 format available.

Message #36 received at 55943 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Kuba Orlik <kontakt <at> kuba-orlik.name>
Cc: 55943 <at> debbugs.gnu.org
Subject: Re: bug#55943: Cannot insert registers in calc
Date: Tue, 14 Jun 2022 13:57:31 +0200
Kuba Orlik <kontakt <at> kuba-orlik.name> writes:

> Should I report it separately?

No, I reopened this bug report.

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




Reply sent to Michael Heerdegen <michael_heerdegen <at> web.de>:
You have taken responsibility. (Thu, 16 Jun 2022 17:18:02 GMT) Full text and rfc822 format available.

Notification sent to Kuba Orlik <kontakt <at> kuba-orlik.name>:
bug acknowledged by developer. (Thu, 16 Jun 2022 17:18:02 GMT) Full text and rfc822 format available.

Message #41 received at 55943-done <at> debbugs.gnu.org (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 55943-done <at> debbugs.gnu.org, Kuba Orlik <kontakt <at> kuba-orlik.name>
Subject: Re: bug#55943: Cannot insert registers in calc
Date: Thu, 16 Jun 2022 19:17:04 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> > Subject: [PATCH] WIP: Allow number register value insertion in Calc
>
> Makes sense to me.  I've now reverted the doc change in Emacs 28 about
> this.

Thanks.  I've now committed my suggested patch (which fixes this
problem) to master and am closing this report.

Side note: AFAIK number registers can only be initialized with integer
values, so the use of this change is limited.


Thanks,

Michael.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 15 Jul 2022 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 340 days ago.

Previous Next


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