2020-10-10 20:00:51 +00:00
|
|
|
|
;;; calc-store.el --- value storage functions for Calc -*- lexical-binding:t -*-
|
2001-11-19 07:44:56 +00:00
|
|
|
|
|
2020-01-01 00:19:43 +00:00
|
|
|
|
;; Copyright (C) 1990-1993, 2001-2020 Free Software Foundation, Inc.
|
2001-11-19 07:44:56 +00:00
|
|
|
|
|
|
|
|
|
;; Author: David Gillespie <daveg@synaptics.com>
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
|
2008-05-06 03:16:00 +00:00
|
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
2007-03-19 20:59:53 +00:00
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-06 03:16:00 +00:00
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
;; (at your option) any later version.
|
2007-03-19 20:59:53 +00:00
|
|
|
|
|
2001-11-06 18:59:06 +00:00
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
2007-03-19 20:59:53 +00:00
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2017-09-13 22:52:52 +00:00
|
|
|
|
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
2001-11-19 07:44:56 +00:00
|
|
|
|
;;; Commentary:
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
2001-11-19 07:44:56 +00:00
|
|
|
|
;;; Code:
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
;; This file is autoloaded from calc-ext.el.
|
|
|
|
|
|
2004-11-30 17:25:00 +00:00
|
|
|
|
(require 'calc-ext)
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(require 'calc-macs)
|
|
|
|
|
|
|
|
|
|
;;; Memory commands.
|
|
|
|
|
|
2001-11-19 07:44:56 +00:00
|
|
|
|
(defvar calc-store-keep nil)
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(defun calc-store (&optional var)
|
|
|
|
|
(interactive)
|
|
|
|
|
(let ((calc-store-keep t))
|
2001-11-14 09:09:09 +00:00
|
|
|
|
(calc-store-into var)))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
2001-11-19 07:44:56 +00:00
|
|
|
|
(defvar calc-given-value-flag nil)
|
2004-11-26 22:35:35 +00:00
|
|
|
|
(defvar calc-given-value)
|
|
|
|
|
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(defun calc-store-into (&optional var)
|
|
|
|
|
(interactive)
|
|
|
|
|
(calc-wrapper
|
|
|
|
|
(let ((calc-given-value nil)
|
|
|
|
|
(calc-given-value-flag 1))
|
|
|
|
|
(or var (setq var (calc-read-var-name "Store: " t)))
|
|
|
|
|
(if var
|
|
|
|
|
(let ((found (assq var '( ( + . calc-store-plus )
|
|
|
|
|
( - . calc-store-minus )
|
|
|
|
|
( * . calc-store-times )
|
|
|
|
|
( / . calc-store-div )
|
|
|
|
|
( ^ . calc-store-power )
|
|
|
|
|
( | . calc-store-concat ) ))))
|
|
|
|
|
(if found
|
|
|
|
|
(funcall (cdr found))
|
2005-05-15 05:20:59 +00:00
|
|
|
|
(let ((msg
|
|
|
|
|
(calc-store-value var (or calc-given-value (calc-top 1))
|
|
|
|
|
"" calc-given-value-flag)))
|
2015-09-20 16:40:35 +00:00
|
|
|
|
(message "Stored to variable \"%s\"%s"
|
|
|
|
|
(calc-var-name var) msg))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(setq var (calc-is-assignments (calc-top 1)))
|
|
|
|
|
(if var
|
|
|
|
|
(while var
|
2005-05-15 05:20:59 +00:00
|
|
|
|
(let ((msg
|
|
|
|
|
(calc-store-value (car (car var)) (cdr (car var))
|
|
|
|
|
(if (not (cdr var)) "")
|
|
|
|
|
(if (not (cdr var)) 1))))
|
2015-09-20 16:40:35 +00:00
|
|
|
|
(message "Stored to variable \"%s\"%s"
|
|
|
|
|
(calc-var-name (car (car var))) msg))
|
2001-11-14 09:09:09 +00:00
|
|
|
|
(setq var (cdr var))))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calc-store-plus (&optional var)
|
|
|
|
|
(interactive)
|
2001-11-14 09:09:09 +00:00
|
|
|
|
(calc-store-binary var "+" '+))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calc-store-minus (&optional var)
|
|
|
|
|
(interactive)
|
2001-11-14 09:09:09 +00:00
|
|
|
|
(calc-store-binary var "-" '-))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calc-store-times (&optional var)
|
|
|
|
|
(interactive)
|
2001-11-14 09:09:09 +00:00
|
|
|
|
(calc-store-binary var "*" '*))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calc-store-div (&optional var)
|
|
|
|
|
(interactive)
|
2001-11-14 09:09:09 +00:00
|
|
|
|
(calc-store-binary var "/" '/))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calc-store-power (&optional var)
|
|
|
|
|
(interactive)
|
2001-11-14 09:09:09 +00:00
|
|
|
|
(calc-store-binary var "^" '^))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calc-store-concat (&optional var)
|
|
|
|
|
(interactive)
|
2001-11-14 09:09:09 +00:00
|
|
|
|
(calc-store-binary var "|" '|))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calc-store-neg (n &optional var)
|
|
|
|
|
(interactive "p")
|
2001-11-14 09:09:09 +00:00
|
|
|
|
(calc-store-binary var "n" '/ (- n)))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calc-store-inv (n &optional var)
|
|
|
|
|
(interactive "p")
|
2001-11-14 09:09:09 +00:00
|
|
|
|
(calc-store-binary var "&" '^ (- n)))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calc-store-incr (n &optional var)
|
|
|
|
|
(interactive "p")
|
2001-11-14 09:09:09 +00:00
|
|
|
|
(calc-store-binary var "n" '- (- n)))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calc-store-decr (n &optional var)
|
|
|
|
|
(interactive "p")
|
2001-11-14 09:09:09 +00:00
|
|
|
|
(calc-store-binary var "n" '- n))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calc-store-value (var value tag &optional pop)
|
2005-05-15 05:20:59 +00:00
|
|
|
|
(let ((msg ""))
|
|
|
|
|
(if var
|
|
|
|
|
(let ((old (calc-var-value var)))
|
|
|
|
|
(set var value)
|
|
|
|
|
(if pop (or calc-store-keep (calc-pop-stack pop)))
|
|
|
|
|
(calc-record-undo (list 'store (symbol-name var) old))
|
|
|
|
|
(if tag
|
|
|
|
|
(let ((calc-full-trail-vectors nil))
|
|
|
|
|
(calc-record value (format ">%s%s" tag (calc-var-name var)))))
|
|
|
|
|
(cond
|
|
|
|
|
((and (memq var '(var-e var-i var-pi var-phi var-gamma))
|
|
|
|
|
(eq (car-safe old) 'special-const))
|
2007-09-26 00:07:05 +00:00
|
|
|
|
(setq msg (format " (Note: Built-in definition of %s has been lost)"
|
2005-05-15 05:20:59 +00:00
|
|
|
|
(calc-var-name var))))
|
|
|
|
|
((and (memq var '(var-inf var-uinf var-nan))
|
|
|
|
|
(null old))
|
|
|
|
|
(setq msg (format " (Note: %s has built-in meanings which may interfere)"
|
|
|
|
|
(calc-var-name var)))))
|
|
|
|
|
(calc-refresh-evaltos var)))
|
|
|
|
|
msg))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calc-var-name (var)
|
|
|
|
|
(if (symbolp var) (setq var (symbol-name var)))
|
|
|
|
|
(if (string-match "\\`var-." var)
|
|
|
|
|
(substring var 4)
|
2001-11-14 09:09:09 +00:00
|
|
|
|
var))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calc-store-binary (var tag func &optional val)
|
|
|
|
|
(calc-wrapper
|
|
|
|
|
(let ((calc-simplify-mode (if (eq calc-simplify-mode 'none)
|
|
|
|
|
'num calc-simplify-mode))
|
|
|
|
|
(value (or val (calc-top 1))))
|
|
|
|
|
(or var (setq var (calc-read-var-name (format "Store %s: " tag))))
|
|
|
|
|
(if var
|
|
|
|
|
(let ((old (calc-var-value var)))
|
2005-05-15 05:20:59 +00:00
|
|
|
|
(if (eq (car-safe old) 'special-const)
|
|
|
|
|
(error "\"%s\" is a special constant" (calc-var-name var)))
|
|
|
|
|
(if (not old)
|
|
|
|
|
(if (memq var '(var-inf var-uinf var-nan))
|
|
|
|
|
(error "\"%s\" is a special variable" (calc-var-name var))
|
|
|
|
|
(error "No such variable: \"%s\"" (calc-var-name var))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(if (stringp old)
|
|
|
|
|
(setq old (math-read-expr old)))
|
|
|
|
|
(if (eq (car-safe old) 'error)
|
|
|
|
|
(error "Bad format in variable contents: %s" (nth 2 old)))
|
|
|
|
|
(calc-store-value var
|
|
|
|
|
(calc-normalize (if (calc-is-inverse)
|
|
|
|
|
(list func value old)
|
|
|
|
|
(list func old value)))
|
|
|
|
|
tag (and (not val) 1))
|
2005-05-15 05:20:59 +00:00
|
|
|
|
(message "Variable \"%s\" changed" (calc-var-name var)))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
2004-11-26 22:35:35 +00:00
|
|
|
|
(defvar calc-var-name-map nil "Keymap for reading Calc variable names.")
|
|
|
|
|
(if calc-var-name-map
|
|
|
|
|
()
|
|
|
|
|
(setq calc-var-name-map (copy-keymap minibuffer-local-completion-map))
|
|
|
|
|
(define-key calc-var-name-map " " 'self-insert-command)
|
2007-09-26 00:07:05 +00:00
|
|
|
|
(mapc (function
|
|
|
|
|
(lambda (x)
|
|
|
|
|
(define-key calc-var-name-map (char-to-string x)
|
|
|
|
|
'calcVar-digit)))
|
|
|
|
|
"0123456789")
|
|
|
|
|
(mapc (function
|
|
|
|
|
(lambda (x)
|
|
|
|
|
(define-key calc-var-name-map (char-to-string x)
|
|
|
|
|
'calcVar-oper)))
|
|
|
|
|
"+-*/^|"))
|
2004-11-26 22:35:35 +00:00
|
|
|
|
|
|
|
|
|
(defvar calc-store-opers)
|
|
|
|
|
|
2008-03-26 20:26:50 +00:00
|
|
|
|
(defvar calc-read-var-name-history nil
|
|
|
|
|
"History for reading variable names.")
|
|
|
|
|
|
2020-10-10 20:00:51 +00:00
|
|
|
|
(defun calc-read-var-name (prompt &optional store-opers)
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(setq calc-given-value nil
|
|
|
|
|
calc-aborted-prefix nil)
|
2020-10-10 20:00:51 +00:00
|
|
|
|
(let* ((calc-store-opers store-opers)
|
|
|
|
|
(var (concat
|
2004-12-27 05:02:08 +00:00
|
|
|
|
"var-"
|
|
|
|
|
(let ((minibuffer-completion-table
|
2007-09-26 00:07:05 +00:00
|
|
|
|
(mapcar (lambda (x) (substring x 4))
|
2004-12-27 05:02:08 +00:00
|
|
|
|
(all-completions "var-" obarray)))
|
2007-09-26 00:07:05 +00:00
|
|
|
|
(minibuffer-completion-predicate
|
2004-12-27 05:02:08 +00:00
|
|
|
|
(lambda (x) (boundp (intern (concat "var-" x)))))
|
|
|
|
|
(minibuffer-completion-confirm t))
|
2010-06-22 07:41:10 +00:00
|
|
|
|
(read-from-minibuffer
|
|
|
|
|
prompt nil calc-var-name-map nil
|
2008-03-26 20:26:50 +00:00
|
|
|
|
'calc-read-var-name-history)))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(setq calc-aborted-prefix "")
|
2004-12-27 05:02:08 +00:00
|
|
|
|
(and (not (equal var "var-"))
|
2010-05-15 04:50:25 +00:00
|
|
|
|
(if (string-match "\\`\\([-a-zA-Zα-ωΑ-Ω0-9]+\\) *:?=" var)
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(if (null calc-given-value-flag)
|
|
|
|
|
(error "Assignment is not allowed in this command")
|
|
|
|
|
(let ((svar (intern (substring var 0 (match-end 1)))))
|
|
|
|
|
(setq calc-given-value-flag 0
|
|
|
|
|
calc-given-value (math-read-expr
|
|
|
|
|
(substring var (match-end 0))))
|
|
|
|
|
(if (eq (car-safe calc-given-value) 'error)
|
|
|
|
|
(error "Bad format: %s" (nth 2 calc-given-value)))
|
|
|
|
|
(setq calc-given-value (math-evaluate-expr calc-given-value))
|
|
|
|
|
svar))
|
2001-11-14 09:09:09 +00:00
|
|
|
|
(intern var)))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calcVar-digit ()
|
|
|
|
|
(interactive)
|
2004-12-31 20:36:48 +00:00
|
|
|
|
(if (calc-minibuffer-contains "\\'")
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(if (eq calc-store-opers 0)
|
|
|
|
|
(beep)
|
|
|
|
|
(insert "q")
|
|
|
|
|
(self-insert-and-exit))
|
2001-11-14 09:09:09 +00:00
|
|
|
|
(self-insert-command 1)))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calcVar-oper ()
|
|
|
|
|
(interactive)
|
|
|
|
|
(if (and (eq calc-store-opers t)
|
2004-12-31 20:36:48 +00:00
|
|
|
|
(calc-minibuffer-contains "\\'"))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(progn
|
|
|
|
|
(erase-buffer)
|
|
|
|
|
(self-insert-and-exit))
|
2001-11-14 09:09:09 +00:00
|
|
|
|
(self-insert-command 1)))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calc-store-map (&optional oper var)
|
|
|
|
|
(interactive)
|
|
|
|
|
(calc-wrapper
|
2012-09-20 03:44:57 +00:00
|
|
|
|
(let* ((calc-dollar-values (mapcar #'calc-get-stack-element
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(nthcdr calc-stack-top calc-stack)))
|
|
|
|
|
(calc-dollar-used 0)
|
|
|
|
|
(oper (or oper (calc-get-operator "Store Mapping")))
|
|
|
|
|
(nargs (car oper)))
|
|
|
|
|
(or var (setq var (calc-read-var-name (format "Store Mapping %s: "
|
|
|
|
|
(nth 2 oper)))))
|
|
|
|
|
(if var
|
2005-05-15 05:20:59 +00:00
|
|
|
|
(let ((old (calc-var-value var)))
|
|
|
|
|
(if (eq (car-safe old) 'special-const)
|
|
|
|
|
(error "\"%s\" is a special constant" (calc-var-name var)))
|
|
|
|
|
(if (not old)
|
|
|
|
|
(if (memq var '(var-inf var-uinf var-nan))
|
|
|
|
|
(error "\"%s\" is a special variable" (calc-var-name var))
|
|
|
|
|
(error "No such variable: \"%s\"" (calc-var-name var))))
|
|
|
|
|
(let ((calc-simplify-mode (if (eq calc-simplify-mode 'none)
|
|
|
|
|
'num calc-simplify-mode))
|
|
|
|
|
(values (and (> nargs 1)
|
|
|
|
|
(calc-top-list (1- nargs) (1+ calc-dollar-used)))))
|
|
|
|
|
(message "Working...")
|
|
|
|
|
(calc-set-command-flag 'clear-message)
|
|
|
|
|
(if (stringp old)
|
|
|
|
|
(setq old (math-read-expr old)))
|
|
|
|
|
(if (eq (car-safe old) 'error)
|
|
|
|
|
(error "Bad format in variable contents: %s" (nth 2 old)))
|
|
|
|
|
(setq values (if (calc-is-inverse)
|
|
|
|
|
(append values (list old))
|
|
|
|
|
(append (list old) values)))
|
|
|
|
|
(calc-store-value var
|
|
|
|
|
(calc-normalize (cons (nth 1 oper) values))
|
|
|
|
|
(nth 2 oper)
|
|
|
|
|
(+ calc-dollar-used (1- nargs)))
|
|
|
|
|
(message "Variable \"%s\" changed" (calc-var-name var))))))))
|
|
|
|
|
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calc-store-exchange (&optional var)
|
|
|
|
|
(interactive)
|
|
|
|
|
(calc-wrapper
|
|
|
|
|
(let ((calc-given-value nil)
|
|
|
|
|
(calc-given-value-flag 1)
|
|
|
|
|
top)
|
|
|
|
|
(or var (setq var (calc-read-var-name "Exchange with: ")))
|
|
|
|
|
(if var
|
|
|
|
|
(let ((value (calc-var-value var)))
|
|
|
|
|
(if (eq (car-safe value) 'special-const)
|
2005-05-15 05:20:59 +00:00
|
|
|
|
(error "\"%s\" is a special constant" (calc-var-name var)))
|
|
|
|
|
(if (not value)
|
|
|
|
|
(if (memq var '(var-inf var-uinf var-nan))
|
|
|
|
|
(error "\"%s\" is a special variable" (calc-var-name var))
|
|
|
|
|
(error "No such variable: \"%s\"" (calc-var-name var))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(setq top (or calc-given-value (calc-top 1)))
|
|
|
|
|
(calc-store-value var top nil)
|
|
|
|
|
(calc-pop-push-record calc-given-value-flag
|
2001-11-14 09:09:09 +00:00
|
|
|
|
(concat "<>" (calc-var-name var)) value))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calc-unstore (&optional var)
|
|
|
|
|
(interactive)
|
|
|
|
|
(calc-wrapper
|
|
|
|
|
(or var (setq var (calc-read-var-name "Unstore: ")))
|
|
|
|
|
(if var
|
|
|
|
|
(progn
|
|
|
|
|
(and (memq var '(var-e var-i var-pi var-phi var-gamma))
|
|
|
|
|
(eq (car-safe (calc-var-value var)) 'special-const)
|
|
|
|
|
(message "(Note: Built-in definition of %s has been lost)" var))
|
|
|
|
|
(if (and (boundp var) (symbol-value var))
|
|
|
|
|
(message "Unstored variable \"%s\"" (calc-var-name var))
|
|
|
|
|
(message "Variable \"%s\" remains unstored" (calc-var-name var)))
|
|
|
|
|
(makunbound var)
|
2001-11-14 09:09:09 +00:00
|
|
|
|
(calc-refresh-evaltos var)))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calc-let (&optional var)
|
|
|
|
|
(interactive)
|
|
|
|
|
(calc-wrapper
|
|
|
|
|
(let* ((calc-given-value nil)
|
|
|
|
|
(calc-given-value-flag 1)
|
|
|
|
|
thing value)
|
|
|
|
|
(or var (setq var (calc-read-var-name "Let variable: ")))
|
|
|
|
|
(if calc-given-value
|
|
|
|
|
(setq value calc-given-value
|
|
|
|
|
thing (calc-top 1))
|
|
|
|
|
(setq value (calc-top 1)
|
|
|
|
|
thing (calc-top 2)))
|
|
|
|
|
(setq var (if var
|
|
|
|
|
(list (cons var value))
|
|
|
|
|
(calc-is-assignments value)))
|
|
|
|
|
(if var
|
|
|
|
|
(calc-pop-push-record
|
|
|
|
|
(1+ calc-given-value-flag)
|
|
|
|
|
(concat "=" (calc-var-name (car (car var))))
|
|
|
|
|
(let ((saved-val (mapcar (function
|
|
|
|
|
(lambda (v)
|
|
|
|
|
(and (boundp (car v))
|
|
|
|
|
(symbol-value (car v)))))
|
|
|
|
|
var)))
|
|
|
|
|
(unwind-protect
|
|
|
|
|
(let ((vv var))
|
|
|
|
|
(while vv
|
|
|
|
|
(set (car (car vv)) (calc-normalize (cdr (car vv))))
|
|
|
|
|
(calc-refresh-evaltos (car (car vv)))
|
|
|
|
|
(setq vv (cdr vv)))
|
|
|
|
|
(math-evaluate-expr thing))
|
|
|
|
|
(while saved-val
|
|
|
|
|
(if (car saved-val)
|
|
|
|
|
(set (car (car var)) (car saved-val))
|
|
|
|
|
(makunbound (car (car var))))
|
|
|
|
|
(setq saved-val (cdr saved-val)
|
|
|
|
|
var (cdr var)))
|
2001-11-14 09:09:09 +00:00
|
|
|
|
(calc-handle-whys))))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calc-is-assignments (value)
|
|
|
|
|
(if (memq (car-safe value) '(calcFunc-eq calcFunc-assign))
|
|
|
|
|
(and (eq (car-safe (nth 1 value)) 'var)
|
|
|
|
|
(list (cons (nth 2 (nth 1 value)) (nth 2 value))))
|
|
|
|
|
(if (eq (car-safe value) 'vec)
|
|
|
|
|
(let ((vv nil))
|
|
|
|
|
(while (and (setq value (cdr value))
|
|
|
|
|
(memq (car-safe (car value))
|
|
|
|
|
'(calcFunc-eq calcFunc-assign))
|
|
|
|
|
(eq (car-safe (nth 1 (car value))) 'var))
|
|
|
|
|
(setq vv (cons (cons (nth 2 (nth 1 (car value)))
|
|
|
|
|
(nth 2 (car value)))
|
|
|
|
|
vv)))
|
|
|
|
|
(and (not value)
|
2001-11-14 09:09:09 +00:00
|
|
|
|
vv)))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calc-recall (&optional var)
|
|
|
|
|
(interactive)
|
|
|
|
|
(calc-wrapper
|
|
|
|
|
(or var (setq var (calc-read-var-name "Recall: ")))
|
|
|
|
|
(if var
|
|
|
|
|
(let ((value (calc-var-value var)))
|
|
|
|
|
(or value
|
|
|
|
|
(error "No such variable: \"%s\"" (calc-var-name var)))
|
|
|
|
|
(if (stringp value)
|
|
|
|
|
(setq value (math-read-expr value)))
|
|
|
|
|
(if (eq (car-safe value) 'error)
|
|
|
|
|
(error "Bad format in variable contents: %s" (nth 2 value)))
|
|
|
|
|
(setq value (calc-normalize value))
|
|
|
|
|
(let ((calc-full-trail-vectors nil))
|
|
|
|
|
(calc-record value (concat "<" (calc-var-name var))))
|
2001-11-14 09:09:09 +00:00
|
|
|
|
(calc-push value)))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calc-store-quick ()
|
|
|
|
|
(interactive)
|
2009-01-09 03:57:12 +00:00
|
|
|
|
(calc-store (intern (format "var-q%c" last-command-event))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calc-store-into-quick ()
|
|
|
|
|
(interactive)
|
2009-01-09 03:57:12 +00:00
|
|
|
|
(calc-store-into (intern (format "var-q%c" last-command-event))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calc-recall-quick ()
|
|
|
|
|
(interactive)
|
2009-01-09 03:57:12 +00:00
|
|
|
|
(calc-recall (intern (format "var-q%c" last-command-event))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
2005-05-16 03:55:11 +00:00
|
|
|
|
(defun calc-copy-special-constant (&optional sconst var)
|
|
|
|
|
(interactive)
|
|
|
|
|
(let ((sc '(("")
|
|
|
|
|
("e" . (special-const (math-e)))
|
|
|
|
|
("pi" . (special-const (math-pi)))
|
|
|
|
|
("i" . (special-const (math-imaginary 1)))
|
|
|
|
|
("phi" . (special-const (math-phi)))
|
|
|
|
|
("gamma" . (special-const (math-gamma-const))))))
|
|
|
|
|
(calc-wrapper
|
|
|
|
|
(or sconst (setq sconst (completing-read "Special constant: " sc nil t)))
|
|
|
|
|
(unless (string= sconst "")
|
|
|
|
|
(let ((value (cdr (assoc sconst sc))))
|
|
|
|
|
(or var (setq var (calc-read-var-name
|
2007-09-26 00:07:05 +00:00
|
|
|
|
(format "Copy special constant %s, to: "
|
2005-05-16 03:55:11 +00:00
|
|
|
|
sconst))))
|
|
|
|
|
(if var
|
|
|
|
|
(let ((msg (calc-store-value var value "")))
|
2019-03-07 17:02:15 +00:00
|
|
|
|
(message "Special constant \"%s\" copied to \"%s\"%s"
|
|
|
|
|
sconst (calc-var-name var) msg))))))))
|
2005-05-16 03:55:11 +00:00
|
|
|
|
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(defun calc-copy-variable (&optional var1 var2)
|
|
|
|
|
(interactive)
|
|
|
|
|
(calc-wrapper
|
|
|
|
|
(or var1 (setq var1 (calc-read-var-name "Copy variable: ")))
|
|
|
|
|
(if var1
|
|
|
|
|
(let ((value (calc-var-value var1)))
|
|
|
|
|
(or value
|
2004-12-30 17:43:09 +00:00
|
|
|
|
(error "No such variable: \"%s\"" (calc-var-name var1)))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(or var2 (setq var2 (calc-read-var-name
|
2007-09-26 00:07:05 +00:00
|
|
|
|
(format "Copy variable: %s, to: "
|
2004-12-30 17:43:09 +00:00
|
|
|
|
(calc-var-name var1)))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(if var2
|
2005-05-15 05:20:59 +00:00
|
|
|
|
(let ((msg (calc-store-value var2 value "")))
|
2015-09-20 16:40:35 +00:00
|
|
|
|
(message "Variable \"%s\" copied to \"%s\"%s"
|
|
|
|
|
(calc-var-name var1) (calc-var-name var2) msg)))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
2001-11-19 07:44:56 +00:00
|
|
|
|
(defvar calc-last-edited-variable nil)
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(defun calc-edit-variable (&optional var)
|
|
|
|
|
(interactive)
|
|
|
|
|
(calc-wrapper
|
Use `format-prompt' when prompting with default values
* lisp/woman.el (woman-file-name):
* lisp/wid-edit.el (widget-file-prompt-value)
(widget-coding-system-prompt-value):
* lisp/w32-fns.el (w32-set-system-coding-system):
* lisp/vc/vc.el (vc-print-root-log):
* lisp/vc/vc-annotate.el (vc-annotate):
* lisp/vc/emerge.el (emerge-read-file-name):
* lisp/vc/ediff.el (ediff-directories)
(ediff-directory-revisions, ediff-directories3)
(ediff-merge-directories, )
(ediff-merge-directories-with-ancestor)
(ediff-merge-directory-revisions)
(ediff-merge-directory-revisions-with-ancestor)
(ediff-merge-revisions, ediff-merge-revisions-with-ancestor)
(ediff-revision):
* lisp/vc/ediff-util.el (ediff-toggle-regexp-match):
* lisp/vc/ediff-mult.el (ediff-filegroup-action):
* lisp/vc/add-log.el (prompt-for-change-log-name):
* lisp/textmodes/table.el (table-insert-row-column)
(table-span-cell, table-split-cell-horizontally)
(table-split-cell, table-justify, table-generate-source)
(table-insert-sequence, table-capture)
(table--read-from-minibuffer, table--query-justification):
* lisp/textmodes/sgml-mode.el (sgml-tag, sgml-tag-help):
* lisp/textmodes/reftex-ref.el (reftex-goto-label):
* lisp/textmodes/refer.el (refer-get-bib-files):
* lisp/textmodes/css-mode.el (css-lookup-symbol):
* lisp/term.el (serial-read-name, serial-read-speed):
* lisp/speedbar.el (speedbar-change-initial-expansion-list):
* lisp/simple.el (previous-matching-history-element)
(set-variable):
* lisp/ses.el (ses-read-cell, ses-set-column-width):
* lisp/replace.el (query-replace-read-from)
(occur-read-primary-args):
* lisp/rect.el (string-rectangle, string-insert-rectangle):
* lisp/progmodes/tcl.el (tcl-help-on-word):
* lisp/progmodes/sh-script.el (sh-set-shell):
* lisp/progmodes/python.el (python-eldoc-at-point):
* lisp/progmodes/octave.el (octave-completing-read)
(octave-update-function-file-comment, octave-insert-defun):
* lisp/progmodes/inf-lisp.el (lisp-symprompt):
* lisp/progmodes/cperl-mode.el (cperl-info-on-command)
(cperl-perldoc):
* lisp/progmodes/compile.el (compilation-find-file):
* lisp/net/rcirc.el (rcirc-prompt-for-encryption):
* lisp/net/eww.el (eww):
* lisp/net/browse-url.el (browse-url-with-browser-kind):
* lisp/man.el (man):
* lisp/mail/sendmail.el (sendmail-query-user-about-smtp):
* lisp/mail/mailalias.el (build-mail-aliases):
* lisp/mail/mailabbrev.el (merge-mail-abbrevs)
(rebuild-mail-abbrevs):
* lisp/locate.el (locate-prompt-for-search-string):
* lisp/isearch.el (isearch-occur):
* lisp/international/ogonek.el (ogonek-read-encoding)
(ogonek-read-prefix):
* lisp/international/mule.el (read-buffer-file-coding-system)
(set-terminal-coding-system, set-keyboard-coding-system)
(set-next-selection-coding-system, recode-region):
* lisp/international/mule-cmds.el ()
(universal-coding-system-argument, search-unencodable-char)
(select-safe-coding-system-interactively):
* lisp/info.el (Info-search, Info-search-backward, Info-menu):
* lisp/info-look.el (info-lookup-interactive-arguments):
* lisp/imenu.el (imenu--completion-buffer):
* lisp/ibuf-ext.el (mode, used-mode, ibuffer-mark-by-mode):
* lisp/hi-lock.el (hi-lock-unface-buffer)
(hi-lock-read-face-name):
* lisp/help.el (view-emacs-news, where-is):
* lisp/help-fns.el (describe-variable, describe-symbol)
(describe-keymap):
* lisp/gnus/mm-decode.el (mm-save-part):
* lisp/gnus/gnus-sum.el (gnus-summary-browse-url):
* lisp/gnus/gnus-group.el (gnus-group--read-bug-ids)
(gnus-group-set-current-level):
* lisp/frame.el (make-frame-on-monitor)
(close-display-connection, select-frame-by-name):
* lisp/format.el (format-encode-buffer, format-encode-region):
* lisp/files.el (recode-file-name):
* lisp/files-x.el (read-file-local-variable)
(read-file-local-variable-value, )
(read-file-local-variable-mode):
* lisp/ffap.el (ffap-menu-ask):
* lisp/faces.el (face-read-string):
* lisp/facemenu.el (facemenu-set-charset):
* lisp/erc/erc-dcc.el (erc-dcc-do-GET-command):
* lisp/emulation/edt-mapper.el (edt-mapper):
* lisp/emacs-lisp/trace.el (trace--read-args)
(trace-function-foreground, trace-function-background):
* lisp/emacs-lisp/smie.el (smie-config-set-indent):
* lisp/emacs-lisp/re-builder.el (reb-change-syntax):
* lisp/emacs-lisp/package.el (describe-package):
* lisp/emacs-lisp/find-func.el (read-library-name)
(find-function-read):
* lisp/emacs-lisp/ert.el (ert-read-test-name)
(ert-run-tests-interactively):
* lisp/emacs-lisp/disass.el (disassemble):
* lisp/emacs-lisp/debug.el (debug-on-entry)
(debug-on-variable-change):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-read-regexp):
* lisp/dired-x.el (dired--mark-suffix-interactive-spec):
* lisp/dired-aux.el (dired-diff):
* lisp/cus-edit.el (custom-variable-prompt, customize-mode)
(customize-changed-options):
* lisp/completion.el (interactive-completion-string-reader):
* lisp/calendar/timeclock.el (timeclock-ask-for-project):
* lisp/calc/calcalg3.el (calc-get-fit-variables):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-bin.el (calc-word-size):
* lisp/bookmark.el (bookmark-set-internal):
* lisp/abbrev.el (read-abbrev-file): Use `format-prompt' for
prompting (bug#12443).
2020-09-06 14:56:44 +00:00
|
|
|
|
(unless var
|
|
|
|
|
(setq var (calc-read-var-name
|
|
|
|
|
(format-prompt "Edit" (and calc-last-edited-variable
|
|
|
|
|
(calc-var-name
|
|
|
|
|
calc-last-edited-variable))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(or var (setq var calc-last-edited-variable))
|
|
|
|
|
(if var
|
|
|
|
|
(let* ((value (calc-var-value var)))
|
|
|
|
|
(if (eq (car-safe value) 'special-const)
|
|
|
|
|
(error "%s is a special constant" var))
|
|
|
|
|
(setq calc-last-edited-variable var)
|
|
|
|
|
(calc-edit-mode (list 'calc-finish-stack-edit (list 'quote var))
|
|
|
|
|
t
|
More-conservative ‘format’ quote restyling
Instead of restyling curved quotes for every call to ‘format’,
create a new function ‘format-message’ that does the restyling,
and using the new function instead of ‘format’ only in contexts
where this seems appropriate.
Problem reported by Dmitry Gutov and Andreas Schwab in:
http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00826.html
http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00827.html
* doc/lispref/commands.texi (Using Interactive):
* doc/lispref/control.texi (Signaling Errors, Signaling Errors):
* doc/lispref/display.texi (Displaying Messages, Progress):
* doc/lispref/elisp.texi:
* doc/lispref/help.texi (Keys in Documentation):
* doc/lispref/minibuf.texi (Minibuffer Misc):
* doc/lispref/strings.texi (Formatting Strings):
* etc/NEWS:
Document the changes.
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/apropos.el (apropos-library):
* lisp/calc/calc-ext.el (calc-record-message)
(calc-user-function-list):
* lisp/calc/calc-help.el (calc-describe-key, calc-full-help):
* lisp/calc/calc-lang.el (math-read-big-balance):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--add-diary-entry):
* lisp/cedet/mode-local.el (mode-local-print-binding)
(mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-completion-message):
* lisp/cedet/semantic/edit.el (semantic-parse-changes-failed):
* lisp/cedet/semantic/wisent/comp.el (wisent-log):
* lisp/cedet/srecode/insert.el (srecode-insert-show-error-report):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dframe.el (dframe-message):
* lisp/dired-aux.el (dired-query):
* lisp/emacs-lisp/byte-opt.el (byte-compile-log-lap-1):
* lisp/emacs-lisp/bytecomp.el (byte-compile-log)
(byte-compile-log-file, byte-compile-warn, byte-compile-form):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use)
(cconv-analyze-form):
* lisp/emacs-lisp/check-declare.el (check-declare-warn):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine):
* lisp/emacs-lisp/cl-macs.el (cl-symbol-macrolet):
* lisp/emacs-lisp/edebug.el (edebug-format):
* lisp/emacs-lisp/eieio-core.el (eieio-oref):
* lisp/emacs-lisp/eldoc.el (eldoc-minibuffer-message)
(eldoc-message):
* lisp/emacs-lisp/elint.el (elint-file, elint-log):
* lisp/emacs-lisp/find-func.el (find-function-library):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring):
* lisp/emacs-lisp/package.el (package-compute-transaction)
(package-install-button-action, package-delete-button-action)
(package-menu--list-to-prompt):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emacs-lisp/warnings.el (lwarn, warn):
* lisp/emulation/viper-cmd.el:
(viper-toggle-parse-sexp-ignore-comments)
(viper-kill-buffer, viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/facemenu.el (facemenu-add-new-face):
* lisp/faces.el (face-documentation, read-face-name)
(face-read-string, read-face-font, describe-face):
* lisp/files.el (find-alternate-file, hack-local-variables)
(hack-one-local-variable--obsolete, write-file)
(basic-save-buffer, delete-directory):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--obsolete)
(help-fns--interactive-only, describe-function-1)
(describe-variable):
* lisp/help.el (describe-mode):
* lisp/info-xref.el (info-xref-output):
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
* lisp/international/kkc.el (kkc-error):
* lisp/international/mule-cmds.el:
(select-safe-coding-system-interactively)
(select-safe-coding-system, describe-input-method):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/international/quail.el (quail-error):
* lisp/minibuffer.el (minibuffer-message):
* lisp/mpc.el (mpc--debug):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-message):
* lisp/net/gnutls.el (gnutls-message-maybe):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/nsm.el (nsm-query-user):
* lisp/net/rlogin.el (rlogin):
* lisp/net/soap-client.el (soap-warning):
* lisp/net/tramp.el (tramp-debug-message):
* lisp/nxml/nxml-outln.el (nxml-report-outline-error):
* lisp/nxml/nxml-parse.el (nxml-parse-error):
* lisp/nxml/rng-cmpct.el (rng-c-error):
* lisp/nxml/rng-match.el (rng-compile-error):
* lisp/nxml/rng-uri.el (rng-uri-error):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/org/org-ctags.el:
(org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/proced.el (proced-log):
* lisp/progmodes/ebnf2ps.el (ebnf-log):
* lisp/progmodes/flymake.el (flymake-log):
* lisp/progmodes/vhdl-mode.el (vhdl-warning-when-idle):
* lisp/replace.el (occur-1):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, define-alternatives):
* lisp/startup.el (command-line):
* lisp/subr.el (error, user-error, add-to-list):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* src/callint.c (Fcall_interactively):
* src/editfns.c (Fmessage, Fmessage_box):
Restyle the quotes of format strings intended for use as a
diagnostic, when restyling seems appropriate.
* lisp/subr.el (format-message): New function.
* src/doc.c (Finternal__text_restyle): New function.
(syms_of_doc): Define it.
2015-08-24 05:38:02 +00:00
|
|
|
|
(format-message
|
Go back to grave quoting in source-code docstrings etc.
This reverts almost all my recent changes to use curved quotes
in docstrings and/or strings used for error diagnostics.
There are a few exceptions, e.g., Bahá’í proper names.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet)
(outlineify-sticky):
* lisp/apropos.el (apropos-library):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/button.el (button-category-symbol, button-put)
(make-text-button):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-embed.el (calc-do-embedded):
* lisp/calc/calc-ext.el (calc-user-function-list):
* lisp/calc/calc-graph.el (calc-graph-show-dumb):
* lisp/calc/calc-help.el (calc-describe-key)
(calc-describe-thing, calc-full-help):
* lisp/calc/calc-lang.el (calc-c-language)
(math-parse-fortran-vector-end, math-parse-tex-sum)
(math-parse-eqn-matrix, math-parse-eqn-prime)
(calc-yacas-language, calc-maxima-language, calc-giac-language)
(math-read-giac-subscr, math-read-math-subscr)
(math-read-big-rec, math-read-big-balance):
* lisp/calc/calc-misc.el (calc-help, report-calc-bug):
* lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
(calc-auto-recompute):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part, calc-user-define-invocation)
(math-do-arg-check):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-vec.el (math-read-brackets):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/diary-lib.el (diary-check-diary-file)
(diary-mail-entries, diary-from-outlook):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical)
(icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--add-diary-entry):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/timeclock.el (timeclock-mode-line-display)
(timeclock-make-hours-explicit, timeclock-log-data):
* lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
(todo-item-mark, todo-check-format)
(todo-insert-item--next-param, todo-edit-item--next-key)
(todo-mode):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/mode-local.el (describe-mode-local-overload)
(mode-local-print-binding, mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
* lisp/cus-start.el (standard):
* lisp/cus-theme.el (describe-theme-1):
* lisp/custom.el (custom-add-dependencies, custom-check-theme)
(custom--sort-vars-1, load-theme):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
(ad-disable-advice, ad-remove-advice, ad-set-argument)
(ad-set-arguments, ad--defalias-fset, ad-activate)
(ad-deactivate):
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-compile-unfold-lambda, byte-optimize-form-code-walker)
(byte-optimize-while, byte-optimize-apply):
* lisp/emacs-lisp/byte-run.el (defun, defsubst):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
(byte-compile-log-file, byte-compile-format-warn)
(byte-compile-nogroup-warn, byte-compile-arglist-warn)
(byte-compile-cl-warn)
(byte-compile-warn-about-unresolved-functions)
(byte-compile-file, byte-compile--declare-var)
(byte-compile-file-form-defmumble, byte-compile-form)
(byte-compile-normal-call, byte-compile-check-variable)
(byte-compile-variable-ref, byte-compile-variable-set)
(byte-compile-subr-wrong-args, byte-compile-setq-default)
(byte-compile-negation-optimizer)
(byte-compile-condition-case--old)
(byte-compile-condition-case--new, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form)
(byte-compile-make-variable-buffer-local, display-call-tree)
(batch-byte-compile):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use):
* lisp/emacs-lisp/chart.el (chart-space-usage):
* lisp/emacs-lisp/check-declare.el (check-declare-scan)
(check-declare-warn, check-declare-file)
(check-declare-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
(checkdoc-message-text-engine):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer)
(cl--describe-class):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
(cl--generic-describe, cl-generic-generalizers):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
(cl-symbol-macrolet):
* lisp/emacs-lisp/cl.el (cl-unload-function, flet):
* lisp/emacs-lisp/copyright.el (copyright)
(copyright-update-directory):
* lisp/emacs-lisp/edebug.el (edebug-read-list):
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
* lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
(eieio-oref):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
* lisp/emacs-lisp/eieio-speedbar.el:
(eieio-speedbar-child-make-tag-lines)
(eieio-speedbar-child-description):
* lisp/emacs-lisp/eieio.el (defclass, change-class):
* lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
(elint-init-form, elint-check-defalias-form)
(elint-check-let-form):
* lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-describe-test):
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
(find-function-library):
* lisp/emacs-lisp/generator.el (iter-yield):
* lisp/emacs-lisp/gv.el (gv-define-simple-setter):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring)
(advice--make, define-advice):
* lisp/emacs-lisp/package-x.el (package-upload-file):
* lisp/emacs-lisp/package.el (package-version-join)
(package-disabled-p, package-activate-1, package-activate)
(package--download-one-archive)
(package--download-and-read-archives)
(package-compute-transaction, package-install-from-archive)
(package-install, package-install-selected-packages)
(package-delete, package-autoremove, describe-package-1)
(package-install-button-action, package-delete-button-action)
(package-menu-hide-package, package-menu--list-to-prompt)
(package-menu--perform-transaction)
(package-menu--find-and-notify-upgrades):
* lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
* lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
* lisp/emacs-lisp/ring.el (ring-previous, ring-next):
* lisp/emacs-lisp/rx.el (rx-check, rx-anything)
(rx-check-any-string, rx-check-any, rx-check-not, rx-=)
(rx-repeat, rx-check-backref, rx-syntax, rx-check-category)
(rx-form):
* lisp/emacs-lisp/smie.el (smie-config-save):
* lisp/emacs-lisp/subr-x.el (internal--check-binding):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
* lisp/emacs-lisp/testcover.el (testcover-1value):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments)
(viper-toggle-search-style, viper-kill-buffer)
(viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/env.el (setenv):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp)
(eshell-glob-entries):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/facemenu.el (facemenu-add-new-face)
(facemenu-add-new-color):
* lisp/faces.el (read-face-name, read-face-font, describe-face)
(x-resolve-font-name):
* lisp/files-x.el (modify-file-local-variable):
* lisp/files.el (locate-user-emacs-file, find-alternate-file)
(set-auto-mode, hack-one-local-variable--obsolete)
(dir-locals-set-directory-class, write-file, basic-save-buffer)
(delete-directory, copy-directory, recover-session)
(recover-session-finish, insert-directory)
(file-modes-char-to-who, file-modes-symbolic-to-number)
(move-file-to-trash):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/finder.el (finder-commentary):
* lisp/font-lock.el (font-lock-fontify-buffer):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/frame.el (get-device-terminal, select-frame-by-name):
* lisp/fringe.el (fringe--check-style):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--parent-mode)
(help-fns--obsolete, help-fns--interactive-only)
(describe-function-1, describe-variable):
* lisp/help.el (describe-mode)
(describe-minor-mode-from-indicator):
* lisp/image.el (image-type):
* lisp/international/ccl.el (ccl-dump):
* lisp/international/fontset.el (x-must-resolve-font-name):
* lisp/international/mule-cmds.el (prefer-coding-system)
(select-safe-coding-system-interactively)
(select-safe-coding-system, activate-input-method)
(toggle-input-method, describe-current-input-method)
(describe-language-environment):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/imap.el (imap-interactive-login):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/rlogin.el (rlogin):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/proced.el (proced-log):
* lisp/progmodes/ada-mode.el (ada-get-indent-case)
(ada-check-matching-start, ada-goto-matching-start):
* lisp/progmodes/ada-prj.el (ada-prj-display-page):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/ebrowse.el (ebrowse-tags-apropos):
* lisp/progmodes/etags.el (etags-tags-apropos-additional):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-shell-get-process-or-error)
(python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate):
* lisp/recentf.el (recentf-open-files):
* lisp/replace.el (query-replace-read-from)
(occur-after-change-function, occur-1):
* lisp/scroll-bar.el (scroll-bar-columns):
* lisp/server.el (server-get-auth-key):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, list-processes--refresh)
(compose-mail, set-variable, choose-completion-string)
(define-alternatives):
* lisp/startup.el (site-run-file, tty-handle-args, command-line)
(command-line-1):
* lisp/subr.el (noreturn, define-error, add-to-list)
(read-char-choice, version-to-list):
* lisp/term/common-win.el (x-handle-xrm-switch)
(x-handle-name-switch, x-handle-args):
* lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/textmodes/two-column.el (2C-split):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* lisp/type-break.el (type-break-noninteractive-query):
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
* lisp/whitespace.el (whitespace-report-region):
Prefer grave quoting in source-code strings used to generate help
and diagnostics.
* lisp/faces.el (face-documentation):
No need to convert quotes, since the result is a docstring.
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
Simplify by generating only curved quotes, since info files are
typically that ways nowadays anyway.
* lisp/international/mule-diag.el (list-input-methods):
Don’t assume text quoting style is curved.
* lisp/org/org-bibtex.el (org-bibtex-fields):
Revert my recent changes, going back to the old quoting style.
2015-09-07 15:41:44 +00:00
|
|
|
|
"Editing variable `%s'" (calc-var-name var)))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(and value
|
2001-11-14 09:09:09 +00:00
|
|
|
|
(insert (math-format-nice-expr value (frame-width)) "\n")))))
|
|
|
|
|
(calc-show-edit-buffer))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calc-edit-Decls ()
|
|
|
|
|
(interactive)
|
2001-11-14 09:09:09 +00:00
|
|
|
|
(calc-edit-variable 'var-Decls))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calc-edit-EvalRules ()
|
|
|
|
|
(interactive)
|
2001-11-14 09:09:09 +00:00
|
|
|
|
(calc-edit-variable 'var-EvalRules))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calc-edit-FitRules ()
|
|
|
|
|
(interactive)
|
2001-11-14 09:09:09 +00:00
|
|
|
|
(calc-edit-variable 'var-FitRules))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calc-edit-GenCount ()
|
|
|
|
|
(interactive)
|
2001-11-14 09:09:09 +00:00
|
|
|
|
(calc-edit-variable 'var-GenCount))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calc-edit-Holidays ()
|
|
|
|
|
(interactive)
|
2001-11-14 09:09:09 +00:00
|
|
|
|
(calc-edit-variable 'var-Holidays))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calc-edit-IntegLimit ()
|
|
|
|
|
(interactive)
|
2001-11-14 09:09:09 +00:00
|
|
|
|
(calc-edit-variable 'var-IntegLimit))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calc-edit-LineStyles ()
|
|
|
|
|
(interactive)
|
2001-11-14 09:09:09 +00:00
|
|
|
|
(calc-edit-variable 'var-LineStyles))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calc-edit-PointStyles ()
|
|
|
|
|
(interactive)
|
2001-11-14 09:09:09 +00:00
|
|
|
|
(calc-edit-variable 'var-PointStyles))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calc-edit-PlotRejects ()
|
|
|
|
|
(interactive)
|
2001-11-14 09:09:09 +00:00
|
|
|
|
(calc-edit-variable 'var-PlotRejects))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calc-edit-AlgSimpRules ()
|
|
|
|
|
(interactive)
|
2001-11-14 09:09:09 +00:00
|
|
|
|
(calc-edit-variable 'var-AlgSimpRules))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calc-edit-TimeZone ()
|
|
|
|
|
(interactive)
|
2001-11-14 09:09:09 +00:00
|
|
|
|
(calc-edit-variable 'var-TimeZone))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calc-edit-Units ()
|
|
|
|
|
(interactive)
|
2001-11-14 09:09:09 +00:00
|
|
|
|
(calc-edit-variable 'var-Units))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calc-edit-ExtSimpRules ()
|
|
|
|
|
(interactive)
|
2001-11-14 09:09:09 +00:00
|
|
|
|
(calc-edit-variable 'var-ExtSimpRules))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calc-declare-variable (&optional var)
|
|
|
|
|
(interactive)
|
|
|
|
|
(calc-wrapper
|
|
|
|
|
(or var (setq var (calc-read-var-name "Declare: " 0)))
|
|
|
|
|
(or var (setq var 'var-All))
|
2020-10-10 20:00:51 +00:00
|
|
|
|
(let* (dp decl row rp) ;; def
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(or (and (calc-var-value 'var-Decls)
|
|
|
|
|
(eq (car-safe var-Decls) 'vec))
|
|
|
|
|
(setq var-Decls (list 'vec)))
|
|
|
|
|
(setq dp var-Decls)
|
|
|
|
|
(while (and (setq dp (cdr dp))
|
|
|
|
|
(or (not (eq (car-safe (car dp)) 'vec))
|
|
|
|
|
(/= (length (car dp)) 3)
|
|
|
|
|
(progn
|
|
|
|
|
(setq row (nth 1 (car dp))
|
|
|
|
|
rp row)
|
|
|
|
|
(if (eq (car-safe row) 'vec)
|
|
|
|
|
(progn
|
|
|
|
|
(while
|
|
|
|
|
(and (setq rp (cdr rp))
|
|
|
|
|
(or (not (eq (car-safe (car rp)) 'var))
|
|
|
|
|
(not (eq (nth 2 (car rp)) var)))))
|
|
|
|
|
(setq rp (car rp)))
|
|
|
|
|
(if (or (not (eq (car-safe row) 'var))
|
|
|
|
|
(not (eq (nth 2 row) var)))
|
|
|
|
|
(setq rp nil)))
|
|
|
|
|
(not rp)))))
|
|
|
|
|
(calc-unread-command ?\C-a)
|
2005-01-24 18:23:33 +00:00
|
|
|
|
(setq decl (read-string (format "Declare: %s to be: " (calc-var-name var))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(and rp
|
|
|
|
|
(math-format-flat-expr (nth 2 (car dp)) 0))))
|
|
|
|
|
(setq decl (and (string-match "[^ \t]" decl)
|
|
|
|
|
(math-read-exprs decl)))
|
|
|
|
|
(if (eq (car-safe decl) 'error)
|
|
|
|
|
(error "Bad format in declaration: %s" (nth 2 decl)))
|
|
|
|
|
(if (cdr decl)
|
|
|
|
|
(setq decl (cons 'vec decl))
|
|
|
|
|
(setq decl (car decl)))
|
|
|
|
|
(and (eq (car-safe decl) 'vec)
|
|
|
|
|
(= (length decl) 2)
|
|
|
|
|
(setq decl (nth 1 decl)))
|
|
|
|
|
(calc-record (append '(vec) (list (math-build-var-name var))
|
|
|
|
|
(and decl (list decl)))
|
|
|
|
|
"decl")
|
|
|
|
|
(setq var-Decls (copy-sequence var-Decls))
|
|
|
|
|
(if (eq (car-safe row) 'vec)
|
|
|
|
|
(progn
|
|
|
|
|
(setcdr row (delq rp (cdr row)))
|
|
|
|
|
(or (cdr row)
|
|
|
|
|
(setq var-Decls (delq (car dp) var-Decls))))
|
|
|
|
|
(setq var-Decls (delq (car dp) var-Decls)))
|
|
|
|
|
(if decl
|
|
|
|
|
(progn
|
|
|
|
|
(setq dp (and (not (eq var 'var-All)) var-Decls))
|
|
|
|
|
(while (and (setq dp (cdr dp))
|
|
|
|
|
(or (not (eq (car-safe (car dp)) 'vec))
|
|
|
|
|
(/= (length (car dp)) 3)
|
|
|
|
|
(not (equal (nth 2 (car dp)) decl)))))
|
|
|
|
|
(if dp
|
|
|
|
|
(setcar (cdr (car dp))
|
|
|
|
|
(append (if (eq (car-safe (nth 1 (car dp))) 'vec)
|
|
|
|
|
(nth 1 (car dp))
|
|
|
|
|
(list 'vec (nth 1 (car dp))))
|
|
|
|
|
(list (math-build-var-name var))))
|
|
|
|
|
(setq var-Decls (append var-Decls
|
|
|
|
|
(list (list 'vec
|
|
|
|
|
(math-build-var-name var)
|
|
|
|
|
decl)))))))
|
2001-11-14 09:09:09 +00:00
|
|
|
|
(calc-refresh-evaltos 'var-Decls))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
2001-11-19 07:44:56 +00:00
|
|
|
|
(defvar calc-dont-insert-variables '(var-FitRules var-FactorRules
|
|
|
|
|
var-CommuteRules var-JumpRules
|
|
|
|
|
var-DistribRules var-MergeRules
|
|
|
|
|
var-NegateRules var-InvertRules
|
|
|
|
|
var-IntegAfterRules
|
|
|
|
|
var-TimeZone var-PlotRejects
|
|
|
|
|
var-PlotData1 var-PlotData2
|
|
|
|
|
var-PlotData3 var-PlotData4
|
|
|
|
|
var-PlotData5 var-PlotData6
|
|
|
|
|
var-DUMMY))
|
|
|
|
|
|
2004-11-26 22:35:35 +00:00
|
|
|
|
;; The variable calc-pv-pos is local to calc-permanent-variable, but
|
|
|
|
|
;; used by calc-insert-permanent-variable, which is called by
|
|
|
|
|
;; calc-permanent-variable.
|
|
|
|
|
(defvar calc-pv-pos)
|
|
|
|
|
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(defun calc-permanent-variable (&optional var)
|
|
|
|
|
(interactive)
|
|
|
|
|
(calc-wrapper
|
2005-09-24 Emilio C. Lopes <eclig@gmx.net>
* woman.el (woman-file-name):
* wid-edit.el (widget-file-prompt-value)
(widget-coding-system-prompt-value):
* w32-fns.el (set-w32-system-coding-system):
* vc.el (vc-version-diff, vc-annotate):
* textmodes/reftex-auc.el (reftex-arg-cite)
(reftex-arg-index-tag):
* textmodes/refer.el (refer-get-bib-files):
* textmodes/artist.el (artist-figlet-choose-font):
* terminal.el (terminal-emulator):
* replace.el (occur-read-primary-args):
* rect.el (string-rectangle, string-insert-rectangle):
* ps-print.el (ps-print-preprint):
* progmodes/pascal.el (pascal-goto-defun):
* progmodes/etags.el (visit-tags-table, visit-tags-table-buffer):
* progmodes/compile.el (compilation-find-file):
* printing.el (pr-interactive-n-up):
* play/animate.el (animate-birthday-present):
* net/rcompile.el (remote-compile):
* man.el (man, Man-goto-section, Man-follow-manual-reference):
* mail/rmailsum.el (rmail-summary-search-backward)
(rmail-summary-search):
* mail/rmailout.el (rmail-output-read-rmail-file-name)
(rmail-output-read-file-name):
* mail/rmail.el (rmail-search, rmail-search-backwards):
* mail/mailabbrev.el (merge-mail-abbrevs, rebuild-mail-abbrevs):
* locate.el (locate):
* international/quail.el (quail-show-keyboard-layout):
* international/mule.el (set-buffer-file-coding-system)
(revert-buffer-with-coding-system, set-file-name-coding-system)
(set-terminal-coding-system, set-keyboard-coding-system)
(set-next-selection-coding-system):
* international/mule-diag.el (describe-coding-system)
(describe-font, describe-fontset):
* international/mule-cmds.el (universal-coding-system-argument)
(search-unencodable-char, describe-input-method)
(set-language-environment, describe-language-environment):
* international/codepage.el (codepage-setup):
* international/code-pages.el (codepage-setup):
* info.el (Info-search, Info-follow-reference)
(Info-search-backward):
* emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-clear-cache, ad-activate)
(ad-deactivate, ad-update, ad-unadvise, ad-read-advice-name)
(ad-enable-advice, ad-disable-advice, ad-remove-advice)
(ad-read-regexp):
* ediff-util.el (ediff-toggle-regexp-match):
* ediff-ptch.el (ediff-prompt-for-patch-file):
* dired-aux.el (dired-diff):
* diff.el (diff):
* cus-edit.el (custom-variable-prompt):
* calendar/timeclock.el (timeclock-ask-for-project):
* calc/calcalg3.el (calc-get-fit-variables):
* calc/calc-store.el (calc-edit-variable)
(calc-permanent-variable):
* vc-mcvs.el (vc-mcvs-register):
* shadowfile.el (shadow-define-literal-group):
* woman.el (woman-file-name):
* vc.el (vc-version-diff, vc-merge):
* textmodes/reftex-index.el (reftex-index-complete-tag):
* format.el (format-decode-buffer, format-decode-region):
* emulation/viper-cmd.el (viper-read-string-with-history):
* emacs-lisp/debug.el (cancel-debug-on-entry):
* emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine):
* ediff.el (ediff-merge-revisions)
(ediff-merge-revisions-with-ancestor, ediff-revision):
* completion.el (interactive-completion-string-reader):
* calc/calc-prog.el (calc-user-define-formula):
Follow convention for reading with the minibuffer.
2005-09-24 13:44:02 +00:00
|
|
|
|
(or var (setq var (calc-read-var-name "Save variable (default all): ")))
|
2004-11-26 22:35:35 +00:00
|
|
|
|
(let (calc-pv-pos)
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(and var (or (and (boundp var) (symbol-value var))
|
|
|
|
|
(error "No such variable")))
|
|
|
|
|
(set-buffer (find-file-noselect (substitute-in-file-name
|
|
|
|
|
calc-settings-file)))
|
|
|
|
|
(if var
|
|
|
|
|
(calc-insert-permanent-variable var)
|
|
|
|
|
(mapatoms (function
|
|
|
|
|
(lambda (x)
|
|
|
|
|
(and (string-match "\\`var-" (symbol-name x))
|
|
|
|
|
(not (memq x calc-dont-insert-variables))
|
|
|
|
|
(calc-var-value x)
|
|
|
|
|
(not (eq (car-safe (symbol-value x)) 'special-const))
|
|
|
|
|
(calc-insert-permanent-variable x))))))
|
2001-11-14 09:09:09 +00:00
|
|
|
|
(save-buffer))))
|
2001-11-19 07:44:56 +00:00
|
|
|
|
|
|
|
|
|
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calc-insert-permanent-variable (var)
|
|
|
|
|
(goto-char (point-min))
|
2015-06-29 12:26:29 +00:00
|
|
|
|
(if (let (case-fold-search)
|
|
|
|
|
(search-forward (concat "(setq " (symbol-name var) " '") nil t))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(progn
|
2004-11-26 22:35:35 +00:00
|
|
|
|
(setq calc-pv-pos (point-marker))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(forward-line -1)
|
|
|
|
|
(if (looking-at ";;; Variable .* stored by Calc on ")
|
|
|
|
|
(progn
|
|
|
|
|
(delete-region (match-end 0) (progn (end-of-line) (point)))
|
|
|
|
|
(insert (current-time-string))))
|
2004-11-26 22:35:35 +00:00
|
|
|
|
(goto-char (- calc-pv-pos 8 (length (symbol-name var))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(forward-sexp 1)
|
|
|
|
|
(backward-char 1)
|
2004-11-26 22:35:35 +00:00
|
|
|
|
(delete-region calc-pv-pos (point)))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(goto-char (point-max))
|
|
|
|
|
(insert "\n;;; Variable \""
|
|
|
|
|
(symbol-name var)
|
|
|
|
|
"\" stored by Calc on "
|
|
|
|
|
(current-time-string)
|
|
|
|
|
"\n(setq "
|
|
|
|
|
(symbol-name var)
|
|
|
|
|
" ')\n")
|
|
|
|
|
(backward-char 2))
|
|
|
|
|
(insert (prin1-to-string (calc-var-value var)))
|
2001-11-14 09:09:09 +00:00
|
|
|
|
(forward-line 1))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calc-insert-variables (buf)
|
|
|
|
|
(interactive "bBuffer in which to save variable values: ")
|
* calc/calc.el (calc, calc-refresh, calc-trail-buffer, calc-record)
(calcDigit-nondigit):
* calc/calc-yank.el (calc-copy-to-buffer):
* calc/calc-units.el (calc-invalidate-units-table):
* calc/calc-trail.el (calc-trail-yank):
* calc/calc-store.el (calc-insert-variables):
* calc/calc-rewr.el (math-rewrite, math-rewrite-phase):
* calc/calc-prog.el (calc-read-parse-table):
* calc/calc-keypd.el (calc-do-keypad, calc-keypad-right-click):
* calc/calc-help.el (calc-describe-bindings, calc-describe-key):
* calc/calc-graph.el (calc-graph-delete, calc-graph-add-curve)
(calc-graph-juggle, calc-graph-count-curves, calc-graph-plot)
(calc-graph-plot, calc-graph-format-data, calc-graph-set-styles)
(calc-graph-name, calc-graph-find-command, calc-graph-view)
(calc-graph-view, calc-gnuplot-command, calc-graph-init):
* calc/calc-ext.el (calc-realign):
* calc/calc-embed.el (calc-do-embedded, calc-do-embedded)
(calc-embedded-finish-edit, calc-embedded-make-info)
(calc-embedded-finish-command, calc-embedded-stack-change):
* calc/calc-aent.el (calcAlg-enter): Use with-current-buffer.
2009-10-28 18:35:33 +00:00
|
|
|
|
(with-current-buffer buf
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(mapatoms (function
|
|
|
|
|
(lambda (x)
|
|
|
|
|
(and (string-match "\\`var-" (symbol-name x))
|
|
|
|
|
(not (memq x calc-dont-insert-variables))
|
|
|
|
|
(calc-var-value x)
|
|
|
|
|
(not (eq (car-safe (symbol-value x)) 'special-const))
|
|
|
|
|
(or (not (eq x 'var-Decls))
|
|
|
|
|
(not (equal var-Decls '(vec))))
|
|
|
|
|
(or (not (eq x 'var-Holidays))
|
|
|
|
|
(not (equal var-Holidays '(vec (var sat var-sat)
|
|
|
|
|
(var sun var-sun)))))
|
|
|
|
|
(insert "(setq "
|
|
|
|
|
(symbol-name x)
|
|
|
|
|
" "
|
|
|
|
|
(prin1-to-string
|
|
|
|
|
(let ((calc-language
|
|
|
|
|
(if (memq calc-language '(nil big))
|
|
|
|
|
'flat
|
|
|
|
|
calc-language)))
|
|
|
|
|
(math-format-value (symbol-value x) 100000)))
|
2001-11-14 09:09:09 +00:00
|
|
|
|
")\n")))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calc-assign (arg)
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(calc-slow-wrapper
|
2001-11-14 09:09:09 +00:00
|
|
|
|
(calc-binary-op ":=" 'calcFunc-assign arg)))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calc-evalto (arg)
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(calc-slow-wrapper
|
2001-11-14 09:09:09 +00:00
|
|
|
|
(calc-unary-op "=>" 'calcFunc-evalto arg)))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
(defun calc-subscript (arg)
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(calc-slow-wrapper
|
2001-11-14 09:09:09 +00:00
|
|
|
|
(calc-binary-op "sub" 'calcFunc-subscr arg)))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
2004-11-30 17:25:00 +00:00
|
|
|
|
(provide 'calc-store)
|
|
|
|
|
|
2001-11-14 09:09:09 +00:00
|
|
|
|
;;; calc-store.el ends here
|