emacs-devel
[Top][All Lists]
Advanced

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

Re: Is there a sane way to type Hebrew with nikud with Emacs 25/Mac?


From: Mark H. David
Subject: Re: Is there a sane way to type Hebrew with nikud with Emacs 25/Mac?
Date: Tue, 13 Dec 2016 15:41:09 -0800

But Juri, you say

> Give to this command the name of the Emacs input method
> that works correctly for your keyboard

so I don't see how this applies to the case I'm describing,
that is, using the built-in input method (built into the OS)
rather than Emacs's input method, not using any input method
of Emacs's.  Can you help me understand?

Thanks,

Mark

----- Original message -----
From: Juri Linkov <address@hidden>
To: "Mark H. David" <address@hidden>
Cc: Eli Zaretskii <address@hidden>, address@hidden, address@hidden
Subject: Re: Is there a sane way to type Hebrew with nikud with Emacs 25/Mac?
Date: Tue, 13 Dec 2016 23:27:15 +0200

> The goal of this exercise is to allow one to use the built-in input method
> (here, Hebrew keyboard MacOS (or Windows or GNU/Linux)), without needing
> Emacs's input methods.  Nowadays, built-in input methods involve very little
> setup work on all the platforms. And then you have a uniform way to enter your
> text in many apps, e.g., firefox, chrome, safari, terminal, mail, what have 
> you.
> So, just want Emacs to behave like these apps.  It kind of does, as far as
> self-inserting characters are concerned, but having to switch back to US 
> keyboard
> just to type C-x, C-c, C-s, et al, is "insane". How to fix it?

We already solved the same problem for Cyrillic:
https://debbugs.gnu.org/9751#85

You can use the same solution for Hebrew as well.
Give to this command the name of the Emacs input method
that works correctly for your keyboard, and it will create
a reverse mapping converting all entered keys with modifiers
to ASCII without the need to activate the Emacs input method:

(defun reverse-input-method (input-method)
  "Build the reverse mapping of single letters from INPUT-METHOD."
  (interactive
   (list (read-input-method-name "Use input method (default current): ")))
  (if (and input-method (symbolp input-method))
      (setq input-method (symbol-name input-method)))
  (let ((current current-input-method)
        (modifiers '(nil (control) (meta) (control meta))))
    (when input-method
      (activate-input-method input-method))
    (when (and current-input-method quail-keyboard-layout)
      (dolist (map (cdr (quail-map)))
        (let* ((to (car map))
               (from (quail-get-translation
                      (cadr map) (char-to-string to) 1)))
          (when (and (characterp from) (characterp to))
            (dolist (mod modifiers)
              (define-key local-function-key-map
                (vector (append mod (list from)))
                (vector (append mod (list to)))))))))
    (when input-method
      (activate-input-method current))))

If a list of modifiers '(control) (meta) (control meta)' is not enough,
then you can add more combinations of modifiers with:

(defun powerset (S)
    (let ((x (car S)))
      (if (cdr S)
          (let ((y (powerset (remove x S))))
            (append (list (list x))
                    (mapcar (lambda (e) (cons x e)) y)
                    y))
        (list (list x)))))

and

(powerset '(control meta super hyper))



reply via email to

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