From mboxrd@z Thu Jan 1 00:00:00 1970 From: Meiyo Peng Subject: Re: =?utf-8?Q?Let=E2=80=99s?= translate! Date: Sat, 13 Apr 2019 17:46:18 +0800 Message-ID: <878swexmol.fsf@riseup.net> References: <87zhovlztm.fsf@gnu.org> <87wojyllbk.fsf@riseup.net> <850d3fe50a8a6b5ea24f3bdcb409d757@disroot.org> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([209.51.188.92]:51475) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hFFEw-0001ri-SM for guix-devel@gnu.org; Sat, 13 Apr 2019 05:46:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hFFEv-0008Ko-FI for guix-devel@gnu.org; Sat, 13 Apr 2019 05:46:26 -0400 In-reply-to: <850d3fe50a8a6b5ea24f3bdcb409d757@disroot.org> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: znavko@disroot.org Cc: guix-devel@gnu.org Hi znavko, znavko@disroot.org writes: > I've found this emacs config (~/.emacs) in linux.org.ru, that makes workable emacs commands (such as C-c C-c) when keyboard layout is not English. It works for me in Russian layout, and Chinese too as I tried. > > ;;Make emacs commands work when keyboard layout is not English > (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)))) > > (defadvice read-passwd (around my-read-passwd act) > (let ((local-function-key-map nil)) > ad-do-it)) > > (reverse-input-method 'russian-computer) > > > There are suggestions for emacs config to make po-mode by default and also ispell spellchecker in my blog: > dev-znavko.pantheonsite.io > > Hope it helps! Thank you for the trick. The default behavior of Emacs is indeed annoying if a special input method is enabled. But I only enable Chinese Input Method when I input Chinese characters. That's less than 1% of my time with Emacs. So I am OK with the default behavior. -- Meiyo Peng https://www.pengmeiyu.com/