* bug#18469: 24.4.50; quick-calc: Insert result into the current buffer
@ 2014-09-13 18:40 Christopher Schmidt
2014-09-13 21:06 ` Christopher Schmidt
2014-10-29 0:42 ` Jay Belanger
0 siblings, 2 replies; 3+ messages in thread
From: Christopher Schmidt @ 2014-09-13 18:40 UTC (permalink / raw)
To: 18469
[-- Attachment #1: Type: text/plain, Size: 523 bytes --]
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.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-diff, Size: 3759 bytes --]
--- doc/misc/ChangeLog
+++ doc/misc/ChangeLog
@@ -1,3 +1,8 @@
+2014-09-13 Christopher Schmidt <ch@ristopher.com>
+
+ * calc.texi (Quick Calculator):
+ Mention prefix argument of `quick-calc'. (Bug#)
+
2014-09-04 Paul Eggert <eggert@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@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@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)
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#18469: 24.4.50; quick-calc: Insert result into the current buffer
2014-09-13 18:40 bug#18469: 24.4.50; quick-calc: Insert result into the current buffer Christopher Schmidt
@ 2014-09-13 21:06 ` Christopher Schmidt
2014-10-29 0:42 ` Jay Belanger
1 sibling, 0 replies; 3+ messages in thread
From: Christopher Schmidt @ 2014-09-13 21:06 UTC (permalink / raw)
To: 18469
Christopher Schmidt <ch@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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#18469: 24.4.50; quick-calc: Insert result into the current buffer
2014-09-13 18:40 bug#18469: 24.4.50; quick-calc: Insert result into the current buffer Christopher Schmidt
2014-09-13 21:06 ` Christopher Schmidt
@ 2014-10-29 0:42 ` Jay Belanger
1 sibling, 0 replies; 3+ messages in thread
From: Jay Belanger @ 2014-10-29 0:42 UTC (permalink / raw)
To: 18469-done
The patch has been committed.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-10-29 0:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-13 18:40 bug#18469: 24.4.50; quick-calc: Insert result into the current buffer Christopher Schmidt
2014-09-13 21:06 ` Christopher Schmidt
2014-10-29 0:42 ` Jay Belanger
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.