summaryrefslogtreecommitdiff
path: root/lisp/calc
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/calc')
-rw-r--r--lisp/calc/calc-aent.el5
-rw-r--r--lisp/calc/calc-alg.el4
-rw-r--r--lisp/calc/calc-arith.el4
-rw-r--r--lisp/calc/calc-forms.el5
-rw-r--r--lisp/calc/calc-help.el12
-rw-r--r--lisp/calc/calc-prog.el3
-rw-r--r--lisp/calc/calc-yank.el5
-rw-r--r--lisp/calc/calc.el12
8 files changed, 28 insertions, 22 deletions
diff --git a/lisp/calc/calc-aent.el b/lisp/calc/calc-aent.el
index 107c0ae4ce4..968d30ee60a 100644
--- a/lisp/calc/calc-aent.el
+++ b/lisp/calc/calc-aent.el
@@ -52,7 +52,7 @@
"The history list for quick-calc.")
;;;###autoload
-(defun calc-do-quick-calc ()
+(defun calc-do-quick-calc (&optional insert)
(require 'calc-ext)
(calc-check-defines)
(if (eq major-mode 'calc-mode)
@@ -108,7 +108,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)))))
diff --git a/lisp/calc/calc-alg.el b/lisp/calc/calc-alg.el
index 4bd37a4982d..c26b007bb96 100644
--- a/lisp/calc/calc-alg.el
+++ b/lisp/calc/calc-alg.el
@@ -293,7 +293,7 @@
(Math-objectp a))
((eq (car a) 'var)
(if (eq (car b) 'var)
- (string-lessp (symbol-name (nth 1 a)) (symbol-name (nth 1 b)))
+ (string-lessp (nth 1 a) (nth 1 b))
(not (Math-numberp b))))
((eq (car b) 'var) (Math-numberp a))
((eq (car a) (car b))
@@ -302,7 +302,7 @@
(and b
(or (null a)
(math-beforep (car a) (car b)))))
- (t (string-lessp (symbol-name (car a)) (symbol-name (car b))))))
+ (t (string-lessp (car a) (car b)))))
(defsubst math-simplify-extended (a)
diff --git a/lisp/calc/calc-arith.el b/lisp/calc/calc-arith.el
index 43b42038aa6..3a2d1598491 100644
--- a/lisp/calc/calc-arith.el
+++ b/lisp/calc/calc-arith.el
@@ -2249,7 +2249,7 @@
(defun math-min-list (a b)
(if b
- (if (or (Math-anglep (car b)) (eq (car b) 'date)
+ (if (or (Math-anglep (car b)) (eq (caar b) 'date)
(and (eq (car (car b)) 'intv) (math-intv-constp (car b)))
(math-infinitep (car b)))
(math-min-list (math-min a (car b)) (cdr b))
@@ -2279,7 +2279,7 @@
(defun math-max-list (a b)
(if b
- (if (or (Math-anglep (car b)) (eq (car b) 'date)
+ (if (or (Math-anglep (car b)) (eq (caar b) 'date)
(and (eq (car (car b)) 'intv) (math-intv-constp (car b)))
(math-infinitep (car b)))
(math-max-list (math-max a (car b)) (cdr b))
diff --git a/lisp/calc/calc-forms.el b/lisp/calc/calc-forms.el
index dbde4cd0c41..a48075cce91 100644
--- a/lisp/calc/calc-forms.el
+++ b/lisp/calc/calc-forms.el
@@ -273,7 +273,10 @@
(m (math-normalize (nth 2 a)))
(s (let ((calc-internal-prec (max (- calc-internal-prec 4) 3)))
(math-normalize (nth 3 a)))))
- (if (math-negp h)
+ (if (or
+ (math-negp h)
+ (and (= h 0) (math-negp m))
+ (and (= h 0) (= m 0) (math-negp s)))
(progn
(if (math-posp s)
(setq s (math-add s -60)
diff --git a/lisp/calc/calc-help.el b/lisp/calc/calc-help.el
index be04e5a12c0..dfd29230fe5 100644
--- a/lisp/calc/calc-help.el
+++ b/lisp/calc/calc-help.el
@@ -366,9 +366,9 @@ C-w Describe how there is no warranty for Calc."
(Info-goto-node (buffer-substring (match-beginning 1) (match-end 1))))
(or (let ((case-fold-search nil))
(or (re-search-forward (format "\\[`%s'\\]\\|(`%s')\\|\\<The[ \n]`%s'"
- (or target thing)
- (or target thing)
- (or target thing)) nil t)
+ (or target (regexp-quote thing))
+ (or target (regexp-quote thing))
+ (or target (regexp-quote thing))) nil t)
(and not-quoted
(let ((case-fold-search t))
(search-forward (or target thing) nil t)))
@@ -376,9 +376,9 @@ C-w Describe how there is no warranty for Calc."
(search-forward (or target thing) nil t)))
(let ((case-fold-search t))
(or (re-search-forward (format "\\[`%s'\\]\\|(`%s')\\|\\<The[ \n]`%s'"
- (or target thing)
- (or target thing)
- (or target thing)) nil t)
+ (or target (regexp-quote thing))
+ (or target (regexp-quote thing))
+ (or target (regexp-quote thing))) nil t)
(search-forward (format "`%s'" (or target thing)) nil t)
(search-forward (or target thing) nil t))))
(beginning-of-line)
diff --git a/lisp/calc/calc-prog.el b/lisp/calc/calc-prog.el
index 30a06a2aa00..156bf4cd0db 100644
--- a/lisp/calc/calc-prog.el
+++ b/lisp/calc/calc-prog.el
@@ -139,6 +139,7 @@
"calc-"))))
(let* ((kmap (calc-user-key-map))
(old (assq key kmap)))
+ ;; FIXME: Why not (define-key kmap (vector key) func)?
(if old
(setcdr old func)
(setcdr kmap (cons (cons key func) (cdr kmap))))))))
@@ -322,6 +323,7 @@
(if key
(let* ((kmap (calc-user-key-map))
(old (assq key kmap)))
+ ;; FIXME: Why not (define-key kmap (vector key) cmd)?
(if old
(setcdr old cmd)
(setcdr kmap (cons (cons key cmd) (cdr kmap)))))))
@@ -467,6 +469,7 @@
(format "z%c" key)))))
(let* ((kmap (calc-user-key-map))
(old (assq key kmap)))
+ ;; FIXME: Why not (define-key kmap (vector key) func)?
(if old
(setcdr old cmd)
(setcdr kmap (cons (cons key cmd) (cdr kmap))))))))
diff --git a/lisp/calc/calc-yank.el b/lisp/calc/calc-yank.el
index 8d182372cfb..9781d4174f5 100644
--- a/lisp/calc/calc-yank.el
+++ b/lisp/calc/calc-yank.el
@@ -143,10 +143,7 @@ TEXT and CALCVAL are the TEXT and internal structure of stack entries.")
"Set the contents of the Calc register REGISTER to (TEXT . CALCVAL),
as well as set the contents of the Emacs register REGISTER to TEXT."
(set-register register text)
- (let ((aelt (assq register calc-register-alist)))
- (if aelt
- (setcdr aelt (cons text calcval))
- (push (cons register (cons text calcval)) calc-register-alist))))
+ (setf (alist-get register calc-register-alist) (cons text calcval)))
(defun calc-get-register (reg)
"Return the CALCVAL portion of the contents of the Calc register REG,
diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el
index 04d852e5cb3..85266fbac32 100644
--- a/lisp/calc/calc.el
+++ b/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 @@ commands given here will actually operate on the *Calculator* stack."
(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)