Commit d8b01fef authored by Jay Belanger's avatar Jay Belanger
Browse files

* calc-ext.el (calc-init-extensions): Add keybinding for 'calc-option'.

Add `calc-option-prefix-help' to calc-help autoloads.
(calc-inverse): Add "Option" to message, as appropriate.
(calc-hyperbolic): Add "Option" to message, as appropriate.
(calc-option, calc-is-option): New functions.

* calc-help.el (calc-full-help):  Add `calc-option-help'.
(calc-option-prefix-help): New function.

* calc-misc.el (calc-help): Add "Option" entry.

* calc.el (calc-local-var-list): Add `calc-option-flag'.
(calc-option-flag): New variable.
(calc-do): Set `calc-option-flag to nil.
(calc-set-mode-line): Add "Opt " as appropriate.
parent 0f4442ef
2010-04-17 Jay Belanger <jay.p.belanger@gmail.com>
* calc-ext.el (calc-init-extensions): Add keybinding for 'calc-option'.
Add `calc-option-prefix-help' to calc-help autoloads.
(calc-inverse): Add "Option" to message, as appropriate.
(calc-hyperbolic): Add "Option" to message, as appropriate.
(calc-option, calc-is-option): New functions.
* calc-help.el (calc-full-help): Add `calc-option-help'.
(calc-option-prefix-help): New function.
* calc-misc.el (calc-help): Add "Option" entry.
* calc.el (calc-local-var-list): Add `calc-option-flag'.
(calc-option-flag): New variable.
(calc-do): Set `calc-option-flag to nil.
(calc-set-mode-line): Add "Opt " as appropriate.
2010-04-16 Juri Linkov <juri@jurta.org> 2010-04-16 Juri Linkov <juri@jurta.org>
Move scrolling commands from simple.el to window.el Move scrolling commands from simple.el to window.el
......
...@@ -104,6 +104,7 @@ ...@@ -104,6 +104,7 @@
(define-key calc-mode-map "J" 'calc-conj) (define-key calc-mode-map "J" 'calc-conj)
(define-key calc-mode-map "L" 'calc-ln) (define-key calc-mode-map "L" 'calc-ln)
(define-key calc-mode-map "N" 'calc-eval-num) (define-key calc-mode-map "N" 'calc-eval-num)
(define-key calc-mode-map "O" 'calc-option)
(define-key calc-mode-map "P" 'calc-pi) (define-key calc-mode-map "P" 'calc-pi)
(define-key calc-mode-map "Q" 'calc-sqrt) (define-key calc-mode-map "Q" 'calc-sqrt)
(define-key calc-mode-map "R" 'calc-round) (define-key calc-mode-map "R" 'calc-round)
...@@ -1045,7 +1046,7 @@ calc-graph-zero-x calc-graph-zero-y) ...@@ -1045,7 +1046,7 @@ calc-graph-zero-x calc-graph-zero-y)
calc-d-prefix-help calc-describe-function calc-describe-key calc-d-prefix-help calc-describe-function calc-describe-key
calc-describe-key-briefly calc-describe-variable calc-f-prefix-help calc-describe-key-briefly calc-describe-variable calc-f-prefix-help
calc-full-help calc-g-prefix-help calc-help-prefix calc-full-help calc-g-prefix-help calc-help-prefix
calc-hyperbolic-prefix-help calc-inv-hyp-prefix-help calc-hyperbolic-prefix-help calc-inv-hyp-prefix-help calc-option-prefix-help
calc-inverse-prefix-help calc-j-prefix-help calc-k-prefix-help calc-inverse-prefix-help calc-j-prefix-help calc-k-prefix-help
calc-m-prefix-help calc-r-prefix-help calc-s-prefix-help calc-m-prefix-help calc-r-prefix-help calc-s-prefix-help
calc-t-prefix-help calc-u-prefix-help calc-v-prefix-help) calc-t-prefix-help calc-u-prefix-help calc-v-prefix-help)
...@@ -1408,9 +1409,18 @@ calc-kill calc-kill-region calc-yank)))) ...@@ -1408,9 +1409,18 @@ calc-kill calc-kill-region calc-yank))))
(with-current-buffer calc-main-buffer (with-current-buffer calc-main-buffer
calc-hyperbolic-flag) calc-hyperbolic-flag)
calc-hyperbolic-flag)) calc-hyperbolic-flag))
(msg (if hyp-flag (opt-flag (if (or
"Inverse Hyperbolic..." (eq major-mode 'calc-keypad-mode)
"Inverse..."))) (eq major-mode 'calc-trail-mode))
(with-current-buffer calc-main-buffer
calc-option-flag)
calc-option-flag))
(msg
(cond
((and opt-flag hyp-flag) "Option Inverse Hyperbolic...")
(hyp-flag "Inverse Hyperbolic...")
(opt-flag "Option Inverse...")
(t "Inverse..."))))
(calc-fancy-prefix 'calc-inverse-flag msg n))) (calc-fancy-prefix 'calc-inverse-flag msg n)))
(defconst calc-fancy-prefix-map (defconst calc-fancy-prefix-map
...@@ -1489,9 +1499,18 @@ calc-kill calc-kill-region calc-yank)))) ...@@ -1489,9 +1499,18 @@ calc-kill calc-kill-region calc-yank))))
(with-current-buffer calc-main-buffer (with-current-buffer calc-main-buffer
calc-inverse-flag) calc-inverse-flag)
calc-inverse-flag)) calc-inverse-flag))
(msg (if inv-flag (opt-flag (if (or
"Inverse Hyperbolic..." (eq major-mode 'calc-keypad-mode)
"Hyperbolic..."))) (eq major-mode 'calc-trail-mode))
(with-current-buffer calc-main-buffer
calc-option-flag)
calc-option-flag))
(msg
(cond
((and opt-flag inv-flag) "Option Inverse Hyperbolic...")
(opt-flag "Option Hyperbolic...")
(inv-flag "Inverse Hyperbolic...")
(t "Hyperbolic..."))))
(calc-fancy-prefix 'calc-hyperbolic-flag msg n))) (calc-fancy-prefix 'calc-hyperbolic-flag msg n)))
(defun calc-hyperbolic-func () (defun calc-hyperbolic-func ()
...@@ -1504,6 +1523,31 @@ calc-kill calc-kill-region calc-yank)))) ...@@ -1504,6 +1523,31 @@ calc-kill calc-kill-region calc-yank))))
(defun calc-is-hyperbolic () (defun calc-is-hyperbolic ()
calc-hyperbolic-flag) calc-hyperbolic-flag)
(defun calc-option (&optional n)
(interactive "P")
(let* ((inv-flag (if (or
(eq major-mode 'calc-keypad-mode)
(eq major-mode 'calc-trail-mode))
(with-current-buffer calc-main-buffer
calc-inverse-flag)
calc-inverse-flag))
(hyp-flag (if (or
(eq major-mode 'calc-keypad-mode)
(eq major-mode 'calc-trail-mode))
(with-current-buffer calc-main-buffer
calc-hyperbolic-flag)
calc-hyperbolic-flag))
(msg
(cond
((and hyp-flag inv-flag) "Option Inverse Hyperbolic...")
(hyp-flag "Option Hyperbolic...")
(inv-flag "Option Inverse...")
(t "Option..."))))
(calc-fancy-prefix 'calc-option-flag msg n)))
(defun calc-is-option ()
calc-option-flag)
(defun calc-keep-args (&optional n) (defun calc-keep-args (&optional n)
(interactive "P") (interactive "P")
(calc-fancy-prefix 'calc-keep-args-flag "Keep args..." n)) (calc-fancy-prefix 'calc-keep-args-flag "Keep args..." n))
......
...@@ -446,6 +446,7 @@ C-w Describe how there is no warranty for Calc." ...@@ -446,6 +446,7 @@ C-w Describe how there is no warranty for Calc."
'(calc-inverse-prefix-help '(calc-inverse-prefix-help
calc-hyperbolic-prefix-help calc-hyperbolic-prefix-help
calc-inv-hyp-prefix-help calc-inv-hyp-prefix-help
calc-option-prefix-help
calc-a-prefix-help calc-a-prefix-help
calc-b-prefix-help calc-b-prefix-help
calc-c-prefix-help calc-c-prefix-help
...@@ -512,6 +513,11 @@ C-w Describe how there is no warranty for Calc." ...@@ -512,6 +513,11 @@ C-w Describe how there is no warranty for Calc."
"I H + a S (general invert func); v h (rtail)") "I H + a S (general invert func); v h (rtail)")
"inverse-hyperbolic" nil)) "inverse-hyperbolic" nil))
(defun calc-option-prefix-help ()
(interactive)
(calc-do-prefix-help
'("")
"option" nil))
(defun calc-f-prefix-help () (defun calc-f-prefix-help ()
(interactive) (interactive)
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
(declare-function calc-inv-hyp-prefix-help "calc-help" ()) (declare-function calc-inv-hyp-prefix-help "calc-help" ())
(declare-function calc-inverse-prefix-help "calc-help" ()) (declare-function calc-inverse-prefix-help "calc-help" ())
(declare-function calc-hyperbolic-prefix-help "calc-help" ()) (declare-function calc-hyperbolic-prefix-help "calc-help" ())
(declare-function calc-option-prefix-help "calc-help" ())
(declare-function calc-explain-why "calc-stuff" (why &optional more)) (declare-function calc-explain-why "calc-stuff" (why &optional more))
(declare-function calc-clear-command-flag "calc-ext" (f)) (declare-function calc-clear-command-flag "calc-ext" (f))
(declare-function calc-roll-down-with-selections "calc-sel" (n m)) (declare-function calc-roll-down-with-selections "calc-sel" (n m))
...@@ -219,7 +220,7 @@ Calc user interface as before (either C-x * C or C-x * K; initially C-x * C). ...@@ -219,7 +220,7 @@ Calc user interface as before (either C-x * C or C-x * K; initially C-x * C).
(let ((msgs (let ((msgs
'("Press `h' for complete help; press `?' repeatedly for a summary" '("Press `h' for complete help; press `?' repeatedly for a summary"
"Letter keys: Negate; Precision; Yank; Why; Xtended cmd; Quit" "Letter keys: Negate; Precision; Yank; Why; Xtended cmd; Quit"
"Letter keys: SHIFT + Undo, reDo; Keep-args; Inverse, Hyperbolic" "Letter keys: SHIFT + Undo, reDo; Keep-args; Inverse, Hyperbolic, Option"
"Letter keys: SHIFT + sQrt; Sin, Cos, Tan; Exp, Ln, logB" "Letter keys: SHIFT + sQrt; Sin, Cos, Tan; Exp, Ln, logB"
"Letter keys: SHIFT + Floor, Round; Abs, conJ, arG; Pi" "Letter keys: SHIFT + Floor, Round; Abs, conJ, arG; Pi"
"Letter keys: SHIFT + Num-eval; More-recn; eXec-kbd-macro" "Letter keys: SHIFT + Num-eval; More-recn; eXec-kbd-macro"
...@@ -245,20 +246,22 @@ Calc user interface as before (either C-x * C or C-x * K; initially C-x * C). ...@@ -245,20 +246,22 @@ Calc user interface as before (either C-x * C or C-x * K; initially C-x * C).
(calc-inv-hyp-prefix-help) (calc-inv-hyp-prefix-help)
(calc-inverse-prefix-help)) (calc-inverse-prefix-help))
(calc-hyperbolic-prefix-help)) (calc-hyperbolic-prefix-help))
(setq calc-help-phase (if calc-option-flag
(if (eq this-command last-command) (calc-option-prefix-help)
(% (1+ calc-help-phase) (1+ (length msgs))) (setq calc-help-phase
0)) (if (eq this-command last-command)
(let ((msg (nth calc-help-phase msgs))) (% (1+ calc-help-phase) (1+ (length msgs)))
(message "%s" (if msg 0))
(concat msg ":" (let ((msg (nth calc-help-phase msgs)))
(make-string (- (apply 'max (message "%s" (if msg
(mapcar 'length (concat msg ":"
msgs)) (make-string (- (apply 'max
(length msg)) 32) (mapcar 'length
" [?=MORE]") msgs))
""))))))) (length msg)) 32)
" [?=MORE]")
""))))))))
......
...@@ -797,6 +797,7 @@ Used by `calc-user-invocation'.") ...@@ -797,6 +797,7 @@ Used by `calc-user-invocation'.")
calc-matrix-mode calc-matrix-mode
calc-inverse-flag calc-inverse-flag
calc-hyperbolic-flag calc-hyperbolic-flag
calc-option-flag
calc-keep-args-flag calc-keep-args-flag
calc-angle-mode calc-angle-mode
calc-number-radix calc-number-radix
...@@ -926,6 +927,8 @@ Used by `calc-user-invocation'.") ...@@ -926,6 +927,8 @@ Used by `calc-user-invocation'.")
"If non-nil, next operation is Inverse.") "If non-nil, next operation is Inverse.")
(defvar calc-hyperbolic-flag nil (defvar calc-hyperbolic-flag nil
"If non-nil, next operation is Hyperbolic.") "If non-nil, next operation is Hyperbolic.")
(defvar calc-option-flag nil
"If non-nil, next operation has Optional behavior.")
(defvar calc-keep-args-flag nil (defvar calc-keep-args-flag nil
"If non-nil, next operation should not remove its arguments from stack.") "If non-nil, next operation should not remove its arguments from stack.")
(defvar calc-function-open "(" (defvar calc-function-open "("
...@@ -1619,6 +1622,7 @@ See calc-keypad for details." ...@@ -1619,6 +1622,7 @@ See calc-keypad for details."
(calc-select-buffer) (calc-select-buffer)
(setq calc-inverse-flag nil (setq calc-inverse-flag nil
calc-hyperbolic-flag nil calc-hyperbolic-flag nil
calc-option-flag nil
calc-keep-args-flag nil))) calc-keep-args-flag nil)))
(when (memq 'do-edit calc-command-flags) (when (memq 'do-edit calc-command-flags)
(switch-to-buffer (get-buffer-create "*Calc Edit*"))) (switch-to-buffer (get-buffer-create "*Calc Edit*")))
...@@ -1757,6 +1761,7 @@ See calc-keypad for details." ...@@ -1757,6 +1761,7 @@ See calc-keypad for details."
(> (calc-stack-size) 0) (> (calc-stack-size) 0)
(calc-top 1 'sel)) "Sel " "") (calc-top 1 'sel)) "Sel " "")
(if calc-display-dirty "Dirty " "") (if calc-display-dirty "Dirty " "")
(if calc-option-flag "Opt " "")
(if calc-inverse-flag "Inv " "") (if calc-inverse-flag "Inv " "")
(if calc-hyperbolic-flag "Hyp " "") (if calc-hyperbolic-flag "Hyp " "")
(if calc-keep-args-flag "Keep " "") (if calc-keep-args-flag "Keep " "")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment