aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Belanger2005-04-05 03:50:26 +0000
committerJay Belanger2005-04-05 03:50:26 +0000
commitbf7bae80d797472fc05bd12ac4962085f4e18d74 (patch)
tree151ff03a8e71e4c6588b4244cad3e40396b2ee71
parentee298b369eeccdd885718dd57d5b1fd774b577cf (diff)
downloademacs-bf7bae80d797472fc05bd12ac4962085f4e18d74.tar.gz
emacs-bf7bae80d797472fc05bd12ac4962085f4e18d74.zip
(math-read-replacement-list): Add subscripts.
(math-read-subscripts): New variable. (math-read-preprocess-string): Process subscripts.
-rw-r--r--lisp/calc/calc-aent.el24
1 files changed, 23 insertions, 1 deletions
diff --git a/lisp/calc/calc-aent.el b/lisp/calc/calc-aent.el
index e174d81c41d..a2d6e9dc88c 100644
--- a/lisp/calc/calc-aent.el
+++ b/lisp/calc/calc-aent.el
@@ -519,7 +519,22 @@ T means abort and give an error message.")
519 ("⁽" "(") ; ( 519 ("⁽" "(") ; (
520 ("⁾" ")") ; ) 520 ("⁾" ")") ; )
521 ("ⁿ" "n") ; n 521 ("ⁿ" "n") ; n
522 ("ⁱ" "i")) ; i 522 ("ⁱ" "i") ; i
523 ;; subscripts
524 ("₀" "0") ; 0
525 ("₁" "1") ; 1
526 ("₂" "2") ; 2
527 ("₃" "3") ; 3
528 ("₄" "4") ; 4
529 ("₅" "5") ; 5
530 ("₆" "6") ; 6
531 ("₇" "7") ; 7
532 ("₈" "8") ; 8
533 ("₉" "9") ; 9
534 ("₊" "+") ; +
535 ("₋" "-") ; -
536 ("₍" "(") ; (
537 ("₎" ")")) ; )
523 "A list whose elements (old new) indicate replacements to make 538 "A list whose elements (old new) indicate replacements to make
524in Calc algebraic input.") 539in Calc algebraic input.")
525 540
@@ -527,11 +542,18 @@ in Calc algebraic input.")
527 "⁰¹²³⁴⁵⁶⁷⁸⁹⁺⁻⁽⁾ⁿⁱ" ; 0123456789+-()ni 542 "⁰¹²³⁴⁵⁶⁷⁸⁹⁺⁻⁽⁾ⁿⁱ" ; 0123456789+-()ni
528 "A string consisting of the superscripts allowed by Calc.") 543 "A string consisting of the superscripts allowed by Calc.")
529 544
545(defvar math-read-subscripts
546 "₀₁₂₃₄₅₆₇₈₉₊₋₍₎" ; 0123456789+-()
547 "A string consisting of the subscripts allowed by Calc.")
548
530(defun math-read-preprocess-string (str) 549(defun math-read-preprocess-string (str)
531 "Replace some substrings of STR by Calc equivalents." 550 "Replace some substrings of STR by Calc equivalents."
532 (setq str 551 (setq str
533 (replace-regexp-in-string (concat "[" math-read-superscripts "]+") 552 (replace-regexp-in-string (concat "[" math-read-superscripts "]+")
534 "^(\\&)" str)) 553 "^(\\&)" str))
554 (setq str
555 (replace-regexp-in-string (concat "[" math-read-subscripts "]+")
556 "_(\\&)" str))
535 (let ((rep-list math-read-replacement-list)) 557 (let ((rep-list math-read-replacement-list))
536 (while rep-list 558 (while rep-list
537 (setq str 559 (setq str