From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#55704: 29.0.50; Wishlist: Add a command to use XKB "Compose" sequences in Emacs Date: Sun, 29 May 2022 15:39:38 +0200 Message-ID: <87sfoszcdh.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28028"; mail-complaints-to="usenet@ciao.gmane.io" To: 55704@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun May 29 15:40:22 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nvJ9a-00078r-GL for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 29 May 2022 15:40:22 +0200 Original-Received: from localhost ([::1]:54940 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nvJ9Z-0005Y7-21 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 29 May 2022 09:40:21 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45568) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nvJ9G-0005Xa-LL for bug-gnu-emacs@gnu.org; Sun, 29 May 2022 09:40:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45806) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nvJ9G-0003Iy-Bk for bug-gnu-emacs@gnu.org; Sun, 29 May 2022 09:40:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nvJ9G-0005da-9U for bug-gnu-emacs@gnu.org; Sun, 29 May 2022 09:40:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 29 May 2022 13:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 55704 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.165383159421647 (code B ref -1); Sun, 29 May 2022 13:40:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 29 May 2022 13:39:54 +0000 Original-Received: from localhost ([127.0.0.1]:39703 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nvJ97-0005d3-Ka for submit@debbugs.gnu.org; Sun, 29 May 2022 09:39:53 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:33962) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nvJ93-0005cr-3x for submit@debbugs.gnu.org; Sun, 29 May 2022 09:39:52 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45556) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nvJ91-0005N4-CY for bug-gnu-emacs@gnu.org; Sun, 29 May 2022 09:39:48 -0400 Original-Received: from quimby.gnus.org ([2a01:4f9:2b:f0f::2]:51590) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nvJ8z-0003Hq-MV for bug-gnu-emacs@gnu.org; Sun, 29 May 2022 09:39:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:Date:Subject:To:From: Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=otsoHIn9On/ShHgBrGhOFFnJP7QsUuf6jrlRuq9zeSY=; b=nLub6vZz+s20H4B42ufDLQzFCT zfJaGAmZSyPFbAy4VbQKKkqvT+vQ9IZampwU2XwdXvJ80z0deeLohOrgAAwh8NDKL3otM8imUbpb8 t16yXvsNGNarkpBxwgNkFQ74+DypUKWjIRKtkVWiA8dhgEVe7TwHWwqmhvGpGwsahHW0=; Original-Received: from [84.212.220.105] (helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nvJ8u-0004Xg-Nv for bug-gnu-emacs@gnu.org; Sun, 29 May 2022 15:39:43 +0200 X-Now-Playing: This Mortal Coil's _It'll End In Tears_: "track" Received-SPF: pass client-ip=2a01:4f9:2b:f0f::2; envelope-from=larsi@gnus.org; helo=quimby.gnus.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:233319 Archived-At: This spins out of bug#43866. Juri posted the code below, and Eli then made the point that we should pre-generate this data from the two files that are being parsed. I think that sounds like a good idea (i.e., we'd include the two files and then have a Lisp snippet that transforms it into an .el file, as we do with other similar data files). And I think using `C-+' sounds fine, too. -------- Here's is a working implementation. It binds all key sequences to the key 'C-+' that has the mnemonics of adding a character. 'C-+' is free because it can't be used to zoom text since its counterpart key 'C--' is already taken to input numeric arguments. 'C-+ C-+' is bound to 'insert-char' like the current longer key sequence 'C-x 8 RET' that is hard to type. ;;; x-compose.el --- Compose input method from X11 -*- lexical-binding: t; -*- (defvar x-compose-keymap (let ((map (make-sparse-keymap))) (let ((keysymdef (make-hash-table :test 'equal))) (with-temp-buffer (insert-file-contents "/usr/include/X11/keysymdef.h") (while (re-search-forward "^#define XK_\\(\\S-+\\).+/\\* U\\+\\(\\w+\\)" nil t) (puthash (match-string 1) (match-string 2) keysymdef))) (with-temp-buffer (insert-file-contents "/usr/share/X11/locale/en_US.UTF-8/Compose") (while (re-search-forward "^ \\([^:]+\\): \"\\([^\"]+\\)\"" nil t) (let* ((to-char (string-to-char (match-string 2))) (from-keys (match-string 1)) (from-chars (mapcar (lambda (s) (if (string-match "^U\\([[:xdigit:]]+\\)" s) (string-to-number (match-string 1 s) 16) (string-to-number (gethash s keysymdef "0000") 16))) (split-string from-keys "[<> \t]+" t)))) (unless (memq 0 from-chars) (define-key map (apply 'vector from-chars) (vector to-char))))))) map) "Keymap for keys of the Compose input method.") (define-key key-translation-map [(control ?+)] x-compose-keymap) (global-set-key [(control ?+) (control ?+)] 'insert-char) (provide 'x-compose) ;;; x-compose.el ends here In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.16.0) of 2022-05-17 built on xo Repository revision: 803041e01474f2a522170c9f388068e8460be2ae Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12101003 System Description: Debian GNU/Linux bookworm/sid -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no