unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: "Mark H. David" <mhd@yv.org>
Cc: Eli Zaretskii <eliz@gnu.org>, rms@gnu.org, emacs-devel@gnu.org
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	[thread overview]
Message-ID: <87d1gvh639.fsf@mail.linkov.net> (raw)
In-Reply-To: <1481576998.3109775.816718105.3FD7FFFA@webmail.messagingengine.com> (Mark H. David's message of "Mon, 12 Dec 2016 13:09:58 -0800")

> 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))



  parent reply	other threads:[~2016-12-13 21:27 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-06 20:32 Is there a sane way to type Hebrew with nikud with Emacs 25/Mac? Mark H. David
2016-12-06 21:10 ` David Caldwell
2016-12-06 22:04   ` Mark H. David
2016-12-07 20:54 ` Richard Stallman
2016-12-07 23:02   ` Mark H. David
2016-12-08  3:42     ` Eli Zaretskii
2016-12-12 21:09       ` Mark H. David
2016-12-13  3:44         ` Eli Zaretskii
2016-12-13 21:27         ` Juri Linkov [this message]
2016-12-13 23:41           ` Mark H. David
2016-12-14 22:05             ` Juri Linkov
2016-12-08 20:36     ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d1gvh639.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=mhd@yv.org \
    --cc=rms@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).