auctex-devel
[Top][All Lists]
Advanced

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

Re: [AUCTeX-devel] serious keybinding problem


From: Tassilo Horn
Subject: Re: [AUCTeX-devel] serious keybinding problem
Date: Tue, 15 Sep 2015 14:24:13 +0200
User-agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.0.50 (gnu/linux)

Mosè Giordano <address@hidden> writes:

>> (add-hook 'LaTeX-mode-hook 'my-latex-mode-key)
>>
>> (defun my-latex-mode-key ()
>>   "Setting of the following keys"
>>   (interactive)
>>   (local-set-key [(control right)] 'my-turn-bidi-on)
>>   (local-set-key [(control left)] 'my-turn-bidi-off)
>>   (local-set-key [(f31)]   'TeX-fold-buffer)
>>   (local-set-key [(f30)]   'TeX-fold-clearout-buffer)
>>   (local-set-key [(control f30)] 'preview-clearout-buffer))
>>
>> However this binding is ignored, the global-key-binding is taken
>> instead.
>>
>> I have to evaluate the function my-latex-mode-key and then switch latex
>> mode off and on. Very annoying.
>
> I can't reproduce your problem in Emacs 24.5 (and I don't think this
> bug, if exists, has anything to do with AUCTeX).

Me neither.  When I eval the above, find a latex file, and then hit
<C-right> I get

  command-execute: Wrong type argument: commandp, my-turn-bidi-on

so the binding is effective, I just don't have your `my-turn-bidi-on'
defined here.

> If I know map name, I usually set local keys with
>
> (eval-after-load "latex"
>   '(progn
>      (define-key LaTeX-mode-map [(control right)] 'my-turn-bidi-on)
>      (define-key LaTeX-mode-map [(control left)] 'my-turn-bidi-off)
>      (define-key LaTeX-mode-map [(f31)]   'TeX-fold-buffer)
>      (define-key LaTeX-mode-map [(f30)]   'TeX-fold-clearout-buffer)
>      (define-key LaTeX-mode-map [(control f30)] 'preview-clearout-buffer)))

That's a littlebit better because then the keys are set only once and
not every time latex mode is activated but in the end it should have the
very same behavior.  BTW, in more recent emacs versions there's also
`with-eval-after-load' which lets you do the same a bit nicer.

--8<---------------cut here---------------start------------->8---
(with-eval-after-load "latex"
  (define-key LaTeX-mode-map [(control right)] 'my-turn-bidi-on)
  (define-key LaTeX-mode-map [(control left)] 'my-turn-bidi-off)
  (define-key LaTeX-mode-map [(f31)]   'TeX-fold-buffer)
  (define-key LaTeX-mode-map [(f30)]   'TeX-fold-clearout-buffer)
  (define-key LaTeX-mode-map [(control f30)] 'preview-clearout-buffer))
--8<---------------cut here---------------end--------------->8---

Bye,
Tassilo




reply via email to

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