1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

(math-read-replacement-list): Add subscripts.

(math-read-subscripts): New variable.
(math-read-preprocess-string): Process subscripts.
This commit is contained in:
Jay Belanger 2005-04-05 03:50:26 +00:00
parent ee298b369e
commit bf7bae80d7

View file

@ -519,7 +519,22 @@ T means abort and give an error message.")
("" "(") ; (
("" ")") ; )
("" "n") ; n
("" "i")) ; i
("" "i") ; i
;; subscripts
("" "0") ; 0
("" "1") ; 1
("" "2") ; 2
("" "3") ; 3
("" "4") ; 4
("" "5") ; 5
("" "6") ; 6
("" "7") ; 7
("" "8") ; 8
("" "9") ; 9
("" "+") ; +
("" "-") ; -
("" "(") ; (
("" ")")) ; )
"A list whose elements (old new) indicate replacements to make
in Calc algebraic input.")
@ -527,11 +542,18 @@ in Calc algebraic input.")
"⁰¹²³⁴⁵⁶⁷⁸⁹⁺⁻⁽⁾ⁿⁱ" ; 0123456789+-()ni
"A string consisting of the superscripts allowed by Calc.")
(defvar math-read-subscripts
"₀₁₂₃₄₅₆₇₈₉₊₋₍₎" ; 0123456789+-()
"A string consisting of the subscripts allowed by Calc.")
(defun math-read-preprocess-string (str)
"Replace some substrings of STR by Calc equivalents."
(setq str
(replace-regexp-in-string (concat "[" math-read-superscripts "]+")
"^(\\&)" str))
(setq str
(replace-regexp-in-string (concat "[" math-read-subscripts "]+")
"_(\\&)" str))
(let ((rep-list math-read-replacement-list))
(while rep-list
(setq str