auctex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: LaTeX-math-list: Binding on key sequences?


From: Arash Esbati
Subject: Re: LaTeX-math-list: Binding on key sequences?
Date: Thu, 15 Jul 2021 10:31:08 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50

Hi Heiko,

Heiko Schröder <heikos@online.de> writes:

Please always use the `Reply to all' function in your MUA when replying
to a mailing list.  Thanks.

>> Try this:
>>> (eval-after-load "latex"
>>>    '(progn
>>>       ;; Remove default <g> binding.
>>>       (setq LaTeX-math-default
>>>        (delq (assq ?g LaTeX-math-default) LaTeX-math-default))
>>>       ;; Clear and remake keymap.
>>>       (setq LaTeX-math-keymap (make-sparse-keymap))
>>>       (setq LaTeX-math-list
>>>        '(("g a" "alpha" "Greek Lowercase" 945)))
>>>       (LaTeX-math-initialize)
>>>       ;; Bind new keymap.
>>>       (define-key LaTeX-math-mode-map
>>>             (LaTeX-math-abbrev-prefix) LaTeX-math-keymap)))
>
> It seems that it is not possible to map ,,beta'' with ,,g b'' when
> ,,alpha'' is mapped as described.  It seems that only the last binding
> is valid.
>
> (eval-after-load "latex"
>   '(progn
>      ;; Remove default <g> binding.
>      (setq LaTeX-math-default
>          (delq (assq ?g LaTeX-math-default) LaTeX-math-default))
>      ;; Clear and remake keymap.
>      (setq LaTeX-math-keymap (make-sparse-keymap))
>      (setq LaTeX-math-list
>          '(("g a" "alpha" "Greek Lowercase" 945)))
>      (setq LaTeX-math-list                                 ;new
>            '(("g b" "beta" "Greek Lowercase" 946)))        ;new
>      (LaTeX-math-initialize)
>      ;; Bind new keymap.
>      (define-key LaTeX-math-mode-map
>            (LaTeX-math-abbrev-prefix) LaTeX-math-keymap)))
>
> only binds "beta", but not any more "alpha".

Not tested, but looking at the code above this is the expected behavior
since you overwrite the value of `LaTeX-math-list' before the
`LaTeX-math-initialize' call.  Try something like this:

--8<---------------cut here---------------start------------->8---
(eval-after-load "latex"
  '(progn
     ;; Remove default <g> binding.
     (setq LaTeX-math-default
           (delq (assq ?g LaTeX-math-default) LaTeX-math-default))
     ;; Clear and remake keymap.
     (setq LaTeX-math-keymap (make-sparse-keymap))
     (setq LaTeX-math-list
           '(("g a" "alpha" "Greek Lowercase" 945)
             ("g b" "beta" "Greek Lowercase" 946)))
     (LaTeX-math-initialize)
     ;; Bind new keymap.
     (define-key LaTeX-math-mode-map
       (LaTeX-math-abbrev-prefix) LaTeX-math-keymap)))
--8<---------------cut here---------------end--------------->8---

>> I also think we should give users a key for personal key sequences
>> instead of replacing the predefined ones.
>
> That would be /very /great!  Otherwise AUCTeXs math mode is clumsy.

Ok, thanks for your comment.  Can you please elaborate why the math mode
is clumsy?

Best, Arash



reply via email to

[Prev in Thread] Current Thread [Next in Thread]