From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: J J Newsgroups: gmane.emacs.devel Subject: Re: One character key bindings in editing buffers Date: Mon, 30 Jul 2018 22:30:38 +0300 Message-ID: <22430631532979038@myt4-74a8acfc13eb.qloud-c.yandex.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1532983621 30654 195.159.176.226 (30 Jul 2018 20:47:01 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 30 Jul 2018 20:47:01 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jul 30 22:46:57 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fkF4D-0007sY-28 for ged-emacs-devel@m.gmane.org; Mon, 30 Jul 2018 22:46:57 +0200 Original-Received: from localhost ([::1]:55824 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fkF6J-0006ve-Bo for ged-emacs-devel@m.gmane.org; Mon, 30 Jul 2018 16:49:07 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47345) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fkDsS-0006R2-FW for emacs-devel@gnu.org; Mon, 30 Jul 2018 15:30:45 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fkDsP-0003KE-Rv for emacs-devel@gnu.org; Mon, 30 Jul 2018 15:30:44 -0400 Original-Received: from forward101p.mail.yandex.net ([77.88.28.101]:57535) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fkDsP-0003Jm-Dl for emacs-devel@gnu.org; Mon, 30 Jul 2018 15:30:41 -0400 Original-Received: from mxback6g.mail.yandex.net (mxback6g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:167]) by forward101p.mail.yandex.net (Yandex) with ESMTP id 9DB0E4E892BC for ; Mon, 30 Jul 2018 22:30:38 +0300 (MSK) Original-Received: from localhost (localhost [::1]) by mxback6g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id aauvG454zN-UcS8f4Fp; Mon, 30 Jul 2018 22:30:38 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.com; s=mail; t=1532979038; bh=Brd/l6wXLbPGarHXkoLwPPAiwHaGeG1+bHVZTmTSc1Q=; h=From:To:Subject:Date:Message-Id; b=MusiNvduE5JIGXBxWJiksrT+A5IMPn6Dm7MULs7ai2kYdtcdAbGG9Xjr+13mbsF4J WFM/SMyiMRUtBvPjWIezK7sT4bi19ASmrBH1xtXk8q3t1o5SreYWk/kkIZeSJtYYZj Q3EJxnSCJEaTrQLsEATRCyj5w008OVy8j1gn7yyU= Authentication-Results: mxback6g.mail.yandex.net; dkim=pass header.i=@yandex.com Original-Received: by myt4-74a8acfc13eb.qloud-c.yandex.net with HTTP; Mon, 30 Jul 2018 22:30:38 +0300 X-Mailer: Yamail [ http://yandex.ru ] 5.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 77.88.28.101 X-Mailman-Approved-At: Mon, 30 Jul 2018 16:48:27 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:228019 Archived-At: > Sounds like a good idea for a package, indeed (no way this can make it > to a default behavior, OTOH). Naturally, it should not be default behavior. It's an advanced feature, so people should turn it on explicitly, so they know what's going on. > > I recommend you try and avoid sit-for as much as possible (e.g. because > it delays running other post-command-hooks). > E.g. in char-hotkey-wait-for-end, better just set some global var to the > current time, and then in char-hotkey compare that to the current time > to see if 0.5s have elapsed. Thanks, I didn't know that. For some reason I thought sit-for is implemented with a callback or something behind the scenes, so while it waits for input or elapsing time other code can keep on running during that. > Also, I'd recommend you use command remapping here: Yes, that is one of the points which a proper package should handle. In theory it's also possible that if you use some punctuation mark for hotkey then it also already has an electric or similar binding, not self-insert-command, though it's not likely with letter hotkeys. > Also, you can use the minor-mode map feature, so the key-bindings are > automatically (de)activated: > Nifty. Makes things simpler.