2020-10-10 20:00:51 +00:00
|
|
|
;;; calc-prog.el --- user programmability functions for Calc -*- lexical-binding:t -*-
|
2001-11-19 07:44:56 +00:00
|
|
|
|
2023-01-01 10:31:12 +00:00
|
|
|
;; Copyright (C) 1990-1993, 2001-2023 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:
|
|
|
|
|
|
|
|
;;; Code:
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
;; This file is autoloaded from calc-ext.el.
|
|
|
|
|
2004-11-30 17:20:50 +00:00
|
|
|
(require 'calc-ext)
|
2001-11-06 18:59:06 +00:00
|
|
|
(require 'calc-macs)
|
|
|
|
|
2007-11-27 04:08:16 +00:00
|
|
|
;; Declare functions which are defined elsewhere.
|
|
|
|
(declare-function edmacro-format-keys "edmacro" (macro &optional verbose))
|
|
|
|
(declare-function edmacro-parse-keys "edmacro" (string &optional need-vector))
|
|
|
|
(declare-function math-read-expr-level "calc-aent" (exp-prec &optional exp-term))
|
|
|
|
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calc-equal-to (arg)
|
|
|
|
(interactive "P")
|
|
|
|
(calc-wrapper
|
|
|
|
(if (and (integerp arg) (> arg 2))
|
|
|
|
(calc-enter-result arg "eq" (cons 'calcFunc-eq (calc-top-list-n arg)))
|
2001-11-14 09:09:09 +00:00
|
|
|
(calc-binary-op "eq" 'calcFunc-eq arg))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calc-remove-equal (arg)
|
|
|
|
(interactive "P")
|
|
|
|
(calc-wrapper
|
2001-11-14 09:09:09 +00:00
|
|
|
(calc-unary-op "rmeq" 'calcFunc-rmeq arg)))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calc-not-equal-to (arg)
|
|
|
|
(interactive "P")
|
|
|
|
(calc-wrapper
|
|
|
|
(if (and (integerp arg) (> arg 2))
|
|
|
|
(calc-enter-result arg "neq" (cons 'calcFunc-neq (calc-top-list-n arg)))
|
2001-11-14 09:09:09 +00:00
|
|
|
(calc-binary-op "neq" 'calcFunc-neq arg))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calc-less-than (arg)
|
|
|
|
(interactive "P")
|
|
|
|
(calc-wrapper
|
2001-11-14 09:09:09 +00:00
|
|
|
(calc-binary-op "lt" 'calcFunc-lt arg)))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calc-greater-than (arg)
|
|
|
|
(interactive "P")
|
|
|
|
(calc-wrapper
|
2001-11-14 09:09:09 +00:00
|
|
|
(calc-binary-op "gt" 'calcFunc-gt arg)))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calc-less-equal (arg)
|
|
|
|
(interactive "P")
|
|
|
|
(calc-wrapper
|
2001-11-14 09:09:09 +00:00
|
|
|
(calc-binary-op "leq" 'calcFunc-leq arg)))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calc-greater-equal (arg)
|
|
|
|
(interactive "P")
|
|
|
|
(calc-wrapper
|
2001-11-14 09:09:09 +00:00
|
|
|
(calc-binary-op "geq" 'calcFunc-geq arg)))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calc-in-set (arg)
|
|
|
|
(interactive "P")
|
|
|
|
(calc-wrapper
|
2001-11-14 09:09:09 +00:00
|
|
|
(calc-binary-op "in" 'calcFunc-in arg)))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calc-logical-and (arg)
|
|
|
|
(interactive "P")
|
|
|
|
(calc-wrapper
|
2001-11-14 09:09:09 +00:00
|
|
|
(calc-binary-op "land" 'calcFunc-land arg 1)))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calc-logical-or (arg)
|
|
|
|
(interactive "P")
|
|
|
|
(calc-wrapper
|
2001-11-14 09:09:09 +00:00
|
|
|
(calc-binary-op "lor" 'calcFunc-lor arg 0)))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calc-logical-not (arg)
|
|
|
|
(interactive "P")
|
|
|
|
(calc-wrapper
|
2001-11-14 09:09:09 +00:00
|
|
|
(calc-unary-op "lnot" 'calcFunc-lnot arg)))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calc-logical-if ()
|
|
|
|
(interactive)
|
|
|
|
(calc-wrapper
|
2001-11-14 09:09:09 +00:00
|
|
|
(calc-enter-result 3 "if" (cons 'calcFunc-if (calc-top-list-n 3)))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun calc-timing (n)
|
|
|
|
(interactive "P")
|
|
|
|
(calc-wrapper
|
|
|
|
(calc-change-mode 'calc-timing n nil t)
|
|
|
|
(message (if calc-timing
|
2001-11-19 07:44:56 +00:00
|
|
|
"Reporting timing of slow commands in Trail"
|
|
|
|
"Not reporting timing of commands"))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calc-pass-errors ()
|
2020-10-10 20:00:51 +00:00
|
|
|
;; FIXME: This is broken at least since Emacs-26.
|
|
|
|
;; AFAICT the immediate purpose of this code is to hack the
|
|
|
|
;; `condition-case' in `calc-do' so it doesn't catch errors any
|
|
|
|
;; more. I'm not sure why/whatfor this was designed, but I suspect
|
|
|
|
;; that `condition-case-unless-debug' would cover the same needs.
|
2001-11-06 18:59:06 +00:00
|
|
|
(interactive)
|
|
|
|
;; The following two cases are for the new, optimizing byte compiler
|
|
|
|
;; or the standard 18.57 byte compiler, respectively.
|
2020-10-10 20:00:51 +00:00
|
|
|
(condition-case nil
|
2001-11-06 18:59:06 +00:00
|
|
|
(let ((place (aref (nth 2 (nth 2 (symbol-function 'calc-do))) 15)))
|
|
|
|
(or (memq (car-safe (car-safe place)) '(error xxxerror))
|
|
|
|
(setq place (aref (nth 2 (nth 2 (symbol-function 'calc-do))) 27)))
|
|
|
|
(or (memq (car (car place)) '(error xxxerror))
|
2021-09-27 21:56:55 +00:00
|
|
|
(error "Foo"))
|
2001-11-06 18:59:06 +00:00
|
|
|
(setcar (car place) 'xxxerror))
|
2001-11-19 07:44:56 +00:00
|
|
|
(error (error "The calc-do function has been modified; unable to patch"))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calc-user-define ()
|
|
|
|
(interactive)
|
|
|
|
(message "Define user key: z-")
|
|
|
|
(let ((key (read-char)))
|
|
|
|
(if (= (calc-user-function-classify key) 0)
|
|
|
|
(error "Can't redefine \"?\" key"))
|
|
|
|
(let ((func (intern (completing-read (concat "Set key z "
|
|
|
|
(char-to-string key)
|
|
|
|
" to command: ")
|
|
|
|
obarray
|
|
|
|
'commandp
|
|
|
|
t
|
|
|
|
"calc-"))))
|
|
|
|
(let* ((kmap (calc-user-key-map))
|
|
|
|
(old (assq key kmap)))
|
2014-10-01 17:23:42 +00:00
|
|
|
;; FIXME: Why not (define-key kmap (vector key) func)?
|
2001-11-06 18:59:06 +00:00
|
|
|
(if old
|
|
|
|
(setcdr old func)
|
2001-11-14 09:09:09 +00:00
|
|
|
(setcdr kmap (cons (cons key func) (cdr kmap))))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calc-user-undefine ()
|
|
|
|
(interactive)
|
|
|
|
(message "Undefine user key: z-")
|
|
|
|
(let ((key (read-char)))
|
|
|
|
(if (= (calc-user-function-classify key) 0)
|
|
|
|
(error "Can't undefine \"?\" key"))
|
|
|
|
(let* ((kmap (calc-user-key-map)))
|
|
|
|
(delq (or (assq key kmap)
|
|
|
|
(assq (upcase key) kmap)
|
|
|
|
(assq (downcase key) kmap)
|
|
|
|
(error "No such user key is defined"))
|
2001-11-14 09:09:09 +00:00
|
|
|
kmap))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(math-integral-cache-state, calc-lang)
(calc-original-buffer): Declare them.
(calc-user-formula-alist): New variable.
(calc-user-define-formula, calc-fix-user-formula)
(calc-user-define-composition, calc-finish-formula-edit):
Replace variable alist by declared variable.
(var-q0, var-q1, var-q2, var-q3, var-q4, var-q5, var-q6)
(var-q7, var-q7, var-q8, var-q9): Declare them.
(calc-kbd-push): Don't check to see if var-q0 through var-q9
are bound.
(calcFunc-typeof): Replace undeclared variable by correct expression.
(math-exp-env): New variable.
(math-define-body, math-define-exp): Replace exp-env by declared
variable.
(math-define-exp): Replace misplaced variable by expression.
2004-11-21 05:52:41 +00:00
|
|
|
|
|
|
|
;; math-integral-cache-state is originally declared in calcalg2.el,
|
|
|
|
;; it is used in calc-user-define-variable.
|
|
|
|
(defvar math-integral-cache-state)
|
|
|
|
|
|
|
|
;; calc-user-formula-alist is local to calc-user-define-formula,
|
2008-02-21 07:52:22 +00:00
|
|
|
;; calc-user-define-composition and calc-finish-formula-edit,
|
(math-integral-cache-state, calc-lang)
(calc-original-buffer): Declare them.
(calc-user-formula-alist): New variable.
(calc-user-define-formula, calc-fix-user-formula)
(calc-user-define-composition, calc-finish-formula-edit):
Replace variable alist by declared variable.
(var-q0, var-q1, var-q2, var-q3, var-q4, var-q5, var-q6)
(var-q7, var-q7, var-q8, var-q9): Declare them.
(calc-kbd-push): Don't check to see if var-q0 through var-q9
are bound.
(calcFunc-typeof): Replace undeclared variable by correct expression.
(math-exp-env): New variable.
(math-define-body, math-define-exp): Replace exp-env by declared
variable.
(math-define-exp): Replace misplaced variable by expression.
2004-11-21 05:52:41 +00:00
|
|
|
;; but is used by calc-fix-user-formula.
|
|
|
|
(defvar calc-user-formula-alist)
|
2020-10-10 20:00:51 +00:00
|
|
|
(defvar math-arglist) ; dynamically bound in all callers
|
(math-integral-cache-state, calc-lang)
(calc-original-buffer): Declare them.
(calc-user-formula-alist): New variable.
(calc-user-define-formula, calc-fix-user-formula)
(calc-user-define-composition, calc-finish-formula-edit):
Replace variable alist by declared variable.
(var-q0, var-q1, var-q2, var-q3, var-q4, var-q5, var-q6)
(var-q7, var-q7, var-q8, var-q9): Declare them.
(calc-kbd-push): Don't check to see if var-q0 through var-q9
are bound.
(calcFunc-typeof): Replace undeclared variable by correct expression.
(math-exp-env): New variable.
(math-define-body, math-define-exp): Replace exp-env by declared
variable.
(math-define-exp): Replace misplaced variable by expression.
2004-11-21 05:52:41 +00:00
|
|
|
|
2001-11-06 18:59:06 +00:00
|
|
|
(defun calc-user-define-formula ()
|
|
|
|
(interactive)
|
|
|
|
(calc-wrapper
|
|
|
|
(let* ((form (calc-top 1))
|
2011-01-21 03:48:26 +00:00
|
|
|
(math-arglist nil)
|
2001-11-06 18:59:06 +00:00
|
|
|
(is-lambda (and (eq (car-safe form) 'calcFunc-lambda)
|
|
|
|
(>= (length form) 2)))
|
2004-12-29 04:58:24 +00:00
|
|
|
odef key keyname cmd cmd-base cmd-base-default
|
|
|
|
func calc-user-formula-alist is-symb)
|
2001-11-06 18:59:06 +00:00
|
|
|
(if is-lambda
|
Don't quote lambdas with 'function' in calc/*.el
* lisp/calc/calc-aent.el (calc-do-quick-calc)
(calc-do-calc-eval, math-build-parse-table):
* lisp/calc/calc-alg.el (math-polynomial-base):
* lisp/calc/calc-alg.el (math-is-poly-rec):
* lisp/calc/calc-arith.el (calcFunc-scf):
* lisp/calc/calc-arith.el (math-ceiling, math-round):
* lisp/calc/calc-arith.el (math-trunc-fancy, math-floor-fancy):
* lisp/calc/calc-ext.el (calc-init-extensions, calc-reset)
(calc-refresh-top, calc-z-prefix-help, calc-binary-op-fancy)
(calc-unary-op-fancy):
* lisp/calc/calc-forms.el (math-make-mod):
* lisp/calc/calc-frac.el (calcFunc-frac):
* lisp/calc/calc-funcs.el (calcFunc-euler):
* lisp/calc/calc-help.el (calc-full-help):
* lisp/calc/calc-lang.el (c, pascal, fortran, tex, latex, eqn)
(yacas, maxima, giac, math, maple):
* lisp/calc/calc-macs.el (calc-wrapper, calc-slow-wrapper):
* lisp/calc/calc-map.el (calc-get-operator, calcFunc-mapeqr)
(calcFunc-reducea, calcFunc-rreducea, calcFunc-reduced)
(calcFunc-rreduced, calcFunc-outer):
* lisp/calc/calc-misc.el (another-calc, calc-do-handle-whys):
* lisp/calc/calc-mode.el (calc-save-modes):
* lisp/calc/calc-mtx.el (math-col-matrix, math-mul-mat-vec):
* lisp/calc/calc-poly.el (math-sort-terms, math-poly-div-list)
(math-mul-list, math-sort-poly-base-list)
(math-partial-fractions):
* lisp/calc/calc-prog.el (calc-user-define-formula):
* lisp/calc/calc-rewr.el (math-rewrite, math-compile-patterns)
(math-compile-rewrites, math-parse-schedule)
(math-rwcomp-pattern):
* lisp/calc/calc-store.el (calc-var-name-map, calc-let)
(calc-permanent-variable, calc-insert-variables):
* lisp/calc/calc-stuff.el (calc-flush-caches, calcFunc-pclean)
(calcFunc-pfrac):
* lisp/calc/calc-units.el (math-build-units-table)
(math-decompose-units):
* lisp/calc/calc-vec.el (calcFunc-mrow, math-mat-col)
(calcFunc-mcol, math-mat-less-col, math-mimic-ident):
* lisp/calc/calc-yank.el (calc-edit):
* lisp/calc/calc.el
(calc-mode-var-list-restore-default-values)
(calc-mode-var-list-restore-saved-values, calc-mode, calc-quit):
* lisp/calc/calccomp.el (math-compose-expr)
(math-compose-matrix, math-vector-to-string): Don't quote lambdas with
'function'.
2020-11-17 01:51:30 +00:00
|
|
|
(setq math-arglist (mapcar (lambda (x) (nth 1 x))
|
2001-11-06 18:59:06 +00:00
|
|
|
(nreverse (cdr (reverse (cdr form)))))
|
|
|
|
form (nth (1- (length form)) form))
|
|
|
|
(calc-default-formula-arglist form)
|
2011-01-21 03:48:26 +00:00
|
|
|
(setq math-arglist (sort math-arglist 'string-lessp)))
|
2001-11-06 18:59:06 +00:00
|
|
|
(message "Define user key: z-")
|
|
|
|
(setq key (read-char))
|
|
|
|
(if (= (calc-user-function-classify key) 0)
|
|
|
|
(error "Can't redefine \"?\" key"))
|
|
|
|
(setq key (and (not (memq key '(13 32))) key)
|
|
|
|
keyname (and key
|
|
|
|
(if (or (and (<= ?0 key) (<= key ?9))
|
|
|
|
(and (<= ?a key) (<= key ?z))
|
|
|
|
(and (<= ?A key) (<= key ?Z)))
|
|
|
|
(char-to-string key)
|
|
|
|
(format "%03d" key)))
|
|
|
|
odef (assq key (calc-user-key-map)))
|
2004-12-29 04:58:24 +00:00
|
|
|
(unless keyname
|
|
|
|
(setq keyname (format "%05d" (abs (% (random) 10000)))))
|
2001-11-06 18:59:06 +00:00
|
|
|
(while
|
|
|
|
(progn
|
2004-12-29 04:58:24 +00:00
|
|
|
(setq cmd-base-default (concat "User-" keyname))
|
2009-09-15 02:35:22 +00:00
|
|
|
(setq cmd (completing-read
|
2021-10-05 01:34:08 +00:00
|
|
|
(format-prompt "Define M-x command name"
|
|
|
|
(concat "calc-" cmd-base-default))
|
2004-12-29 04:58:24 +00:00
|
|
|
obarray 'commandp nil
|
|
|
|
(if (and odef (symbolp (cdr odef)))
|
|
|
|
(symbol-name (cdr odef))
|
|
|
|
"calc-")))
|
|
|
|
(if (or (string-equal cmd "")
|
|
|
|
(string-equal cmd "calc-"))
|
|
|
|
(setq cmd (concat "calc-User-" keyname)))
|
|
|
|
(setq cmd-base (and (string-match "\\`calc-\\(.+\\)\\'" cmd)
|
|
|
|
(math-match-substring cmd 1)))
|
|
|
|
(setq cmd (intern cmd))
|
2001-11-06 18:59:06 +00:00
|
|
|
(and cmd
|
|
|
|
(fboundp cmd)
|
|
|
|
odef
|
|
|
|
(not
|
|
|
|
(y-or-n-p
|
|
|
|
(if (get cmd 'calc-user-defn)
|
|
|
|
(concat "Replace previous definition for "
|
|
|
|
(symbol-name cmd) "? ")
|
|
|
|
"That name conflicts with a built-in Emacs function. Replace this function? "))))))
|
|
|
|
(while
|
|
|
|
(progn
|
2009-09-15 02:35:22 +00:00
|
|
|
(setq cmd-base-default
|
2004-12-29 04:58:24 +00:00
|
|
|
(if cmd-base
|
|
|
|
(if (string-match
|
|
|
|
"\\`User-.+" cmd-base)
|
|
|
|
(concat
|
|
|
|
"User"
|
|
|
|
(substring cmd-base 5))
|
|
|
|
cmd-base)
|
|
|
|
(concat "User" keyname)))
|
2009-09-15 02:35:22 +00:00
|
|
|
(setq func
|
2004-12-29 04:04:09 +00:00
|
|
|
(concat "calcFunc-"
|
2009-09-15 02:35:22 +00:00
|
|
|
(completing-read
|
2021-10-05 01:34:08 +00:00
|
|
|
(format-prompt "Define algebraic function name"
|
|
|
|
cmd-base-default)
|
2004-12-29 04:58:24 +00:00
|
|
|
(mapcar (lambda (x) (substring x 9))
|
|
|
|
(all-completions "calcFunc-"
|
|
|
|
obarray))
|
2009-09-15 02:35:22 +00:00
|
|
|
(lambda (x)
|
|
|
|
(fboundp
|
2004-12-29 04:58:24 +00:00
|
|
|
(intern (concat "calcFunc-" x))))
|
|
|
|
nil)))
|
|
|
|
(setq func
|
|
|
|
(if (string-equal func "calcFunc-")
|
|
|
|
(intern (concat "calcFunc-" cmd-base-default))
|
|
|
|
(intern func)))
|
2001-11-06 18:59:06 +00:00
|
|
|
(and func
|
|
|
|
(fboundp func)
|
|
|
|
(not (fboundp cmd))
|
|
|
|
odef
|
|
|
|
(not
|
|
|
|
(y-or-n-p
|
|
|
|
(if (get func 'calc-user-defn)
|
|
|
|
(concat "Replace previous definition for "
|
|
|
|
(symbol-name func) "? ")
|
|
|
|
"That name conflicts with a built-in Emacs function. Replace this function? "))))))
|
2004-12-29 04:58:24 +00:00
|
|
|
|
2001-11-06 18:59:06 +00:00
|
|
|
(if (not func)
|
|
|
|
(setq func (intern (concat "calcFunc-User"
|
|
|
|
(or keyname
|
|
|
|
(and cmd (symbol-name cmd))
|
|
|
|
(format "%05d" (% (random) 10000)))))))
|
2004-12-29 04:58:24 +00:00
|
|
|
|
2001-11-06 18:59:06 +00:00
|
|
|
(if is-lambda
|
2011-01-21 03:48:26 +00:00
|
|
|
(setq calc-user-formula-alist math-arglist)
|
2001-11-06 18:59:06 +00:00
|
|
|
(while
|
|
|
|
(progn
|
2009-09-15 02:35:22 +00:00
|
|
|
(setq calc-user-formula-alist
|
(math-integral-cache-state, calc-lang)
(calc-original-buffer): Declare them.
(calc-user-formula-alist): New variable.
(calc-user-define-formula, calc-fix-user-formula)
(calc-user-define-composition, calc-finish-formula-edit):
Replace variable alist by declared variable.
(var-q0, var-q1, var-q2, var-q3, var-q4, var-q5, var-q6)
(var-q7, var-q7, var-q8, var-q9): Declare them.
(calc-kbd-push): Don't check to see if var-q0 through var-q9
are bound.
(calcFunc-typeof): Replace undeclared variable by correct expression.
(math-exp-env): New variable.
(math-define-body, math-define-exp): Replace exp-env by declared
variable.
(math-define-exp): Replace misplaced variable by expression.
2004-11-21 05:52:41 +00:00
|
|
|
(read-from-minibuffer "Function argument list: "
|
2011-01-21 03:48:26 +00:00
|
|
|
(if math-arglist
|
|
|
|
(prin1-to-string math-arglist)
|
(math-integral-cache-state, calc-lang)
(calc-original-buffer): Declare them.
(calc-user-formula-alist): New variable.
(calc-user-define-formula, calc-fix-user-formula)
(calc-user-define-composition, calc-finish-formula-edit):
Replace variable alist by declared variable.
(var-q0, var-q1, var-q2, var-q3, var-q4, var-q5, var-q6)
(var-q7, var-q7, var-q8, var-q9): Declare them.
(calc-kbd-push): Don't check to see if var-q0 through var-q9
are bound.
(calcFunc-typeof): Replace undeclared variable by correct expression.
(math-exp-env): New variable.
(math-define-body, math-define-exp): Replace exp-env by declared
variable.
(math-define-exp): Replace misplaced variable by expression.
2004-11-21 05:52:41 +00:00
|
|
|
"()")
|
|
|
|
minibuffer-local-map
|
|
|
|
t))
|
2011-01-21 03:48:26 +00:00
|
|
|
(and (not (calc-subsetp calc-user-formula-alist math-arglist))
|
2001-11-06 18:59:06 +00:00
|
|
|
(not (y-or-n-p
|
|
|
|
"Okay for arguments that don't appear in formula to be ignored? "))))))
|
(math-integral-cache-state, calc-lang)
(calc-original-buffer): Declare them.
(calc-user-formula-alist): New variable.
(calc-user-define-formula, calc-fix-user-formula)
(calc-user-define-composition, calc-finish-formula-edit):
Replace variable alist by declared variable.
(var-q0, var-q1, var-q2, var-q3, var-q4, var-q5, var-q6)
(var-q7, var-q7, var-q8, var-q9): Declare them.
(calc-kbd-push): Don't check to see if var-q0 through var-q9
are bound.
(calcFunc-typeof): Replace undeclared variable by correct expression.
(math-exp-env): New variable.
(math-define-body, math-define-exp): Replace exp-env by declared
variable.
(math-define-exp): Replace misplaced variable by expression.
2004-11-21 05:52:41 +00:00
|
|
|
(setq is-symb (and calc-user-formula-alist
|
2001-11-06 18:59:06 +00:00
|
|
|
func
|
|
|
|
(y-or-n-p
|
|
|
|
"Leave it symbolic for non-constant arguments? ")))
|
2009-09-15 02:35:22 +00:00
|
|
|
(setq calc-user-formula-alist
|
Don't quote lambdas with 'function' in calc/*.el
* lisp/calc/calc-aent.el (calc-do-quick-calc)
(calc-do-calc-eval, math-build-parse-table):
* lisp/calc/calc-alg.el (math-polynomial-base):
* lisp/calc/calc-alg.el (math-is-poly-rec):
* lisp/calc/calc-arith.el (calcFunc-scf):
* lisp/calc/calc-arith.el (math-ceiling, math-round):
* lisp/calc/calc-arith.el (math-trunc-fancy, math-floor-fancy):
* lisp/calc/calc-ext.el (calc-init-extensions, calc-reset)
(calc-refresh-top, calc-z-prefix-help, calc-binary-op-fancy)
(calc-unary-op-fancy):
* lisp/calc/calc-forms.el (math-make-mod):
* lisp/calc/calc-frac.el (calcFunc-frac):
* lisp/calc/calc-funcs.el (calcFunc-euler):
* lisp/calc/calc-help.el (calc-full-help):
* lisp/calc/calc-lang.el (c, pascal, fortran, tex, latex, eqn)
(yacas, maxima, giac, math, maple):
* lisp/calc/calc-macs.el (calc-wrapper, calc-slow-wrapper):
* lisp/calc/calc-map.el (calc-get-operator, calcFunc-mapeqr)
(calcFunc-reducea, calcFunc-rreducea, calcFunc-reduced)
(calcFunc-rreduced, calcFunc-outer):
* lisp/calc/calc-misc.el (another-calc, calc-do-handle-whys):
* lisp/calc/calc-mode.el (calc-save-modes):
* lisp/calc/calc-mtx.el (math-col-matrix, math-mul-mat-vec):
* lisp/calc/calc-poly.el (math-sort-terms, math-poly-div-list)
(math-mul-list, math-sort-poly-base-list)
(math-partial-fractions):
* lisp/calc/calc-prog.el (calc-user-define-formula):
* lisp/calc/calc-rewr.el (math-rewrite, math-compile-patterns)
(math-compile-rewrites, math-parse-schedule)
(math-rwcomp-pattern):
* lisp/calc/calc-store.el (calc-var-name-map, calc-let)
(calc-permanent-variable, calc-insert-variables):
* lisp/calc/calc-stuff.el (calc-flush-caches, calcFunc-pclean)
(calcFunc-pfrac):
* lisp/calc/calc-units.el (math-build-units-table)
(math-decompose-units):
* lisp/calc/calc-vec.el (calcFunc-mrow, math-mat-col)
(calcFunc-mcol, math-mat-less-col, math-mimic-ident):
* lisp/calc/calc-yank.el (calc-edit):
* lisp/calc/calc.el
(calc-mode-var-list-restore-default-values)
(calc-mode-var-list-restore-saved-values, calc-mode, calc-quit):
* lisp/calc/calccomp.el (math-compose-expr)
(math-compose-matrix, math-vector-to-string): Don't quote lambdas with
'function'.
2020-11-17 01:51:30 +00:00
|
|
|
(mapcar (lambda (x)
|
|
|
|
(or (cdr (assq x '((nil . arg-nil)
|
|
|
|
(t . arg-t))))
|
|
|
|
x)) calc-user-formula-alist))
|
2001-11-06 18:59:06 +00:00
|
|
|
(if cmd
|
|
|
|
(progn
|
2004-11-29 05:58:45 +00:00
|
|
|
(require 'calc-macs)
|
2001-11-06 18:59:06 +00:00
|
|
|
(fset cmd
|
|
|
|
(list 'lambda
|
|
|
|
'()
|
|
|
|
'(interactive)
|
|
|
|
(list 'calc-wrapper
|
|
|
|
(list 'calc-enter-result
|
(math-integral-cache-state, calc-lang)
(calc-original-buffer): Declare them.
(calc-user-formula-alist): New variable.
(calc-user-define-formula, calc-fix-user-formula)
(calc-user-define-composition, calc-finish-formula-edit):
Replace variable alist by declared variable.
(var-q0, var-q1, var-q2, var-q3, var-q4, var-q5, var-q6)
(var-q7, var-q7, var-q8, var-q9): Declare them.
(calc-kbd-push): Don't check to see if var-q0 through var-q9
are bound.
(calcFunc-typeof): Replace undeclared variable by correct expression.
(math-exp-env): New variable.
(math-define-body, math-define-exp): Replace exp-env by declared
variable.
(math-define-exp): Replace misplaced variable by expression.
2004-11-21 05:52:41 +00:00
|
|
|
(length calc-user-formula-alist)
|
2001-11-06 18:59:06 +00:00
|
|
|
(let ((name (symbol-name (or func cmd))))
|
|
|
|
(and (string-match
|
|
|
|
"\\([^-][^-]?[^-]?[^-]?\\)[^-]*\\'"
|
|
|
|
name)
|
|
|
|
(math-match-substring name 1)))
|
|
|
|
(list 'cons
|
|
|
|
(list 'quote func)
|
|
|
|
(list 'calc-top-list-n
|
(math-integral-cache-state, calc-lang)
(calc-original-buffer): Declare them.
(calc-user-formula-alist): New variable.
(calc-user-define-formula, calc-fix-user-formula)
(calc-user-define-composition, calc-finish-formula-edit):
Replace variable alist by declared variable.
(var-q0, var-q1, var-q2, var-q3, var-q4, var-q5, var-q6)
(var-q7, var-q7, var-q8, var-q9): Declare them.
(calc-kbd-push): Don't check to see if var-q0 through var-q9
are bound.
(calcFunc-typeof): Replace undeclared variable by correct expression.
(math-exp-env): New variable.
(math-define-body, math-define-exp): Replace exp-env by declared
variable.
(math-define-exp): Replace misplaced variable by expression.
2004-11-21 05:52:41 +00:00
|
|
|
(length calc-user-formula-alist)))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
(put cmd 'calc-user-defn t)))
|
|
|
|
(let ((body (list 'math-normalize (calc-fix-user-formula form))))
|
|
|
|
(fset func
|
|
|
|
(append
|
(math-integral-cache-state, calc-lang)
(calc-original-buffer): Declare them.
(calc-user-formula-alist): New variable.
(calc-user-define-formula, calc-fix-user-formula)
(calc-user-define-composition, calc-finish-formula-edit):
Replace variable alist by declared variable.
(var-q0, var-q1, var-q2, var-q3, var-q4, var-q5, var-q6)
(var-q7, var-q7, var-q8, var-q9): Declare them.
(calc-kbd-push): Don't check to see if var-q0 through var-q9
are bound.
(calcFunc-typeof): Replace undeclared variable by correct expression.
(math-exp-env): New variable.
(math-define-body, math-define-exp): Replace exp-env by declared
variable.
(math-define-exp): Replace misplaced variable by expression.
2004-11-21 05:52:41 +00:00
|
|
|
(list 'lambda calc-user-formula-alist)
|
2001-11-06 18:59:06 +00:00
|
|
|
(and is-symb
|
Don't quote lambdas with 'function' in calc/*.el
* lisp/calc/calc-aent.el (calc-do-quick-calc)
(calc-do-calc-eval, math-build-parse-table):
* lisp/calc/calc-alg.el (math-polynomial-base):
* lisp/calc/calc-alg.el (math-is-poly-rec):
* lisp/calc/calc-arith.el (calcFunc-scf):
* lisp/calc/calc-arith.el (math-ceiling, math-round):
* lisp/calc/calc-arith.el (math-trunc-fancy, math-floor-fancy):
* lisp/calc/calc-ext.el (calc-init-extensions, calc-reset)
(calc-refresh-top, calc-z-prefix-help, calc-binary-op-fancy)
(calc-unary-op-fancy):
* lisp/calc/calc-forms.el (math-make-mod):
* lisp/calc/calc-frac.el (calcFunc-frac):
* lisp/calc/calc-funcs.el (calcFunc-euler):
* lisp/calc/calc-help.el (calc-full-help):
* lisp/calc/calc-lang.el (c, pascal, fortran, tex, latex, eqn)
(yacas, maxima, giac, math, maple):
* lisp/calc/calc-macs.el (calc-wrapper, calc-slow-wrapper):
* lisp/calc/calc-map.el (calc-get-operator, calcFunc-mapeqr)
(calcFunc-reducea, calcFunc-rreducea, calcFunc-reduced)
(calcFunc-rreduced, calcFunc-outer):
* lisp/calc/calc-misc.el (another-calc, calc-do-handle-whys):
* lisp/calc/calc-mode.el (calc-save-modes):
* lisp/calc/calc-mtx.el (math-col-matrix, math-mul-mat-vec):
* lisp/calc/calc-poly.el (math-sort-terms, math-poly-div-list)
(math-mul-list, math-sort-poly-base-list)
(math-partial-fractions):
* lisp/calc/calc-prog.el (calc-user-define-formula):
* lisp/calc/calc-rewr.el (math-rewrite, math-compile-patterns)
(math-compile-rewrites, math-parse-schedule)
(math-rwcomp-pattern):
* lisp/calc/calc-store.el (calc-var-name-map, calc-let)
(calc-permanent-variable, calc-insert-variables):
* lisp/calc/calc-stuff.el (calc-flush-caches, calcFunc-pclean)
(calcFunc-pfrac):
* lisp/calc/calc-units.el (math-build-units-table)
(math-decompose-units):
* lisp/calc/calc-vec.el (calcFunc-mrow, math-mat-col)
(calcFunc-mcol, math-mat-less-col, math-mimic-ident):
* lisp/calc/calc-yank.el (calc-edit):
* lisp/calc/calc.el
(calc-mode-var-list-restore-default-values)
(calc-mode-var-list-restore-saved-values, calc-mode, calc-quit):
* lisp/calc/calccomp.el (math-compose-expr)
(math-compose-matrix, math-vector-to-string): Don't quote lambdas with
'function'.
2020-11-17 01:51:30 +00:00
|
|
|
(mapcar (lambda (v)
|
|
|
|
(list 'math-check-const v t))
|
(math-integral-cache-state, calc-lang)
(calc-original-buffer): Declare them.
(calc-user-formula-alist): New variable.
(calc-user-define-formula, calc-fix-user-formula)
(calc-user-define-composition, calc-finish-formula-edit):
Replace variable alist by declared variable.
(var-q0, var-q1, var-q2, var-q3, var-q4, var-q5, var-q6)
(var-q7, var-q7, var-q8, var-q9): Declare them.
(calc-kbd-push): Don't check to see if var-q0 through var-q9
are bound.
(calcFunc-typeof): Replace undeclared variable by correct expression.
(math-exp-env): New variable.
(math-define-body, math-define-exp): Replace exp-env by declared
variable.
(math-define-exp): Replace misplaced variable by expression.
2004-11-21 05:52:41 +00:00
|
|
|
calc-user-formula-alist))
|
2001-11-06 18:59:06 +00:00
|
|
|
(list body))))
|
|
|
|
(put func 'calc-user-defn form)
|
|
|
|
(setq math-integral-cache-state nil)
|
|
|
|
(if key
|
|
|
|
(let* ((kmap (calc-user-key-map))
|
|
|
|
(old (assq key kmap)))
|
2014-10-01 17:23:42 +00:00
|
|
|
;; FIXME: Why not (define-key kmap (vector key) cmd)?
|
2001-11-06 18:59:06 +00:00
|
|
|
(if old
|
|
|
|
(setcdr old cmd)
|
|
|
|
(setcdr kmap (cons (cons key cmd) (cdr kmap)))))))
|
2001-11-14 09:09:09 +00:00
|
|
|
(message "")))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calc-default-formula-arglist (form)
|
|
|
|
(if (consp form)
|
|
|
|
(if (eq (car form) 'var)
|
2011-01-21 03:48:26 +00:00
|
|
|
(if (or (memq (nth 1 form) math-arglist)
|
2001-11-06 18:59:06 +00:00
|
|
|
(math-const-var form))
|
|
|
|
()
|
2011-01-21 03:48:26 +00:00
|
|
|
(setq math-arglist (cons (nth 1 form) math-arglist)))
|
2001-11-14 09:09:09 +00:00
|
|
|
(calc-default-formula-arglist-step (cdr form)))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calc-default-formula-arglist-step (l)
|
|
|
|
(and l
|
|
|
|
(progn
|
|
|
|
(calc-default-formula-arglist (car l))
|
2001-11-14 09:09:09 +00:00
|
|
|
(calc-default-formula-arglist-step (cdr l)))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calc-subsetp (a b)
|
|
|
|
(or (null a)
|
|
|
|
(and (memq (car a) b)
|
2001-11-14 09:09:09 +00:00
|
|
|
(calc-subsetp (cdr a) b))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calc-fix-user-formula (f)
|
|
|
|
(if (consp f)
|
|
|
|
(let (temp)
|
|
|
|
(cond ((and (eq (car f) 'var)
|
|
|
|
(memq (setq temp (or (cdr (assq (nth 1 f) '((nil . arg-nil)
|
|
|
|
(t . arg-t))))
|
|
|
|
(nth 1 f)))
|
(math-integral-cache-state, calc-lang)
(calc-original-buffer): Declare them.
(calc-user-formula-alist): New variable.
(calc-user-define-formula, calc-fix-user-formula)
(calc-user-define-composition, calc-finish-formula-edit):
Replace variable alist by declared variable.
(var-q0, var-q1, var-q2, var-q3, var-q4, var-q5, var-q6)
(var-q7, var-q7, var-q8, var-q9): Declare them.
(calc-kbd-push): Don't check to see if var-q0 through var-q9
are bound.
(calcFunc-typeof): Replace undeclared variable by correct expression.
(math-exp-env): New variable.
(math-define-body, math-define-exp): Replace exp-env by declared
variable.
(math-define-exp): Replace misplaced variable by expression.
2004-11-21 05:52:41 +00:00
|
|
|
calc-user-formula-alist))
|
2001-11-06 18:59:06 +00:00
|
|
|
temp)
|
|
|
|
((or (math-constp f) (eq (car f) 'var))
|
|
|
|
(list 'quote f))
|
|
|
|
((and (eq (car f) 'calcFunc-eval)
|
|
|
|
(= (length f) 2))
|
|
|
|
(list 'let '((calc-simplify-mode nil))
|
|
|
|
(list 'math-normalize (calc-fix-user-formula (nth 1 f)))))
|
|
|
|
((and (eq (car f) 'calcFunc-evalsimp)
|
|
|
|
(= (length f) 2))
|
|
|
|
(list 'math-simplify (calc-fix-user-formula (nth 1 f))))
|
|
|
|
((and (eq (car f) 'calcFunc-evalextsimp)
|
|
|
|
(= (length f) 2))
|
|
|
|
(list 'math-simplify-extended
|
|
|
|
(calc-fix-user-formula (nth 1 f))))
|
|
|
|
(t
|
|
|
|
(cons 'list
|
|
|
|
(cons (list 'quote (car f))
|
|
|
|
(mapcar 'calc-fix-user-formula (cdr f)))))))
|
2001-11-14 09:09:09 +00:00
|
|
|
f))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calc-user-define-composition ()
|
|
|
|
(interactive)
|
|
|
|
(calc-wrapper
|
|
|
|
(if (eq calc-language 'unform)
|
|
|
|
(error "Can't define formats for unformatted mode"))
|
|
|
|
(let* ((comp (calc-top 1))
|
2009-09-15 02:35:22 +00:00
|
|
|
(func (intern
|
2004-12-29 04:04:09 +00:00
|
|
|
(concat "calcFunc-"
|
|
|
|
(completing-read "Define format for which function: "
|
|
|
|
(mapcar (lambda (x) (substring x 9))
|
|
|
|
(all-completions "calcFunc-"
|
|
|
|
obarray))
|
2009-09-15 02:35:22 +00:00
|
|
|
(lambda (x)
|
|
|
|
(fboundp
|
2004-12-29 04:04:09 +00:00
|
|
|
(intern (concat "calcFunc-" x))))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
(comps (get func 'math-compose-forms))
|
|
|
|
entry entry2
|
2011-01-21 03:48:26 +00:00
|
|
|
(math-arglist nil)
|
(math-integral-cache-state, calc-lang)
(calc-original-buffer): Declare them.
(calc-user-formula-alist): New variable.
(calc-user-define-formula, calc-fix-user-formula)
(calc-user-define-composition, calc-finish-formula-edit):
Replace variable alist by declared variable.
(var-q0, var-q1, var-q2, var-q3, var-q4, var-q5, var-q6)
(var-q7, var-q7, var-q8, var-q9): Declare them.
(calc-kbd-push): Don't check to see if var-q0 through var-q9
are bound.
(calcFunc-typeof): Replace undeclared variable by correct expression.
(math-exp-env): New variable.
(math-define-body, math-define-exp): Replace exp-env by declared
variable.
(math-define-exp): Replace misplaced variable by expression.
2004-11-21 05:52:41 +00:00
|
|
|
(calc-user-formula-alist nil))
|
2001-11-06 18:59:06 +00:00
|
|
|
(if (math-zerop comp)
|
|
|
|
(if (setq entry (assq calc-language comps))
|
|
|
|
(put func 'math-compose-forms (delq entry comps)))
|
|
|
|
(calc-default-formula-arglist comp)
|
2011-01-21 03:48:26 +00:00
|
|
|
(setq math-arglist (sort math-arglist 'string-lessp))
|
2001-11-06 18:59:06 +00:00
|
|
|
(while
|
|
|
|
(progn
|
2009-09-15 02:35:22 +00:00
|
|
|
(setq calc-user-formula-alist
|
(math-integral-cache-state, calc-lang)
(calc-original-buffer): Declare them.
(calc-user-formula-alist): New variable.
(calc-user-define-formula, calc-fix-user-formula)
(calc-user-define-composition, calc-finish-formula-edit):
Replace variable alist by declared variable.
(var-q0, var-q1, var-q2, var-q3, var-q4, var-q5, var-q6)
(var-q7, var-q7, var-q8, var-q9): Declare them.
(calc-kbd-push): Don't check to see if var-q0 through var-q9
are bound.
(calcFunc-typeof): Replace undeclared variable by correct expression.
(math-exp-env): New variable.
(math-define-body, math-define-exp): Replace exp-env by declared
variable.
(math-define-exp): Replace misplaced variable by expression.
2004-11-21 05:52:41 +00:00
|
|
|
(read-from-minibuffer "Composition argument list: "
|
2011-01-21 03:48:26 +00:00
|
|
|
(if math-arglist
|
|
|
|
(prin1-to-string math-arglist)
|
(math-integral-cache-state, calc-lang)
(calc-original-buffer): Declare them.
(calc-user-formula-alist): New variable.
(calc-user-define-formula, calc-fix-user-formula)
(calc-user-define-composition, calc-finish-formula-edit):
Replace variable alist by declared variable.
(var-q0, var-q1, var-q2, var-q3, var-q4, var-q5, var-q6)
(var-q7, var-q7, var-q8, var-q9): Declare them.
(calc-kbd-push): Don't check to see if var-q0 through var-q9
are bound.
(calcFunc-typeof): Replace undeclared variable by correct expression.
(math-exp-env): New variable.
(math-define-body, math-define-exp): Replace exp-env by declared
variable.
(math-define-exp): Replace misplaced variable by expression.
2004-11-21 05:52:41 +00:00
|
|
|
"()")
|
|
|
|
minibuffer-local-map
|
|
|
|
t))
|
2011-01-21 03:48:26 +00:00
|
|
|
(and (not (calc-subsetp calc-user-formula-alist math-arglist))
|
2001-11-06 18:59:06 +00:00
|
|
|
(y-or-n-p
|
|
|
|
"Okay for arguments that don't appear in formula to be invisible? "))))
|
|
|
|
(or (setq entry (assq calc-language comps))
|
|
|
|
(put func 'math-compose-forms
|
|
|
|
(cons (setq entry (list calc-language)) comps)))
|
(math-integral-cache-state, calc-lang)
(calc-original-buffer): Declare them.
(calc-user-formula-alist): New variable.
(calc-user-define-formula, calc-fix-user-formula)
(calc-user-define-composition, calc-finish-formula-edit):
Replace variable alist by declared variable.
(var-q0, var-q1, var-q2, var-q3, var-q4, var-q5, var-q6)
(var-q7, var-q7, var-q8, var-q9): Declare them.
(calc-kbd-push): Don't check to see if var-q0 through var-q9
are bound.
(calcFunc-typeof): Replace undeclared variable by correct expression.
(math-exp-env): New variable.
(math-define-body, math-define-exp): Replace exp-env by declared
variable.
(math-define-exp): Replace misplaced variable by expression.
2004-11-21 05:52:41 +00:00
|
|
|
(or (setq entry2 (assq (length calc-user-formula-alist) (cdr entry)))
|
2001-11-06 18:59:06 +00:00
|
|
|
(setcdr entry
|
2009-09-15 02:35:22 +00:00
|
|
|
(cons (setq entry2
|
(math-integral-cache-state, calc-lang)
(calc-original-buffer): Declare them.
(calc-user-formula-alist): New variable.
(calc-user-define-formula, calc-fix-user-formula)
(calc-user-define-composition, calc-finish-formula-edit):
Replace variable alist by declared variable.
(var-q0, var-q1, var-q2, var-q3, var-q4, var-q5, var-q6)
(var-q7, var-q7, var-q8, var-q9): Declare them.
(calc-kbd-push): Don't check to see if var-q0 through var-q9
are bound.
(calcFunc-typeof): Replace undeclared variable by correct expression.
(math-exp-env): New variable.
(math-define-body, math-define-exp): Replace exp-env by declared
variable.
(math-define-exp): Replace misplaced variable by expression.
2004-11-21 05:52:41 +00:00
|
|
|
(list (length calc-user-formula-alist))) (cdr entry))))
|
2009-09-15 02:35:22 +00:00
|
|
|
(setcdr entry2
|
(math-integral-cache-state, calc-lang)
(calc-original-buffer): Declare them.
(calc-user-formula-alist): New variable.
(calc-user-define-formula, calc-fix-user-formula)
(calc-user-define-composition, calc-finish-formula-edit):
Replace variable alist by declared variable.
(var-q0, var-q1, var-q2, var-q3, var-q4, var-q5, var-q6)
(var-q7, var-q7, var-q8, var-q9): Declare them.
(calc-kbd-push): Don't check to see if var-q0 through var-q9
are bound.
(calcFunc-typeof): Replace undeclared variable by correct expression.
(math-exp-env): New variable.
(math-define-body, math-define-exp): Replace exp-env by declared
variable.
(math-define-exp): Replace misplaced variable by expression.
2004-11-21 05:52:41 +00:00
|
|
|
(list 'lambda calc-user-formula-alist (calc-fix-user-formula comp))))
|
2001-11-06 18:59:06 +00:00
|
|
|
(calc-pop-stack 1)
|
2001-11-14 09:09:09 +00:00
|
|
|
(calc-do-refresh))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
(defun calc-user-define-kbd-macro (arg)
|
|
|
|
(interactive "P")
|
|
|
|
(or last-kbd-macro
|
|
|
|
(error "No keyboard macro defined"))
|
|
|
|
(message "Define last kbd macro on user key: z-")
|
|
|
|
(let ((key (read-char)))
|
|
|
|
(if (= (calc-user-function-classify key) 0)
|
|
|
|
(error "Can't redefine \"?\" key"))
|
|
|
|
(let ((cmd (intern (completing-read "Full name for new command: "
|
|
|
|
obarray
|
|
|
|
'commandp
|
|
|
|
nil
|
|
|
|
(concat "calc-User-"
|
|
|
|
(if (or (and (>= key ?a)
|
|
|
|
(<= key ?z))
|
|
|
|
(and (>= key ?A)
|
|
|
|
(<= key ?Z))
|
|
|
|
(and (>= key ?0)
|
|
|
|
(<= key ?9)))
|
|
|
|
(char-to-string key)
|
|
|
|
(format "%03d" key)))))))
|
|
|
|
(and (fboundp cmd)
|
|
|
|
(not (let ((f (symbol-function cmd)))
|
|
|
|
(or (stringp f)
|
|
|
|
(and (consp f)
|
|
|
|
(eq (car-safe (nth 3 f))
|
|
|
|
'calc-execute-kbd-macro)))))
|
|
|
|
(error "Function %s is already defined and not a keyboard macro"
|
|
|
|
cmd))
|
|
|
|
(put cmd 'calc-user-defn t)
|
|
|
|
(fset cmd (if (< (prefix-numeric-value arg) 0)
|
|
|
|
last-kbd-macro
|
|
|
|
(list 'lambda
|
|
|
|
'(arg)
|
|
|
|
'(interactive "P")
|
|
|
|
(list 'calc-execute-kbd-macro
|
|
|
|
(vector (key-description last-kbd-macro)
|
|
|
|
last-kbd-macro)
|
|
|
|
'arg
|
|
|
|
(format "z%c" key)))))
|
|
|
|
(let* ((kmap (calc-user-key-map))
|
|
|
|
(old (assq key kmap)))
|
2014-10-01 17:23:42 +00:00
|
|
|
;; FIXME: Why not (define-key kmap (vector key) func)?
|
2001-11-06 18:59:06 +00:00
|
|
|
(if old
|
|
|
|
(setcdr old cmd)
|
2001-11-14 09:09:09 +00:00
|
|
|
(setcdr kmap (cons (cons key cmd) (cdr kmap))))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
(defun calc-edit-user-syntax ()
|
|
|
|
(interactive)
|
|
|
|
(calc-wrapper
|
|
|
|
(let ((lang calc-language))
|
2021-01-04 05:01:58 +00:00
|
|
|
(calc--edit-mode (lambda () (calc-finish-user-syntax-edit lang))
|
|
|
|
t
|
|
|
|
(format "Editing %s-Mode Syntax Table. "
|
|
|
|
(cond ((null lang) "Normal")
|
|
|
|
((eq lang 'tex) "TeX")
|
|
|
|
((eq lang 'latex) "LaTeX")
|
|
|
|
(t (capitalize (symbol-name lang))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
(calc-write-parse-table (cdr (assq lang calc-user-parse-tables))
|
|
|
|
lang)))
|
2001-11-14 09:09:09 +00:00
|
|
|
(calc-show-edit-buffer))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(math-integral-cache-state, calc-lang)
(calc-original-buffer): Declare them.
(calc-user-formula-alist): New variable.
(calc-user-define-formula, calc-fix-user-formula)
(calc-user-define-composition, calc-finish-formula-edit):
Replace variable alist by declared variable.
(var-q0, var-q1, var-q2, var-q3, var-q4, var-q5, var-q6)
(var-q7, var-q7, var-q8, var-q9): Declare them.
(calc-kbd-push): Don't check to see if var-q0 through var-q9
are bound.
(calcFunc-typeof): Replace undeclared variable by correct expression.
(math-exp-env): New variable.
(math-define-body, math-define-exp): Replace exp-env by declared
variable.
(math-define-exp): Replace misplaced variable by expression.
2004-11-21 05:52:41 +00:00
|
|
|
(defvar calc-original-buffer)
|
|
|
|
|
2001-11-06 18:59:06 +00:00
|
|
|
(defun calc-finish-user-syntax-edit (lang)
|
|
|
|
(let ((tab (calc-read-parse-table calc-original-buffer lang))
|
|
|
|
(entry (assq lang calc-user-parse-tables)))
|
|
|
|
(if tab
|
|
|
|
(setcdr (or entry
|
|
|
|
(car (setq calc-user-parse-tables
|
|
|
|
(cons (list lang) calc-user-parse-tables))))
|
|
|
|
tab)
|
|
|
|
(if entry
|
|
|
|
(setq calc-user-parse-tables
|
|
|
|
(delq entry calc-user-parse-tables)))))
|
2001-11-14 09:09:09 +00:00
|
|
|
(switch-to-buffer calc-original-buffer))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(math-integral-cache-state, calc-lang)
(calc-original-buffer): Declare them.
(calc-user-formula-alist): New variable.
(calc-user-define-formula, calc-fix-user-formula)
(calc-user-define-composition, calc-finish-formula-edit):
Replace variable alist by declared variable.
(var-q0, var-q1, var-q2, var-q3, var-q4, var-q5, var-q6)
(var-q7, var-q7, var-q8, var-q9): Declare them.
(calc-kbd-push): Don't check to see if var-q0 through var-q9
are bound.
(calcFunc-typeof): Replace undeclared variable by correct expression.
(math-exp-env): New variable.
(math-define-body, math-define-exp): Replace exp-env by declared
variable.
(math-define-exp): Replace misplaced variable by expression.
2004-11-21 05:52:41 +00:00
|
|
|
;; The variable calc-lang is local to calc-write-parse-table, but is
|
2009-09-15 02:35:22 +00:00
|
|
|
;; used by calc-write-parse-table-part which is called by
|
|
|
|
;; calc-write-parse-table. The variable is also local to
|
(math-integral-cache-state, calc-lang)
(calc-original-buffer): Declare them.
(calc-user-formula-alist): New variable.
(calc-user-define-formula, calc-fix-user-formula)
(calc-user-define-composition, calc-finish-formula-edit):
Replace variable alist by declared variable.
(var-q0, var-q1, var-q2, var-q3, var-q4, var-q5, var-q6)
(var-q7, var-q7, var-q8, var-q9): Declare them.
(calc-kbd-push): Don't check to see if var-q0 through var-q9
are bound.
(calcFunc-typeof): Replace undeclared variable by correct expression.
(math-exp-env): New variable.
(math-define-body, math-define-exp): Replace exp-env by declared
variable.
(math-define-exp): Replace misplaced variable by expression.
2004-11-21 05:52:41 +00:00
|
|
|
;; calc-read-parse-table, but is used by calc-fix-token-name which
|
|
|
|
;; is called (indirectly) by calc-read-parse-table.
|
|
|
|
(defvar calc-lang)
|
|
|
|
|
2020-10-10 20:00:51 +00:00
|
|
|
(defun calc-write-parse-table (tab lang)
|
|
|
|
(let ((calc-lang lang)
|
|
|
|
(p tab))
|
2001-11-06 18:59:06 +00:00
|
|
|
(while p
|
|
|
|
(calc-write-parse-table-part (car (car p)))
|
|
|
|
(insert ":= "
|
|
|
|
(let ((math-format-hash-args t))
|
|
|
|
(math-format-flat-expr (cdr (car p)) 0))
|
|
|
|
"\n")
|
2001-11-14 09:09:09 +00:00
|
|
|
(setq p (cdr p)))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calc-write-parse-table-part (p)
|
|
|
|
(while p
|
|
|
|
(cond ((stringp (car p))
|
|
|
|
(let ((s (car p)))
|
|
|
|
(if (and (string-match "\\`\\\\dots\\>" s)
|
2005-02-08 05:03:07 +00:00
|
|
|
(not (memq calc-lang '(tex latex))))
|
2001-11-06 18:59:06 +00:00
|
|
|
(setq s (concat ".." (substring s 5))))
|
|
|
|
(if (or (and (string-match
|
|
|
|
"[a-zA-Z0-9\"{}]\\|\\`:=\\'\\|\\`#\\|\\`%%" s)
|
|
|
|
(string-match "[^a-zA-Z0-9\\]" s))
|
|
|
|
(and (assoc s '((")") ("]") (">")))
|
|
|
|
(not (cdr p))))
|
|
|
|
(insert (prin1-to-string s) " ")
|
|
|
|
(insert s " "))))
|
|
|
|
((integerp (car p))
|
|
|
|
(insert "#")
|
|
|
|
(or (= (car p) 0)
|
|
|
|
(insert "/" (int-to-string (car p))))
|
|
|
|
(insert " "))
|
|
|
|
((and (eq (car (car p)) '\?) (equal (car (nth 2 (car p))) "$$"))
|
|
|
|
(insert (car (nth 1 (car p))) " "))
|
|
|
|
(t
|
|
|
|
(insert "{ ")
|
|
|
|
(calc-write-parse-table-part (nth 1 (car p)))
|
|
|
|
(insert "}" (symbol-name (car (car p))))
|
|
|
|
(if (nth 2 (car p))
|
|
|
|
(calc-write-parse-table-part (list (car (nth 2 (car p)))))
|
|
|
|
(insert " "))))
|
2001-11-14 09:09:09 +00:00
|
|
|
(setq p (cdr p))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
2020-10-10 20:00:51 +00:00
|
|
|
(defun calc-read-parse-table (calc-buf lang)
|
|
|
|
(let ((calc-lang lang)
|
|
|
|
(tab nil))
|
2001-11-06 18:59:06 +00:00
|
|
|
(while (progn
|
|
|
|
(skip-chars-forward "\n\t ")
|
|
|
|
(not (eobp)))
|
|
|
|
(if (looking-at "%%")
|
|
|
|
(end-of-line)
|
|
|
|
(let ((pt (point))
|
|
|
|
(p (calc-read-parse-table-part ":=[\n\t ]+" ":=")))
|
|
|
|
(or (stringp (car p))
|
|
|
|
(and (integerp (car p))
|
|
|
|
(stringp (nth 1 p)))
|
|
|
|
(progn
|
|
|
|
(goto-char pt)
|
|
|
|
(error "Malformed syntax rule")))
|
|
|
|
(let ((pos (point)))
|
|
|
|
(end-of-line)
|
|
|
|
(let* ((str (buffer-substring pos (point)))
|
* 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
|
|
|
(exp (with-current-buffer calc-buf
|
2001-11-06 18:59:06 +00:00
|
|
|
(let ((calc-user-parse-tables nil)
|
|
|
|
(calc-language nil)
|
2007-06-20 04:16:57 +00:00
|
|
|
(math-expr-opers (math-standard-ops))
|
2001-11-06 18:59:06 +00:00
|
|
|
(calc-hashes-used 0))
|
|
|
|
(math-read-expr
|
|
|
|
(if (string-match ",[ \t]*\\'" str)
|
|
|
|
(substring str 0 (match-beginning 0))
|
|
|
|
str))))))
|
|
|
|
(if (eq (car-safe exp) 'error)
|
|
|
|
(progn
|
|
|
|
(goto-char (+ pos (nth 1 exp)))
|
|
|
|
(error (nth 2 exp))))
|
|
|
|
(setq tab (nconc tab (list (cons p exp)))))))))
|
2001-11-14 09:09:09 +00:00
|
|
|
tab))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calc-fix-token-name (name &optional unquoted)
|
|
|
|
(cond ((string-match "\\`\\.\\." name)
|
|
|
|
(concat "\\dots" (substring name 2)))
|
2005-01-31 06:28:06 +00:00
|
|
|
((and (equal name "{") (memq calc-lang '(tex latex eqn)))
|
2001-11-06 18:59:06 +00:00
|
|
|
"(")
|
2005-01-31 06:28:06 +00:00
|
|
|
((and (equal name "}") (memq calc-lang '(tex latex eqn)))
|
2001-11-06 18:59:06 +00:00
|
|
|
")")
|
2005-02-08 05:03:07 +00:00
|
|
|
((and (equal name "&") (memq calc-lang '(tex latex)))
|
2001-11-06 18:59:06 +00:00
|
|
|
",")
|
|
|
|
((equal name "#")
|
|
|
|
(search-backward "#")
|
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
|
|
|
(error "Token `#' is reserved"))
|
Use string-search instead of string-match[-p]
`string-search` is easier to understand, less error-prone, much
faster, does not pollute the regexp cache, and does not mutate global
state. Use it where applicable and obviously safe (erring on the
conservative side).
* admin/authors.el (authors-canonical-file-name)
(authors-scan-change-log):
* lisp/apropos.el (apropos-command)
(apropos-documentation-property, apropos-symbols-internal):
* lisp/arc-mode.el (archive-arc-summarize)
(archive-zoo-summarize):
* lisp/calc/calc-aent.el (math-read-factor):
* lisp/calc/calc-ext.el (math-read-big-expr)
(math-format-nice-expr, math-format-number-fancy):
* lisp/calc/calc-forms.el (math-read-angle-brackets):
* lisp/calc/calc-graph.el (calc-graph-set-range):
* lisp/calc/calc-keypd.el (calc-keypad-press):
* lisp/calc/calc-lang.el (tex, latex, math-read-big-rec):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-user-define-permanent, math-define-exp):
* lisp/calc/calc.el (calc-record, calcDigit-key)
(calc-count-lines):
* lisp/calc/calcalg2.el (calc-solve-for, calc-poly-roots)
(math-do-integral):
* lisp/calc/calcalg3.el (calc-find-root, calc-find-minimum)
(calc-get-fit-variables):
* lisp/cedet/ede/speedbar.el (ede-tag-expand):
* lisp/cedet/semantic/java.el (semantic-java-expand-tag):
* lisp/cedet/semantic/sb.el (semantic-sb-show-extra)
(semantic-sb-expand-group):
* lisp/cedet/semantic/wisent/python.el
(semantic-python-instance-variable-p):
* lisp/cus-edit.el (get):
* lisp/descr-text.el (describe-text-sexp):
* lisp/dired-aux.el (dired-compress-file):
* lisp/dired-x.el (dired-make-relative-symlink):
* lisp/dired.el (dired-glob-regexp):
* lisp/dos-fns.el (dos-convert-standard-filename, dos-8+3-filename):
* lisp/edmacro.el (edmacro-format-keys):
* lisp/emacs-lisp/eieio-opt.el (eieio-sb-expand):
* lisp/emacs-lisp/eieio-speedbar.el (eieio-speedbar-object-expand):
* lisp/emacs-lisp/lisp-mnt.el (lm-keywords-list):
* lisp/emacs-lisp/warnings.el (display-warning):
* lisp/emulation/viper-ex.el (viper-ex-read-file-name)
(ex-print-display-lines):
* lisp/env.el (read-envvar-name, setenv):
* lisp/epa-mail.el (epa-mail-encrypt):
* lisp/epg.el (epg--start):
* lisp/erc/erc-backend.el (erc-parse-server-response):
* lisp/erc/erc-dcc.el (erc-dcc-member):
* lisp/erc/erc-speedbar.el (erc-speedbar-expand-server)
(erc-speedbar-expand-channel, erc-speedbar-expand-user):
* lisp/erc/erc.el (erc-send-input):
* lisp/eshell/em-glob.el (eshell-glob-entries):
* lisp/eshell/esh-proc.el (eshell-needs-pipe-p):
* lisp/eshell/esh-util.el (eshell-convert):
* lisp/eshell/esh-var.el (eshell-envvar-names):
* lisp/faces.el (x-resolve-font-name):
* lisp/ffap.el (ffap-file-at-point):
* lisp/files.el (wildcard-to-regexp, shell-quote-wildcard-pattern):
* lisp/forms.el (forms--update):
* lisp/frameset.el (frameset-filter-unshelve-param):
* lisp/gnus/gnus-art.el (article-decode-charset):
* lisp/gnus/gnus-kill.el (gnus-kill-parse-rn-kill-file):
* lisp/gnus/gnus-mlspl.el (gnus-group-split-fancy):
* lisp/gnus/gnus-msg.el (gnus-summary-resend-message-insert-gcc)
(gnus-inews-insert-gcc):
* lisp/gnus/gnus-rfc1843.el (rfc1843-decode-article-body):
* lisp/gnus/gnus-search.el (gnus-search-indexed-parse-output)
(gnus-search--complete-key-data):
* lisp/gnus/gnus-spec.el (gnus-parse-simple-format):
* lisp/gnus/gnus-sum.el (gnus-summary-refer-article):
* lisp/gnus/gnus-util.el (gnus-extract-address-components)
(gnus-newsgroup-directory-form):
* lisp/gnus/gnus-uu.el (gnus-uu-grab-view):
* lisp/gnus/gnus.el (gnus-group-native-p, gnus-short-group-name):
* lisp/gnus/message.el (message-check-news-header-syntax)
(message-make-message-id, message-user-mail-address)
(message-make-fqdn, message-get-reply-headers, message-followup):
* lisp/gnus/mm-decode.el (mm-dissect-buffer):
* lisp/gnus/nnheader.el (nnheader-insert):
* lisp/gnus/nnimap.el (nnimap-process-quirk)
(nnimap-imap-ranges-to-gnus-ranges):
* lisp/gnus/nnmaildir.el (nnmaildir--ensure-suffix):
* lisp/gnus/nnmairix.el (nnmairix-determine-original-group-from-path):
* lisp/gnus/nnrss.el (nnrss-match-macro):
* lisp/gnus/nntp.el (nntp-find-group-and-number):
* lisp/help-fns.el (help--symbol-completion-table-affixation):
* lisp/help.el (help-function-arglist):
* lisp/hippie-exp.el (he-concat-directory-file-name):
* lisp/htmlfontify.el (hfy-relstub):
* lisp/ido.el (ido-make-prompt, ido-complete, ido-copy-current-word)
(ido-exhibit):
* lisp/image/image-converter.el (image-convert-p):
* lisp/info-xref.el (info-xref-docstrings):
* lisp/info.el (Info-toc-build, Info-follow-reference)
(Info-backward-node, Info-finder-find-node)
(Info-speedbar-expand-node):
* lisp/international/mule-diag.el (print-fontset-element):
* lisp/language/korea-util.el (default-korean-keyboard):
* lisp/linum.el (linum-after-change):
* lisp/mail/ietf-drums.el (ietf-drums-parse-address):
* lisp/mail/mail-utils.el (mail-dont-reply-to):
* lisp/mail/rfc2047.el (rfc2047-encode-1, rfc2047-decode-string):
* lisp/mail/rfc2231.el (rfc2231-parse-string):
* lisp/mail/rmailkwd.el (rmail-set-label):
* lisp/mail/rmailsum.el (rmail-header-summary):
* lisp/mail/smtpmail.el (smtpmail-maybe-append-domain)
(smtpmail-user-mail-address):
* lisp/mail/uce.el (uce-reply-to-uce):
* lisp/man.el (Man-default-man-entry):
* lisp/mh-e/mh-alias.el (mh-alias-gecos-name)
(mh-alias-minibuffer-confirm-address):
* lisp/mh-e/mh-comp.el (mh-forwarded-letter-subject):
* lisp/mh-e/mh-speed.el (mh-speed-parse-flists-output):
* lisp/mh-e/mh-utils.el (mh-collect-folder-names-filter)
(mh-folder-completion-function):
* lisp/minibuffer.el (completion--make-envvar-table)
(completion-file-name-table, completion-flex-try-completion)
(completion-flex-all-completions):
* lisp/mpc.el (mpc--proc-quote-string, mpc-cmd-special-tag-p)
(mpc-constraints-tag-lookup):
* lisp/net/ange-ftp.el (ange-ftp-send-cmd)
(ange-ftp-allow-child-lookup):
* lisp/net/mailcap.el (mailcap-mime-types):
* lisp/net/mairix.el (mairix-search-thread-this-article):
* lisp/net/pop3.el (pop3-open-server):
* lisp/net/soap-client.el (soap-decode-xs-complex-type):
* lisp/net/socks.el (socks-filter):
* lisp/nxml/nxml-outln.el (nxml-highlighted-qname):
* lisp/nxml/rng-cmpct.el (rng-c-expand-name, rng-c-expand-datatype):
* lisp/nxml/rng-uri.el (rng-uri-file-name-1):
* lisp/obsolete/complete.el (partial-completion-mode)
(PC-do-completion):
* lisp/obsolete/longlines.el (longlines-encode-string):
* lisp/obsolete/nnir.el (nnir-compose-result):
* lisp/obsolete/terminal.el (te-quote-arg-for-sh):
* lisp/obsolete/tpu-edt.el (tpu-check-search-case):
* lisp/obsolete/url-ns.el (isPlainHostName):
* lisp/pcmpl-unix.el (pcomplete/scp):
* lisp/play/dunnet.el (dun-listify-string2, dun-get-path)
(dun-unix-parse, dun-doassign, dun-cat, dun-batch-unix-interface):
* lisp/progmodes/ebnf2ps.el: (ebnf-eps-header-footer-comment):
* lisp/progmodes/gdb-mi.el (gdb-var-delete)
(gdb-speedbar-expand-node, gdbmi-bnf-incomplete-record-result):
* lisp/progmodes/gud.el (gud-find-expr):
* lisp/progmodes/idlw-help.el (idlwave-do-context-help1):
* lisp/progmodes/idlw-shell.el (idlwave-shell-mode)
(idlwave-shell-filter-hidden-output, idlwave-shell-filter):
* lisp/progmodes/idlwave.el (idlwave-skip-label-or-case)
(idlwave-routine-info):
* lisp/progmodes/octave.el (inferior-octave-completion-at-point):
* lisp/progmodes/sh-script.el (sh-add-completer):
* lisp/progmodes/sql.el (defun):
* lisp/progmodes/xscheme.el (xscheme-process-filter):
* lisp/replace.el (query-replace-compile-replacement)
(map-query-replace-regexp):
* lisp/shell.el (shell--command-completion-data)
(shell-environment-variable-completion):
* lisp/simple.el (display-message-or-buffer):
* lisp/speedbar.el (speedbar-dired, speedbar-tag-file)
(speedbar-tag-expand):
* lisp/subr.el (split-string-and-unquote):
* lisp/tar-mode.el (tar-extract):
* lisp/term.el (term-command-hook, serial-read-name):
* lisp/textmodes/bibtex.el (bibtex-print-help-message):
* lisp/textmodes/ispell.el (ispell-lookup-words, ispell-filter)
(ispell-parse-output, ispell-buffer-local-parsing):
* lisp/textmodes/reftex-cite.el (reftex-do-citation):
* lisp/textmodes/reftex-parse.el (reftex-notice-new):
* lisp/textmodes/reftex-ref.el (reftex-show-entry):
* lisp/textmodes/reftex.el (reftex-compile-variables):
* lisp/textmodes/tex-mode.el (tex-send-command)
(tex-start-tex, tex-append):
* lisp/thingatpt.el (thing-at-point-url-at-point):
* lisp/tmm.el (tmm-add-one-shortcut):
* lisp/transient.el (transient-format-key):
* lisp/url/url-auth.el (url-basic-auth)
(url-digest-auth-directory-id-assoc):
* lisp/url/url-news.el (url-news):
* lisp/url/url-util.el (url-parse-query-string):
* lisp/vc/vc-cvs.el (vc-cvs-parse-entry):
* lisp/wid-browse.el (widget-browse-sexp):
* lisp/woman.el (woman-parse-colon-path, woman-mini-help)
(WoMan-getpage-in-background, woman-negative-vertical-space):
* lisp/xml.el:
* test/lisp/emacs-lisp/check-declare-tests.el
(check-declare-tests-warn):
* test/lisp/files-tests.el
(files-tests-file-name-non-special-dired-compress-handler):
* test/lisp/net/network-stream-tests.el (server-process-filter):
* test/src/coding-tests.el (ert-test-unibyte-buffer-dos-eol-decode):
Use `string-search` instead of `string-match` and `string-match-p`.
2021-08-09 09:20:00 +00:00
|
|
|
((and unquoted (string-search "#" name))
|
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
|
|
|
(error "Tokens containing `#' must be quoted"))
|
2001-11-06 18:59:06 +00:00
|
|
|
((not (string-match "[^ ]" name))
|
|
|
|
(search-backward "\"" nil t)
|
|
|
|
(error "Blank tokens are not allowed"))
|
2001-11-14 09:09:09 +00:00
|
|
|
(t name)))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calc-read-parse-table-part (term eterm)
|
|
|
|
(let ((part nil)
|
|
|
|
(quoted nil))
|
|
|
|
(while (progn
|
|
|
|
(skip-chars-forward "\n\t ")
|
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
|
|
|
(if (eobp) (error "Expected `%s'" eterm))
|
2001-11-06 18:59:06 +00:00
|
|
|
(not (looking-at term)))
|
|
|
|
(cond ((looking-at "%%")
|
|
|
|
(end-of-line))
|
|
|
|
((looking-at "{[\n\t ]")
|
|
|
|
(forward-char 2)
|
|
|
|
(let ((p (calc-read-parse-table-part "}" "}")))
|
|
|
|
(or (looking-at "[+*?]")
|
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
|
|
|
(error "Expected `+', `*', or `?'"))
|
2001-11-06 18:59:06 +00:00
|
|
|
(let ((sym (intern (buffer-substring (point) (1+ (point))))))
|
|
|
|
(forward-char 1)
|
|
|
|
(looking-at "[^\n\t ]*")
|
|
|
|
(let ((sep (buffer-substring (point) (match-end 0))))
|
|
|
|
(goto-char (match-end 0))
|
|
|
|
(and (eq sym '\?) (> (length sep) 0)
|
|
|
|
(not (equal sep "$")) (not (equal sep "."))
|
|
|
|
(error "Separator not allowed with { ... }?"))
|
|
|
|
(if (string-match "\\`\"" sep)
|
|
|
|
(setq sep (read-from-string sep)))
|
2010-09-18 17:23:12 +00:00
|
|
|
(if (> (length sep) 0)
|
|
|
|
(setq sep (calc-fix-token-name sep)))
|
2001-11-06 18:59:06 +00:00
|
|
|
(setq part (nconc part
|
|
|
|
(list (list sym p
|
|
|
|
(and (> (length sep) 0)
|
|
|
|
(cons sep p))))))))))
|
|
|
|
((looking-at "}")
|
|
|
|
(error "Too many }'s"))
|
|
|
|
((looking-at "\"")
|
|
|
|
(setq quoted (calc-fix-token-name (read (current-buffer)))
|
|
|
|
part (nconc part (list quoted))))
|
|
|
|
((looking-at "#\\(\\(/[0-9]+\\)?\\)[\n\t ]")
|
|
|
|
(setq part (nconc part (list (if (= (match-beginning 1)
|
|
|
|
(match-end 1))
|
|
|
|
0
|
2005-05-02 19:44:43 +00:00
|
|
|
(string-to-number
|
2001-11-06 18:59:06 +00:00
|
|
|
(buffer-substring
|
|
|
|
(1+ (match-beginning 1))
|
|
|
|
(match-end 1)))))))
|
|
|
|
(goto-char (match-end 0)))
|
|
|
|
((looking-at ":=[\n\t ]")
|
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
|
|
|
(error "Misplaced `:='"))
|
2001-11-06 18:59:06 +00:00
|
|
|
(t
|
|
|
|
(looking-at "[^\n\t ]*")
|
|
|
|
(let ((end (match-end 0)))
|
|
|
|
(setq part (nconc part (list (calc-fix-token-name
|
|
|
|
(buffer-substring
|
|
|
|
(point) end) t))))
|
|
|
|
(goto-char end)))))
|
|
|
|
(goto-char (match-end 0))
|
|
|
|
(let ((len (length part)))
|
|
|
|
(while (and (> len 1)
|
|
|
|
(let ((last (nthcdr (setq len (1- len)) part)))
|
|
|
|
(and (assoc (car last) '((")") ("]") (">")))
|
|
|
|
(not (eq (car last) quoted))
|
|
|
|
(setcar last
|
|
|
|
(list '\? (list (car last)) '("$$"))))))))
|
2001-11-14 09:09:09 +00:00
|
|
|
part))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calc-user-define-invocation ()
|
|
|
|
(interactive)
|
|
|
|
(or last-kbd-macro
|
|
|
|
(error "No keyboard macro defined"))
|
|
|
|
(setq calc-invocation-macro last-kbd-macro)
|
2022-07-03 15:35:53 +00:00
|
|
|
(message (substitute-command-keys "Use \\`C-x * Z' to invoke this macro")))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(calc-finish-macro-edit): Remove.
(calc-edit-macro-repeats, calc-edit-macro-adjust-buffer,
calc-edit-macro-command, calc-edit-macro-command-type,
calc-edit-macro-combine-alg-ent, calc-edit-macro-combine-ext-command,
calc-edit-macro-combine-var-name, calc-edit-macro-combine-digits,
calc-edit-format-macro-buffer, calc-edit-macro-pre-finish-edit,
calc-edit-macro-finish-edit): New functions.
(calc-user-define-edit): Use new functions to edit named calc macros.
2005-01-02 04:51:06 +00:00
|
|
|
(defun calc-user-define-edit ()
|
|
|
|
(interactive) ; but no calc-wrapper!
|
2001-11-06 18:59:06 +00:00
|
|
|
(message "Edit definition of command: z-")
|
2005-02-19 20:01:01 +00:00
|
|
|
(let* (cmdname
|
|
|
|
(key (read-char))
|
2001-11-06 18:59:06 +00:00
|
|
|
(def (or (assq key (calc-user-key-map))
|
|
|
|
(assq (upcase key) (calc-user-key-map))
|
|
|
|
(assq (downcase key) (calc-user-key-map))
|
|
|
|
(error "No command defined for that key")))
|
|
|
|
(cmd (cdr def)))
|
(calc-finish-macro-edit): Remove.
(calc-edit-macro-repeats, calc-edit-macro-adjust-buffer,
calc-edit-macro-command, calc-edit-macro-command-type,
calc-edit-macro-combine-alg-ent, calc-edit-macro-combine-ext-command,
calc-edit-macro-combine-var-name, calc-edit-macro-combine-digits,
calc-edit-format-macro-buffer, calc-edit-macro-pre-finish-edit,
calc-edit-macro-finish-edit): New functions.
(calc-user-define-edit): Use new functions to edit named calc macros.
2005-01-02 04:51:06 +00:00
|
|
|
(when (symbolp cmd)
|
|
|
|
(setq cmdname (symbol-name cmd))
|
|
|
|
(setq cmd (symbol-function cmd)))
|
2001-11-06 18:59:06 +00:00
|
|
|
(cond ((or (stringp cmd)
|
|
|
|
(and (consp cmd)
|
2021-01-04 05:01:58 +00:00
|
|
|
(eq (car-safe (nth 3 cmd)) #'calc-execute-kbd-macro)))
|
|
|
|
;; FIXME: Won't (nth 3 cmd) fail when (stringp cmd)?
|
(calc-finish-macro-edit): Remove.
(calc-edit-macro-repeats, calc-edit-macro-adjust-buffer,
calc-edit-macro-command, calc-edit-macro-command-type,
calc-edit-macro-combine-alg-ent, calc-edit-macro-combine-ext-command,
calc-edit-macro-combine-var-name, calc-edit-macro-combine-digits,
calc-edit-format-macro-buffer, calc-edit-macro-pre-finish-edit,
calc-edit-macro-finish-edit): New functions.
(calc-user-define-edit): Use new functions to edit named calc macros.
2005-01-02 04:51:06 +00:00
|
|
|
(let* ((mac (elt (nth 1 (nth 3 cmd)) 1))
|
|
|
|
(str (edmacro-format-keys mac t))
|
2005-01-02 06:48:17 +00:00
|
|
|
(kys (nth 3 (nth 3 cmd))))
|
2021-01-04 05:01:58 +00:00
|
|
|
(calc--edit-mode
|
|
|
|
(lambda () (calc-edit-macro-finish-edit cmdname kys))
|
2009-09-15 02:35:22 +00:00
|
|
|
t (format (concat
|
|
|
|
"Editing keyboard macro (%s, bound to %s).\n"
|
2005-01-02 17:08:31 +00:00
|
|
|
"Original keys: %s \n")
|
|
|
|
cmdname kys (elt (nth 1 (nth 3 cmd)) 0)))
|
(calc-finish-macro-edit): Remove.
(calc-edit-macro-repeats, calc-edit-macro-adjust-buffer,
calc-edit-macro-command, calc-edit-macro-command-type,
calc-edit-macro-combine-alg-ent, calc-edit-macro-combine-ext-command,
calc-edit-macro-combine-var-name, calc-edit-macro-combine-digits,
calc-edit-format-macro-buffer, calc-edit-macro-pre-finish-edit,
calc-edit-macro-finish-edit): New functions.
(calc-user-define-edit): Use new functions to edit named calc macros.
2005-01-02 04:51:06 +00:00
|
|
|
(insert str "\n")
|
|
|
|
(calc-edit-format-macro-buffer)
|
2005-01-02 17:08:31 +00:00
|
|
|
(calc-show-edit-buffer)))
|
2001-11-06 18:59:06 +00:00
|
|
|
(t (let* ((func (calc-stack-command-p cmd))
|
|
|
|
(defn (and func
|
|
|
|
(symbolp func)
|
2005-01-02 06:48:17 +00:00
|
|
|
(get func 'calc-user-defn)))
|
|
|
|
(kys (concat "z" (char-to-string (car def))))
|
|
|
|
(intcmd (symbol-name (cdr def)))
|
2005-05-26 12:24:05 +00:00
|
|
|
(algcmd (if func (substring (symbol-name func) 9) "")))
|
2001-11-06 18:59:06 +00:00
|
|
|
(if (and defn (calc-valid-formula-func func))
|
2005-01-19 17:21:44 +00:00
|
|
|
(let ((niceexpr (math-format-nice-expr defn (frame-width))))
|
2001-11-06 18:59:06 +00:00
|
|
|
(calc-wrapper
|
2021-01-04 05:01:58 +00:00
|
|
|
(calc--edit-mode
|
|
|
|
(lambda () (calc-finish-formula-edit func))
|
2005-01-02 06:48:17 +00:00
|
|
|
nil
|
2005-01-19 17:21:44 +00:00
|
|
|
(format (concat
|
|
|
|
"Editing formula (%s, %s, bound to %s).\n"
|
|
|
|
"Original formula: %s\n")
|
|
|
|
intcmd algcmd kys niceexpr))
|
2005-01-02 07:34:14 +00:00
|
|
|
(insert (math-showing-full-precision
|
2005-01-19 17:21:44 +00:00
|
|
|
niceexpr)
|
2005-01-02 07:34:14 +00:00
|
|
|
"\n"))
|
2005-01-02 17:08:31 +00:00
|
|
|
(calc-show-edit-buffer))
|
2001-11-14 09:09:09 +00:00
|
|
|
(error "That command's definition cannot be edited")))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(calc-finish-macro-edit): Remove.
(calc-edit-macro-repeats, calc-edit-macro-adjust-buffer,
calc-edit-macro-command, calc-edit-macro-command-type,
calc-edit-macro-combine-alg-ent, calc-edit-macro-combine-ext-command,
calc-edit-macro-combine-var-name, calc-edit-macro-combine-digits,
calc-edit-format-macro-buffer, calc-edit-macro-pre-finish-edit,
calc-edit-macro-finish-edit): New functions.
(calc-user-define-edit): Use new functions to edit named calc macros.
2005-01-02 04:51:06 +00:00
|
|
|
;; Formatting the macro buffer
|
|
|
|
|
2005-02-19 20:01:01 +00:00
|
|
|
(defvar calc-edit-top)
|
|
|
|
|
(calc-finish-macro-edit): Remove.
(calc-edit-macro-repeats, calc-edit-macro-adjust-buffer,
calc-edit-macro-command, calc-edit-macro-command-type,
calc-edit-macro-combine-alg-ent, calc-edit-macro-combine-ext-command,
calc-edit-macro-combine-var-name, calc-edit-macro-combine-digits,
calc-edit-format-macro-buffer, calc-edit-macro-pre-finish-edit,
calc-edit-macro-finish-edit): New functions.
(calc-user-define-edit): Use new functions to edit named calc macros.
2005-01-02 04:51:06 +00:00
|
|
|
(defun calc-edit-macro-repeats ()
|
2005-01-02 17:08:31 +00:00
|
|
|
(goto-char calc-edit-top)
|
(calc-finish-macro-edit): Remove.
(calc-edit-macro-repeats, calc-edit-macro-adjust-buffer,
calc-edit-macro-command, calc-edit-macro-command-type,
calc-edit-macro-combine-alg-ent, calc-edit-macro-combine-ext-command,
calc-edit-macro-combine-var-name, calc-edit-macro-combine-digits,
calc-edit-format-macro-buffer, calc-edit-macro-pre-finish-edit,
calc-edit-macro-finish-edit): New functions.
(calc-user-define-edit): Use new functions to edit named calc macros.
2005-01-02 04:51:06 +00:00
|
|
|
(while
|
|
|
|
(re-search-forward "^\\([0-9]+\\)\\*" nil t)
|
2005-05-02 19:44:43 +00:00
|
|
|
(let ((num (string-to-number (match-string 1)))
|
2005-02-19 20:01:01 +00:00
|
|
|
(line (buffer-substring (point) (line-end-position))))
|
|
|
|
(goto-char (line-beginning-position))
|
|
|
|
(kill-line 1)
|
|
|
|
(while (> num 0)
|
|
|
|
(insert line "\n")
|
|
|
|
(setq num (1- num))))))
|
(calc-finish-macro-edit): Remove.
(calc-edit-macro-repeats, calc-edit-macro-adjust-buffer,
calc-edit-macro-command, calc-edit-macro-command-type,
calc-edit-macro-combine-alg-ent, calc-edit-macro-combine-ext-command,
calc-edit-macro-combine-var-name, calc-edit-macro-combine-digits,
calc-edit-format-macro-buffer, calc-edit-macro-pre-finish-edit,
calc-edit-macro-finish-edit): New functions.
(calc-user-define-edit): Use new functions to edit named calc macros.
2005-01-02 04:51:06 +00:00
|
|
|
|
|
|
|
(defun calc-edit-macro-adjust-buffer ()
|
|
|
|
(calc-edit-macro-repeats)
|
2005-01-02 17:08:31 +00:00
|
|
|
(goto-char calc-edit-top)
|
(calc-finish-macro-edit): Remove.
(calc-edit-macro-repeats, calc-edit-macro-adjust-buffer,
calc-edit-macro-command, calc-edit-macro-command-type,
calc-edit-macro-combine-alg-ent, calc-edit-macro-combine-ext-command,
calc-edit-macro-combine-var-name, calc-edit-macro-combine-digits,
calc-edit-format-macro-buffer, calc-edit-macro-pre-finish-edit,
calc-edit-macro-finish-edit): New functions.
(calc-user-define-edit): Use new functions to edit named calc macros.
2005-01-02 04:51:06 +00:00
|
|
|
(while (re-search-forward "^RET$" nil t)
|
|
|
|
(delete-char 1))
|
2005-01-02 17:08:31 +00:00
|
|
|
(goto-char calc-edit-top)
|
(calc-finish-macro-edit): Remove.
(calc-edit-macro-repeats, calc-edit-macro-adjust-buffer,
calc-edit-macro-command, calc-edit-macro-command-type,
calc-edit-macro-combine-alg-ent, calc-edit-macro-combine-ext-command,
calc-edit-macro-combine-var-name, calc-edit-macro-combine-digits,
calc-edit-format-macro-buffer, calc-edit-macro-pre-finish-edit,
calc-edit-macro-finish-edit): New functions.
(calc-user-define-edit): Use new functions to edit named calc macros.
2005-01-02 04:51:06 +00:00
|
|
|
(while (and (re-search-forward "^$" nil t)
|
|
|
|
(not (= (point) (point-max))))
|
|
|
|
(delete-char 1)))
|
|
|
|
|
|
|
|
(defun calc-edit-macro-command ()
|
|
|
|
"Return the command on the current line in a Calc macro editing buffer."
|
|
|
|
(let ((beg (line-beginning-position))
|
|
|
|
(end (save-excursion
|
|
|
|
(if (search-forward ";;" (line-end-position) 1)
|
|
|
|
(forward-char -2))
|
|
|
|
(skip-chars-backward " \t")
|
|
|
|
(point))))
|
|
|
|
(buffer-substring beg end)))
|
|
|
|
|
|
|
|
(defun calc-edit-macro-command-type ()
|
|
|
|
"Return the type of command on the current line in a Calc macro editing buffer."
|
|
|
|
(let ((beg (save-excursion
|
|
|
|
(if (search-forward ";;" (line-end-position) t)
|
|
|
|
(progn
|
|
|
|
(skip-chars-forward " \t")
|
|
|
|
(point)))))
|
|
|
|
(end (save-excursion
|
|
|
|
(goto-char (line-end-position))
|
|
|
|
(skip-chars-backward " \t")
|
|
|
|
(point))))
|
|
|
|
(if beg
|
|
|
|
(buffer-substring beg end)
|
|
|
|
"")))
|
|
|
|
|
|
|
|
(defun calc-edit-macro-combine-alg-ent ()
|
|
|
|
"Put an entire algebraic entry on a single line."
|
|
|
|
(let ((line (calc-edit-macro-command))
|
|
|
|
(type (calc-edit-macro-command-type))
|
|
|
|
curline
|
|
|
|
match)
|
|
|
|
(goto-char (line-beginning-position))
|
|
|
|
(kill-line 1)
|
|
|
|
(setq curline (calc-edit-macro-command))
|
|
|
|
(while (and curline
|
|
|
|
(not (string-equal "RET" curline))
|
|
|
|
(not (setq match (string-match "<return>" curline))))
|
|
|
|
(setq line (concat line curline))
|
|
|
|
(kill-line 1)
|
|
|
|
(setq curline (calc-edit-macro-command)))
|
|
|
|
(when match
|
|
|
|
(kill-line 1)
|
|
|
|
(setq line (concat line (substring curline 0 match))))
|
Use string-replace instead of replace-regexp-in-string
`string-replace` is easier to understand, less error-prone, much
faster, and results in shorter Lisp and byte code. Use it where
applicable and obviously safe (erring on the conservative side).
* admin/authors.el (authors-scan-change-log):
* lisp/autoinsert.el (auto-insert-alist):
* lisp/calc/calc-prog.el (calc-edit-macro-combine-alg-ent)
(calc-edit-macro-combine-ext-command)
(calc-edit-macro-combine-var-name):
* lisp/calc/calc-units.el (math-make-unit-string):
* lisp/calendar/cal-html.el (cal-html-comment):
* lisp/calendar/cal-tex.el (cal-tex-comment):
* lisp/calendar/icalendar.el (icalendar--convert-string-for-export)
(icalendar--convert-string-for-import):
* lisp/calendar/iso8601.el (iso8601--concat-regexps)
(iso8601--full-time-match, iso8601--combined-match):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/todo-mode.el (todo-filter-items-filename):
* lisp/cedet/cedet-files.el (cedet-directory-name-to-file-name)
(cedet-file-name-to-directory-name):
* lisp/comint.el (comint-watch-for-password-prompt):
* lisp/dired-aux.el (dired-do-chmod):
* lisp/dired-x.el (dired-man):
* lisp/dired.el (dired-insert-directory, dired-goto-file-1):
* lisp/emacs-lisp/comp.el (comp-c-func-name):
* lisp/emacs-lisp/re-builder.el (reb-copy):
* lisp/erc/erc-dcc.el (erc-dcc-unquote-filename):
* lisp/erc/erc.el (erc-quit-reason-zippy, erc-part-reason-zippy)
(erc-update-mode-line-buffer, erc-message-english-PART):
* lisp/files.el (make-backup-file-name-1, files--transform-file-name)
(read-file-modes):
* lisp/fringe.el (fringe-mode):
* lisp/gnus/gnus-art.el (gnus-button-handle-info-url):
* lisp/gnus/gnus-group.el (gnus-group-completing-read):
* lisp/gnus/gnus-icalendar.el (gnus-icalendar-event-from-ical):
* lisp/gnus/gnus-mlspl.el (gnus-group-split-fancy):
* lisp/gnus/gnus-search.el (gnus-search-query-parse-date)
(gnus-search-transform-expression, gnus-search-run-search):
* lisp/gnus/gnus-start.el (gnus-dribble-enter):
* lisp/gnus/gnus-sum.el (gnus-summary-refer-article):
* lisp/gnus/gnus-util.el (gnus-mode-string-quote):
* lisp/gnus/message.el (message-put-addresses-in-ecomplete)
(message-parse-mailto-url, message-mailto-1):
* lisp/gnus/mml-sec.el (mml-secure-epg-sign):
* lisp/gnus/mml-smime.el (mml-smime-epg-verify):
* lisp/gnus/mml2015.el (mml2015-epg-verify):
* lisp/gnus/nnmaildir.el (nnmaildir--system-name)
(nnmaildir-request-list, nnmaildir-retrieve-groups)
(nnmaildir-request-group, nnmaildir-retrieve-headers):
* lisp/gnus/nnrss.el (nnrss-node-text):
* lisp/gnus/spam-report.el (spam-report-gmane-internal)
(spam-report-user-mail-address):
* lisp/ibuffer.el (name):
* lisp/image-dired.el (image-dired-pngnq-thumb)
(image-dired-pngcrush-thumb, image-dired-optipng-thumb)
(image-dired-create-thumb-1):
* lisp/info.el (Info-set-mode-line):
* lisp/international/mule-cmds.el (describe-language-environment):
* lisp/mail/rfc2231.el (rfc2231-parse-string):
* lisp/mail/rfc2368.el (rfc2368-parse-mailto-url):
* lisp/mail/rmail.el (rmail-insert-inbox-text)
(rmail-simplified-subject-regexp):
* lisp/mail/rmailout.el (rmail-output-body-to-file):
* lisp/mail/undigest.el (rmail-digest-rfc1153):
* lisp/man.el (Man-default-man-entry):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc--debug):
* lisp/net/browse-url.el (browse-url-mail):
* lisp/net/eww.el (eww-update-header-line-format):
* lisp/net/newst-backend.el (newsticker-save-item):
* lisp/net/rcirc.el (rcirc-sentinel):
* lisp/net/soap-client.el (soap-decode-date-time):
* lisp/nxml/rng-cmpct.el (rng-c-literal-2-re):
* lisp/nxml/xmltok.el (let*):
* lisp/obsolete/nnir.el (nnir-run-swish-e, nnir-run-hyrex)
(nnir-run-find-grep):
* lisp/play/dunnet.el (dun-doassign):
* lisp/play/handwrite.el (handwrite):
* lisp/proced.el (proced-format-args):
* lisp/profiler.el (profiler-report-header-line-format):
* lisp/progmodes/gdb-mi.el (gdb-mi-quote):
* lisp/progmodes/make-mode.el (makefile-bsdmake-rule-action-regex)
(makefile-make-font-lock-keywords):
* lisp/progmodes/prolog.el (prolog-guess-fill-prefix):
* lisp/progmodes/ruby-mode.el (ruby-toggle-string-quotes):
* lisp/progmodes/sql.el (sql-remove-tabs-filter, sql-str-literal):
* lisp/progmodes/which-func.el (which-func-current):
* lisp/replace.el (query-replace-read-from)
(occur-engine, replace-quote):
* lisp/select.el (xselect--encode-string):
* lisp/ses.el (ses-export-tab):
* lisp/subr.el (shell-quote-argument):
* lisp/term/pc-win.el (msdos-show-help):
* lisp/term/w32-win.el (w32--set-selection):
* lisp/term/xterm.el (gui-backend-set-selection):
* lisp/textmodes/picture.el (picture-tab-search):
* lisp/thumbs.el (thumbs-call-setroot-command):
* lisp/tooltip.el (tooltip-show-help-non-mode):
* lisp/transient.el (transient-format-key):
* lisp/url/url-mailto.el (url-mailto):
* lisp/vc/log-edit.el (log-edit-changelog-ours-p):
* lisp/vc/vc-bzr.el (vc-bzr-status):
* lisp/vc/vc-hg.el (vc-hg--glob-to-pcre):
* lisp/vc/vc-svn.el (vc-svn-after-dir-status):
* lisp/xdg.el (xdg-desktop-strings):
* test/lisp/electric-tests.el (defun):
* test/lisp/term-tests.el (term-simple-lines):
* test/lisp/time-stamp-tests.el (formatz-mod-del-colons):
* test/lisp/wdired-tests.el (wdired-test-bug32173-01)
(wdired-test-unfinished-edit-01):
* test/src/json-tests.el (json-parse-with-custom-null-and-false-objects):
Use `string-replace` instead of `replace-regexp-in-string`.
2021-08-08 16:58:46 +00:00
|
|
|
(setq line (string-replace "SPC" " SPC "
|
|
|
|
(string-replace " " "" line)))
|
(calc-finish-macro-edit): Remove.
(calc-edit-macro-repeats, calc-edit-macro-adjust-buffer,
calc-edit-macro-command, calc-edit-macro-command-type,
calc-edit-macro-combine-alg-ent, calc-edit-macro-combine-ext-command,
calc-edit-macro-combine-var-name, calc-edit-macro-combine-digits,
calc-edit-format-macro-buffer, calc-edit-macro-pre-finish-edit,
calc-edit-macro-finish-edit): New functions.
(calc-user-define-edit): Use new functions to edit named calc macros.
2005-01-02 04:51:06 +00:00
|
|
|
(insert line "\t\t\t")
|
|
|
|
(if (> (current-column) 24)
|
|
|
|
(delete-char -1))
|
|
|
|
(insert ";; " type "\n")
|
|
|
|
(if match
|
|
|
|
(insert "RET\t\t\t;; calc-enter\n"))))
|
|
|
|
|
|
|
|
(defun calc-edit-macro-combine-ext-command ()
|
|
|
|
"Put an entire extended command on a single line."
|
|
|
|
(let ((cmdbeg (calc-edit-macro-command))
|
|
|
|
(line "")
|
|
|
|
(type (calc-edit-macro-command-type))
|
|
|
|
curline
|
|
|
|
match)
|
|
|
|
(goto-char (line-beginning-position))
|
|
|
|
(kill-line 1)
|
|
|
|
(setq curline (calc-edit-macro-command))
|
|
|
|
(while (and curline
|
|
|
|
(not (string-equal "RET" curline))
|
|
|
|
(not (setq match (string-match "<return>" curline))))
|
|
|
|
(setq line (concat line curline))
|
|
|
|
(kill-line 1)
|
|
|
|
(setq curline (calc-edit-macro-command)))
|
2009-09-15 02:35:22 +00:00
|
|
|
(when match
|
(calc-finish-macro-edit): Remove.
(calc-edit-macro-repeats, calc-edit-macro-adjust-buffer,
calc-edit-macro-command, calc-edit-macro-command-type,
calc-edit-macro-combine-alg-ent, calc-edit-macro-combine-ext-command,
calc-edit-macro-combine-var-name, calc-edit-macro-combine-digits,
calc-edit-format-macro-buffer, calc-edit-macro-pre-finish-edit,
calc-edit-macro-finish-edit): New functions.
(calc-user-define-edit): Use new functions to edit named calc macros.
2005-01-02 04:51:06 +00:00
|
|
|
(kill-line 1)
|
|
|
|
(setq line (concat line (substring curline 0 match))))
|
Use string-replace instead of replace-regexp-in-string
`string-replace` is easier to understand, less error-prone, much
faster, and results in shorter Lisp and byte code. Use it where
applicable and obviously safe (erring on the conservative side).
* admin/authors.el (authors-scan-change-log):
* lisp/autoinsert.el (auto-insert-alist):
* lisp/calc/calc-prog.el (calc-edit-macro-combine-alg-ent)
(calc-edit-macro-combine-ext-command)
(calc-edit-macro-combine-var-name):
* lisp/calc/calc-units.el (math-make-unit-string):
* lisp/calendar/cal-html.el (cal-html-comment):
* lisp/calendar/cal-tex.el (cal-tex-comment):
* lisp/calendar/icalendar.el (icalendar--convert-string-for-export)
(icalendar--convert-string-for-import):
* lisp/calendar/iso8601.el (iso8601--concat-regexps)
(iso8601--full-time-match, iso8601--combined-match):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/todo-mode.el (todo-filter-items-filename):
* lisp/cedet/cedet-files.el (cedet-directory-name-to-file-name)
(cedet-file-name-to-directory-name):
* lisp/comint.el (comint-watch-for-password-prompt):
* lisp/dired-aux.el (dired-do-chmod):
* lisp/dired-x.el (dired-man):
* lisp/dired.el (dired-insert-directory, dired-goto-file-1):
* lisp/emacs-lisp/comp.el (comp-c-func-name):
* lisp/emacs-lisp/re-builder.el (reb-copy):
* lisp/erc/erc-dcc.el (erc-dcc-unquote-filename):
* lisp/erc/erc.el (erc-quit-reason-zippy, erc-part-reason-zippy)
(erc-update-mode-line-buffer, erc-message-english-PART):
* lisp/files.el (make-backup-file-name-1, files--transform-file-name)
(read-file-modes):
* lisp/fringe.el (fringe-mode):
* lisp/gnus/gnus-art.el (gnus-button-handle-info-url):
* lisp/gnus/gnus-group.el (gnus-group-completing-read):
* lisp/gnus/gnus-icalendar.el (gnus-icalendar-event-from-ical):
* lisp/gnus/gnus-mlspl.el (gnus-group-split-fancy):
* lisp/gnus/gnus-search.el (gnus-search-query-parse-date)
(gnus-search-transform-expression, gnus-search-run-search):
* lisp/gnus/gnus-start.el (gnus-dribble-enter):
* lisp/gnus/gnus-sum.el (gnus-summary-refer-article):
* lisp/gnus/gnus-util.el (gnus-mode-string-quote):
* lisp/gnus/message.el (message-put-addresses-in-ecomplete)
(message-parse-mailto-url, message-mailto-1):
* lisp/gnus/mml-sec.el (mml-secure-epg-sign):
* lisp/gnus/mml-smime.el (mml-smime-epg-verify):
* lisp/gnus/mml2015.el (mml2015-epg-verify):
* lisp/gnus/nnmaildir.el (nnmaildir--system-name)
(nnmaildir-request-list, nnmaildir-retrieve-groups)
(nnmaildir-request-group, nnmaildir-retrieve-headers):
* lisp/gnus/nnrss.el (nnrss-node-text):
* lisp/gnus/spam-report.el (spam-report-gmane-internal)
(spam-report-user-mail-address):
* lisp/ibuffer.el (name):
* lisp/image-dired.el (image-dired-pngnq-thumb)
(image-dired-pngcrush-thumb, image-dired-optipng-thumb)
(image-dired-create-thumb-1):
* lisp/info.el (Info-set-mode-line):
* lisp/international/mule-cmds.el (describe-language-environment):
* lisp/mail/rfc2231.el (rfc2231-parse-string):
* lisp/mail/rfc2368.el (rfc2368-parse-mailto-url):
* lisp/mail/rmail.el (rmail-insert-inbox-text)
(rmail-simplified-subject-regexp):
* lisp/mail/rmailout.el (rmail-output-body-to-file):
* lisp/mail/undigest.el (rmail-digest-rfc1153):
* lisp/man.el (Man-default-man-entry):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc--debug):
* lisp/net/browse-url.el (browse-url-mail):
* lisp/net/eww.el (eww-update-header-line-format):
* lisp/net/newst-backend.el (newsticker-save-item):
* lisp/net/rcirc.el (rcirc-sentinel):
* lisp/net/soap-client.el (soap-decode-date-time):
* lisp/nxml/rng-cmpct.el (rng-c-literal-2-re):
* lisp/nxml/xmltok.el (let*):
* lisp/obsolete/nnir.el (nnir-run-swish-e, nnir-run-hyrex)
(nnir-run-find-grep):
* lisp/play/dunnet.el (dun-doassign):
* lisp/play/handwrite.el (handwrite):
* lisp/proced.el (proced-format-args):
* lisp/profiler.el (profiler-report-header-line-format):
* lisp/progmodes/gdb-mi.el (gdb-mi-quote):
* lisp/progmodes/make-mode.el (makefile-bsdmake-rule-action-regex)
(makefile-make-font-lock-keywords):
* lisp/progmodes/prolog.el (prolog-guess-fill-prefix):
* lisp/progmodes/ruby-mode.el (ruby-toggle-string-quotes):
* lisp/progmodes/sql.el (sql-remove-tabs-filter, sql-str-literal):
* lisp/progmodes/which-func.el (which-func-current):
* lisp/replace.el (query-replace-read-from)
(occur-engine, replace-quote):
* lisp/select.el (xselect--encode-string):
* lisp/ses.el (ses-export-tab):
* lisp/subr.el (shell-quote-argument):
* lisp/term/pc-win.el (msdos-show-help):
* lisp/term/w32-win.el (w32--set-selection):
* lisp/term/xterm.el (gui-backend-set-selection):
* lisp/textmodes/picture.el (picture-tab-search):
* lisp/thumbs.el (thumbs-call-setroot-command):
* lisp/tooltip.el (tooltip-show-help-non-mode):
* lisp/transient.el (transient-format-key):
* lisp/url/url-mailto.el (url-mailto):
* lisp/vc/log-edit.el (log-edit-changelog-ours-p):
* lisp/vc/vc-bzr.el (vc-bzr-status):
* lisp/vc/vc-hg.el (vc-hg--glob-to-pcre):
* lisp/vc/vc-svn.el (vc-svn-after-dir-status):
* lisp/xdg.el (xdg-desktop-strings):
* test/lisp/electric-tests.el (defun):
* test/lisp/term-tests.el (term-simple-lines):
* test/lisp/time-stamp-tests.el (formatz-mod-del-colons):
* test/lisp/wdired-tests.el (wdired-test-bug32173-01)
(wdired-test-unfinished-edit-01):
* test/src/json-tests.el (json-parse-with-custom-null-and-false-objects):
Use `string-replace` instead of `replace-regexp-in-string`.
2021-08-08 16:58:46 +00:00
|
|
|
(setq line (string-replace " " "" line))
|
(calc-finish-macro-edit): Remove.
(calc-edit-macro-repeats, calc-edit-macro-adjust-buffer,
calc-edit-macro-command, calc-edit-macro-command-type,
calc-edit-macro-combine-alg-ent, calc-edit-macro-combine-ext-command,
calc-edit-macro-combine-var-name, calc-edit-macro-combine-digits,
calc-edit-format-macro-buffer, calc-edit-macro-pre-finish-edit,
calc-edit-macro-finish-edit): New functions.
(calc-user-define-edit): Use new functions to edit named calc macros.
2005-01-02 04:51:06 +00:00
|
|
|
(insert cmdbeg " " line "\t\t\t")
|
|
|
|
(if (> (current-column) 24)
|
|
|
|
(delete-char -1))
|
|
|
|
(insert ";; " type "\n")
|
|
|
|
(if match
|
|
|
|
(insert "RET\t\t\t;; calc-enter\n"))))
|
|
|
|
|
|
|
|
(defun calc-edit-macro-combine-var-name ()
|
|
|
|
"Put an entire variable name on a single line."
|
|
|
|
(let ((line (calc-edit-macro-command))
|
|
|
|
curline
|
|
|
|
match)
|
|
|
|
(goto-char (line-beginning-position))
|
|
|
|
(kill-line 1)
|
2005-01-02 06:48:17 +00:00
|
|
|
(if (member line '("0" "1" "2" "3" "4" "5" "6" "7" "8" "9"))
|
(calc-finish-macro-edit): Remove.
(calc-edit-macro-repeats, calc-edit-macro-adjust-buffer,
calc-edit-macro-command, calc-edit-macro-command-type,
calc-edit-macro-combine-alg-ent, calc-edit-macro-combine-ext-command,
calc-edit-macro-combine-var-name, calc-edit-macro-combine-digits,
calc-edit-format-macro-buffer, calc-edit-macro-pre-finish-edit,
calc-edit-macro-finish-edit): New functions.
(calc-user-define-edit): Use new functions to edit named calc macros.
2005-01-02 04:51:06 +00:00
|
|
|
(insert line "\t\t\t;; calc quick variable\n")
|
|
|
|
(setq curline (calc-edit-macro-command))
|
|
|
|
(while (and curline
|
|
|
|
(not (string-equal "RET" curline))
|
|
|
|
(not (setq match (string-match "<return>" curline))))
|
|
|
|
(setq line (concat line curline))
|
|
|
|
(kill-line 1)
|
|
|
|
(setq curline (calc-edit-macro-command)))
|
2009-09-15 02:35:22 +00:00
|
|
|
(when match
|
(calc-finish-macro-edit): Remove.
(calc-edit-macro-repeats, calc-edit-macro-adjust-buffer,
calc-edit-macro-command, calc-edit-macro-command-type,
calc-edit-macro-combine-alg-ent, calc-edit-macro-combine-ext-command,
calc-edit-macro-combine-var-name, calc-edit-macro-combine-digits,
calc-edit-format-macro-buffer, calc-edit-macro-pre-finish-edit,
calc-edit-macro-finish-edit): New functions.
(calc-user-define-edit): Use new functions to edit named calc macros.
2005-01-02 04:51:06 +00:00
|
|
|
(kill-line 1)
|
|
|
|
(setq line (concat line (substring curline 0 match))))
|
Use string-replace instead of replace-regexp-in-string
`string-replace` is easier to understand, less error-prone, much
faster, and results in shorter Lisp and byte code. Use it where
applicable and obviously safe (erring on the conservative side).
* admin/authors.el (authors-scan-change-log):
* lisp/autoinsert.el (auto-insert-alist):
* lisp/calc/calc-prog.el (calc-edit-macro-combine-alg-ent)
(calc-edit-macro-combine-ext-command)
(calc-edit-macro-combine-var-name):
* lisp/calc/calc-units.el (math-make-unit-string):
* lisp/calendar/cal-html.el (cal-html-comment):
* lisp/calendar/cal-tex.el (cal-tex-comment):
* lisp/calendar/icalendar.el (icalendar--convert-string-for-export)
(icalendar--convert-string-for-import):
* lisp/calendar/iso8601.el (iso8601--concat-regexps)
(iso8601--full-time-match, iso8601--combined-match):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/todo-mode.el (todo-filter-items-filename):
* lisp/cedet/cedet-files.el (cedet-directory-name-to-file-name)
(cedet-file-name-to-directory-name):
* lisp/comint.el (comint-watch-for-password-prompt):
* lisp/dired-aux.el (dired-do-chmod):
* lisp/dired-x.el (dired-man):
* lisp/dired.el (dired-insert-directory, dired-goto-file-1):
* lisp/emacs-lisp/comp.el (comp-c-func-name):
* lisp/emacs-lisp/re-builder.el (reb-copy):
* lisp/erc/erc-dcc.el (erc-dcc-unquote-filename):
* lisp/erc/erc.el (erc-quit-reason-zippy, erc-part-reason-zippy)
(erc-update-mode-line-buffer, erc-message-english-PART):
* lisp/files.el (make-backup-file-name-1, files--transform-file-name)
(read-file-modes):
* lisp/fringe.el (fringe-mode):
* lisp/gnus/gnus-art.el (gnus-button-handle-info-url):
* lisp/gnus/gnus-group.el (gnus-group-completing-read):
* lisp/gnus/gnus-icalendar.el (gnus-icalendar-event-from-ical):
* lisp/gnus/gnus-mlspl.el (gnus-group-split-fancy):
* lisp/gnus/gnus-search.el (gnus-search-query-parse-date)
(gnus-search-transform-expression, gnus-search-run-search):
* lisp/gnus/gnus-start.el (gnus-dribble-enter):
* lisp/gnus/gnus-sum.el (gnus-summary-refer-article):
* lisp/gnus/gnus-util.el (gnus-mode-string-quote):
* lisp/gnus/message.el (message-put-addresses-in-ecomplete)
(message-parse-mailto-url, message-mailto-1):
* lisp/gnus/mml-sec.el (mml-secure-epg-sign):
* lisp/gnus/mml-smime.el (mml-smime-epg-verify):
* lisp/gnus/mml2015.el (mml2015-epg-verify):
* lisp/gnus/nnmaildir.el (nnmaildir--system-name)
(nnmaildir-request-list, nnmaildir-retrieve-groups)
(nnmaildir-request-group, nnmaildir-retrieve-headers):
* lisp/gnus/nnrss.el (nnrss-node-text):
* lisp/gnus/spam-report.el (spam-report-gmane-internal)
(spam-report-user-mail-address):
* lisp/ibuffer.el (name):
* lisp/image-dired.el (image-dired-pngnq-thumb)
(image-dired-pngcrush-thumb, image-dired-optipng-thumb)
(image-dired-create-thumb-1):
* lisp/info.el (Info-set-mode-line):
* lisp/international/mule-cmds.el (describe-language-environment):
* lisp/mail/rfc2231.el (rfc2231-parse-string):
* lisp/mail/rfc2368.el (rfc2368-parse-mailto-url):
* lisp/mail/rmail.el (rmail-insert-inbox-text)
(rmail-simplified-subject-regexp):
* lisp/mail/rmailout.el (rmail-output-body-to-file):
* lisp/mail/undigest.el (rmail-digest-rfc1153):
* lisp/man.el (Man-default-man-entry):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc--debug):
* lisp/net/browse-url.el (browse-url-mail):
* lisp/net/eww.el (eww-update-header-line-format):
* lisp/net/newst-backend.el (newsticker-save-item):
* lisp/net/rcirc.el (rcirc-sentinel):
* lisp/net/soap-client.el (soap-decode-date-time):
* lisp/nxml/rng-cmpct.el (rng-c-literal-2-re):
* lisp/nxml/xmltok.el (let*):
* lisp/obsolete/nnir.el (nnir-run-swish-e, nnir-run-hyrex)
(nnir-run-find-grep):
* lisp/play/dunnet.el (dun-doassign):
* lisp/play/handwrite.el (handwrite):
* lisp/proced.el (proced-format-args):
* lisp/profiler.el (profiler-report-header-line-format):
* lisp/progmodes/gdb-mi.el (gdb-mi-quote):
* lisp/progmodes/make-mode.el (makefile-bsdmake-rule-action-regex)
(makefile-make-font-lock-keywords):
* lisp/progmodes/prolog.el (prolog-guess-fill-prefix):
* lisp/progmodes/ruby-mode.el (ruby-toggle-string-quotes):
* lisp/progmodes/sql.el (sql-remove-tabs-filter, sql-str-literal):
* lisp/progmodes/which-func.el (which-func-current):
* lisp/replace.el (query-replace-read-from)
(occur-engine, replace-quote):
* lisp/select.el (xselect--encode-string):
* lisp/ses.el (ses-export-tab):
* lisp/subr.el (shell-quote-argument):
* lisp/term/pc-win.el (msdos-show-help):
* lisp/term/w32-win.el (w32--set-selection):
* lisp/term/xterm.el (gui-backend-set-selection):
* lisp/textmodes/picture.el (picture-tab-search):
* lisp/thumbs.el (thumbs-call-setroot-command):
* lisp/tooltip.el (tooltip-show-help-non-mode):
* lisp/transient.el (transient-format-key):
* lisp/url/url-mailto.el (url-mailto):
* lisp/vc/log-edit.el (log-edit-changelog-ours-p):
* lisp/vc/vc-bzr.el (vc-bzr-status):
* lisp/vc/vc-hg.el (vc-hg--glob-to-pcre):
* lisp/vc/vc-svn.el (vc-svn-after-dir-status):
* lisp/xdg.el (xdg-desktop-strings):
* test/lisp/electric-tests.el (defun):
* test/lisp/term-tests.el (term-simple-lines):
* test/lisp/time-stamp-tests.el (formatz-mod-del-colons):
* test/lisp/wdired-tests.el (wdired-test-bug32173-01)
(wdired-test-unfinished-edit-01):
* test/src/json-tests.el (json-parse-with-custom-null-and-false-objects):
Use `string-replace` instead of `replace-regexp-in-string`.
2021-08-08 16:58:46 +00:00
|
|
|
(setq line (string-replace " " "" line))
|
(calc-finish-macro-edit): Remove.
(calc-edit-macro-repeats, calc-edit-macro-adjust-buffer,
calc-edit-macro-command, calc-edit-macro-command-type,
calc-edit-macro-combine-alg-ent, calc-edit-macro-combine-ext-command,
calc-edit-macro-combine-var-name, calc-edit-macro-combine-digits,
calc-edit-format-macro-buffer, calc-edit-macro-pre-finish-edit,
calc-edit-macro-finish-edit): New functions.
(calc-user-define-edit): Use new functions to edit named calc macros.
2005-01-02 04:51:06 +00:00
|
|
|
(insert line "\t\t\t")
|
|
|
|
(if (> (current-column) 24)
|
|
|
|
(delete-char -1))
|
|
|
|
(insert ";; calc variable\n")
|
|
|
|
(if match
|
|
|
|
(insert "RET\t\t\t;; calc-enter\n")))))
|
|
|
|
|
|
|
|
(defun calc-edit-macro-combine-digits ()
|
|
|
|
"Put an entire sequence of digits on a single line."
|
|
|
|
(let ((line (calc-edit-macro-command))
|
2020-10-10 20:00:51 +00:00
|
|
|
) ;; curline
|
(calc-finish-macro-edit): Remove.
(calc-edit-macro-repeats, calc-edit-macro-adjust-buffer,
calc-edit-macro-command, calc-edit-macro-command-type,
calc-edit-macro-combine-alg-ent, calc-edit-macro-combine-ext-command,
calc-edit-macro-combine-var-name, calc-edit-macro-combine-digits,
calc-edit-format-macro-buffer, calc-edit-macro-pre-finish-edit,
calc-edit-macro-finish-edit): New functions.
(calc-user-define-edit): Use new functions to edit named calc macros.
2005-01-02 04:51:06 +00:00
|
|
|
(goto-char (line-beginning-position))
|
|
|
|
(kill-line 1)
|
|
|
|
(while (string-equal (calc-edit-macro-command-type) "calcDigit-start")
|
|
|
|
(setq line (concat line (calc-edit-macro-command)))
|
|
|
|
(kill-line 1))
|
|
|
|
(insert line "\t\t\t")
|
|
|
|
(if (> (current-column) 24)
|
|
|
|
(delete-char -1))
|
|
|
|
(insert ";; calc digits\n")))
|
|
|
|
|
|
|
|
(defun calc-edit-format-macro-buffer ()
|
|
|
|
"Rewrite the Calc macro editing buffer."
|
|
|
|
(calc-edit-macro-adjust-buffer)
|
2005-01-02 17:08:31 +00:00
|
|
|
(goto-char calc-edit-top)
|
(calc-finish-macro-edit): Remove.
(calc-edit-macro-repeats, calc-edit-macro-adjust-buffer,
calc-edit-macro-command, calc-edit-macro-command-type,
calc-edit-macro-combine-alg-ent, calc-edit-macro-combine-ext-command,
calc-edit-macro-combine-var-name, calc-edit-macro-combine-digits,
calc-edit-format-macro-buffer, calc-edit-macro-pre-finish-edit,
calc-edit-macro-finish-edit): New functions.
(calc-user-define-edit): Use new functions to edit named calc macros.
2005-01-02 04:51:06 +00:00
|
|
|
(let ((type (calc-edit-macro-command-type)))
|
|
|
|
(while (not (string-equal type ""))
|
|
|
|
(cond
|
|
|
|
((or
|
|
|
|
(string-equal type "calc-algebraic-entry")
|
|
|
|
(string-equal type "calc-auto-algebraic-entry"))
|
|
|
|
(calc-edit-macro-combine-alg-ent))
|
|
|
|
((string-equal type "calc-execute-extended-command")
|
|
|
|
(calc-edit-macro-combine-ext-command))
|
|
|
|
((string-equal type "calcDigit-start")
|
|
|
|
(calc-edit-macro-combine-digits))
|
|
|
|
((or
|
|
|
|
(string-equal type "calc-store")
|
|
|
|
(string-equal type "calc-store-into")
|
|
|
|
(string-equal type "calc-store-neg")
|
|
|
|
(string-equal type "calc-store-plus")
|
|
|
|
(string-equal type "calc-store-minus")
|
|
|
|
(string-equal type "calc-store-div")
|
|
|
|
(string-equal type "calc-store-times")
|
|
|
|
(string-equal type "calc-store-power")
|
|
|
|
(string-equal type "calc-store-concat")
|
|
|
|
(string-equal type "calc-store-inv")
|
|
|
|
(string-equal type "calc-store-dec")
|
|
|
|
(string-equal type "calc-store-incr")
|
|
|
|
(string-equal type "calc-store-exchange")
|
|
|
|
(string-equal type "calc-unstore")
|
|
|
|
(string-equal type "calc-recall")
|
|
|
|
(string-equal type "calc-let")
|
|
|
|
(string-equal type "calc-permanent-variable"))
|
|
|
|
(forward-line 1)
|
|
|
|
(calc-edit-macro-combine-var-name))
|
|
|
|
((or
|
|
|
|
(string-equal type "calc-copy-variable")
|
2005-05-16 03:54:05 +00:00
|
|
|
(string-equal type "calc-copy-special-constant")
|
(calc-finish-macro-edit): Remove.
(calc-edit-macro-repeats, calc-edit-macro-adjust-buffer,
calc-edit-macro-command, calc-edit-macro-command-type,
calc-edit-macro-combine-alg-ent, calc-edit-macro-combine-ext-command,
calc-edit-macro-combine-var-name, calc-edit-macro-combine-digits,
calc-edit-format-macro-buffer, calc-edit-macro-pre-finish-edit,
calc-edit-macro-finish-edit): New functions.
(calc-user-define-edit): Use new functions to edit named calc macros.
2005-01-02 04:51:06 +00:00
|
|
|
(string-equal type "calc-declare-variable"))
|
|
|
|
(forward-line 1)
|
|
|
|
(calc-edit-macro-combine-var-name)
|
|
|
|
(calc-edit-macro-combine-var-name))
|
|
|
|
(t (forward-line 1)))
|
|
|
|
(setq type (calc-edit-macro-command-type))))
|
2005-01-02 17:08:31 +00:00
|
|
|
(goto-char calc-edit-top))
|
(calc-finish-macro-edit): Remove.
(calc-edit-macro-repeats, calc-edit-macro-adjust-buffer,
calc-edit-macro-command, calc-edit-macro-command-type,
calc-edit-macro-combine-alg-ent, calc-edit-macro-combine-ext-command,
calc-edit-macro-combine-var-name, calc-edit-macro-combine-digits,
calc-edit-format-macro-buffer, calc-edit-macro-pre-finish-edit,
calc-edit-macro-finish-edit): New functions.
(calc-user-define-edit): Use new functions to edit named calc macros.
2005-01-02 04:51:06 +00:00
|
|
|
|
|
|
|
;; Finish editing the macro
|
|
|
|
|
|
|
|
(defun calc-edit-macro-pre-finish-edit ()
|
2005-01-02 17:08:31 +00:00
|
|
|
(goto-char calc-edit-top)
|
(calc-finish-macro-edit): Remove.
(calc-edit-macro-repeats, calc-edit-macro-adjust-buffer,
calc-edit-macro-command, calc-edit-macro-command-type,
calc-edit-macro-combine-alg-ent, calc-edit-macro-combine-ext-command,
calc-edit-macro-combine-var-name, calc-edit-macro-combine-digits,
calc-edit-format-macro-buffer, calc-edit-macro-pre-finish-edit,
calc-edit-macro-finish-edit): New functions.
(calc-user-define-edit): Use new functions to edit named calc macros.
2005-01-02 04:51:06 +00:00
|
|
|
(while (re-search-forward "\\(^\\| \\)RET\\($\\|\t\\| \\)" nil t)
|
|
|
|
(search-backward "RET")
|
|
|
|
(delete-char 3)
|
|
|
|
(insert "<return>")))
|
|
|
|
|
|
|
|
(defun calc-edit-macro-finish-edit (cmdname key)
|
|
|
|
"Finish editing a Calc macro.
|
|
|
|
Redefine the corresponding command."
|
|
|
|
(interactive)
|
|
|
|
(let ((cmd (intern cmdname)))
|
|
|
|
(calc-edit-macro-pre-finish-edit)
|
2005-01-02 17:08:31 +00:00
|
|
|
(let* ((str (buffer-substring calc-edit-top (point-max)))
|
(calc-finish-macro-edit): Remove.
(calc-edit-macro-repeats, calc-edit-macro-adjust-buffer,
calc-edit-macro-command, calc-edit-macro-command-type,
calc-edit-macro-combine-alg-ent, calc-edit-macro-combine-ext-command,
calc-edit-macro-combine-var-name, calc-edit-macro-combine-digits,
calc-edit-format-macro-buffer, calc-edit-macro-pre-finish-edit,
calc-edit-macro-finish-edit): New functions.
(calc-user-define-edit): Use new functions to edit named calc macros.
2005-01-02 04:51:06 +00:00
|
|
|
(mac (edmacro-parse-keys str t)))
|
|
|
|
(if (= (length mac) 0)
|
|
|
|
(fmakunbound cmd)
|
|
|
|
(fset cmd
|
|
|
|
(list 'lambda '(arg)
|
|
|
|
'(interactive "P")
|
|
|
|
(list 'calc-execute-kbd-macro
|
|
|
|
(vector (key-description mac)
|
|
|
|
mac)
|
|
|
|
'arg key)))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calc-finish-formula-edit (func)
|
|
|
|
(let ((buf (current-buffer))
|
2005-01-02 17:08:31 +00:00
|
|
|
(str (buffer-substring calc-edit-top (point-max)))
|
2001-11-06 18:59:06 +00:00
|
|
|
(start (point))
|
|
|
|
(body (calc-valid-formula-func func)))
|
|
|
|
(set-buffer calc-original-buffer)
|
|
|
|
(let ((val (math-read-expr str)))
|
|
|
|
(if (eq (car-safe val) 'error)
|
|
|
|
(progn
|
|
|
|
(set-buffer buf)
|
|
|
|
(goto-char (+ start (nth 1 val)))
|
|
|
|
(error (nth 2 val))))
|
|
|
|
(setcar (cdr body)
|
(math-integral-cache-state, calc-lang)
(calc-original-buffer): Declare them.
(calc-user-formula-alist): New variable.
(calc-user-define-formula, calc-fix-user-formula)
(calc-user-define-composition, calc-finish-formula-edit):
Replace variable alist by declared variable.
(var-q0, var-q1, var-q2, var-q3, var-q4, var-q5, var-q6)
(var-q7, var-q7, var-q8, var-q9): Declare them.
(calc-kbd-push): Don't check to see if var-q0 through var-q9
are bound.
(calcFunc-typeof): Replace undeclared variable by correct expression.
(math-exp-env): New variable.
(math-define-body, math-define-exp): Replace exp-env by declared
variable.
(math-define-exp): Replace misplaced variable by expression.
2004-11-21 05:52:41 +00:00
|
|
|
(let ((calc-user-formula-alist (nth 1 (symbol-function func))))
|
2001-11-06 18:59:06 +00:00
|
|
|
(calc-fix-user-formula val)))
|
2001-11-14 09:09:09 +00:00
|
|
|
(put func 'calc-user-defn val))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calc-valid-formula-func (func)
|
|
|
|
(let ((def (symbol-function func)))
|
|
|
|
(and (consp def)
|
|
|
|
(eq (car def) 'lambda)
|
|
|
|
(progn
|
|
|
|
(setq def (cdr (cdr def)))
|
|
|
|
(while (and def
|
|
|
|
(not (eq (car (car def)) 'math-normalize)))
|
|
|
|
(setq def (cdr def)))
|
2001-11-14 09:09:09 +00:00
|
|
|
(car def)))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
(defun calc-get-user-defn ()
|
|
|
|
(interactive)
|
|
|
|
(calc-wrapper
|
|
|
|
(message "Get definition of command: z-")
|
|
|
|
(let* ((key (read-char))
|
|
|
|
(def (or (assq key (calc-user-key-map))
|
|
|
|
(assq (upcase key) (calc-user-key-map))
|
|
|
|
(assq (downcase key) (calc-user-key-map))
|
|
|
|
(error "No command defined for that key")))
|
|
|
|
(cmd (cdr def)))
|
|
|
|
(if (symbolp cmd)
|
|
|
|
(setq cmd (symbol-function cmd)))
|
|
|
|
(cond ((stringp cmd)
|
|
|
|
(message "Keyboard macro: %s" cmd))
|
|
|
|
(t (let* ((func (calc-stack-command-p cmd))
|
|
|
|
(defn (and func
|
|
|
|
(symbolp func)
|
|
|
|
(get func 'calc-user-defn))))
|
|
|
|
(if defn
|
|
|
|
(progn
|
|
|
|
(and (calc-valid-formula-func func)
|
|
|
|
(setq defn (append '(calcFunc-lambda)
|
|
|
|
(mapcar 'math-build-var-name
|
|
|
|
(nth 1 (symbol-function
|
|
|
|
func)))
|
|
|
|
(list defn))))
|
|
|
|
(calc-enter-result 0 "gdef" defn))
|
2001-11-14 09:09:09 +00:00
|
|
|
(error "That command is not defined by a formula"))))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
(defun calc-user-define-permanent ()
|
|
|
|
(interactive)
|
|
|
|
(calc-wrapper
|
|
|
|
(message "Record in %s the command: z-" calc-settings-file)
|
|
|
|
(let* ((key (read-char))
|
|
|
|
(def (or (assq key (calc-user-key-map))
|
|
|
|
(assq (upcase key) (calc-user-key-map))
|
|
|
|
(assq (downcase key) (calc-user-key-map))
|
2003-02-04 13:24:35 +00:00
|
|
|
(and (eq key ?\')
|
2004-12-29 04:04:09 +00:00
|
|
|
(cons nil
|
|
|
|
(intern
|
|
|
|
(concat "calcFunc-"
|
|
|
|
(completing-read
|
|
|
|
(format "Record in %s the algebraic function: "
|
|
|
|
calc-settings-file)
|
|
|
|
(mapcar (lambda (x) (substring x 9))
|
|
|
|
(all-completions "calcFunc-"
|
|
|
|
obarray))
|
2009-09-15 02:35:22 +00:00
|
|
|
(lambda (x)
|
|
|
|
(fboundp
|
2004-12-29 04:04:09 +00:00
|
|
|
(intern (concat "calcFunc-" x))))
|
|
|
|
t)))))
|
|
|
|
(and (eq key ?\M-x)
|
2001-11-06 18:59:06 +00:00
|
|
|
(cons nil
|
|
|
|
(intern (completing-read
|
2004-12-29 04:04:09 +00:00
|
|
|
(format "Record in %s the command: "
|
2001-11-06 18:59:06 +00:00
|
|
|
calc-settings-file)
|
2004-12-29 04:04:09 +00:00
|
|
|
obarray 'fboundp nil "calc-"))))
|
2001-11-06 18:59:06 +00:00
|
|
|
(error "No command defined for that key"))))
|
|
|
|
(set-buffer (find-file-noselect (substitute-in-file-name
|
|
|
|
calc-settings-file)))
|
|
|
|
(goto-char (point-max))
|
|
|
|
(let* ((cmd (cdr def))
|
|
|
|
(fcmd (and cmd (symbolp cmd) (symbol-function cmd)))
|
|
|
|
(func nil)
|
2020-10-10 20:00:51 +00:00
|
|
|
;; (pt (point))
|
2001-11-06 18:59:06 +00:00
|
|
|
(fill-column 70)
|
|
|
|
(fill-prefix nil)
|
|
|
|
str q-ok)
|
|
|
|
(insert "\n;;; Definition stored by Calc on " (current-time-string)
|
|
|
|
"\n(put 'calc-define '"
|
|
|
|
(if (symbolp cmd) (symbol-name cmd) (format "key%d" key))
|
|
|
|
" '(progn\n")
|
|
|
|
(if (and fcmd
|
|
|
|
(eq (car-safe fcmd) 'lambda)
|
|
|
|
(get cmd 'calc-user-defn))
|
|
|
|
(let ((pt (point)))
|
|
|
|
(and (eq (car-safe (nth 3 fcmd)) 'calc-execute-kbd-macro)
|
|
|
|
(vectorp (nth 1 (nth 3 fcmd)))
|
|
|
|
(progn (and (fboundp 'edit-kbd-macro)
|
|
|
|
(edit-kbd-macro nil))
|
2004-12-30 19:45:12 +00:00
|
|
|
(fboundp 'edmacro-parse-keys))
|
2001-11-06 18:59:06 +00:00
|
|
|
(setq q-ok t)
|
|
|
|
(aset (nth 1 (nth 3 fcmd)) 1 nil))
|
|
|
|
(insert (setq str (prin1-to-string
|
|
|
|
(cons 'defun (cons cmd (cdr fcmd)))))
|
|
|
|
"\n")
|
Use string-search instead of string-match[-p]
`string-search` is easier to understand, less error-prone, much
faster, does not pollute the regexp cache, and does not mutate global
state. Use it where applicable and obviously safe (erring on the
conservative side).
* admin/authors.el (authors-canonical-file-name)
(authors-scan-change-log):
* lisp/apropos.el (apropos-command)
(apropos-documentation-property, apropos-symbols-internal):
* lisp/arc-mode.el (archive-arc-summarize)
(archive-zoo-summarize):
* lisp/calc/calc-aent.el (math-read-factor):
* lisp/calc/calc-ext.el (math-read-big-expr)
(math-format-nice-expr, math-format-number-fancy):
* lisp/calc/calc-forms.el (math-read-angle-brackets):
* lisp/calc/calc-graph.el (calc-graph-set-range):
* lisp/calc/calc-keypd.el (calc-keypad-press):
* lisp/calc/calc-lang.el (tex, latex, math-read-big-rec):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-user-define-permanent, math-define-exp):
* lisp/calc/calc.el (calc-record, calcDigit-key)
(calc-count-lines):
* lisp/calc/calcalg2.el (calc-solve-for, calc-poly-roots)
(math-do-integral):
* lisp/calc/calcalg3.el (calc-find-root, calc-find-minimum)
(calc-get-fit-variables):
* lisp/cedet/ede/speedbar.el (ede-tag-expand):
* lisp/cedet/semantic/java.el (semantic-java-expand-tag):
* lisp/cedet/semantic/sb.el (semantic-sb-show-extra)
(semantic-sb-expand-group):
* lisp/cedet/semantic/wisent/python.el
(semantic-python-instance-variable-p):
* lisp/cus-edit.el (get):
* lisp/descr-text.el (describe-text-sexp):
* lisp/dired-aux.el (dired-compress-file):
* lisp/dired-x.el (dired-make-relative-symlink):
* lisp/dired.el (dired-glob-regexp):
* lisp/dos-fns.el (dos-convert-standard-filename, dos-8+3-filename):
* lisp/edmacro.el (edmacro-format-keys):
* lisp/emacs-lisp/eieio-opt.el (eieio-sb-expand):
* lisp/emacs-lisp/eieio-speedbar.el (eieio-speedbar-object-expand):
* lisp/emacs-lisp/lisp-mnt.el (lm-keywords-list):
* lisp/emacs-lisp/warnings.el (display-warning):
* lisp/emulation/viper-ex.el (viper-ex-read-file-name)
(ex-print-display-lines):
* lisp/env.el (read-envvar-name, setenv):
* lisp/epa-mail.el (epa-mail-encrypt):
* lisp/epg.el (epg--start):
* lisp/erc/erc-backend.el (erc-parse-server-response):
* lisp/erc/erc-dcc.el (erc-dcc-member):
* lisp/erc/erc-speedbar.el (erc-speedbar-expand-server)
(erc-speedbar-expand-channel, erc-speedbar-expand-user):
* lisp/erc/erc.el (erc-send-input):
* lisp/eshell/em-glob.el (eshell-glob-entries):
* lisp/eshell/esh-proc.el (eshell-needs-pipe-p):
* lisp/eshell/esh-util.el (eshell-convert):
* lisp/eshell/esh-var.el (eshell-envvar-names):
* lisp/faces.el (x-resolve-font-name):
* lisp/ffap.el (ffap-file-at-point):
* lisp/files.el (wildcard-to-regexp, shell-quote-wildcard-pattern):
* lisp/forms.el (forms--update):
* lisp/frameset.el (frameset-filter-unshelve-param):
* lisp/gnus/gnus-art.el (article-decode-charset):
* lisp/gnus/gnus-kill.el (gnus-kill-parse-rn-kill-file):
* lisp/gnus/gnus-mlspl.el (gnus-group-split-fancy):
* lisp/gnus/gnus-msg.el (gnus-summary-resend-message-insert-gcc)
(gnus-inews-insert-gcc):
* lisp/gnus/gnus-rfc1843.el (rfc1843-decode-article-body):
* lisp/gnus/gnus-search.el (gnus-search-indexed-parse-output)
(gnus-search--complete-key-data):
* lisp/gnus/gnus-spec.el (gnus-parse-simple-format):
* lisp/gnus/gnus-sum.el (gnus-summary-refer-article):
* lisp/gnus/gnus-util.el (gnus-extract-address-components)
(gnus-newsgroup-directory-form):
* lisp/gnus/gnus-uu.el (gnus-uu-grab-view):
* lisp/gnus/gnus.el (gnus-group-native-p, gnus-short-group-name):
* lisp/gnus/message.el (message-check-news-header-syntax)
(message-make-message-id, message-user-mail-address)
(message-make-fqdn, message-get-reply-headers, message-followup):
* lisp/gnus/mm-decode.el (mm-dissect-buffer):
* lisp/gnus/nnheader.el (nnheader-insert):
* lisp/gnus/nnimap.el (nnimap-process-quirk)
(nnimap-imap-ranges-to-gnus-ranges):
* lisp/gnus/nnmaildir.el (nnmaildir--ensure-suffix):
* lisp/gnus/nnmairix.el (nnmairix-determine-original-group-from-path):
* lisp/gnus/nnrss.el (nnrss-match-macro):
* lisp/gnus/nntp.el (nntp-find-group-and-number):
* lisp/help-fns.el (help--symbol-completion-table-affixation):
* lisp/help.el (help-function-arglist):
* lisp/hippie-exp.el (he-concat-directory-file-name):
* lisp/htmlfontify.el (hfy-relstub):
* lisp/ido.el (ido-make-prompt, ido-complete, ido-copy-current-word)
(ido-exhibit):
* lisp/image/image-converter.el (image-convert-p):
* lisp/info-xref.el (info-xref-docstrings):
* lisp/info.el (Info-toc-build, Info-follow-reference)
(Info-backward-node, Info-finder-find-node)
(Info-speedbar-expand-node):
* lisp/international/mule-diag.el (print-fontset-element):
* lisp/language/korea-util.el (default-korean-keyboard):
* lisp/linum.el (linum-after-change):
* lisp/mail/ietf-drums.el (ietf-drums-parse-address):
* lisp/mail/mail-utils.el (mail-dont-reply-to):
* lisp/mail/rfc2047.el (rfc2047-encode-1, rfc2047-decode-string):
* lisp/mail/rfc2231.el (rfc2231-parse-string):
* lisp/mail/rmailkwd.el (rmail-set-label):
* lisp/mail/rmailsum.el (rmail-header-summary):
* lisp/mail/smtpmail.el (smtpmail-maybe-append-domain)
(smtpmail-user-mail-address):
* lisp/mail/uce.el (uce-reply-to-uce):
* lisp/man.el (Man-default-man-entry):
* lisp/mh-e/mh-alias.el (mh-alias-gecos-name)
(mh-alias-minibuffer-confirm-address):
* lisp/mh-e/mh-comp.el (mh-forwarded-letter-subject):
* lisp/mh-e/mh-speed.el (mh-speed-parse-flists-output):
* lisp/mh-e/mh-utils.el (mh-collect-folder-names-filter)
(mh-folder-completion-function):
* lisp/minibuffer.el (completion--make-envvar-table)
(completion-file-name-table, completion-flex-try-completion)
(completion-flex-all-completions):
* lisp/mpc.el (mpc--proc-quote-string, mpc-cmd-special-tag-p)
(mpc-constraints-tag-lookup):
* lisp/net/ange-ftp.el (ange-ftp-send-cmd)
(ange-ftp-allow-child-lookup):
* lisp/net/mailcap.el (mailcap-mime-types):
* lisp/net/mairix.el (mairix-search-thread-this-article):
* lisp/net/pop3.el (pop3-open-server):
* lisp/net/soap-client.el (soap-decode-xs-complex-type):
* lisp/net/socks.el (socks-filter):
* lisp/nxml/nxml-outln.el (nxml-highlighted-qname):
* lisp/nxml/rng-cmpct.el (rng-c-expand-name, rng-c-expand-datatype):
* lisp/nxml/rng-uri.el (rng-uri-file-name-1):
* lisp/obsolete/complete.el (partial-completion-mode)
(PC-do-completion):
* lisp/obsolete/longlines.el (longlines-encode-string):
* lisp/obsolete/nnir.el (nnir-compose-result):
* lisp/obsolete/terminal.el (te-quote-arg-for-sh):
* lisp/obsolete/tpu-edt.el (tpu-check-search-case):
* lisp/obsolete/url-ns.el (isPlainHostName):
* lisp/pcmpl-unix.el (pcomplete/scp):
* lisp/play/dunnet.el (dun-listify-string2, dun-get-path)
(dun-unix-parse, dun-doassign, dun-cat, dun-batch-unix-interface):
* lisp/progmodes/ebnf2ps.el: (ebnf-eps-header-footer-comment):
* lisp/progmodes/gdb-mi.el (gdb-var-delete)
(gdb-speedbar-expand-node, gdbmi-bnf-incomplete-record-result):
* lisp/progmodes/gud.el (gud-find-expr):
* lisp/progmodes/idlw-help.el (idlwave-do-context-help1):
* lisp/progmodes/idlw-shell.el (idlwave-shell-mode)
(idlwave-shell-filter-hidden-output, idlwave-shell-filter):
* lisp/progmodes/idlwave.el (idlwave-skip-label-or-case)
(idlwave-routine-info):
* lisp/progmodes/octave.el (inferior-octave-completion-at-point):
* lisp/progmodes/sh-script.el (sh-add-completer):
* lisp/progmodes/sql.el (defun):
* lisp/progmodes/xscheme.el (xscheme-process-filter):
* lisp/replace.el (query-replace-compile-replacement)
(map-query-replace-regexp):
* lisp/shell.el (shell--command-completion-data)
(shell-environment-variable-completion):
* lisp/simple.el (display-message-or-buffer):
* lisp/speedbar.el (speedbar-dired, speedbar-tag-file)
(speedbar-tag-expand):
* lisp/subr.el (split-string-and-unquote):
* lisp/tar-mode.el (tar-extract):
* lisp/term.el (term-command-hook, serial-read-name):
* lisp/textmodes/bibtex.el (bibtex-print-help-message):
* lisp/textmodes/ispell.el (ispell-lookup-words, ispell-filter)
(ispell-parse-output, ispell-buffer-local-parsing):
* lisp/textmodes/reftex-cite.el (reftex-do-citation):
* lisp/textmodes/reftex-parse.el (reftex-notice-new):
* lisp/textmodes/reftex-ref.el (reftex-show-entry):
* lisp/textmodes/reftex.el (reftex-compile-variables):
* lisp/textmodes/tex-mode.el (tex-send-command)
(tex-start-tex, tex-append):
* lisp/thingatpt.el (thing-at-point-url-at-point):
* lisp/tmm.el (tmm-add-one-shortcut):
* lisp/transient.el (transient-format-key):
* lisp/url/url-auth.el (url-basic-auth)
(url-digest-auth-directory-id-assoc):
* lisp/url/url-news.el (url-news):
* lisp/url/url-util.el (url-parse-query-string):
* lisp/vc/vc-cvs.el (vc-cvs-parse-entry):
* lisp/wid-browse.el (widget-browse-sexp):
* lisp/woman.el (woman-parse-colon-path, woman-mini-help)
(WoMan-getpage-in-background, woman-negative-vertical-space):
* lisp/xml.el:
* test/lisp/emacs-lisp/check-declare-tests.el
(check-declare-tests-warn):
* test/lisp/files-tests.el
(files-tests-file-name-non-special-dired-compress-handler):
* test/lisp/net/network-stream-tests.el (server-process-filter):
* test/src/coding-tests.el (ert-test-unibyte-buffer-dos-eol-decode):
Use `string-search` instead of `string-match` and `string-match-p`.
2021-08-09 09:20:00 +00:00
|
|
|
(or (and (string-search "\"" str) (not q-ok))
|
2001-11-06 18:59:06 +00:00
|
|
|
(fill-region pt (point)))
|
|
|
|
(indent-rigidly pt (point) 2)
|
|
|
|
(delete-region pt (1+ pt))
|
|
|
|
(insert " (put '" (symbol-name cmd)
|
|
|
|
" 'calc-user-defn '"
|
|
|
|
(prin1-to-string (get cmd 'calc-user-defn))
|
|
|
|
")\n")
|
|
|
|
(setq func (calc-stack-command-p cmd))
|
|
|
|
(let ((ffunc (and func (symbolp func) (symbol-function func)))
|
|
|
|
(pt (point)))
|
|
|
|
(and ffunc
|
|
|
|
(eq (car-safe ffunc) 'lambda)
|
|
|
|
(get func 'calc-user-defn)
|
|
|
|
(progn
|
|
|
|
(insert (setq str (prin1-to-string
|
|
|
|
(cons 'defun (cons func
|
|
|
|
(cdr ffunc)))))
|
|
|
|
"\n")
|
Use string-search instead of string-match[-p]
`string-search` is easier to understand, less error-prone, much
faster, does not pollute the regexp cache, and does not mutate global
state. Use it where applicable and obviously safe (erring on the
conservative side).
* admin/authors.el (authors-canonical-file-name)
(authors-scan-change-log):
* lisp/apropos.el (apropos-command)
(apropos-documentation-property, apropos-symbols-internal):
* lisp/arc-mode.el (archive-arc-summarize)
(archive-zoo-summarize):
* lisp/calc/calc-aent.el (math-read-factor):
* lisp/calc/calc-ext.el (math-read-big-expr)
(math-format-nice-expr, math-format-number-fancy):
* lisp/calc/calc-forms.el (math-read-angle-brackets):
* lisp/calc/calc-graph.el (calc-graph-set-range):
* lisp/calc/calc-keypd.el (calc-keypad-press):
* lisp/calc/calc-lang.el (tex, latex, math-read-big-rec):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-user-define-permanent, math-define-exp):
* lisp/calc/calc.el (calc-record, calcDigit-key)
(calc-count-lines):
* lisp/calc/calcalg2.el (calc-solve-for, calc-poly-roots)
(math-do-integral):
* lisp/calc/calcalg3.el (calc-find-root, calc-find-minimum)
(calc-get-fit-variables):
* lisp/cedet/ede/speedbar.el (ede-tag-expand):
* lisp/cedet/semantic/java.el (semantic-java-expand-tag):
* lisp/cedet/semantic/sb.el (semantic-sb-show-extra)
(semantic-sb-expand-group):
* lisp/cedet/semantic/wisent/python.el
(semantic-python-instance-variable-p):
* lisp/cus-edit.el (get):
* lisp/descr-text.el (describe-text-sexp):
* lisp/dired-aux.el (dired-compress-file):
* lisp/dired-x.el (dired-make-relative-symlink):
* lisp/dired.el (dired-glob-regexp):
* lisp/dos-fns.el (dos-convert-standard-filename, dos-8+3-filename):
* lisp/edmacro.el (edmacro-format-keys):
* lisp/emacs-lisp/eieio-opt.el (eieio-sb-expand):
* lisp/emacs-lisp/eieio-speedbar.el (eieio-speedbar-object-expand):
* lisp/emacs-lisp/lisp-mnt.el (lm-keywords-list):
* lisp/emacs-lisp/warnings.el (display-warning):
* lisp/emulation/viper-ex.el (viper-ex-read-file-name)
(ex-print-display-lines):
* lisp/env.el (read-envvar-name, setenv):
* lisp/epa-mail.el (epa-mail-encrypt):
* lisp/epg.el (epg--start):
* lisp/erc/erc-backend.el (erc-parse-server-response):
* lisp/erc/erc-dcc.el (erc-dcc-member):
* lisp/erc/erc-speedbar.el (erc-speedbar-expand-server)
(erc-speedbar-expand-channel, erc-speedbar-expand-user):
* lisp/erc/erc.el (erc-send-input):
* lisp/eshell/em-glob.el (eshell-glob-entries):
* lisp/eshell/esh-proc.el (eshell-needs-pipe-p):
* lisp/eshell/esh-util.el (eshell-convert):
* lisp/eshell/esh-var.el (eshell-envvar-names):
* lisp/faces.el (x-resolve-font-name):
* lisp/ffap.el (ffap-file-at-point):
* lisp/files.el (wildcard-to-regexp, shell-quote-wildcard-pattern):
* lisp/forms.el (forms--update):
* lisp/frameset.el (frameset-filter-unshelve-param):
* lisp/gnus/gnus-art.el (article-decode-charset):
* lisp/gnus/gnus-kill.el (gnus-kill-parse-rn-kill-file):
* lisp/gnus/gnus-mlspl.el (gnus-group-split-fancy):
* lisp/gnus/gnus-msg.el (gnus-summary-resend-message-insert-gcc)
(gnus-inews-insert-gcc):
* lisp/gnus/gnus-rfc1843.el (rfc1843-decode-article-body):
* lisp/gnus/gnus-search.el (gnus-search-indexed-parse-output)
(gnus-search--complete-key-data):
* lisp/gnus/gnus-spec.el (gnus-parse-simple-format):
* lisp/gnus/gnus-sum.el (gnus-summary-refer-article):
* lisp/gnus/gnus-util.el (gnus-extract-address-components)
(gnus-newsgroup-directory-form):
* lisp/gnus/gnus-uu.el (gnus-uu-grab-view):
* lisp/gnus/gnus.el (gnus-group-native-p, gnus-short-group-name):
* lisp/gnus/message.el (message-check-news-header-syntax)
(message-make-message-id, message-user-mail-address)
(message-make-fqdn, message-get-reply-headers, message-followup):
* lisp/gnus/mm-decode.el (mm-dissect-buffer):
* lisp/gnus/nnheader.el (nnheader-insert):
* lisp/gnus/nnimap.el (nnimap-process-quirk)
(nnimap-imap-ranges-to-gnus-ranges):
* lisp/gnus/nnmaildir.el (nnmaildir--ensure-suffix):
* lisp/gnus/nnmairix.el (nnmairix-determine-original-group-from-path):
* lisp/gnus/nnrss.el (nnrss-match-macro):
* lisp/gnus/nntp.el (nntp-find-group-and-number):
* lisp/help-fns.el (help--symbol-completion-table-affixation):
* lisp/help.el (help-function-arglist):
* lisp/hippie-exp.el (he-concat-directory-file-name):
* lisp/htmlfontify.el (hfy-relstub):
* lisp/ido.el (ido-make-prompt, ido-complete, ido-copy-current-word)
(ido-exhibit):
* lisp/image/image-converter.el (image-convert-p):
* lisp/info-xref.el (info-xref-docstrings):
* lisp/info.el (Info-toc-build, Info-follow-reference)
(Info-backward-node, Info-finder-find-node)
(Info-speedbar-expand-node):
* lisp/international/mule-diag.el (print-fontset-element):
* lisp/language/korea-util.el (default-korean-keyboard):
* lisp/linum.el (linum-after-change):
* lisp/mail/ietf-drums.el (ietf-drums-parse-address):
* lisp/mail/mail-utils.el (mail-dont-reply-to):
* lisp/mail/rfc2047.el (rfc2047-encode-1, rfc2047-decode-string):
* lisp/mail/rfc2231.el (rfc2231-parse-string):
* lisp/mail/rmailkwd.el (rmail-set-label):
* lisp/mail/rmailsum.el (rmail-header-summary):
* lisp/mail/smtpmail.el (smtpmail-maybe-append-domain)
(smtpmail-user-mail-address):
* lisp/mail/uce.el (uce-reply-to-uce):
* lisp/man.el (Man-default-man-entry):
* lisp/mh-e/mh-alias.el (mh-alias-gecos-name)
(mh-alias-minibuffer-confirm-address):
* lisp/mh-e/mh-comp.el (mh-forwarded-letter-subject):
* lisp/mh-e/mh-speed.el (mh-speed-parse-flists-output):
* lisp/mh-e/mh-utils.el (mh-collect-folder-names-filter)
(mh-folder-completion-function):
* lisp/minibuffer.el (completion--make-envvar-table)
(completion-file-name-table, completion-flex-try-completion)
(completion-flex-all-completions):
* lisp/mpc.el (mpc--proc-quote-string, mpc-cmd-special-tag-p)
(mpc-constraints-tag-lookup):
* lisp/net/ange-ftp.el (ange-ftp-send-cmd)
(ange-ftp-allow-child-lookup):
* lisp/net/mailcap.el (mailcap-mime-types):
* lisp/net/mairix.el (mairix-search-thread-this-article):
* lisp/net/pop3.el (pop3-open-server):
* lisp/net/soap-client.el (soap-decode-xs-complex-type):
* lisp/net/socks.el (socks-filter):
* lisp/nxml/nxml-outln.el (nxml-highlighted-qname):
* lisp/nxml/rng-cmpct.el (rng-c-expand-name, rng-c-expand-datatype):
* lisp/nxml/rng-uri.el (rng-uri-file-name-1):
* lisp/obsolete/complete.el (partial-completion-mode)
(PC-do-completion):
* lisp/obsolete/longlines.el (longlines-encode-string):
* lisp/obsolete/nnir.el (nnir-compose-result):
* lisp/obsolete/terminal.el (te-quote-arg-for-sh):
* lisp/obsolete/tpu-edt.el (tpu-check-search-case):
* lisp/obsolete/url-ns.el (isPlainHostName):
* lisp/pcmpl-unix.el (pcomplete/scp):
* lisp/play/dunnet.el (dun-listify-string2, dun-get-path)
(dun-unix-parse, dun-doassign, dun-cat, dun-batch-unix-interface):
* lisp/progmodes/ebnf2ps.el: (ebnf-eps-header-footer-comment):
* lisp/progmodes/gdb-mi.el (gdb-var-delete)
(gdb-speedbar-expand-node, gdbmi-bnf-incomplete-record-result):
* lisp/progmodes/gud.el (gud-find-expr):
* lisp/progmodes/idlw-help.el (idlwave-do-context-help1):
* lisp/progmodes/idlw-shell.el (idlwave-shell-mode)
(idlwave-shell-filter-hidden-output, idlwave-shell-filter):
* lisp/progmodes/idlwave.el (idlwave-skip-label-or-case)
(idlwave-routine-info):
* lisp/progmodes/octave.el (inferior-octave-completion-at-point):
* lisp/progmodes/sh-script.el (sh-add-completer):
* lisp/progmodes/sql.el (defun):
* lisp/progmodes/xscheme.el (xscheme-process-filter):
* lisp/replace.el (query-replace-compile-replacement)
(map-query-replace-regexp):
* lisp/shell.el (shell--command-completion-data)
(shell-environment-variable-completion):
* lisp/simple.el (display-message-or-buffer):
* lisp/speedbar.el (speedbar-dired, speedbar-tag-file)
(speedbar-tag-expand):
* lisp/subr.el (split-string-and-unquote):
* lisp/tar-mode.el (tar-extract):
* lisp/term.el (term-command-hook, serial-read-name):
* lisp/textmodes/bibtex.el (bibtex-print-help-message):
* lisp/textmodes/ispell.el (ispell-lookup-words, ispell-filter)
(ispell-parse-output, ispell-buffer-local-parsing):
* lisp/textmodes/reftex-cite.el (reftex-do-citation):
* lisp/textmodes/reftex-parse.el (reftex-notice-new):
* lisp/textmodes/reftex-ref.el (reftex-show-entry):
* lisp/textmodes/reftex.el (reftex-compile-variables):
* lisp/textmodes/tex-mode.el (tex-send-command)
(tex-start-tex, tex-append):
* lisp/thingatpt.el (thing-at-point-url-at-point):
* lisp/tmm.el (tmm-add-one-shortcut):
* lisp/transient.el (transient-format-key):
* lisp/url/url-auth.el (url-basic-auth)
(url-digest-auth-directory-id-assoc):
* lisp/url/url-news.el (url-news):
* lisp/url/url-util.el (url-parse-query-string):
* lisp/vc/vc-cvs.el (vc-cvs-parse-entry):
* lisp/wid-browse.el (widget-browse-sexp):
* lisp/woman.el (woman-parse-colon-path, woman-mini-help)
(WoMan-getpage-in-background, woman-negative-vertical-space):
* lisp/xml.el:
* test/lisp/emacs-lisp/check-declare-tests.el
(check-declare-tests-warn):
* test/lisp/files-tests.el
(files-tests-file-name-non-special-dired-compress-handler):
* test/lisp/net/network-stream-tests.el (server-process-filter):
* test/src/coding-tests.el (ert-test-unibyte-buffer-dos-eol-decode):
Use `string-search` instead of `string-match` and `string-match-p`.
2021-08-09 09:20:00 +00:00
|
|
|
(or (and (string-search "\"" str) (not q-ok))
|
2001-11-06 18:59:06 +00:00
|
|
|
(fill-region pt (point)))
|
|
|
|
(indent-rigidly pt (point) 2)
|
|
|
|
(delete-region pt (1+ pt))
|
|
|
|
(setq pt (point))
|
|
|
|
(insert "(put '" (symbol-name func)
|
|
|
|
" 'calc-user-defn '"
|
|
|
|
(prin1-to-string (get func 'calc-user-defn))
|
|
|
|
")\n")
|
|
|
|
(fill-region pt (point))
|
|
|
|
(indent-rigidly pt (point) 2)
|
|
|
|
(delete-region pt (1+ pt))))))
|
|
|
|
(and (stringp fcmd)
|
|
|
|
(insert " (fset '" (prin1-to-string cmd)
|
|
|
|
" " (prin1-to-string fcmd) ")\n")))
|
|
|
|
(or func (setq func (and cmd (symbolp cmd) (fboundp cmd) cmd)))
|
|
|
|
(if (get func 'math-compose-forms)
|
|
|
|
(let ((pt (point)))
|
2019-07-18 15:16:50 +00:00
|
|
|
(insert "(put '" (symbol-name func)
|
2001-11-06 18:59:06 +00:00
|
|
|
" 'math-compose-forms '"
|
|
|
|
(prin1-to-string (get func 'math-compose-forms))
|
|
|
|
")\n")
|
|
|
|
(fill-region pt (point))
|
|
|
|
(indent-rigidly pt (point) 2)
|
|
|
|
(delete-region pt (1+ pt))))
|
|
|
|
(if (car def)
|
|
|
|
(insert " (define-key calc-mode-map "
|
|
|
|
(prin1-to-string (concat "z" (char-to-string key)))
|
|
|
|
" '"
|
|
|
|
(prin1-to-string cmd)
|
|
|
|
")\n")))
|
|
|
|
(insert "))\n")
|
2001-11-14 09:09:09 +00:00
|
|
|
(save-buffer))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calc-stack-command-p (cmd)
|
|
|
|
(if (and cmd (symbolp cmd))
|
|
|
|
(and (fboundp cmd)
|
|
|
|
(calc-stack-command-p (symbol-function cmd)))
|
|
|
|
(and (consp cmd)
|
|
|
|
(eq (car cmd) 'lambda)
|
|
|
|
(setq cmd (or (assq 'calc-wrapper cmd)
|
|
|
|
(assq 'calc-slow-wrapper cmd)))
|
|
|
|
(setq cmd (assq 'calc-enter-result cmd))
|
|
|
|
(memq (car (nth 3 cmd)) '(cons list))
|
|
|
|
(eq (car (nth 1 (nth 3 cmd))) 'quote)
|
2001-11-14 09:09:09 +00:00
|
|
|
(nth 1 (nth 1 (nth 3 cmd))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
(defun calc-call-last-kbd-macro (arg)
|
|
|
|
(interactive "P")
|
|
|
|
(and defining-kbd-macro
|
|
|
|
(error "Can't execute anonymous macro while defining one"))
|
|
|
|
(or last-kbd-macro
|
|
|
|
(error "No kbd macro has been defined"))
|
2001-11-14 09:09:09 +00:00
|
|
|
(calc-execute-kbd-macro last-kbd-macro arg))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calc-execute-kbd-macro (mac arg &rest prefix)
|
2005-01-19 05:12:36 +00:00
|
|
|
(if calc-keep-args-flag
|
|
|
|
(calc-keep-args))
|
2001-11-06 18:59:06 +00:00
|
|
|
(if (and (vectorp mac) (> (length mac) 0) (stringp (aref mac 0)))
|
|
|
|
(setq mac (or (aref mac 1)
|
|
|
|
(aset mac 1 (progn (and (fboundp 'edit-kbd-macro)
|
|
|
|
(edit-kbd-macro nil))
|
2004-12-30 19:45:12 +00:00
|
|
|
(edmacro-parse-keys (aref mac 0)))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
(if (< (prefix-numeric-value arg) 0)
|
|
|
|
(execute-kbd-macro mac (- (prefix-numeric-value arg)))
|
|
|
|
(if calc-executing-macro
|
|
|
|
(execute-kbd-macro mac arg)
|
|
|
|
(calc-slow-wrapper
|
|
|
|
(let ((old-stack-whole (copy-sequence calc-stack))
|
|
|
|
(old-stack-top calc-stack-top)
|
|
|
|
(old-buffer-size (buffer-size))
|
|
|
|
(old-refresh-count calc-refresh-count))
|
|
|
|
(unwind-protect
|
|
|
|
(let ((calc-executing-macro mac))
|
|
|
|
(execute-kbd-macro mac arg))
|
|
|
|
(calc-select-buffer)
|
|
|
|
(let ((new-stack (reverse calc-stack))
|
|
|
|
(old-stack (reverse old-stack-whole)))
|
|
|
|
(while (and new-stack old-stack
|
|
|
|
(equal (car new-stack) (car old-stack)))
|
|
|
|
(setq new-stack (cdr new-stack)
|
|
|
|
old-stack (cdr old-stack)))
|
|
|
|
(or (equal prefix '(nil))
|
|
|
|
(calc-record-list (if (> (length new-stack) 1)
|
|
|
|
(mapcar 'car new-stack)
|
|
|
|
'(""))
|
|
|
|
(or (car prefix) "kmac")))
|
|
|
|
(calc-record-undo (list 'set 'saved-stack-top old-stack-top))
|
|
|
|
(and old-stack
|
|
|
|
(calc-record-undo (list 'pop 1 (mapcar 'car old-stack))))
|
|
|
|
(let ((calc-stack old-stack-whole)
|
|
|
|
(calc-stack-top 0))
|
|
|
|
(calc-cursor-stack-index (length old-stack)))
|
|
|
|
(if (and (= old-buffer-size (buffer-size))
|
|
|
|
(= old-refresh-count calc-refresh-count))
|
|
|
|
(let ((buffer-read-only nil))
|
|
|
|
(delete-region (point) (point-max))
|
|
|
|
(while new-stack
|
|
|
|
(calc-record-undo (list 'push 1))
|
|
|
|
(insert (math-format-stack-value (car new-stack)) "\n")
|
|
|
|
(setq new-stack (cdr new-stack)))
|
|
|
|
(calc-renumber-stack))
|
|
|
|
(while new-stack
|
|
|
|
(calc-record-undo (list 'push 1))
|
|
|
|
(setq new-stack (cdr new-stack)))
|
|
|
|
(calc-refresh))
|
2001-11-14 09:09:09 +00:00
|
|
|
(calc-record-undo (list 'set 'saved-stack-top 0)))))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calc-push-list-in-macro (vals m sels)
|
|
|
|
(let ((entry (list (car vals) 1 (car sels)))
|
|
|
|
(mm (+ (or m 1) calc-stack-top)))
|
|
|
|
(if (> mm 1)
|
|
|
|
(setcdr (nthcdr (- mm 2) calc-stack)
|
|
|
|
(cons entry (nthcdr (1- mm) calc-stack)))
|
2001-11-14 09:09:09 +00:00
|
|
|
(setq calc-stack (cons entry calc-stack)))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calc-pop-stack-in-macro (n mm)
|
|
|
|
(if (> mm 1)
|
|
|
|
(setcdr (nthcdr (- mm 2) calc-stack)
|
|
|
|
(nthcdr (+ n mm -1) calc-stack))
|
2001-11-14 09:09:09 +00:00
|
|
|
(setq calc-stack (nthcdr n calc-stack))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
(defun calc-kbd-if ()
|
|
|
|
(interactive)
|
|
|
|
(calc-wrapper
|
|
|
|
(let ((cond (calc-top-n 1)))
|
|
|
|
(calc-pop-stack 1)
|
|
|
|
(if (math-is-true cond)
|
|
|
|
(if defining-kbd-macro
|
2009-09-29 02:26:20 +00:00
|
|
|
(message "If true..."))
|
2001-11-06 18:59:06 +00:00
|
|
|
(if defining-kbd-macro
|
|
|
|
(message "Condition is false; skipping to Z: or Z] ..."))
|
2001-11-14 09:09:09 +00:00
|
|
|
(calc-kbd-skip-to-else-if t)))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calc-kbd-else-if ()
|
|
|
|
(interactive)
|
2001-11-14 09:09:09 +00:00
|
|
|
(calc-kbd-if))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calc-kbd-skip-to-else-if (else-okay)
|
|
|
|
(let ((count 0)
|
|
|
|
ch)
|
|
|
|
(while (>= count 0)
|
|
|
|
(setq ch (read-char))
|
|
|
|
(if (= ch -1)
|
|
|
|
(error "Unterminated Z[ in keyboard macro"))
|
|
|
|
(if (= ch ?Z)
|
|
|
|
(progn
|
|
|
|
(setq ch (read-char))
|
|
|
|
(cond ((= ch ?\[)
|
|
|
|
(setq count (1+ count)))
|
|
|
|
((= ch ?\])
|
|
|
|
(setq count (1- count)))
|
|
|
|
((= ch ?\:)
|
|
|
|
(and (= count 0)
|
|
|
|
else-okay
|
|
|
|
(setq count -1)))
|
|
|
|
((eq ch 7)
|
|
|
|
(keyboard-quit))))))
|
|
|
|
(and defining-kbd-macro
|
|
|
|
(if (= ch ?\:)
|
|
|
|
(message "Else...")
|
2001-11-14 09:09:09 +00:00
|
|
|
(message "End-if...")))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calc-kbd-end-if ()
|
|
|
|
(interactive)
|
|
|
|
(if defining-kbd-macro
|
2001-11-14 09:09:09 +00:00
|
|
|
(message "End-if...")))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calc-kbd-else ()
|
|
|
|
(interactive)
|
|
|
|
(if defining-kbd-macro
|
|
|
|
(message "Else; skipping to Z] ..."))
|
2001-11-14 09:09:09 +00:00
|
|
|
(calc-kbd-skip-to-else-if nil))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
(defun calc-kbd-repeat ()
|
|
|
|
(interactive)
|
|
|
|
(let (count)
|
|
|
|
(calc-wrapper
|
|
|
|
(setq count (math-trunc (calc-top-n 1)))
|
|
|
|
(or (Math-integerp count)
|
|
|
|
(error "Count must be an integer"))
|
|
|
|
(if (Math-integer-negp count)
|
|
|
|
(setq count 0))
|
|
|
|
(or (integerp count)
|
|
|
|
(setq count 1000000))
|
|
|
|
(calc-pop-stack 1))
|
2001-11-14 09:09:09 +00:00
|
|
|
(calc-kbd-loop count)))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calc-kbd-for (dir)
|
|
|
|
(interactive "P")
|
|
|
|
(let (init final)
|
|
|
|
(calc-wrapper
|
|
|
|
(setq init (calc-top-n 2)
|
|
|
|
final (calc-top-n 1))
|
|
|
|
(or (and (math-anglep init) (math-anglep final))
|
|
|
|
(error "Initial and final values must be real numbers"))
|
|
|
|
(calc-pop-stack 2))
|
2001-11-14 09:09:09 +00:00
|
|
|
(calc-kbd-loop nil init final (and dir (prefix-numeric-value dir)))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calc-kbd-loop (rpt-count &optional initial final dir)
|
|
|
|
(interactive "P")
|
|
|
|
(setq rpt-count (if rpt-count (prefix-numeric-value rpt-count) 1000000))
|
|
|
|
(let* ((count 0)
|
|
|
|
(parts nil)
|
2015-10-10 23:36:51 +00:00
|
|
|
(body (vector))
|
2009-01-09 03:57:12 +00:00
|
|
|
(open last-command-event)
|
2001-11-06 18:59:06 +00:00
|
|
|
(counter initial)
|
|
|
|
ch)
|
2001-11-13 07:30:58 +00:00
|
|
|
(or executing-kbd-macro
|
2001-11-06 18:59:06 +00:00
|
|
|
(message "Reading loop body..."))
|
|
|
|
(while (>= count 0)
|
2015-10-10 22:21:44 +00:00
|
|
|
(setq ch (read-event))
|
|
|
|
(if (eq ch -1)
|
2001-11-06 18:59:06 +00:00
|
|
|
(error "Unterminated Z%c in keyboard macro" open))
|
2015-10-10 22:21:44 +00:00
|
|
|
(if (eq ch ?Z)
|
2001-11-06 18:59:06 +00:00
|
|
|
(progn
|
2015-10-10 22:21:44 +00:00
|
|
|
(setq ch (read-event)
|
2015-10-10 23:36:51 +00:00
|
|
|
body (vconcat body (vector ?Z ch)))
|
2001-11-06 18:59:06 +00:00
|
|
|
(cond ((memq ch '(?\< ?\( ?\{))
|
|
|
|
(setq count (1+ count)))
|
|
|
|
((memq ch '(?\> ?\) ?\}))
|
|
|
|
(setq count (1- count)))
|
|
|
|
((and (= ch ?/)
|
|
|
|
(= count 0))
|
2015-10-10 22:21:44 +00:00
|
|
|
(setq parts (nconc parts (list (vconcat (substring body 0 -2)
|
|
|
|
(vector ?Z ?\]) )))
|
2001-11-06 18:59:06 +00:00
|
|
|
body ""))
|
|
|
|
((eq ch 7)
|
|
|
|
(keyboard-quit))))
|
2015-10-10 22:21:44 +00:00
|
|
|
(setq body (vconcat body (vector ch)))))
|
2001-11-06 18:59:06 +00:00
|
|
|
(if (/= ch (cdr (assq open '( (?\< . ?\>) (?\( . ?\)) (?\{ . ?\}) ))))
|
|
|
|
(error "Mismatched Z%c and Z%c in keyboard macro" open ch))
|
2001-11-13 07:30:58 +00:00
|
|
|
(or executing-kbd-macro
|
2001-11-06 18:59:06 +00:00
|
|
|
(message "Looping..."))
|
2015-10-10 22:21:44 +00:00
|
|
|
(setq body (vconcat (substring body 0 -2) (vector ?Z ?\]) ))
|
2001-11-13 07:30:58 +00:00
|
|
|
(and (not executing-kbd-macro)
|
2001-11-06 18:59:06 +00:00
|
|
|
(= rpt-count 1000000)
|
|
|
|
(null parts)
|
|
|
|
(null counter)
|
|
|
|
(progn
|
2001-11-19 07:44:56 +00:00
|
|
|
(message "Warning: Infinite loop! Not executing")
|
2001-11-06 18:59:06 +00:00
|
|
|
(setq rpt-count 0)))
|
|
|
|
(or (not initial) dir
|
|
|
|
(setq dir (math-compare final initial)))
|
|
|
|
(calc-wrapper
|
|
|
|
(while (> rpt-count 0)
|
|
|
|
(let ((part parts))
|
|
|
|
(if counter
|
|
|
|
(if (cond ((eq dir 0) (Math-equal final counter))
|
|
|
|
((eq dir 1) (Math-lessp final counter))
|
|
|
|
((eq dir -1) (Math-lessp counter final)))
|
|
|
|
(setq rpt-count 0)
|
|
|
|
(calc-push counter)))
|
|
|
|
(while (and part (> rpt-count 0))
|
|
|
|
(execute-kbd-macro (car part))
|
|
|
|
(if (math-is-true (calc-top-n 1))
|
|
|
|
(setq rpt-count 0)
|
|
|
|
(setq part (cdr part)))
|
|
|
|
(calc-pop-stack 1))
|
|
|
|
(if (> rpt-count 0)
|
|
|
|
(progn
|
|
|
|
(execute-kbd-macro body)
|
|
|
|
(if counter
|
|
|
|
(let ((step (calc-top-n 1)))
|
|
|
|
(calc-pop-stack 1)
|
|
|
|
(setq counter (calcFunc-add counter step)))
|
|
|
|
(setq rpt-count (1- rpt-count))))))))
|
2001-11-13 07:30:58 +00:00
|
|
|
(or executing-kbd-macro
|
2001-11-14 09:09:09 +00:00
|
|
|
(message "Looping...done"))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calc-kbd-end-repeat ()
|
|
|
|
(interactive)
|
2001-11-14 09:09:09 +00:00
|
|
|
(error "Unbalanced Z> in keyboard macro"))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calc-kbd-end-for ()
|
|
|
|
(interactive)
|
2001-11-14 09:09:09 +00:00
|
|
|
(error "Unbalanced Z) in keyboard macro"))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calc-kbd-end-loop ()
|
|
|
|
(interactive)
|
2001-11-14 09:09:09 +00:00
|
|
|
(error "Unbalanced Z} in keyboard macro"))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calc-kbd-break ()
|
|
|
|
(interactive)
|
|
|
|
(calc-wrapper
|
|
|
|
(let ((cond (calc-top-n 1)))
|
|
|
|
(calc-pop-stack 1)
|
|
|
|
(if (math-is-true cond)
|
2001-11-19 07:44:56 +00:00
|
|
|
(error "Keyboard macro aborted")))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
2001-11-19 07:44:56 +00:00
|
|
|
(defvar calc-kbd-push-level 0)
|
(math-integral-cache-state, calc-lang)
(calc-original-buffer): Declare them.
(calc-user-formula-alist): New variable.
(calc-user-define-formula, calc-fix-user-formula)
(calc-user-define-composition, calc-finish-formula-edit):
Replace variable alist by declared variable.
(var-q0, var-q1, var-q2, var-q3, var-q4, var-q5, var-q6)
(var-q7, var-q7, var-q8, var-q9): Declare them.
(calc-kbd-push): Don't check to see if var-q0 through var-q9
are bound.
(calcFunc-typeof): Replace undeclared variable by correct expression.
(math-exp-env): New variable.
(math-define-body, math-define-exp): Replace exp-env by declared
variable.
(math-define-exp): Replace misplaced variable by expression.
2004-11-21 05:52:41 +00:00
|
|
|
|
|
|
|
;; The variables var-q0 through var-q9 are the "quick" variables.
|
|
|
|
(defvar var-q0 nil)
|
|
|
|
(defvar var-q1 nil)
|
|
|
|
(defvar var-q2 nil)
|
|
|
|
(defvar var-q3 nil)
|
|
|
|
(defvar var-q4 nil)
|
|
|
|
(defvar var-q5 nil)
|
|
|
|
(defvar var-q6 nil)
|
|
|
|
(defvar var-q7 nil)
|
|
|
|
(defvar var-q8 nil)
|
|
|
|
(defvar var-q9 nil)
|
|
|
|
|
2001-11-06 18:59:06 +00:00
|
|
|
(defun calc-kbd-push (arg)
|
|
|
|
(interactive "P")
|
|
|
|
(calc-wrapper
|
|
|
|
(let* ((defs (and arg (> (prefix-numeric-value arg) 0)))
|
(math-integral-cache-state, calc-lang)
(calc-original-buffer): Declare them.
(calc-user-formula-alist): New variable.
(calc-user-define-formula, calc-fix-user-formula)
(calc-user-define-composition, calc-finish-formula-edit):
Replace variable alist by declared variable.
(var-q0, var-q1, var-q2, var-q3, var-q4, var-q5, var-q6)
(var-q7, var-q7, var-q8, var-q9): Declare them.
(calc-kbd-push): Don't check to see if var-q0 through var-q9
are bound.
(calcFunc-typeof): Replace undeclared variable by correct expression.
(math-exp-env): New variable.
(math-define-body, math-define-exp): Replace exp-env by declared
variable.
(math-define-exp): Replace misplaced variable by expression.
2004-11-21 05:52:41 +00:00
|
|
|
(var-q0 var-q0)
|
|
|
|
(var-q1 var-q1)
|
|
|
|
(var-q2 var-q2)
|
|
|
|
(var-q3 var-q3)
|
|
|
|
(var-q4 var-q4)
|
|
|
|
(var-q5 var-q5)
|
|
|
|
(var-q6 var-q6)
|
|
|
|
(var-q7 var-q7)
|
|
|
|
(var-q8 var-q8)
|
|
|
|
(var-q9 var-q9)
|
2001-11-06 18:59:06 +00:00
|
|
|
(calc-internal-prec (if defs 12 calc-internal-prec))
|
|
|
|
(calc-word-size (if defs 32 calc-word-size))
|
|
|
|
(calc-angle-mode (if defs 'deg calc-angle-mode))
|
|
|
|
(calc-simplify-mode (if defs nil calc-simplify-mode))
|
|
|
|
(calc-algebraic-mode (if arg nil calc-algebraic-mode))
|
|
|
|
(calc-incomplete-algebraic-mode (if arg nil
|
|
|
|
calc-incomplete-algebraic-mode))
|
|
|
|
(calc-symbolic-mode (if defs nil calc-symbolic-mode))
|
|
|
|
(calc-matrix-mode (if defs nil calc-matrix-mode))
|
|
|
|
(calc-prefer-frac (if defs nil calc-prefer-frac))
|
|
|
|
(calc-complex-mode (if defs nil calc-complex-mode))
|
|
|
|
(calc-infinite-mode (if defs nil calc-infinite-mode))
|
|
|
|
(count 0)
|
|
|
|
(body "")
|
|
|
|
ch)
|
2001-11-13 07:30:58 +00:00
|
|
|
(if (or executing-kbd-macro defining-kbd-macro)
|
2001-11-06 18:59:06 +00:00
|
|
|
(progn
|
|
|
|
(if defining-kbd-macro
|
|
|
|
(message "Reading body..."))
|
|
|
|
(while (>= count 0)
|
|
|
|
(setq ch (read-char))
|
|
|
|
(if (= ch -1)
|
|
|
|
(error "Unterminated Z` in keyboard macro"))
|
|
|
|
(if (= ch ?Z)
|
|
|
|
(progn
|
|
|
|
(setq ch (read-char)
|
|
|
|
body (concat body "Z" (char-to-string ch)))
|
|
|
|
(cond ((eq ch ?\`)
|
|
|
|
(setq count (1+ count)))
|
|
|
|
((eq ch ?\')
|
|
|
|
(setq count (1- count)))
|
|
|
|
((eq ch 7)
|
|
|
|
(keyboard-quit))))
|
|
|
|
(setq body (concat body (char-to-string ch)))))
|
|
|
|
(if defining-kbd-macro
|
|
|
|
(message "Reading body...done"))
|
|
|
|
(let ((calc-kbd-push-level 0))
|
|
|
|
(execute-kbd-macro (substring body 0 -2))))
|
|
|
|
(let ((calc-kbd-push-level (1+ calc-kbd-push-level)))
|
2021-10-05 17:52:23 +00:00
|
|
|
;; Avoid substituting the "'" character:
|
|
|
|
(message "%s" "Saving modes; type Z' to restore")
|
2001-11-14 09:09:09 +00:00
|
|
|
(recursive-edit))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calc-kbd-pop ()
|
|
|
|
(interactive)
|
|
|
|
(if (> calc-kbd-push-level 0)
|
|
|
|
(progn
|
|
|
|
(message "Mode settings restored")
|
|
|
|
(exit-recursive-edit))
|
2015-08-29 05:24:10 +00:00
|
|
|
(error "%s" "Unbalanced Z' in keyboard macro")))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
2005-05-27 14:25:16 +00:00
|
|
|
(defun calc-kbd-query ()
|
|
|
|
(interactive)
|
|
|
|
(let ((defining-kbd-macro nil)
|
|
|
|
(executing-kbd-macro nil)
|
|
|
|
(msg (calc-top 1)))
|
|
|
|
(if (not (eq (car-safe msg) 'vec))
|
2005-05-27 14:31:10 +00:00
|
|
|
(error "No prompt string provided")
|
2005-05-27 14:25:16 +00:00
|
|
|
(setq msg (math-vector-to-string msg))
|
|
|
|
(calc-wrapper
|
|
|
|
(calc-pop-stack 1)
|
|
|
|
(calc-alg-entry nil (and (not (equal msg "")) msg))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
;;;; Logical operations.
|
|
|
|
|
|
|
|
(defun calcFunc-eq (a b &rest more)
|
|
|
|
(if more
|
|
|
|
(let* ((args (cons a (cons b (copy-sequence more))))
|
|
|
|
(res 1)
|
|
|
|
(p args)
|
|
|
|
p2)
|
|
|
|
(while (and (cdr p) (not (eq res 0)))
|
|
|
|
(setq p2 p)
|
|
|
|
(while (and (setq p2 (cdr p2)) (not (eq res 0)))
|
|
|
|
(setq res (math-two-eq (car p) (car p2)))
|
|
|
|
(if (eq res 1)
|
|
|
|
(setcdr p (delq (car p2) (cdr p)))))
|
|
|
|
(setq p (cdr p)))
|
|
|
|
(if (eq res 0)
|
|
|
|
0
|
|
|
|
(if (cdr args)
|
|
|
|
(cons 'calcFunc-eq args)
|
|
|
|
1)))
|
|
|
|
(or (math-two-eq a b)
|
|
|
|
(if (and (or (math-looks-negp a) (math-zerop a))
|
|
|
|
(or (math-looks-negp b) (math-zerop b)))
|
|
|
|
(list 'calcFunc-eq (math-neg a) (math-neg b))
|
2001-11-14 09:09:09 +00:00
|
|
|
(list 'calcFunc-eq a b)))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calcFunc-neq (a b &rest more)
|
|
|
|
(if more
|
|
|
|
(let* ((args (cons a (cons b more)))
|
|
|
|
(res 0)
|
|
|
|
(all t)
|
|
|
|
(p args)
|
|
|
|
p2)
|
|
|
|
(while (and (cdr p) (not (eq res 1)))
|
|
|
|
(setq p2 p)
|
|
|
|
(while (and (setq p2 (cdr p2)) (not (eq res 1)))
|
|
|
|
(setq res (math-two-eq (car p) (car p2)))
|
|
|
|
(or res (setq all nil)))
|
|
|
|
(setq p (cdr p)))
|
|
|
|
(if (eq res 1)
|
|
|
|
0
|
|
|
|
(if all
|
|
|
|
1
|
|
|
|
(cons 'calcFunc-neq args))))
|
|
|
|
(or (cdr (assq (math-two-eq a b) '((0 . 1) (1 . 0))))
|
|
|
|
(if (and (or (math-looks-negp a) (math-zerop a))
|
|
|
|
(or (math-looks-negp b) (math-zerop b)))
|
|
|
|
(list 'calcFunc-neq (math-neg a) (math-neg b))
|
2001-11-14 09:09:09 +00:00
|
|
|
(list 'calcFunc-neq a b)))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun math-two-eq (a b)
|
|
|
|
(if (eq (car-safe a) 'vec)
|
|
|
|
(if (eq (car-safe b) 'vec)
|
|
|
|
(if (= (length a) (length b))
|
|
|
|
(let ((res 1))
|
|
|
|
(while (and (setq a (cdr a) b (cdr b)) (not (eq res 0)))
|
|
|
|
(if res
|
|
|
|
(setq res (math-two-eq (car a) (car b)))
|
|
|
|
(if (eq (math-two-eq (car a) (car b)) 0)
|
|
|
|
(setq res 0))))
|
|
|
|
res)
|
|
|
|
0)
|
|
|
|
(if (Math-objectp b)
|
|
|
|
0
|
|
|
|
nil))
|
|
|
|
(if (eq (car-safe b) 'vec)
|
|
|
|
(if (Math-objectp a)
|
|
|
|
0
|
|
|
|
nil)
|
|
|
|
(let ((res (math-compare a b)))
|
|
|
|
(if (= res 0)
|
|
|
|
1
|
|
|
|
(if (and (= res 2) (not (and (Math-scalarp a) (Math-scalarp b))))
|
|
|
|
nil
|
2001-11-14 09:09:09 +00:00
|
|
|
0))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calcFunc-lt (a b)
|
|
|
|
(let ((res (math-compare a b)))
|
|
|
|
(if (= res -1)
|
|
|
|
1
|
|
|
|
(if (= res 2)
|
|
|
|
(if (and (or (math-looks-negp a) (math-zerop a))
|
|
|
|
(or (math-looks-negp b) (math-zerop b)))
|
|
|
|
(list 'calcFunc-gt (math-neg a) (math-neg b))
|
|
|
|
(list 'calcFunc-lt a b))
|
2001-11-14 09:09:09 +00:00
|
|
|
0))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calcFunc-gt (a b)
|
|
|
|
(let ((res (math-compare a b)))
|
|
|
|
(if (= res 1)
|
|
|
|
1
|
|
|
|
(if (= res 2)
|
|
|
|
(if (and (or (math-looks-negp a) (math-zerop a))
|
|
|
|
(or (math-looks-negp b) (math-zerop b)))
|
|
|
|
(list 'calcFunc-lt (math-neg a) (math-neg b))
|
|
|
|
(list 'calcFunc-gt a b))
|
2001-11-14 09:09:09 +00:00
|
|
|
0))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calcFunc-leq (a b)
|
|
|
|
(let ((res (math-compare a b)))
|
|
|
|
(if (= res 1)
|
|
|
|
0
|
|
|
|
(if (= res 2)
|
|
|
|
(if (and (or (math-looks-negp a) (math-zerop a))
|
|
|
|
(or (math-looks-negp b) (math-zerop b)))
|
|
|
|
(list 'calcFunc-geq (math-neg a) (math-neg b))
|
|
|
|
(list 'calcFunc-leq a b))
|
2001-11-14 09:09:09 +00:00
|
|
|
1))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calcFunc-geq (a b)
|
|
|
|
(let ((res (math-compare a b)))
|
|
|
|
(if (= res -1)
|
|
|
|
0
|
|
|
|
(if (= res 2)
|
|
|
|
(if (and (or (math-looks-negp a) (math-zerop a))
|
|
|
|
(or (math-looks-negp b) (math-zerop b)))
|
|
|
|
(list 'calcFunc-leq (math-neg a) (math-neg b))
|
|
|
|
(list 'calcFunc-geq a b))
|
2001-11-14 09:09:09 +00:00
|
|
|
1))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calcFunc-rmeq (a)
|
|
|
|
(if (math-vectorp a)
|
|
|
|
(math-map-vec 'calcFunc-rmeq a)
|
|
|
|
(if (assq (car-safe a) calc-tweak-eqn-table)
|
|
|
|
(if (and (eq (car-safe (nth 2 a)) 'var)
|
|
|
|
(math-objectp (nth 1 a)))
|
|
|
|
(nth 1 a)
|
|
|
|
(nth 2 a))
|
|
|
|
(if (eq (car-safe a) 'calcFunc-assign)
|
|
|
|
(nth 2 a)
|
|
|
|
(if (eq (car-safe a) 'calcFunc-evalto)
|
|
|
|
(nth 1 a)
|
2001-11-14 09:09:09 +00:00
|
|
|
(list 'calcFunc-rmeq a))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calcFunc-land (a b)
|
|
|
|
(cond ((Math-zerop a)
|
|
|
|
a)
|
|
|
|
((Math-zerop b)
|
|
|
|
b)
|
|
|
|
((math-is-true a)
|
|
|
|
b)
|
|
|
|
((math-is-true b)
|
|
|
|
a)
|
2001-11-14 09:09:09 +00:00
|
|
|
(t (list 'calcFunc-land a b))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calcFunc-lor (a b)
|
|
|
|
(cond ((Math-zerop a)
|
|
|
|
b)
|
|
|
|
((Math-zerop b)
|
|
|
|
a)
|
|
|
|
((math-is-true a)
|
|
|
|
a)
|
|
|
|
((math-is-true b)
|
|
|
|
b)
|
2001-11-14 09:09:09 +00:00
|
|
|
(t (list 'calcFunc-lor a b))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calcFunc-lnot (a)
|
|
|
|
(if (Math-zerop a)
|
|
|
|
1
|
|
|
|
(if (math-is-true a)
|
|
|
|
0
|
|
|
|
(let ((op (and (= (length a) 3)
|
|
|
|
(assq (car a) calc-tweak-eqn-table))))
|
|
|
|
(if op
|
|
|
|
(cons (nth 2 op) (cdr a))
|
2001-11-14 09:09:09 +00:00
|
|
|
(list 'calcFunc-lnot a))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calcFunc-if (c e1 e2)
|
|
|
|
(if (Math-zerop c)
|
|
|
|
e2
|
|
|
|
(if (and (math-is-true c) (not (Math-vectorp c)))
|
|
|
|
e1
|
|
|
|
(or (and (Math-vectorp c)
|
|
|
|
(math-constp c)
|
|
|
|
(let ((ee1 (if (Math-vectorp e1)
|
|
|
|
(if (= (length c) (length e1))
|
|
|
|
(cdr e1)
|
|
|
|
(calc-record-why "*Dimension error" e1))
|
|
|
|
(list e1)))
|
|
|
|
(ee2 (if (Math-vectorp e2)
|
|
|
|
(if (= (length c) (length e2))
|
|
|
|
(cdr e2)
|
|
|
|
(calc-record-why "*Dimension error" e2))
|
|
|
|
(list e2))))
|
|
|
|
(and ee1 ee2
|
|
|
|
(cons 'vec (math-if-vector (cdr c) ee1 ee2)))))
|
2001-11-14 09:09:09 +00:00
|
|
|
(list 'calcFunc-if c e1 e2)))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun math-if-vector (c e1 e2)
|
|
|
|
(and c
|
|
|
|
(cons (if (Math-zerop (car c)) (car e2) (car e1))
|
|
|
|
(math-if-vector (cdr c)
|
|
|
|
(or (cdr e1) e1)
|
2001-11-14 09:09:09 +00:00
|
|
|
(or (cdr e2) e2)))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun math-normalize-logical-op (a)
|
|
|
|
(or (and (eq (car a) 'calcFunc-if)
|
|
|
|
(= (length a) 4)
|
|
|
|
(let ((a1 (math-normalize (nth 1 a))))
|
|
|
|
(if (Math-zerop a1)
|
|
|
|
(math-normalize (nth 3 a))
|
|
|
|
(if (Math-numberp a1)
|
|
|
|
(math-normalize (nth 2 a))
|
|
|
|
(if (and (Math-vectorp (nth 1 a))
|
|
|
|
(math-constp (nth 1 a)))
|
|
|
|
(calcFunc-if (nth 1 a)
|
|
|
|
(math-normalize (nth 2 a))
|
|
|
|
(math-normalize (nth 3 a)))
|
|
|
|
(let ((calc-simplify-mode 'none))
|
|
|
|
(list 'calcFunc-if a1
|
|
|
|
(math-normalize (nth 2 a))
|
|
|
|
(math-normalize (nth 3 a)))))))))
|
2001-11-14 09:09:09 +00:00
|
|
|
a))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calcFunc-in (a b)
|
|
|
|
(or (and (eq (car-safe b) 'vec)
|
|
|
|
(let ((bb b))
|
|
|
|
(while (and (setq bb (cdr bb))
|
|
|
|
(not (if (memq (car-safe (car bb)) '(vec intv))
|
|
|
|
(eq (calcFunc-in a (car bb)) 1)
|
|
|
|
(Math-equal a (car bb))))))
|
|
|
|
(if bb 1 (and (math-constp a) (math-constp bb) 0))))
|
|
|
|
(and (eq (car-safe b) 'intv)
|
|
|
|
(let ((res (math-compare a (nth 2 b))) res2)
|
|
|
|
(cond ((= res -1)
|
|
|
|
0)
|
|
|
|
((and (= res 0)
|
|
|
|
(or (/= (nth 1 b) 2)
|
|
|
|
(Math-lessp (nth 2 b) (nth 3 b))))
|
|
|
|
(if (memq (nth 1 b) '(2 3)) 1 0))
|
|
|
|
((= (setq res2 (math-compare a (nth 3 b))) 1)
|
|
|
|
0)
|
|
|
|
((and (= res2 0)
|
|
|
|
(or (/= (nth 1 b) 1)
|
|
|
|
(Math-lessp (nth 2 b) (nth 3 b))))
|
|
|
|
(if (memq (nth 1 b) '(1 3)) 1 0))
|
|
|
|
((/= res 1)
|
|
|
|
nil)
|
|
|
|
((/= res2 -1)
|
|
|
|
nil)
|
|
|
|
(t 1))))
|
|
|
|
(and (Math-equal a b)
|
|
|
|
1)
|
|
|
|
(and (math-constp a) (math-constp b)
|
|
|
|
0)
|
2001-11-14 09:09:09 +00:00
|
|
|
(list 'calcFunc-in a b)))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calcFunc-typeof (a)
|
|
|
|
(cond ((Math-integerp a) 1)
|
|
|
|
((eq (car a) 'frac) 2)
|
|
|
|
((eq (car a) 'float) 3)
|
|
|
|
((eq (car a) 'hms) 4)
|
|
|
|
((eq (car a) 'cplx) 5)
|
|
|
|
((eq (car a) 'polar) 6)
|
|
|
|
((eq (car a) 'sdev) 7)
|
|
|
|
((eq (car a) 'intv) 8)
|
|
|
|
((eq (car a) 'mod) 9)
|
|
|
|
((eq (car a) 'date) (if (Math-integerp (nth 1 a)) 10 11))
|
|
|
|
((eq (car a) 'var)
|
|
|
|
(if (memq (nth 2 a) '(var-inf var-uinf var-nan)) 12 100))
|
|
|
|
((eq (car a) 'vec) (if (math-matrixp a) 102 101))
|
(math-integral-cache-state, calc-lang)
(calc-original-buffer): Declare them.
(calc-user-formula-alist): New variable.
(calc-user-define-formula, calc-fix-user-formula)
(calc-user-define-composition, calc-finish-formula-edit):
Replace variable alist by declared variable.
(var-q0, var-q1, var-q2, var-q3, var-q4, var-q5, var-q6)
(var-q7, var-q7, var-q8, var-q9): Declare them.
(calc-kbd-push): Don't check to see if var-q0 through var-q9
are bound.
(calcFunc-typeof): Replace undeclared variable by correct expression.
(math-exp-env): New variable.
(math-define-body, math-define-exp): Replace exp-env by declared
variable.
(math-define-exp): Replace misplaced variable by expression.
2004-11-21 05:52:41 +00:00
|
|
|
(t (math-calcFunc-to-var (car a)))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calcFunc-integer (a)
|
|
|
|
(if (Math-integerp a)
|
|
|
|
1
|
|
|
|
(if (Math-objvecp a)
|
|
|
|
0
|
2001-11-14 09:09:09 +00:00
|
|
|
(list 'calcFunc-integer a))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calcFunc-real (a)
|
|
|
|
(if (Math-realp a)
|
|
|
|
1
|
|
|
|
(if (Math-objvecp a)
|
|
|
|
0
|
2001-11-14 09:09:09 +00:00
|
|
|
(list 'calcFunc-real a))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calcFunc-constant (a)
|
|
|
|
(if (math-constp a)
|
|
|
|
1
|
|
|
|
(if (Math-objvecp a)
|
|
|
|
0
|
2001-11-14 09:09:09 +00:00
|
|
|
(list 'calcFunc-constant a))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calcFunc-refers (a b)
|
|
|
|
(if (math-expr-contains a b)
|
|
|
|
1
|
|
|
|
(if (eq (car-safe a) 'var)
|
|
|
|
(list 'calcFunc-refers a b)
|
2001-11-14 09:09:09 +00:00
|
|
|
0)))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calcFunc-negative (a)
|
|
|
|
(if (math-looks-negp a)
|
|
|
|
1
|
|
|
|
(if (or (math-zerop a)
|
|
|
|
(math-posp a))
|
|
|
|
0
|
2001-11-14 09:09:09 +00:00
|
|
|
(list 'calcFunc-negative a))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calcFunc-variable (a)
|
|
|
|
(if (eq (car-safe a) 'var)
|
|
|
|
1
|
|
|
|
(if (Math-objvecp a)
|
|
|
|
0
|
2001-11-14 09:09:09 +00:00
|
|
|
(list 'calcFunc-variable a))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calcFunc-nonvar (a)
|
|
|
|
(if (eq (car-safe a) 'var)
|
|
|
|
(list 'calcFunc-nonvar a)
|
2001-11-14 09:09:09 +00:00
|
|
|
1))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun calcFunc-istrue (a)
|
|
|
|
(if (math-is-true a)
|
|
|
|
1
|
2001-11-14 09:09:09 +00:00
|
|
|
0))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;; User-programmability.
|
|
|
|
|
|
|
|
;;; Compiling Lisp-like forms to use the math library.
|
|
|
|
|
|
|
|
(defun math-do-defmath (func args body)
|
2004-11-29 05:58:45 +00:00
|
|
|
(require 'calc-macs)
|
2001-11-06 18:59:06 +00:00
|
|
|
(let* ((fname (intern (concat "calcFunc-" (symbol-name func))))
|
2012-08-07 16:12:20 +00:00
|
|
|
(doc (if (stringp (car body))
|
|
|
|
(prog1 (list (car body))
|
|
|
|
(setq body (cdr body)))))
|
2001-11-06 18:59:06 +00:00
|
|
|
(clargs (mapcar 'math-clean-arg args))
|
2012-08-07 16:12:20 +00:00
|
|
|
(inter (if (and (consp (car body))
|
|
|
|
(eq (car (car body)) 'interactive))
|
|
|
|
(prog1 (car body)
|
|
|
|
(setq body (cdr body))))))
|
|
|
|
(setq body (math-define-function-body body clargs))
|
|
|
|
`(progn
|
|
|
|
,(if inter
|
|
|
|
(if (or (> (length inter) 2)
|
|
|
|
(integerp (nth 1 inter)))
|
|
|
|
(let ((hasprefix nil) (hasmulti nil))
|
|
|
|
(when (stringp (nth 1 inter))
|
|
|
|
(cond ((equal (nth 1 inter) "p")
|
|
|
|
(setq hasprefix t))
|
|
|
|
((equal (nth 1 inter) "m")
|
|
|
|
(setq hasmulti t))
|
|
|
|
(t (error
|
|
|
|
"Can't handle interactive code string \"%s\""
|
|
|
|
(nth 1 inter))))
|
|
|
|
(setq inter (cdr inter)))
|
|
|
|
(unless (integerp (nth 1 inter))
|
|
|
|
(error "Expected an integer in interactive specification"))
|
|
|
|
`(defun ,(intern (concat "calc-" (symbol-name func)))
|
|
|
|
,(if (or hasprefix hasmulti) '(&optional n) ())
|
|
|
|
,@doc
|
|
|
|
(interactive ,@(if (or hasprefix hasmulti) '("P")))
|
|
|
|
(calc-slow-wrapper
|
|
|
|
,@(if hasmulti
|
|
|
|
`((setq n (if n
|
|
|
|
(prefix-numeric-value n)
|
|
|
|
,(nth 1 inter)))))
|
|
|
|
(calc-enter-result
|
|
|
|
,(if hasmulti 'n (nth 1 inter))
|
|
|
|
,(nth 2 inter)
|
|
|
|
,(if hasprefix
|
|
|
|
`(append '(,fname)
|
|
|
|
(calc-top-list-n ,(nth 1 inter))
|
|
|
|
(and n
|
|
|
|
(list
|
|
|
|
(math-normalize
|
|
|
|
(prefix-numeric-value n)))))
|
|
|
|
`(cons ',fname
|
|
|
|
(calc-top-list-n
|
|
|
|
,(if hasmulti
|
|
|
|
'n
|
|
|
|
(nth 1 inter)))))))))
|
|
|
|
`(defun ,(intern (concat "calc-" (symbol-name func))) ,clargs
|
|
|
|
,@doc
|
|
|
|
,inter
|
|
|
|
(calc-wrapper ,@body))))
|
|
|
|
(defun ,fname ,clargs
|
|
|
|
,@doc
|
|
|
|
,@(math-do-arg-list-check args nil nil)
|
|
|
|
,@body))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun math-clean-arg (arg)
|
|
|
|
(if (consp arg)
|
|
|
|
(math-clean-arg (nth 1 arg))
|
2001-11-14 09:09:09 +00:00
|
|
|
arg))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun math-do-arg-check (arg var is-opt is-rest)
|
|
|
|
(if is-opt
|
|
|
|
(let ((chk (math-do-arg-check arg var nil nil)))
|
|
|
|
(list (cons 'and
|
|
|
|
(cons var
|
|
|
|
(if (cdr chk)
|
2012-08-07 16:12:20 +00:00
|
|
|
`((progn ,@chk))
|
2001-11-06 18:59:06 +00:00
|
|
|
chk)))))
|
2012-08-07 16:12:20 +00:00
|
|
|
(when (consp arg)
|
|
|
|
(let* ((rest (math-do-arg-check (nth 1 arg) var is-opt is-rest))
|
|
|
|
(qual (car arg))
|
|
|
|
(qual-name (symbol-name qual))
|
|
|
|
(chk (intern (concat "math-check-" qual-name))))
|
|
|
|
(if (fboundp chk)
|
|
|
|
(append rest
|
|
|
|
(if is-rest
|
|
|
|
`((setq ,var (mapcar ',chk ,var)))
|
|
|
|
`((setq ,var (,chk ,var)))))
|
|
|
|
(if (fboundp (setq chk (intern (concat "math-" qual-name))))
|
|
|
|
(append rest
|
|
|
|
(if is-rest
|
2021-04-05 15:28:05 +00:00
|
|
|
`((mapcar (lambda (x)
|
|
|
|
(or (,chk x)
|
|
|
|
(math-reject-arg x ',qual)))
|
2012-08-07 16:12:20 +00:00
|
|
|
,var))
|
|
|
|
`((or (,chk ,var)
|
|
|
|
(math-reject-arg ,var ',qual)))))
|
|
|
|
(if (and (string-match "\\`not-\\(.*\\)\\'" qual-name)
|
|
|
|
(fboundp (setq chk (intern
|
|
|
|
(concat "math-"
|
|
|
|
(math-match-substring
|
|
|
|
qual-name 1))))))
|
|
|
|
(append rest
|
2001-11-06 18:59:06 +00:00
|
|
|
(if is-rest
|
2021-04-05 15:28:05 +00:00
|
|
|
`((mapcar (lambda (x)
|
|
|
|
(and (,chk x)
|
|
|
|
(math-reject-arg x ',qual)))
|
2012-08-07 16:12:20 +00:00
|
|
|
,var))
|
|
|
|
`((and
|
|
|
|
(,chk ,var)
|
|
|
|
(math-reject-arg ,var ',qual)))))
|
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
|
|
|
(error "Unknown qualifier `%s'" qual-name))))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun math-do-arg-list-check (args is-opt is-rest)
|
|
|
|
(cond ((null args) nil)
|
|
|
|
((consp (car args))
|
|
|
|
(append (math-do-arg-check (car args)
|
|
|
|
(math-clean-arg (car args))
|
|
|
|
is-opt is-rest)
|
|
|
|
(math-do-arg-list-check (cdr args) is-opt is-rest)))
|
|
|
|
((eq (car args) '&optional)
|
|
|
|
(math-do-arg-list-check (cdr args) t nil))
|
|
|
|
((eq (car args) '&rest)
|
|
|
|
(math-do-arg-list-check (cdr args) nil t))
|
2001-11-14 09:09:09 +00:00
|
|
|
(t (math-do-arg-list-check (cdr args) is-opt is-rest))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defconst math-prim-funcs
|
|
|
|
'( (~= . math-nearly-equal)
|
|
|
|
(% . math-mod)
|
|
|
|
(lsh . calcFunc-lsh)
|
|
|
|
(ash . calcFunc-ash)
|
|
|
|
(logand . calcFunc-and)
|
|
|
|
(logandc2 . calcFunc-diff)
|
|
|
|
(logior . calcFunc-or)
|
|
|
|
(logxor . calcFunc-xor)
|
|
|
|
(lognot . calcFunc-not)
|
|
|
|
(equal . equal) ; need to leave these ones alone!
|
|
|
|
(eq . eq)
|
|
|
|
(and . and)
|
|
|
|
(or . or)
|
|
|
|
(if . if)
|
|
|
|
(^ . math-pow)
|
|
|
|
(expt . math-pow)
|
2001-11-14 09:09:09 +00:00
|
|
|
))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defconst math-prim-vars
|
|
|
|
'( (nil . nil)
|
|
|
|
(t . t)
|
|
|
|
(&optional . &optional)
|
|
|
|
(&rest . &rest)
|
2001-11-14 09:09:09 +00:00
|
|
|
))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun math-define-function-body (body env)
|
|
|
|
(let ((body (math-define-body body env)))
|
|
|
|
(if (math-body-refers-to body 'math-return)
|
2012-08-07 16:12:20 +00:00
|
|
|
`((catch 'math-return ,@body))
|
2001-11-14 09:09:09 +00:00
|
|
|
body)))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
(math-integral-cache-state, calc-lang)
(calc-original-buffer): Declare them.
(calc-user-formula-alist): New variable.
(calc-user-define-formula, calc-fix-user-formula)
(calc-user-define-composition, calc-finish-formula-edit):
Replace variable alist by declared variable.
(var-q0, var-q1, var-q2, var-q3, var-q4, var-q5, var-q6)
(var-q7, var-q7, var-q8, var-q9): Declare them.
(calc-kbd-push): Don't check to see if var-q0 through var-q9
are bound.
(calcFunc-typeof): Replace undeclared variable by correct expression.
(math-exp-env): New variable.
(math-define-body, math-define-exp): Replace exp-env by declared
variable.
(math-define-exp): Replace misplaced variable by expression.
2004-11-21 05:52:41 +00:00
|
|
|
;; The variable math-exp-env is local to math-define-body, but is
|
|
|
|
;; used by math-define-exp, which is called (indirectly) by
|
2022-07-02 10:01:18 +00:00
|
|
|
;; math-define-body.
|
(math-integral-cache-state, calc-lang)
(calc-original-buffer): Declare them.
(calc-user-formula-alist): New variable.
(calc-user-define-formula, calc-fix-user-formula)
(calc-user-define-composition, calc-finish-formula-edit):
Replace variable alist by declared variable.
(var-q0, var-q1, var-q2, var-q3, var-q4, var-q5, var-q6)
(var-q7, var-q7, var-q8, var-q9): Declare them.
(calc-kbd-push): Don't check to see if var-q0 through var-q9
are bound.
(calcFunc-typeof): Replace undeclared variable by correct expression.
(math-exp-env): New variable.
(math-define-body, math-define-exp): Replace exp-env by declared
variable.
(math-define-exp): Replace misplaced variable by expression.
2004-11-21 05:52:41 +00:00
|
|
|
(defvar math-exp-env)
|
|
|
|
|
2020-10-10 20:00:51 +00:00
|
|
|
(defun math-define-body (body exp-env)
|
|
|
|
(let ((math-exp-env exp-env))
|
|
|
|
(math-define-list body)))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun math-define-list (body &optional quote)
|
|
|
|
(cond ((null body)
|
|
|
|
nil)
|
|
|
|
((and (eq (car body) ':)
|
|
|
|
(stringp (nth 1 body)))
|
|
|
|
(cons (let* ((math-read-expr-quotes t)
|
|
|
|
(exp (math-read-plain-expr (nth 1 body) t)))
|
|
|
|
(math-define-exp exp))
|
|
|
|
(math-define-list (cdr (cdr body)))))
|
|
|
|
(quote
|
|
|
|
(cons (cond ((consp (car body))
|
|
|
|
(math-define-list (cdr body) t))
|
|
|
|
(t
|
|
|
|
(car body)))
|
|
|
|
(math-define-list (cdr body))))
|
|
|
|
(t
|
|
|
|
(cons (math-define-exp (car body))
|
2001-11-14 09:09:09 +00:00
|
|
|
(math-define-list (cdr body))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun math-define-exp (exp)
|
|
|
|
(cond ((consp exp)
|
|
|
|
(let ((func (car exp)))
|
|
|
|
(cond ((memq func '(quote function))
|
|
|
|
(if (and (consp (nth 1 exp))
|
|
|
|
(eq (car (nth 1 exp)) 'lambda))
|
|
|
|
(cons 'quote
|
(math-integral-cache-state, calc-lang)
(calc-original-buffer): Declare them.
(calc-user-formula-alist): New variable.
(calc-user-define-formula, calc-fix-user-formula)
(calc-user-define-composition, calc-finish-formula-edit):
Replace variable alist by declared variable.
(var-q0, var-q1, var-q2, var-q3, var-q4, var-q5, var-q6)
(var-q7, var-q7, var-q8, var-q9): Declare them.
(calc-kbd-push): Don't check to see if var-q0 through var-q9
are bound.
(calcFunc-typeof): Replace undeclared variable by correct expression.
(math-exp-env): New variable.
(math-define-body, math-define-exp): Replace exp-env by declared
variable.
(math-define-exp): Replace misplaced variable by expression.
2004-11-21 05:52:41 +00:00
|
|
|
(math-define-lambda (nth 1 exp) math-exp-env))
|
2001-11-06 18:59:06 +00:00
|
|
|
exp))
|
Fix multiple Calc defmath errors (bug#46750)
Fix incorrect variable scoping in `let*`, `for` and `foreach`.
Fix loop variable value in `foreach` (should be element, not tail).
Fix function quoting, as in ('cons x y) -- didn't work at all.
Reported by Stephan Neuhaus.
* lisp/calc/calc-prog.el (math-define-exp, math-handle-foreach):
* test/lisp/calc/calc-tests.el: (var-g, test1, test2, test3, test4)
(test5, test6, test7, calc-defmath): Test various defmath forms.
2021-03-01 19:52:39 +00:00
|
|
|
((eq func 'let)
|
|
|
|
(let ((bindings (nth 1 exp))
|
|
|
|
(body (cddr exp)))
|
|
|
|
`(let ,(math-define-let bindings)
|
|
|
|
,@(math-define-body
|
|
|
|
body (append (math-define-let-env bindings)
|
|
|
|
math-exp-env)))))
|
|
|
|
((eq func 'let*)
|
|
|
|
;; Rewrite in terms of `let'.
|
|
|
|
(let ((bindings (nth 1 exp))
|
|
|
|
(body (cddr exp)))
|
|
|
|
(math-define-exp
|
|
|
|
(if (> (length bindings) 1)
|
|
|
|
`(let ,(list (car bindings))
|
|
|
|
(let* ,(cdr bindings) ,@body))
|
|
|
|
`(let ,bindings ,@body)))))
|
|
|
|
((memq func '(for foreach))
|
|
|
|
(let ((bindings (nth 1 exp))
|
|
|
|
(body (cddr exp)))
|
|
|
|
(if (> (length bindings) 1)
|
|
|
|
;; Rewrite as nested loops.
|
|
|
|
(math-define-exp
|
|
|
|
`(,func ,(list (car bindings))
|
|
|
|
(,func ,(cdr bindings) ,@body)))
|
|
|
|
(let ((mac (cdr (assq func '((for . math-for)
|
|
|
|
(foreach . math-foreach))))))
|
|
|
|
(macroexpand
|
|
|
|
`(,mac ,(math-define-let bindings)
|
|
|
|
,@(math-define-body
|
|
|
|
body (append (math-define-let-env bindings)
|
|
|
|
math-exp-env))))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
((and (memq func '(setq setf))
|
|
|
|
(math-complicated-lhs (cdr exp)))
|
|
|
|
(if (> (length exp) 3)
|
|
|
|
(cons 'progn (math-define-setf-list (cdr exp)))
|
|
|
|
(math-define-setf (nth 1 exp) (nth 2 exp))))
|
|
|
|
((eq func 'condition-case)
|
|
|
|
(cons func
|
|
|
|
(cons (nth 1 exp)
|
|
|
|
(math-define-body (cdr (cdr exp))
|
|
|
|
(cons (nth 1 exp)
|
(math-integral-cache-state, calc-lang)
(calc-original-buffer): Declare them.
(calc-user-formula-alist): New variable.
(calc-user-define-formula, calc-fix-user-formula)
(calc-user-define-composition, calc-finish-formula-edit):
Replace variable alist by declared variable.
(var-q0, var-q1, var-q2, var-q3, var-q4, var-q5, var-q6)
(var-q7, var-q7, var-q8, var-q9): Declare them.
(calc-kbd-push): Don't check to see if var-q0 through var-q9
are bound.
(calcFunc-typeof): Replace undeclared variable by correct expression.
(math-exp-env): New variable.
(math-define-body, math-define-exp): Replace exp-env by declared
variable.
(math-define-exp): Replace misplaced variable by expression.
2004-11-21 05:52:41 +00:00
|
|
|
math-exp-env)))))
|
2001-11-06 18:59:06 +00:00
|
|
|
((eq func 'cond)
|
|
|
|
(cons func
|
|
|
|
(math-define-cond (cdr exp))))
|
|
|
|
((and (consp func) ; ('spam a b) == force use of plain spam
|
|
|
|
(eq (car func) 'quote))
|
Fix multiple Calc defmath errors (bug#46750)
Fix incorrect variable scoping in `let*`, `for` and `foreach`.
Fix loop variable value in `foreach` (should be element, not tail).
Fix function quoting, as in ('cons x y) -- didn't work at all.
Reported by Stephan Neuhaus.
* lisp/calc/calc-prog.el (math-define-exp, math-handle-foreach):
* test/lisp/calc/calc-tests.el: (var-g, test1, test2, test3, test4)
(test5, test6, test7, calc-defmath): Test various defmath forms.
2021-03-01 19:52:39 +00:00
|
|
|
(cons (cadr func) (math-define-list (cdr exp))))
|
2001-11-06 18:59:06 +00:00
|
|
|
((symbolp func)
|
|
|
|
(let ((args (math-define-list (cdr exp)))
|
|
|
|
(prim (assq func math-prim-funcs)))
|
|
|
|
(cond (prim
|
|
|
|
(cons (cdr prim) args))
|
|
|
|
((eq func 'floatp)
|
|
|
|
(list 'eq (car args) '(quote float)))
|
|
|
|
((eq func '+)
|
|
|
|
(math-define-binop 'math-add 0
|
|
|
|
(car args) (cdr args)))
|
|
|
|
((eq func '-)
|
|
|
|
(if (= (length args) 1)
|
|
|
|
(cons 'math-neg args)
|
|
|
|
(math-define-binop 'math-sub 0
|
|
|
|
(car args) (cdr args))))
|
|
|
|
((eq func '*)
|
|
|
|
(math-define-binop 'math-mul 1
|
|
|
|
(car args) (cdr args)))
|
|
|
|
((eq func '/)
|
|
|
|
(math-define-binop 'math-div 1
|
|
|
|
(car args) (cdr args)))
|
|
|
|
((eq func 'min)
|
|
|
|
(math-define-binop 'math-min 0
|
|
|
|
(car args) (cdr args)))
|
|
|
|
((eq func 'max)
|
|
|
|
(math-define-binop 'math-max 0
|
|
|
|
(car args) (cdr args)))
|
|
|
|
((eq func '<)
|
|
|
|
(if (and (math-numberp (nth 1 args))
|
|
|
|
(math-zerop (nth 1 args)))
|
|
|
|
(list 'math-negp (car args))
|
|
|
|
(cons 'math-lessp args)))
|
|
|
|
((eq func '>)
|
|
|
|
(if (and (math-numberp (nth 1 args))
|
|
|
|
(math-zerop (nth 1 args)))
|
|
|
|
(list 'math-posp (car args))
|
|
|
|
(list 'math-lessp (nth 1 args) (nth 0 args))))
|
|
|
|
((eq func '<=)
|
|
|
|
(list 'not
|
|
|
|
(if (and (math-numberp (nth 1 args))
|
|
|
|
(math-zerop (nth 1 args)))
|
|
|
|
(list 'math-posp (car args))
|
|
|
|
(list 'math-lessp
|
|
|
|
(nth 1 args) (nth 0 args)))))
|
|
|
|
((eq func '>=)
|
|
|
|
(list 'not
|
|
|
|
(if (and (math-numberp (nth 1 args))
|
|
|
|
(math-zerop (nth 1 args)))
|
|
|
|
(list 'math-negp (car args))
|
|
|
|
(cons 'math-lessp args))))
|
|
|
|
((eq func '=)
|
|
|
|
(if (and (math-numberp (nth 1 args))
|
|
|
|
(math-zerop (nth 1 args)))
|
|
|
|
(list 'math-zerop (nth 0 args))
|
|
|
|
(if (and (integerp (nth 1 args))
|
|
|
|
(/= (% (nth 1 args) 10) 0))
|
|
|
|
(cons 'math-equal-int args)
|
|
|
|
(cons 'math-equal args))))
|
|
|
|
((eq func '/=)
|
|
|
|
(list 'not
|
|
|
|
(if (and (math-numberp (nth 1 args))
|
|
|
|
(math-zerop (nth 1 args)))
|
|
|
|
(list 'math-zerop (nth 0 args))
|
|
|
|
(if (and (integerp (nth 1 args))
|
|
|
|
(/= (% (nth 1 args) 10) 0))
|
|
|
|
(cons 'math-equal-int args)
|
|
|
|
(cons 'math-equal args)))))
|
|
|
|
((eq func '1+)
|
|
|
|
(list 'math-add (car args) 1))
|
|
|
|
((eq func '1-)
|
|
|
|
(list 'math-add (car args) -1))
|
|
|
|
((eq func 'not) ; optimize (not (not x)) => x
|
|
|
|
(if (eq (car-safe args) func)
|
|
|
|
(car (nth 1 args))
|
|
|
|
(cons func args)))
|
|
|
|
((and (eq func 'elt) (cdr (cdr args)))
|
|
|
|
(math-define-elt (car args) (cdr args)))
|
|
|
|
(t
|
|
|
|
(macroexpand
|
|
|
|
(let* ((name (symbol-name func))
|
|
|
|
(cfunc (intern (concat "calcFunc-" name)))
|
|
|
|
(mfunc (intern (concat "math-" name))))
|
|
|
|
(cond ((fboundp cfunc)
|
|
|
|
(cons cfunc args))
|
|
|
|
((fboundp mfunc)
|
|
|
|
(cons mfunc args))
|
|
|
|
((or (fboundp func)
|
|
|
|
(string-match "\\`calcFunc-.*" name))
|
|
|
|
(cons func args))
|
|
|
|
(t
|
|
|
|
(cons cfunc args)))))))))
|
(math-integral-cache-state, calc-lang)
(calc-original-buffer): Declare them.
(calc-user-formula-alist): New variable.
(calc-user-define-formula, calc-fix-user-formula)
(calc-user-define-composition, calc-finish-formula-edit):
Replace variable alist by declared variable.
(var-q0, var-q1, var-q2, var-q3, var-q4, var-q5, var-q6)
(var-q7, var-q7, var-q8, var-q9): Declare them.
(calc-kbd-push): Don't check to see if var-q0 through var-q9
are bound.
(calcFunc-typeof): Replace undeclared variable by correct expression.
(math-exp-env): New variable.
(math-define-body, math-define-exp): Replace exp-env by declared
variable.
(math-define-exp): Replace misplaced variable by expression.
2004-11-21 05:52:41 +00:00
|
|
|
(t (cons func (math-define-list (cdr exp))))))) ;;args
|
2001-11-06 18:59:06 +00:00
|
|
|
((symbolp exp)
|
|
|
|
(let ((prim (assq exp math-prim-vars))
|
|
|
|
(name (symbol-name exp)))
|
|
|
|
(cond (prim
|
|
|
|
(cdr prim))
|
(math-integral-cache-state, calc-lang)
(calc-original-buffer): Declare them.
(calc-user-formula-alist): New variable.
(calc-user-define-formula, calc-fix-user-formula)
(calc-user-define-composition, calc-finish-formula-edit):
Replace variable alist by declared variable.
(var-q0, var-q1, var-q2, var-q3, var-q4, var-q5, var-q6)
(var-q7, var-q7, var-q8, var-q9): Declare them.
(calc-kbd-push): Don't check to see if var-q0 through var-q9
are bound.
(calcFunc-typeof): Replace undeclared variable by correct expression.
(math-exp-env): New variable.
(math-define-body, math-define-exp): Replace exp-env by declared
variable.
(math-define-exp): Replace misplaced variable by expression.
2004-11-21 05:52:41 +00:00
|
|
|
((memq exp math-exp-env)
|
2001-11-06 18:59:06 +00:00
|
|
|
exp)
|
Use string-search instead of string-match[-p]
`string-search` is easier to understand, less error-prone, much
faster, does not pollute the regexp cache, and does not mutate global
state. Use it where applicable and obviously safe (erring on the
conservative side).
* admin/authors.el (authors-canonical-file-name)
(authors-scan-change-log):
* lisp/apropos.el (apropos-command)
(apropos-documentation-property, apropos-symbols-internal):
* lisp/arc-mode.el (archive-arc-summarize)
(archive-zoo-summarize):
* lisp/calc/calc-aent.el (math-read-factor):
* lisp/calc/calc-ext.el (math-read-big-expr)
(math-format-nice-expr, math-format-number-fancy):
* lisp/calc/calc-forms.el (math-read-angle-brackets):
* lisp/calc/calc-graph.el (calc-graph-set-range):
* lisp/calc/calc-keypd.el (calc-keypad-press):
* lisp/calc/calc-lang.el (tex, latex, math-read-big-rec):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-user-define-permanent, math-define-exp):
* lisp/calc/calc.el (calc-record, calcDigit-key)
(calc-count-lines):
* lisp/calc/calcalg2.el (calc-solve-for, calc-poly-roots)
(math-do-integral):
* lisp/calc/calcalg3.el (calc-find-root, calc-find-minimum)
(calc-get-fit-variables):
* lisp/cedet/ede/speedbar.el (ede-tag-expand):
* lisp/cedet/semantic/java.el (semantic-java-expand-tag):
* lisp/cedet/semantic/sb.el (semantic-sb-show-extra)
(semantic-sb-expand-group):
* lisp/cedet/semantic/wisent/python.el
(semantic-python-instance-variable-p):
* lisp/cus-edit.el (get):
* lisp/descr-text.el (describe-text-sexp):
* lisp/dired-aux.el (dired-compress-file):
* lisp/dired-x.el (dired-make-relative-symlink):
* lisp/dired.el (dired-glob-regexp):
* lisp/dos-fns.el (dos-convert-standard-filename, dos-8+3-filename):
* lisp/edmacro.el (edmacro-format-keys):
* lisp/emacs-lisp/eieio-opt.el (eieio-sb-expand):
* lisp/emacs-lisp/eieio-speedbar.el (eieio-speedbar-object-expand):
* lisp/emacs-lisp/lisp-mnt.el (lm-keywords-list):
* lisp/emacs-lisp/warnings.el (display-warning):
* lisp/emulation/viper-ex.el (viper-ex-read-file-name)
(ex-print-display-lines):
* lisp/env.el (read-envvar-name, setenv):
* lisp/epa-mail.el (epa-mail-encrypt):
* lisp/epg.el (epg--start):
* lisp/erc/erc-backend.el (erc-parse-server-response):
* lisp/erc/erc-dcc.el (erc-dcc-member):
* lisp/erc/erc-speedbar.el (erc-speedbar-expand-server)
(erc-speedbar-expand-channel, erc-speedbar-expand-user):
* lisp/erc/erc.el (erc-send-input):
* lisp/eshell/em-glob.el (eshell-glob-entries):
* lisp/eshell/esh-proc.el (eshell-needs-pipe-p):
* lisp/eshell/esh-util.el (eshell-convert):
* lisp/eshell/esh-var.el (eshell-envvar-names):
* lisp/faces.el (x-resolve-font-name):
* lisp/ffap.el (ffap-file-at-point):
* lisp/files.el (wildcard-to-regexp, shell-quote-wildcard-pattern):
* lisp/forms.el (forms--update):
* lisp/frameset.el (frameset-filter-unshelve-param):
* lisp/gnus/gnus-art.el (article-decode-charset):
* lisp/gnus/gnus-kill.el (gnus-kill-parse-rn-kill-file):
* lisp/gnus/gnus-mlspl.el (gnus-group-split-fancy):
* lisp/gnus/gnus-msg.el (gnus-summary-resend-message-insert-gcc)
(gnus-inews-insert-gcc):
* lisp/gnus/gnus-rfc1843.el (rfc1843-decode-article-body):
* lisp/gnus/gnus-search.el (gnus-search-indexed-parse-output)
(gnus-search--complete-key-data):
* lisp/gnus/gnus-spec.el (gnus-parse-simple-format):
* lisp/gnus/gnus-sum.el (gnus-summary-refer-article):
* lisp/gnus/gnus-util.el (gnus-extract-address-components)
(gnus-newsgroup-directory-form):
* lisp/gnus/gnus-uu.el (gnus-uu-grab-view):
* lisp/gnus/gnus.el (gnus-group-native-p, gnus-short-group-name):
* lisp/gnus/message.el (message-check-news-header-syntax)
(message-make-message-id, message-user-mail-address)
(message-make-fqdn, message-get-reply-headers, message-followup):
* lisp/gnus/mm-decode.el (mm-dissect-buffer):
* lisp/gnus/nnheader.el (nnheader-insert):
* lisp/gnus/nnimap.el (nnimap-process-quirk)
(nnimap-imap-ranges-to-gnus-ranges):
* lisp/gnus/nnmaildir.el (nnmaildir--ensure-suffix):
* lisp/gnus/nnmairix.el (nnmairix-determine-original-group-from-path):
* lisp/gnus/nnrss.el (nnrss-match-macro):
* lisp/gnus/nntp.el (nntp-find-group-and-number):
* lisp/help-fns.el (help--symbol-completion-table-affixation):
* lisp/help.el (help-function-arglist):
* lisp/hippie-exp.el (he-concat-directory-file-name):
* lisp/htmlfontify.el (hfy-relstub):
* lisp/ido.el (ido-make-prompt, ido-complete, ido-copy-current-word)
(ido-exhibit):
* lisp/image/image-converter.el (image-convert-p):
* lisp/info-xref.el (info-xref-docstrings):
* lisp/info.el (Info-toc-build, Info-follow-reference)
(Info-backward-node, Info-finder-find-node)
(Info-speedbar-expand-node):
* lisp/international/mule-diag.el (print-fontset-element):
* lisp/language/korea-util.el (default-korean-keyboard):
* lisp/linum.el (linum-after-change):
* lisp/mail/ietf-drums.el (ietf-drums-parse-address):
* lisp/mail/mail-utils.el (mail-dont-reply-to):
* lisp/mail/rfc2047.el (rfc2047-encode-1, rfc2047-decode-string):
* lisp/mail/rfc2231.el (rfc2231-parse-string):
* lisp/mail/rmailkwd.el (rmail-set-label):
* lisp/mail/rmailsum.el (rmail-header-summary):
* lisp/mail/smtpmail.el (smtpmail-maybe-append-domain)
(smtpmail-user-mail-address):
* lisp/mail/uce.el (uce-reply-to-uce):
* lisp/man.el (Man-default-man-entry):
* lisp/mh-e/mh-alias.el (mh-alias-gecos-name)
(mh-alias-minibuffer-confirm-address):
* lisp/mh-e/mh-comp.el (mh-forwarded-letter-subject):
* lisp/mh-e/mh-speed.el (mh-speed-parse-flists-output):
* lisp/mh-e/mh-utils.el (mh-collect-folder-names-filter)
(mh-folder-completion-function):
* lisp/minibuffer.el (completion--make-envvar-table)
(completion-file-name-table, completion-flex-try-completion)
(completion-flex-all-completions):
* lisp/mpc.el (mpc--proc-quote-string, mpc-cmd-special-tag-p)
(mpc-constraints-tag-lookup):
* lisp/net/ange-ftp.el (ange-ftp-send-cmd)
(ange-ftp-allow-child-lookup):
* lisp/net/mailcap.el (mailcap-mime-types):
* lisp/net/mairix.el (mairix-search-thread-this-article):
* lisp/net/pop3.el (pop3-open-server):
* lisp/net/soap-client.el (soap-decode-xs-complex-type):
* lisp/net/socks.el (socks-filter):
* lisp/nxml/nxml-outln.el (nxml-highlighted-qname):
* lisp/nxml/rng-cmpct.el (rng-c-expand-name, rng-c-expand-datatype):
* lisp/nxml/rng-uri.el (rng-uri-file-name-1):
* lisp/obsolete/complete.el (partial-completion-mode)
(PC-do-completion):
* lisp/obsolete/longlines.el (longlines-encode-string):
* lisp/obsolete/nnir.el (nnir-compose-result):
* lisp/obsolete/terminal.el (te-quote-arg-for-sh):
* lisp/obsolete/tpu-edt.el (tpu-check-search-case):
* lisp/obsolete/url-ns.el (isPlainHostName):
* lisp/pcmpl-unix.el (pcomplete/scp):
* lisp/play/dunnet.el (dun-listify-string2, dun-get-path)
(dun-unix-parse, dun-doassign, dun-cat, dun-batch-unix-interface):
* lisp/progmodes/ebnf2ps.el: (ebnf-eps-header-footer-comment):
* lisp/progmodes/gdb-mi.el (gdb-var-delete)
(gdb-speedbar-expand-node, gdbmi-bnf-incomplete-record-result):
* lisp/progmodes/gud.el (gud-find-expr):
* lisp/progmodes/idlw-help.el (idlwave-do-context-help1):
* lisp/progmodes/idlw-shell.el (idlwave-shell-mode)
(idlwave-shell-filter-hidden-output, idlwave-shell-filter):
* lisp/progmodes/idlwave.el (idlwave-skip-label-or-case)
(idlwave-routine-info):
* lisp/progmodes/octave.el (inferior-octave-completion-at-point):
* lisp/progmodes/sh-script.el (sh-add-completer):
* lisp/progmodes/sql.el (defun):
* lisp/progmodes/xscheme.el (xscheme-process-filter):
* lisp/replace.el (query-replace-compile-replacement)
(map-query-replace-regexp):
* lisp/shell.el (shell--command-completion-data)
(shell-environment-variable-completion):
* lisp/simple.el (display-message-or-buffer):
* lisp/speedbar.el (speedbar-dired, speedbar-tag-file)
(speedbar-tag-expand):
* lisp/subr.el (split-string-and-unquote):
* lisp/tar-mode.el (tar-extract):
* lisp/term.el (term-command-hook, serial-read-name):
* lisp/textmodes/bibtex.el (bibtex-print-help-message):
* lisp/textmodes/ispell.el (ispell-lookup-words, ispell-filter)
(ispell-parse-output, ispell-buffer-local-parsing):
* lisp/textmodes/reftex-cite.el (reftex-do-citation):
* lisp/textmodes/reftex-parse.el (reftex-notice-new):
* lisp/textmodes/reftex-ref.el (reftex-show-entry):
* lisp/textmodes/reftex.el (reftex-compile-variables):
* lisp/textmodes/tex-mode.el (tex-send-command)
(tex-start-tex, tex-append):
* lisp/thingatpt.el (thing-at-point-url-at-point):
* lisp/tmm.el (tmm-add-one-shortcut):
* lisp/transient.el (transient-format-key):
* lisp/url/url-auth.el (url-basic-auth)
(url-digest-auth-directory-id-assoc):
* lisp/url/url-news.el (url-news):
* lisp/url/url-util.el (url-parse-query-string):
* lisp/vc/vc-cvs.el (vc-cvs-parse-entry):
* lisp/wid-browse.el (widget-browse-sexp):
* lisp/woman.el (woman-parse-colon-path, woman-mini-help)
(WoMan-getpage-in-background, woman-negative-vertical-space):
* lisp/xml.el:
* test/lisp/emacs-lisp/check-declare-tests.el
(check-declare-tests-warn):
* test/lisp/files-tests.el
(files-tests-file-name-non-special-dired-compress-handler):
* test/lisp/net/network-stream-tests.el (server-process-filter):
* test/src/coding-tests.el (ert-test-unibyte-buffer-dos-eol-decode):
Use `string-search` instead of `string-match` and `string-match-p`.
2021-08-09 09:20:00 +00:00
|
|
|
((string-search "-" name)
|
2001-11-06 18:59:06 +00:00
|
|
|
exp)
|
|
|
|
(t
|
|
|
|
(intern (concat "var-" name))))))
|
|
|
|
((integerp exp)
|
|
|
|
(if (or (<= exp -1000000) (>= exp 1000000))
|
|
|
|
(list 'quote (math-normalize exp))
|
|
|
|
exp))
|
2001-11-14 09:09:09 +00:00
|
|
|
(t exp)))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun math-define-cond (forms)
|
|
|
|
(and forms
|
|
|
|
(cons (math-define-list (car forms))
|
2001-11-14 09:09:09 +00:00
|
|
|
(math-define-cond (cdr forms)))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun math-complicated-lhs (body)
|
|
|
|
(and body
|
|
|
|
(or (not (symbolp (car body)))
|
2001-11-14 09:09:09 +00:00
|
|
|
(math-complicated-lhs (cdr (cdr body))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun math-define-setf-list (body)
|
|
|
|
(and body
|
|
|
|
(cons (math-define-setf (nth 0 body) (nth 1 body))
|
2001-11-14 09:09:09 +00:00
|
|
|
(math-define-setf-list (cdr (cdr body))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun math-define-setf (place value)
|
|
|
|
(setq place (math-define-exp place)
|
|
|
|
value (math-define-exp value))
|
|
|
|
(cond ((symbolp place)
|
|
|
|
(list 'setq place value))
|
|
|
|
((eq (car-safe place) 'nth)
|
|
|
|
(list 'setcar (list 'nthcdr (nth 1 place) (nth 2 place)) value))
|
|
|
|
((eq (car-safe place) 'elt)
|
|
|
|
(list 'setcar (list 'nthcdr (nth 2 place) (nth 1 place)) value))
|
|
|
|
((eq (car-safe place) 'car)
|
|
|
|
(list 'setcar (nth 1 place) value))
|
|
|
|
((eq (car-safe place) 'cdr)
|
|
|
|
(list 'setcdr (nth 1 place) value))
|
|
|
|
(t
|
2001-11-14 09:09:09 +00:00
|
|
|
(error "Bad place form for setf: %s" place))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun math-define-binop (op ident arg1 rest)
|
|
|
|
(if rest
|
|
|
|
(math-define-binop op ident
|
|
|
|
(list op arg1 (car rest))
|
|
|
|
(cdr rest))
|
2001-11-14 09:09:09 +00:00
|
|
|
(or arg1 ident)))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun math-define-let (vlist)
|
|
|
|
(and vlist
|
|
|
|
(cons (if (consp (car vlist))
|
|
|
|
(cons (car (car vlist))
|
|
|
|
(math-define-list (cdr (car vlist))))
|
|
|
|
(car vlist))
|
2001-11-14 09:09:09 +00:00
|
|
|
(math-define-let (cdr vlist)))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun math-define-let-env (vlist)
|
|
|
|
(and vlist
|
|
|
|
(cons (if (consp (car vlist))
|
|
|
|
(car (car vlist))
|
|
|
|
(car vlist))
|
2001-11-14 09:09:09 +00:00
|
|
|
(math-define-let-env (cdr vlist)))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun math-define-lambda (exp exp-env)
|
|
|
|
(nconc (list (nth 0 exp) ; 'lambda
|
|
|
|
(nth 1 exp)) ; arg list
|
|
|
|
(math-define-function-body (cdr (cdr exp))
|
2001-11-14 09:09:09 +00:00
|
|
|
(append (nth 1 exp) exp-env))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun math-define-elt (seq idx)
|
|
|
|
(if idx
|
|
|
|
(math-define-elt (list 'elt seq (car idx)) (cdr idx))
|
2001-11-14 09:09:09 +00:00
|
|
|
seq))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; Useful programming macros.
|
|
|
|
|
|
|
|
(defmacro math-while (head &rest body)
|
|
|
|
(let ((body (cons 'while (cons head body))))
|
|
|
|
(if (math-body-refers-to body 'math-break)
|
|
|
|
(cons 'catch (cons '(quote math-break) (list body)))
|
2001-11-14 09:09:09 +00:00
|
|
|
body)))
|
2001-11-19 07:44:56 +00:00
|
|
|
;; (put 'math-while 'lisp-indent-hook 1)
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defmacro math-for (head &rest body)
|
|
|
|
(let ((body (if head
|
|
|
|
(math-handle-for head body)
|
|
|
|
(cons 'while (cons t body)))))
|
|
|
|
(if (math-body-refers-to body 'math-break)
|
|
|
|
(cons 'catch (cons '(quote math-break) (list body)))
|
2001-11-14 09:09:09 +00:00
|
|
|
body)))
|
2001-11-19 07:44:56 +00:00
|
|
|
;; (put 'math-for 'lisp-indent-hook 1)
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun math-handle-for (head body)
|
|
|
|
(let* ((var (nth 0 (car head)))
|
|
|
|
(init (nth 1 (car head)))
|
|
|
|
(limit (nth 2 (car head)))
|
|
|
|
(step (or (nth 3 (car head)) 1))
|
|
|
|
(body (if (cdr head)
|
|
|
|
(list (math-handle-for (cdr head) body))
|
|
|
|
body))
|
|
|
|
(all-ints (and (integerp init) (integerp limit) (integerp step)))
|
|
|
|
(const-limit (or (integerp limit)
|
|
|
|
(and (eq (car-safe limit) 'quote)
|
|
|
|
(math-realp (nth 1 limit)))))
|
|
|
|
(const-step (or (integerp step)
|
|
|
|
(and (eq (car-safe step) 'quote)
|
|
|
|
(math-realp (nth 1 step)))))
|
|
|
|
(save-limit (if const-limit limit (make-symbol "<limit>")))
|
|
|
|
(save-step (if const-step step (make-symbol "<step>"))))
|
|
|
|
(cons 'let
|
|
|
|
(cons (append (if const-limit nil (list (list save-limit limit)))
|
|
|
|
(if const-step nil (list (list save-step step)))
|
|
|
|
(list (list var init)))
|
|
|
|
(list
|
|
|
|
(cons 'while
|
|
|
|
(cons (if all-ints
|
|
|
|
(if (> step 0)
|
|
|
|
(list '<= var save-limit)
|
|
|
|
(list '>= var save-limit))
|
|
|
|
(list 'not
|
|
|
|
(if const-step
|
|
|
|
(if (or (math-posp step)
|
|
|
|
(math-posp
|
|
|
|
(cdr-safe step)))
|
|
|
|
(list 'math-lessp
|
|
|
|
save-limit
|
|
|
|
var)
|
|
|
|
(list 'math-lessp
|
|
|
|
var
|
|
|
|
save-limit))
|
|
|
|
(list 'if
|
|
|
|
(list 'math-posp
|
|
|
|
save-step)
|
|
|
|
(list 'math-lessp
|
|
|
|
save-limit
|
|
|
|
var)
|
|
|
|
(list 'math-lessp
|
|
|
|
var
|
|
|
|
save-limit)))))
|
|
|
|
(append body
|
|
|
|
(list (list 'setq
|
|
|
|
var
|
|
|
|
(list (if all-ints
|
|
|
|
'+
|
|
|
|
'math-add)
|
|
|
|
var
|
2001-11-14 09:09:09 +00:00
|
|
|
save-step)))))))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defmacro math-foreach (head &rest body)
|
|
|
|
(let ((body (math-handle-foreach head body)))
|
|
|
|
(if (math-body-refers-to body 'math-break)
|
|
|
|
(cons 'catch (cons '(quote math-break) (list body)))
|
2001-11-14 09:09:09 +00:00
|
|
|
body)))
|
2001-11-19 07:44:56 +00:00
|
|
|
;; (put 'math-foreach 'lisp-indent-hook 1)
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun math-handle-foreach (head body)
|
|
|
|
(let ((var (nth 0 (car head)))
|
Fix multiple Calc defmath errors (bug#46750)
Fix incorrect variable scoping in `let*`, `for` and `foreach`.
Fix loop variable value in `foreach` (should be element, not tail).
Fix function quoting, as in ('cons x y) -- didn't work at all.
Reported by Stephan Neuhaus.
* lisp/calc/calc-prog.el (math-define-exp, math-handle-foreach):
* test/lisp/calc/calc-tests.el: (var-g, test1, test2, test3, test4)
(test5, test6, test7, calc-defmath): Test various defmath forms.
2021-03-01 19:52:39 +00:00
|
|
|
(loop-var (gensym "foreach"))
|
2001-11-06 18:59:06 +00:00
|
|
|
(data (nth 1 (car head)))
|
|
|
|
(body (if (cdr head)
|
|
|
|
(list (math-handle-foreach (cdr head) body))
|
|
|
|
body)))
|
Fix multiple Calc defmath errors (bug#46750)
Fix incorrect variable scoping in `let*`, `for` and `foreach`.
Fix loop variable value in `foreach` (should be element, not tail).
Fix function quoting, as in ('cons x y) -- didn't work at all.
Reported by Stephan Neuhaus.
* lisp/calc/calc-prog.el (math-define-exp, math-handle-foreach):
* test/lisp/calc/calc-tests.el: (var-g, test1, test2, test3, test4)
(test5, test6, test7, calc-defmath): Test various defmath forms.
2021-03-01 19:52:39 +00:00
|
|
|
`(let ((,loop-var ,data))
|
|
|
|
(while ,loop-var
|
|
|
|
(let ((,var (car ,loop-var)))
|
|
|
|
,@(append body
|
|
|
|
`((setq ,loop-var (cdr ,loop-var)))))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun math-body-refers-to (body thing)
|
|
|
|
(or (equal body thing)
|
|
|
|
(and (consp body)
|
|
|
|
(or (math-body-refers-to (car body) thing)
|
2001-11-14 09:09:09 +00:00
|
|
|
(math-body-refers-to (cdr body) thing)))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun math-break (&optional value)
|
2001-11-14 09:09:09 +00:00
|
|
|
(throw 'math-break value))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
(defun math-return (&optional value)
|
2001-11-14 09:09:09 +00:00
|
|
|
(throw 'math-return value))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun math-composite-inequalities (x op)
|
|
|
|
(if (memq (nth 1 op) '(calcFunc-eq calcFunc-neq))
|
|
|
|
(if (eq (car x) (nth 1 op))
|
|
|
|
(append x (list (math-read-expr-level (nth 3 op))))
|
|
|
|
(throw 'syntax "Syntax error"))
|
|
|
|
(list 'calcFunc-in
|
|
|
|
(nth 2 x)
|
|
|
|
(if (memq (nth 1 op) '(calcFunc-lt calcFunc-leq))
|
|
|
|
(if (memq (car x) '(calcFunc-lt calcFunc-leq))
|
|
|
|
(math-make-intv
|
|
|
|
(+ (if (eq (car x) 'calcFunc-leq) 2 0)
|
|
|
|
(if (eq (nth 1 op) 'calcFunc-leq) 1 0))
|
|
|
|
(nth 1 x) (math-read-expr-level (nth 3 op)))
|
|
|
|
(throw 'syntax "Syntax error"))
|
|
|
|
(if (memq (car x) '(calcFunc-gt calcFunc-geq))
|
|
|
|
(math-make-intv
|
|
|
|
(+ (if (eq (nth 1 op) 'calcFunc-geq) 2 0)
|
|
|
|
(if (eq (car x) 'calcFunc-geq) 1 0))
|
|
|
|
(math-read-expr-level (nth 3 op)) (nth 1 x))
|
2001-11-14 09:09:09 +00:00
|
|
|
(throw 'syntax "Syntax error"))))))
|
2001-11-06 18:59:06 +00:00
|
|
|
|
2004-11-30 17:20:50 +00:00
|
|
|
(provide 'calc-prog)
|
|
|
|
|
2001-11-14 09:09:09 +00:00
|
|
|
;;; calc-prog.el ends here
|