[Top][All Lists]

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

Re: [AUCTeX-devel] non latin alphabet based languages input method and l

From: Uwe Brauer
Subject: Re: [AUCTeX-devel] non latin alphabet based languages input method and latex
Date: Thu, 09 Nov 2017 16:43:35 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

   > Hi Uwe,

   > I don't switch keyboard.  I set up the default input method for Japanese
   > in my init file ~/.emacs.d/init.el and just type C-\
   > (toggle-input-method) to activate and deactivate the input method during
   > the edit of LaTeX documents.

   > Yes, this is a little cumbersome certainly, but I accept it as
   > inevitable cost for us Japanese to use computers.

I tried the following
(defvar keyboard-maniac-fill-mode nil)
(make-variable-buffer-local 'keyboard-maniac-fill-mode) 

(defun my-test-hebrew ()
  (if (texmathp)
      (toggle-input-method nil 1)
      (message "We are in math toogle input method")))

(defun my-test-nohbrew ()
 (if (not (texmathp))
     (set-input-method "hebrew-phonetic-qwerty" t)
         (message "Switched from default to hebrew keyboard")))

;; Call keyboard-maniac fill after each command.
(add-hook 'post-command-hook 'my-test-hebrew)
(add-hook 'post-command-hook 'my-test-nohebrew)
;; (remove-hook 'post-command-hook 'my-test-nohebrew)
;; (remove-hook 'post-command-hook 'my-test-hebrew)

;; Add to mode line.
(or (assq 'keyboard-maniac-fill-mode minor-mode-alist)
    (setq minor-mode-alist
          (cons '(keyboard-maniac-fill-mode (" Keyb-Maniac"))

(defun keyboard-maniac-fill-mode (&optional arg)
  "Toggle keyboard-maniac fill mode.
With prefix arg, turn keyboard-maniac fill mode on iff arg is positive.

When keyboard-maniac fill mode is on, the current paragraph will be formatted
after each command."
  (interactive "P")
  (setq keyboard-maniac-fill-mode (not (or (and (null arg) 
                                  (<= (prefix-numeric-value arg) 0))))
  (set-buffer-modified-p (buffer-modified-p)))

(provide 'keyboard-maniac)

;;; keyboard-maniac.el ends here

Based on an old code from Peer Abrahamsen,
the hook 
(add-hook 'post-command-hook 'my-test-hebrew)
is very problematic.

Any ideas?


reply via email to

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