From 2667d5c7fbaa3de8103488c7e3779eb768f9d15c Mon Sep 17 00:00:00 2001 From: Jay Belanger Date: Tue, 15 Sep 2015 19:53:06 -0500 Subject: Add new functions for the root mean square of a (Calc) vector * lisp/calc/calc-stats.el (calcFunc-rms, calc-vector-rms): New functions. * lisp/calc/calc-ext.el (calc-init-extensions): Add keybinding for `calc-vector-rms', add autoloads for `calc-vector-rms' and `calcFunc-rms'. * lisp/calc/calc-map.el (calc-u-oper-keys): Add entry for `calcFunc-rms'. * lisp/calc/calc-menu.el (calc-vectors-menu): Add entry for `calc-vector-rms'. * doc/misc/calc.texi (Single-Variable Statistics): Document the rms command. --- lisp/calc/calc-ext.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lisp/calc/calc-ext.el') diff --git a/lisp/calc/calc-ext.el b/lisp/calc/calc-ext.el index cb6ab6f8ecc..27898fd9c97 100644 --- a/lisp/calc/calc-ext.el +++ b/lisp/calc/calc-ext.el @@ -574,6 +574,7 @@ (define-key calc-mode-map "uG" 'calc-vector-geometric-mean) (define-key calc-mode-map "uM" 'calc-vector-mean) (define-key calc-mode-map "uN" 'calc-vector-min) + (define-key calc-mode-map "uR" 'calc-vector-rms) (define-key calc-mode-map "uS" 'calc-vector-sdev) (define-key calc-mode-map "uU" 'calc-undo) (define-key calc-mode-map "uX" 'calc-vector-max) @@ -932,7 +933,7 @@ calc-preserve-point calc-replace-selections calc-replace-sub-formula calc-roll-down-with-selections calc-roll-up-with-selections calc-sel-error) - ("calc-stat" calc-vector-op calcFunc-agmean + ("calc-stat" calc-vector-op calcFunc-agmean calcFunc-rms calcFunc-vcorr calcFunc-vcount calcFunc-vcov calcFunc-vflat calcFunc-vgmean calcFunc-vhmean calcFunc-vmax calcFunc-vmean calcFunc-vmeane calcFunc-vmedian calcFunc-vmin calcFunc-vpcov @@ -1147,8 +1148,8 @@ calc-vector-covariance calc-vector-geometric-mean calc-vector-harmonic-mean calc-vector-max calc-vector-mean calc-vector-mean-error calc-vector-median calc-vector-min calc-vector-pop-covariance calc-vector-pop-sdev -calc-vector-pop-variance calc-vector-product calc-vector-sdev -calc-vector-sum calc-vector-variance) +calc-vector-pop-variance calc-vector-product calc-vector-rms +calc-vector-sdev calc-vector-sum calc-vector-variance) ("calc-store" calc-assign calc-copy-special-constant calc-copy-variable calc-declare-variable -- cgit v1.2.1 From fb875ee6ff20034944df04b83a147493db7ddeb3 Mon Sep 17 00:00:00 2001 From: Jay Belanger Date: Thu, 17 Sep 2015 22:22:18 -0500 Subject: Fix the routine for help on Calc's prefixes. * lisp/calc/calc-ext.el (calc-prefix-help-retry): New variable. (calc-do-prefix-help): Use `read-char' to determine the next Calc command. --- lisp/calc/calc-ext.el | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'lisp/calc/calc-ext.el') diff --git a/lisp/calc/calc-ext.el b/lisp/calc/calc-ext.el index 27898fd9c97..adbb20c82f8 100644 --- a/lisp/calc/calc-ext.el +++ b/lisp/calc/calc-ext.el @@ -1293,6 +1293,7 @@ calc-kill calc-kill-region calc-yank)))) (define-key calc-help-map "?" 'calc-help-for-help) (define-key calc-help-map "\C-h" 'calc-help-for-help)) +(defvar calc-prefix-help-retry nil) (defvar calc-prefix-help-phase 0) (defun calc-do-prefix-help (msgs group key) (if calc-full-help-flag @@ -1300,7 +1301,7 @@ calc-kill calc-kill-region calc-yank)))) (if (cdr msgs) (progn (setq calc-prefix-help-phase - (if (eq this-command last-command) + (if calc-prefix-help-retry (% (1+ calc-prefix-help-phase) (1+ (length msgs))) 0)) (let ((msg (nth calc-prefix-help-phase msgs))) @@ -1321,7 +1322,13 @@ calc-kill calc-kill-region calc-yank)))) (message "%s: %s: %c-" group (car msgs) key) (message "%s: (none) %c-" group key)) (message "%s: %s" group (car msgs)))) - (and key (calc-unread-command key)))) + (let* ((chr (read-char)) + (keys (if key (string key chr) (string chr))) + (bnd (local-key-binding keys))) + (setq calc-prefix-help-retry (= chr ??)) + (if bnd + (call-interactively bnd) + (message (concat keys " is undefined")))))) ;;;; Commands. -- cgit v1.2.1 From 404f3aff4f709641b45e5bcd61f91f860426e0cf Mon Sep 17 00:00:00 2001 From: Jay Belanger Date: Sat, 19 Sep 2015 21:44:45 -0500 Subject: * lisp/calc/calc-ext.el (calc-do-prefix-help): Tidy up error message. --- lisp/calc/calc-ext.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lisp/calc/calc-ext.el') diff --git a/lisp/calc/calc-ext.el b/lisp/calc/calc-ext.el index adbb20c82f8..83722e761b0 100644 --- a/lisp/calc/calc-ext.el +++ b/lisp/calc/calc-ext.el @@ -1323,12 +1323,13 @@ calc-kill calc-kill-region calc-yank)))) (message "%s: (none) %c-" group key)) (message "%s: %s" group (car msgs)))) (let* ((chr (read-char)) - (keys (if key (string key chr) (string chr))) - (bnd (local-key-binding keys))) + (bnd (local-key-binding (if key (string key chr) (string chr))))) (setq calc-prefix-help-retry (= chr ??)) (if bnd (call-interactively bnd) - (message (concat keys " is undefined")))))) + (if key + (message (concat (key-description (vector key chr)) " is undefined")) + (message (concat (key-description (vector chr)) " is undefined"))))))) ;;;; Commands. -- cgit v1.2.1 From ab11a1cf27ebe3791df45cccde3c851affd184dd Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 20 Sep 2015 09:40:35 -0700 Subject: Use %s to format strings instead of splicing them MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If FOO might contain quotes that are part of a file or variable name, the quotes should not be translated when showing FOO’s name in a diagnostic. So, for example, (message (concat (FOO ": bar"))) is not quite right, as it would translate FOO’s quotes. Change it to (message "%s: bar" FOO) instead. * lisp/allout.el (allout-process-exposed): * lisp/calc/calc-ext.el (calc-do-prefix-help): * lisp/calc/calc-store.el (calc-store-into): * lisp/calendar/todo-mode.el (todo-category-completions): * lisp/cedet/semantic/complete.el (semantic-completion-message): * lisp/org/ob-latex.el (convert-pdf): * lisp/org/org-crypt.el (org-crypt-check-auto-save): * lisp/org/ox-latex.el (org-latex-compile): * lisp/org/ox-man.el (org-man-compile): * lisp/org/ox-odt.el (org-odt--export-wrap): * lisp/org/ox-texinfo.el (org-texinfo-compile): * lisp/progmodes/ruby-mode.el (ruby-in-ppss-context-p): * lisp/progmodes/verilog-mode.el (verilog-batch-execute-func) (verilog-signals-combine-bus, verilog-read-defines) (verilog-getopt-file, verilog-expand-dirnames) (verilog-modi-lookup, verilog-modi-modport-lookup-one): * lisp/term/ns-win.el (ns-spi-service-call): Use %s to avoid translating quotes of file names etc. in diagnostics. --- lisp/calc/calc-ext.el | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lisp/calc/calc-ext.el') diff --git a/lisp/calc/calc-ext.el b/lisp/calc/calc-ext.el index 83722e761b0..933c446875e 100644 --- a/lisp/calc/calc-ext.el +++ b/lisp/calc/calc-ext.el @@ -1327,9 +1327,8 @@ calc-kill calc-kill-region calc-yank)))) (setq calc-prefix-help-retry (= chr ??)) (if bnd (call-interactively bnd) - (if key - (message (concat (key-description (vector key chr)) " is undefined")) - (message (concat (key-description (vector chr)) " is undefined"))))))) + (message "%s is undefined" + (key-description (if key (vector key chr) (vector chr)))))))) ;;;; Commands. -- cgit v1.2.1