]> git.eshelyaron.com Git - emacs.git/commitdiff
Allow number register insertion in Calc (Bug#55943)
authorMichael Heerdegen <michael_heerdegen@web.de>
Tue, 14 Jun 2022 11:26:06 +0000 (13:26 +0200)
committerMichael Heerdegen <michael_heerdegen@web.de>
Thu, 16 Jun 2022 16:32:40 +0000 (18:32 +0200)
* lisp/calc/calc-yank.el (calc-get-register): Convert number values to
strings.

lisp/calc/calc-yank.el

index 172ccf1adcd923e061591d894ab747ea87b29971..c98505a0b1d0b611e99028ff8233cfb35da1ef64 100644 (file)
@@ -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.