GNU bug report logs - #18469
24.4.50; quick-calc: Insert result into the current buffer

Previous Next

Package: emacs;

Reported by: Christopher Schmidt <ch <at> ristopher.com>

Date: Sat, 13 Sep 2014 18:42:02 UTC

Severity: wishlist

Found in version 24.4.50

Done: Jay Belanger <jay.p.belanger <at> gmail.com>

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 18469 in the body.
You can then email your comments to 18469 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#18469; Package emacs. (Sat, 13 Sep 2014 18:42:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Christopher Schmidt <ch <at> ristopher.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 13 Sep 2014 18:42:02 GMT) Full text and rfc822 format available.

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

From: Christopher Schmidt <ch <at> ristopher.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.4.50; quick-calc: Insert result into the current buffer
Date: Sat, 13 Sep 2014 14:40:54 -0400 (EDT)
[Message part 1 (text/plain, inline)]
severity: wishlist

There is this nifty feature of quick-calc (C-x * q):

    (info "(calc)Quick Calculator")

    If you finish your formula by typing <LFD> (or `C-j') instead of
    <RET>, the result is inserted immediately into the current buffer
    rather than going into the kill ring.

This should be mentioned in the doc string.

In fact, considering that inserting the result of a quick calculation
into the current is an elementary use case, quick-calc's prefix arg
should be dedicated to enabling this feature.

[Message part 2 (text/x-diff, inline)]
--- doc/misc/ChangeLog
+++ doc/misc/ChangeLog
@@ -1,3 +1,8 @@
+2014-09-13  Christopher Schmidt  <ch <at> ristopher.com>
+
+	* calc.texi (Quick Calculator):
+	Mention prefix argument of `quick-calc'.  (Bug#)
+
 2014-09-04  Paul Eggert  <eggert <at> cs.ucla.edu>
 
 	Less chatter in 'make' output.
--- doc/misc/calc.texi
+++ doc/misc/calc.texi
@@ -10168,9 +10168,10 @@
 explicit alternative to @kbd{$} notation, or to yank the result
 into the Calculator stack after typing @kbd{C-x * c}.
 
-If you finish your formula by typing @key{LFD} (or @kbd{C-j}) instead
-of @key{RET}, the result is inserted immediately into the current
-buffer rather than going into the kill ring.
+If you give a prefix argument to @kbd{C-x * q} or finish your formula
+by typing @key{LFD} (or @kbd{C-j}) instead of @key{RET}, the result is
+inserted immediately into the current buffer rather than going into
+the kill ring.
 
 Quick Calculator results are actually evaluated as if by the @kbd{=}
 key (which replaces variable names by their stored values, if any).
--- etc/ChangeLog
+++ etc/ChangeLog
@@ -1,5 +1,7 @@
 2014-09-13  Christopher Schmidt  <ch <at> ristopher.com>
 
+	* NEWS: Mention prefix argument of `quick-calc'.  (Bug#)
+
 	* NEWS: Mention nil `calendar-mode-line-format' will not modify
 	the mode line of the calendar buffer.  (Bug#18467)
 
--- etc/NEWS
+++ etc/NEWS
@@ -116,6 +116,11 @@
 ** Macro `minibuffer-with-setup-hook' takes (:append FUN) to mean
 appending FUN to `minibuffer-setup-hook'.
 
+** Calc
+
+*** If `quick-calc' is called with a prefix argument, insert the
+result of the calculation into the current buffer.
+
 ** Calendar and diary
 
 +++
--- lisp/ChangeLog
+++ lisp/ChangeLog
@@ -1,5 +1,9 @@
 2014-09-13  Christopher Schmidt  <ch <at> ristopher.com>
 
+	* calc/calc.el (quick-calc):
+	* calc/calc-aent.el (calc-do-quick-calc):
+	New argument INSERT.  (Bug#)
+
 	* calendar/calendar.el (calendar-update-mode-line):
 	Do not overwrite mode-line-format if calendar-mode-line-format is
 	nil.  (Bug#18467)
--- lisp/calc/calc-aent.el
+++ lisp/calc/calc-aent.el
@@ -52,7 +52,8 @@
   "The history list for quick-calc.")
 
 ;;;###autoload
-(defun calc-do-quick-calc ()
+(defun calc-do-quick-calc (&optional insert)
+  (interactive "P")
   (require 'calc-ext)
   (calc-check-defines)
   (if (eq major-mode 'calc-mode)
@@ -108,7 +109,8 @@
 		    (setq buf long))))
 	  (calc-handle-whys)
 	  (message "Result: %s" buf)))
-      (if (eq last-command-event 10)
+      (if (or insert
+	      (eq last-command-event 10))
 	  (insert shortbuf)
         (kill-new shortbuf)))))
 
--- lisp/calc/calc.el
+++ lisp/calc/calc.el
@@ -147,7 +147,7 @@
 (declare-function calc-edit-finish "calc-yank" (&optional keep))
 (declare-function calc-edit-cancel "calc-yank" ())
 (declare-function calc-locate-cursor-element "calc-yank" (pt))
-(declare-function calc-do-quick-calc "calc-aent" ())
+(declare-function calc-do-quick-calc "calc-aent" (&optional insert))
 (declare-function calc-do-calc-eval "calc-aent" (str separator args))
 (declare-function calc-do-keypad "calc-keypd" (&optional full-display interactive))
 (declare-function calcFunc-unixtime "calc-forms" (date &optional zone))
@@ -1549,10 +1549,12 @@
         (and kbuf (bury-buffer kbuf))))))
 
 ;;;###autoload
-(defun quick-calc ()
-  "Do a quick calculation in the minibuffer without invoking full Calculator."
-  (interactive)
-  (calc-do-quick-calc))
+(defun quick-calc (&optional insert)
+  "Do a quick calculation in the minibuffer without invoking full Calculator.
+With prefix argument INSERT, insert the result in the current
+buffer.  Otherwise, the result is copied into the kill ring."
+  (interactive "P")
+  (calc-do-quick-calc insert))
 
 ;;;###autoload
 (defun calc-eval (str &optional separator &rest args)

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18469; Package emacs. (Sat, 13 Sep 2014 21:07:02 GMT) Full text and rfc822 format available.

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

From: Christopher Schmidt <ch <at> ristopher.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#18469: 24.4.50;
 quick-calc: Insert result into the current buffer
Date: Sat, 13 Sep 2014 17:06:36 -0400 (EDT)
Christopher Schmidt <ch <at> ristopher.com> writes:
>  ;;;###autoload
> -(defun calc-do-quick-calc ()
> +(defun calc-do-quick-calc (&optional insert)
> +  (interactive "P")
     ^^^^^^^^^^^^^^^^^
FWIW the interactive form here is unnecessary.  I missed removing this
one before preparing the patch.




Reply sent to jay.p.belanger <at> gmail.com:
You have taken responsibility. (Wed, 29 Oct 2014 00:43:02 GMT) Full text and rfc822 format available.

Notification sent to Christopher Schmidt <ch <at> ristopher.com>:
bug acknowledged by developer. (Wed, 29 Oct 2014 00:43:03 GMT) Full text and rfc822 format available.

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

From: Jay Belanger <jay.p.belanger <at> gmail.com>
To: 18469-done <at> debbugs.gnu.org
Cc: jay.p.belanger <at> gmail.com
Subject: Re: bug#18469: 24.4.50;
 quick-calc: Insert result into the current buffer
Date: Tue, 28 Oct 2014 19:42:52 -0500
The patch has been committed.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 26 Nov 2014 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 268 days ago.

Previous Next


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