3907 |
:group 'LaTeX-math |
:group 'LaTeX-math |
3908 |
:type 'sexp) |
:type 'sexp) |
3909 |
|
|
3910 |
(defvar LaTeX-math-keymap (make-sparse-keymap) |
(defvar LaTeX-math-keymap |
3911 |
|
(let ((map (make-sparse-keymap))) |
3912 |
|
(define-key map LaTeX-math-abbrev-prefix 'self-insert-command) |
3913 |
|
map) |
3914 |
"Keymap used for `LaTeX-math-mode' commands.") |
"Keymap used for `LaTeX-math-mode' commands.") |
3915 |
|
|
3916 |
(defvar LaTeX-math-menu |
(defvar LaTeX-math-menu |
3922 |
The menu entries will be generated dynamically, but you can specify |
The menu entries will be generated dynamically, but you can specify |
3923 |
the sequence by initializing this variable.") |
the sequence by initializing this variable.") |
3924 |
|
|
|
(define-key LaTeX-math-keymap |
|
|
(apply 'vector (append LaTeX-math-abbrev-prefix |
|
|
LaTeX-math-abbrev-prefix nil)) |
|
|
'LaTeX-math-insert-prefix) |
|
|
|
|
3925 |
(defcustom LaTeX-math-menu-unicode |
(defcustom LaTeX-math-menu-unicode |
3926 |
(and (string-match "\\<GTK\\>" (emacs-version)) t) |
(and (string-match "\\<GTK\\>" (emacs-version)) t) |
3927 |
"Whether the LaTeX menu should try using Unicode for effect." |
"Whether the LaTeX menu should try using Unicode for effect." |
3929 |
:group 'LaTeX-math) |
:group 'LaTeX-math) |
3930 |
|
|
3931 |
(let ((math (reverse (append LaTeX-math-list LaTeX-math-default))) |
(let ((math (reverse (append LaTeX-math-list LaTeX-math-default))) |
3932 |
(map (lookup-key LaTeX-math-keymap LaTeX-math-abbrev-prefix)) |
(map LaTeX-math-keymap) |
3933 |
(unicode (and LaTeX-math-menu-unicode (fboundp 'decode-char)))) |
(unicode (and LaTeX-math-menu-unicode (fboundp 'decode-char)))) |
3934 |
(while math |
(while math |
3935 |
(let* ((entry (car math)) |
(let* ((entry (car math)) |
3983 |
(vector menu name t)) |
(vector menu name t)) |
3984 |
(cdr parent)))))))))) |
(cdr parent)))))))))) |
3985 |
|
|
|
(easy-menu-define LaTeX-math-mode-menu |
|
|
LaTeX-math-keymap |
|
|
"Menu used in math minor mode." |
|
|
LaTeX-math-menu) |
|
|
|
|
3986 |
(define-minor-mode LaTeX-math-mode |
(define-minor-mode LaTeX-math-mode |
3987 |
"A minor mode with easy acces to TeX math macros. |
"A minor mode with easy acces to TeX math macros. |
3988 |
|
|
3990 |
the symbols will be surrounded by dollar signs. The following |
the symbols will be surrounded by dollar signs. The following |
3991 |
commands are defined: |
commands are defined: |
3992 |
|
|
3993 |
\\{LaTeX-math-keymap}" |
\\{LaTeX-math-mode-map}" |
3994 |
nil nil LaTeX-math-keymap |
nil nil (list (cons LaTeX-math-abbrev-prefix LaTeX-math-keymap)) |
3995 |
(if LaTeX-math-mode |
(if LaTeX-math-mode |
3996 |
(easy-menu-add LaTeX-math-mode-menu LaTeX-math-keymap) |
(easy-menu-add LaTeX-math-mode-menu LaTeX-math-mode-map) |
3997 |
(easy-menu-remove LaTeX-math-mode-menu)) |
(easy-menu-remove LaTeX-math-mode-menu)) |
3998 |
(TeX-set-mode-name)) |
(TeX-set-mode-name)) |
3999 |
(defalias 'latex-math-mode 'LaTeX-math-mode) |
(defalias 'latex-math-mode 'LaTeX-math-mode) |
4000 |
|
|
4001 |
(defun LaTeX-math-insert-prefix () |
(easy-menu-define LaTeX-math-mode-menu |
4002 |
"Insert the value of `LaTeX-math-abbrev-prefix'." |
LaTeX-math-mode-map |
4003 |
(interactive "*") |
"Menu used in math minor mode." |
4004 |
(let (LaTeX-math-mode) |
LaTeX-math-menu) |
|
(if (key-binding LaTeX-math-abbrev-prefix) |
|
|
(call-interactively (key-binding LaTeX-math-abbrev-prefix)) |
|
|
(error "%S has no default binding" LaTeX-math-abbrev-prefix)))) |
|
4005 |
|
|
4006 |
(defcustom LaTeX-math-insert-function 'TeX-insert-macro |
(defcustom LaTeX-math-insert-function 'TeX-insert-macro |
4007 |
"Function called with argument STRING to insert \\STRING." |
"Function called with argument STRING to insert \\STRING." |