emacs-diffs
[Top][All Lists]
Advanced

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

master 28218092a6: Allow number register insertion in Calc (Bug#55943)


From: Michael Heerdegen
Subject: master 28218092a6: Allow number register insertion in Calc (Bug#55943)
Date: Thu, 16 Jun 2022 12:41:56 -0400 (EDT)

branch: master
commit 28218092a699c637ab5164db69ff68f3209c5f84
Author: Michael Heerdegen <michael_heerdegen@web.de>
Commit: Michael Heerdegen <michael_heerdegen@web.de>

    Allow number register insertion in Calc (Bug#55943)
    
    * lisp/calc/calc-yank.el (calc-get-register): Convert number values to
    strings.
---
 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 172ccf1adc..c98505a0b1 100644
--- a/lisp/calc/calc-yank.el
+++ b/lisp/calc/calc-yank.el
@@ -266,14 +266,16 @@ as well as set the contents of the Emacs register 
REGISTER to TEXT."
   "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.



reply via email to

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