From unknown Mon Jun 23 23:49:09 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#16346 <16346@debbugs.gnu.org> To: bug#16346 <16346@debbugs.gnu.org> Subject: Status: 24.3; electric-pair-mode close-paren issue Reply-To: bug#16346 <16346@debbugs.gnu.org> Date: Tue, 24 Jun 2025 06:49:09 +0000 retitle 16346 24.3; electric-pair-mode close-paren issue reassign 16346 emacs submitter 16346 Leo Liu severity 16346 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 04 21:57:36 2014 Received: (at submit) by debbugs.gnu.org; 5 Jan 2014 02:57:37 +0000 Received: from localhost ([127.0.0.1]:34825 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VzduC-0005yM-4d for submit@debbugs.gnu.org; Sat, 04 Jan 2014 21:57:36 -0500 Received: from eggs.gnu.org ([208.118.235.92]:40355) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VzduA-0005yA-Bp for submit@debbugs.gnu.org; Sat, 04 Jan 2014 21:57:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vzdu1-0000fc-Np for submit@debbugs.gnu.org; Sat, 04 Jan 2014 21:57:34 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:42261) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vzdu1-0000fY-Kg for submit@debbugs.gnu.org; Sat, 04 Jan 2014 21:57:25 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42066) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vzdtt-00006H-6s for bug-gnu-emacs@gnu.org; Sat, 04 Jan 2014 21:57:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vzdtk-0000UP-Pt for bug-gnu-emacs@gnu.org; Sat, 04 Jan 2014 21:57:17 -0500 Received: from mail-pa0-x229.google.com ([2607:f8b0:400e:c03::229]:65373) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vzdtk-0000UK-IX for bug-gnu-emacs@gnu.org; Sat, 04 Jan 2014 21:57:08 -0500 Received: by mail-pa0-f41.google.com with SMTP id lf10so17341322pab.0 for ; Sat, 04 Jan 2014 18:57:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:mime-version:content-type; bh=AezpfhrcTZoSumcaTXVI8hNLUOquBDuwmA2qKltgVAE=; b=w/V1T8brTtuWsuvyAxZ4e480fRncyJgBgOnnAh7lF8WW+l0WqMSW+mkBAM6GRYu9oQ NGKflh9YHxQzdUcFw+rwZVRd8CW0f4pJxePJsFdBoCz7hVNldBqHIuLzZUt6JN8U2JSH EOEC6Vlv+yAiHftWmQH0cNGlQldU85UH3UpRVGbFYnw0XxGycPmv5dgzQ7a2ND51AsR+ SE2Jdb6OYTNTWDTEWuzdxRwQuehFIzqYX8UjiPKhxSa+PegoD8Y9ag3L2/rBSz20Z8Q1 qgKCPG30P/cEqzbNuTttXa+KNu2HIZMEAIh3Zl5f735YKkiFfBReYiqCw0HSgFExoMsd Tf4g== X-Received: by 10.68.20.1 with SMTP id j1mr111281403pbe.148.1388890627004; Sat, 04 Jan 2014 18:57:07 -0800 (PST) Received: from localhost ([221.220.128.204]) by mx.google.com with ESMTPSA id dq3sm118835069pbc.35.2014.01.04.18.57.04 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 04 Jan 2014 18:57:06 -0800 (PST) From: Leo Liu To: bug-gnu-emacs@gnu.org Subject: 24.3; electric-pair-mode close-paren issue X-Debbugs-CC: , Stefan Monnier Date: Sun, 05 Jan 2014 10:57:02 +0800 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) In some of the eldoc-documentation-function's when used by eldoc-post-insert-mode, for example octave-eldoc-function, the eldoc (calltip) is only shown after inserting the ( and inside the (). The new feature introduced to electric-pair-mode fails the above by triggering two successive runs of post-self-insert-hook, one for inserting the open-paren and the other for the close-paren. Thus the eldoc message is immediately cleared by the second run. My impression is if a user didn't type ) it should not trigger post-self-insert-hook. WDYT? Leo From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 05 06:51:36 2014 Received: (at 16346) by debbugs.gnu.org; 5 Jan 2014 11:51:36 +0000 Received: from localhost ([127.0.0.1]:35385 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VzmEx-0000K1-Ow for submit@debbugs.gnu.org; Sun, 05 Jan 2014 06:51:36 -0500 Received: from mail-we0-f180.google.com ([74.125.82.180]:64175) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VzmEv-0000Jk-3s for 16346@debbugs.gnu.org; Sun, 05 Jan 2014 06:51:33 -0500 Received: by mail-we0-f180.google.com with SMTP id t61so14803875wes.39 for <16346@debbugs.gnu.org>; Sun, 05 Jan 2014 03:51:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=LBfnWJVr4djL9hXJy8pMQIo5VoPH8VNNlssI7YAMme8=; b=baLFfGUgNNvHuhDJtKmXu1OeCOp/hvs8i46OzoP5MNESlwaAB7KtdnIQ1cw6ahEZRE 0hcTg2K5wWj9vpQbs3Ap+un1QRKEDxiDjw8Q6ubO5nTGZxEST3nNatLF9Ta560M8jxqo LMMmCSS8zWnmPG5JWFmTbF5SUSc25E3O1Ip6P2hqmgodqtHsNcVa7g6B1rIAJVp4woCF pI8d8YObseDiKmRTGgLqp5ndbcp7LvkWWzKcuCnosEg/GdMUszrT9hAdLhuvoKFYiYmv F0rR+KvClv+Yb5bVbkqnJvXOztanqUrOG3eyK9vtsSumqPp/fWbLYKtUZ5d4B6ejReVg Uc8g== X-Received: by 10.180.13.139 with SMTP id h11mr8528925wic.3.1388922692049; Sun, 05 Jan 2014 03:51:32 -0800 (PST) Received: from kitaj.yourcompany.com (66.207.108.93.rev.vodafone.pt. [93.108.207.66]) by mx.google.com with ESMTPSA id kr10sm39890123wjc.22.2014.01.05.03.51.30 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 05 Jan 2014 03:51:31 -0800 (PST) From: joaotavora@gmail.com (=?utf-8?B?Sm/Do28gVMOhdm9yYQ==?=) To: Leo Liu Subject: Re: bug#16346: 24.3; electric-pair-mode close-paren issue References: Date: Sun, 05 Jan 2014 11:49:34 +0000 In-Reply-To: (Leo Liu's message of "Sun, 05 Jan 2014 10:57:02 +0800") Message-ID: <878uuuy7g1.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 16346 Cc: 16346@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Leo Liu writes: > In some of the eldoc-documentation-function's when used by > eldoc-post-insert-mode, for example octave-eldoc-function, the eldoc > (calltip) is only shown after inserting the ( and inside the (). > > The new feature introduced to electric-pair-mode fails the above by > triggering two successive runs of post-self-insert-hook, one for > inserting the open-paren and the other for the close-paren. Thus the > eldoc message is immediately cleared by the second run. Are you sure this is only with the new features? > My impression is if a user didn't type ) it should not trigger > post-self-insert-hook. WDYT? The idea of inserting matchers with self-insert-command is to allow other hooks to run recursively, but it has some problems as described by the FIXME's that I found before my changes electric-pair-mode. Indeed, it wasn't "self inserted" it, it was "electric inserted". electric-pair--insert is this abstraction and it's used to insert matchers. It does some rebinding of vars to keep other modes like blink-matching-paren from interfering. Maybe eldoc-mode deserves a place in there? (defun electric-pair--insert (char) (let ((last-command-event char) (blink-matching-paren nil) (electric-pair-mode nil) (eldoc-mode nil)) (self-insert-command 1))) Haven't tested though... Will have little time the coming weeks, sorry. From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 05 10:30:58 2014 Received: (at 16346) by debbugs.gnu.org; 5 Jan 2014 15:30:58 +0000 Received: from localhost ([127.0.0.1]:36321 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VzpfF-000804-Ex for submit@debbugs.gnu.org; Sun, 05 Jan 2014 10:30:57 -0500 Received: from mail-pb0-f43.google.com ([209.85.160.43]:40777) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VzpfC-0007zs-It for 16346@debbugs.gnu.org; Sun, 05 Jan 2014 10:30:55 -0500 Received: by mail-pb0-f43.google.com with SMTP id rq2so17459919pbb.16 for <16346@debbugs.gnu.org>; Sun, 05 Jan 2014 07:30:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:face:date:in-reply-to:message-id :user-agent:mime-version:content-type:content-transfer-encoding; bh=GQSaymL+kCKd145MbHu0/8CWVhAC7BKg98cUJtdxMJc=; b=BOA9aNcKq5C7ICl6JZJEIPmcurBmwvhQA8OW92ZKSq9+slgxVPWhk2dKILJ+sBwMRi 3HqSw6cmDyRhJQlkKeg9wN4YT2YhyzfU9ni0IV9hUZr2bln+6UCSZSqKspoNC3Diolcm K6cBgoV//rrl0o6oUwwooM3ODO1JLohLxSeX4kBl0+FTKaanItm1ea0iktzTzzGrC+/g 4H7OeDGQh2vR5tm8MSGmd9QuFYvrk9fs95wJei4Rs5rwc6wRqHOrNy6rYTGtWWawcazf JZaKWwC2vA9LXHYDCEL0/feXK7/y/ikedj2ZKnOQigkbE+lyUIRRc+BWB8JbIFpcy6fc cTIA== X-Received: by 10.68.241.134 with SMTP id wi6mr114870091pbc.44.1388935853427; Sun, 05 Jan 2014 07:30:53 -0800 (PST) Received: from localhost ([221.220.128.204]) by mx.google.com with ESMTPSA id y9sm160602492pas.10.2014.01.05.07.30.51 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 05 Jan 2014 07:30:52 -0800 (PST) From: Leo Liu To: joaotavora@gmail.com (=?iso-8859-1?Q?Jo=E3o_T=E1vora?=) Subject: Re: bug#16346: 24.3; electric-pair-mode close-paren issue References: <878uuuy7g1.fsf@gmail.com> Face: iVBORw0KGgoAAAANSUhEUgAAACgAAAAoBAMAAAB+0KVeAAAAElBMVEUAAAAAAP+LRRP0pGC+ vr7///+7mT1iAAAAAWJLR0QAiAUdSAAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9cBBwMO DhglKe4AAAEsSURBVCjPbZNBboQwDEV/Cd4X9QJRThApmn0XYW+Jyf2v0m+HhqDBgiAe9rcTG7QH w/1Vn2Ar8gBb/ocywSN3qK9T3z4eFDB4eApocBpeBs1RSykoJd8gQcm8pGmHXFso3ajnmsqV0TnY DQkOfXUfN5NwaI7AWTVOyEhcu1aHmdWItHddUVUcUgUBCkitu8V6ditHVOVdqzl2EQ1ZVGTbdK0V 7cqn8vWzoU5Q/bF9Y/Y0cRU1xwkys5dJ+Dt6pBDWifcNQml8Gh2JVmPSoQzo7en0grswkxrUGYJ7 0hSxxAGr7ZMwYcHIzprpi7TENEE1xtiYxixRlCfPBsUUrwHD7uGIwATrbnODJcVrPpVn3hxiGloe m/S+z3CtuzUSMo83N4DPH+F0evwR3P4A2k+75838OKQAAAAASUVORK5CYII= Date: Sun, 05 Jan 2014 23:30:47 +0800 In-Reply-To: <878uuuy7g1.fsf@gmail.com> (=?iso-8859-1?Q?=22Jo=E3o_T=E1vora?= =?iso-8859-1?Q?=22's?= message of "Sun, 05 Jan 2014 11:49:34 +0000") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (OS X 10.9.1) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 16346 Cc: 16346@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On 2014-01-05 19:49 +0800, Jo=E3o T=E1vora wrote: > Are you sure this is only with the new features? Yes. >> My impression is if a user didn't type ) it should not trigger >> post-self-insert-hook. WDYT? > > The idea of inserting matchers with > self-insert-command is to allow other hooks to run recursively, but it > has some problems as described by the FIXME's that I found before my > changes electric-pair-mode. But this may break the other half of stuff using post-self-insert-hook? > Indeed, it wasn't "self inserted" it, it was "electric > inserted". electric-pair--insert is this abstraction and it's used to > insert matchers. It does some rebinding of vars to keep other modes like > blink-matching-paren from interfering. Maybe eldoc-mode deserves a place > in there? > > (defun electric-pair--insert (char) > (let ((last-command-event char) > (blink-matching-paren nil) > (electric-pair-mode nil) > (eldoc-mode nil)) > (self-insert-command 1))) > > Haven't tested though... Will have little time the coming weeks, sorry. Add (eldoc-post-insert-mode nil) fixes this bug. Leo From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 05 14:27:42 2014 Received: (at 16346) by debbugs.gnu.org; 5 Jan 2014 19:27:42 +0000 Received: from localhost ([127.0.0.1]:36723 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VztMK-0006He-C2 for submit@debbugs.gnu.org; Sun, 05 Jan 2014 14:27:40 -0500 Received: from mail-wg0-f46.google.com ([74.125.82.46]:35763) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VztMH-0006HW-JR for 16346@debbugs.gnu.org; Sun, 05 Jan 2014 14:27:38 -0500 Received: by mail-wg0-f46.google.com with SMTP id m15so14875660wgh.13 for <16346@debbugs.gnu.org>; Sun, 05 Jan 2014 11:27:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=7/n7Rhi1gSmBQQKGiiudkxpeAK5iu8s1ZN5Tted3AFY=; b=Dn+BQSbEbi5XzhJm4WzpT84U8IcaEYbDXDQpiRwrSdIBnGEZBHj4sjFZLUJucvkWmT 4yHQ5ly3yWpA8eMnxR58chTUjVplnmd6ETLQjLY6qOTsY7ivYZiSlgXv2zee089zrI+j xmdmHVSYb6LBRqATOdA7gQ5YdXii3Pu6j8tmp2j1H2hFzk/04E0HMgA9LRPsMiOf/IEy YOO1QcOGabxmEJLuxYuusKIfJwVK7pqKb7eB0VUmXTDmL20lef66SYWCrqRjyaS6oORW +ePBsShveENFN5SQuUAwapqpMBj2lcVOifarpHsBjgnRxa2AeQ10tCNfbx9gWMyTXOAJ TWnw== X-Received: by 10.194.2.11 with SMTP id 11mr212429wjq.82.1388950056686; Sun, 05 Jan 2014 11:27:36 -0800 (PST) Received: from kitaj.yourcompany.com (66.207.108.93.rev.vodafone.pt. [93.108.207.66]) by mx.google.com with ESMTPSA id hv3sm14058292wib.5.2014.01.05.11.27.35 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 05 Jan 2014 11:27:35 -0800 (PST) From: joaotavora@gmail.com (=?utf-8?B?Sm/Do28gVMOhdm9yYQ==?=) To: Leo Liu Subject: Re: bug#16346: 24.3; electric-pair-mode close-paren issue References: <878uuuy7g1.fsf@gmail.com> Date: Sun, 05 Jan 2014 19:25:32 +0000 In-Reply-To: (Leo Liu's message of "Sun, 05 Jan 2014 23:30:47 +0800") Message-ID: <87d2k6temr.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 16346 Cc: 16346@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Leo Liu writes: >> Are you sure this is only with the new features? > Yes. Funny, `electric-pair--insert' was also being called with the previous `electric-pair-mode' to insert matchers and it didn't change. The previous version did sometimes match ( didn't it? :) > But this may break the other half of stuff using > post-self-insert-hook? Yes, more or less I think that was the gist of the FIXME notes that Stefan had added there. OTOH, it's useful, for example, when newlines are inserted. electric-indent-mode has a chance to kick in there. Let's look at this this way, if the user pressed `(', `)' and `C-b' in sucession, what would that "half of stuff" do? This is what electric-pair more or less emulates. On the other hand, we can decide to insert matchers using simple `insert'. Stefan any thoughts? > Add (eldoc-post-insert-mode nil) fixes this bug. Nice, looks good, maybe you could commit this and maybe add a test or two. I can only look at this at the end of the week, sorry. From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 05 18:13:37 2014 Received: (at 16346) by debbugs.gnu.org; 5 Jan 2014 23:13:37 +0000 Received: from localhost ([127.0.0.1]:37114 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vzwsz-000473-2u for submit@debbugs.gnu.org; Sun, 05 Jan 2014 18:13:37 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:15243) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vzwsx-00046q-BT for 16346@debbugs.gnu.org; Sun, 05 Jan 2014 18:13:35 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFG4rwsm/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDiYSFBgNJIgeBsEtkQoDiGGcGYFegxU X-IPAS-Result: Av4EABK/CFG4rwsm/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDiYSFBgNJIgeBsEtkQoDiGGcGYFegxU X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="44133889" Received: from 184-175-11-38.dsl.teksavvy.com (HELO fmsmemgm.homelinux.net) ([184.175.11.38]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 05 Jan 2014 18:13:29 -0500 Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id 34BECAEA58; Sun, 5 Jan 2014 18:13:28 -0500 (EST) From: Stefan Monnier To: Leo Liu Subject: Re: bug#16346: 24.3; electric-pair-mode close-paren issue Message-ID: References: <878uuuy7g1.fsf@gmail.com> Date: Sun, 05 Jan 2014 18:13:28 -0500 In-Reply-To: (Leo Liu's message of "Sun, 05 Jan 2014 23:30:47 +0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 16346 Cc: 16346@debbugs.gnu.org, =?windows-1252?B?Sm/jbyBU4XZvcmE=?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) > Add (eldoc-post-insert-mode nil) fixes this bug. FWIW, I find eldoc-post-insert-mode suffers from many problems. I'd appreciate if someone who likes eldoc-post-insert-mode explains to me the advantages it sees in comparison to the "default" post-command-hook mode, so we can maybe find a better way to get the same result. Stefan From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 05 19:48:34 2014 Received: (at 16346) by debbugs.gnu.org; 6 Jan 2014 00:48:34 +0000 Received: from localhost ([127.0.0.1]:37368 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VzyMs-0007wT-8x for submit@debbugs.gnu.org; Sun, 05 Jan 2014 19:48:34 -0500 Received: from mail-pa0-f41.google.com ([209.85.220.41]:49840) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VzyMq-0007wG-2L for 16346@debbugs.gnu.org; Sun, 05 Jan 2014 19:48:32 -0500 Received: by mail-pa0-f41.google.com with SMTP id lf10so17925389pab.14 for <16346@debbugs.gnu.org>; Sun, 05 Jan 2014 16:48:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:face:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=YmDZ9awHtI/8sHRa/aT34LYjTcNbqfTPsMJ1d3rlGVk=; b=bPdIkC20oJ+QWXIhAYE9l8sdPv7/7EbD+Wjj6ADRYbjMDKYl23y9kc5F1fZdjMo4kt 6uxQQ/TJUvowjnnxmfTEaKUAAQuuSZaiJQ11hCUH2meQSqVYpXbRHOh832qUPCoIIwi0 zbtTvWUPcz9uIUpdgS5dX0j/k+r+9/NhOlSR3ZEc99nc42pwsXXoFS9J3wdqudZX3auI iJOwZkLMJ3psMfkGohcbXvW0nlZhwFwhRxHFEwKVmmedKMa52doQUDDw4LaT9t9ehCbz BrqBTm2c3Hu0kav7WIzArd4s33+Ev0DpS8vcmu9fiEDAFLr+bfUGFC4sJPF5fJUsAf1N 5pdA== X-Received: by 10.68.230.137 with SMTP id sy9mr119544055pbc.126.1388969310979; Sun, 05 Jan 2014 16:48:30 -0800 (PST) Received: from localhost ([221.220.128.204]) by mx.google.com with ESMTPSA id qp15sm124519830pbb.2.2014.01.05.16.48.28 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 05 Jan 2014 16:48:30 -0800 (PST) From: Leo Liu To: Stefan Monnier Subject: Re: bug#16346: 24.3; electric-pair-mode close-paren issue References: <878uuuy7g1.fsf@gmail.com> Face: iVBORw0KGgoAAAANSUhEUgAAACkAAAApAQAAAACAGz1bAAABKElEQVQYlWNg3NIt5FDPUPt7 4+X79Qyucz5/ugik+L2PBgKpyphaIK921q23QDnG0NBQoMr/vaWl9f8ZLL78uPv5PwN7RETfzXoG jhmFz27XM0RXmpuY/WfY+fv0Mc56BvFybfXA/wwL5t/wF61n2PU59axXPcOVzbmSW/8zrNt1benC /ww70hqUU/4zKCtrT9jwn8FhwynbufUMendE2aLqGRpdX9al1zM8eh17lKeeQcTMrdD5P8P3j/YT Q/8zXHSb7p1Qz/C4OM2JuZ7hgtI7K6AjqsMnf8j4z8C6xG1tw3+GqpqvsVn/GTzmpD9j/8/wP/oZ S/l/Bka+QO/g/wy15ueeFQL9N1O8mPU/g+umV3t1gdT0/1bTgHLqYVeXAlWKpMWt+w8Az82C9nHf X0cAAAAASUVORK5CYII= Date: Mon, 06 Jan 2014 08:48:24 +0800 In-Reply-To: (Stefan Monnier's message of "Sun, 05 Jan 2014 18:13:28 -0500") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (OS X 10.9.1) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 16346 Cc: 16346@debbugs.gnu.org, =?iso-8859-1?Q?Jo=E3o_T=E1vora?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On 2014-01-06 07:13 +0800, Stefan Monnier wrote: > FWIW, I find eldoc-post-insert-mode suffers from many problems. > I'd appreciate if someone who likes eldoc-post-insert-mode explains to > me the advantages it sees in comparison to the "default" > post-command-hook mode, so we can maybe find a better way to get the > same result. I might be the only one using it (exclusively) :( but I am open to change. The idea behind eldoc-post-insert-mode is not to show the eldoc messages all the time which can be kinda distracting. Some editing environments (maybe Matlab) also only show the arglist after inserting (. In general I find the arglist (eldoc) most useful when editing text. When browsing code it is most of the time easy to guess from context. Also getting the arglist can be expensive. For example in octave it has to ask the running process (which can get stuck when the process is in the middle of doing something else). In other cases it has to make remote calls. Leo From debbugs-submit-bounces@debbugs.gnu.org Thu Jan 09 11:12:53 2014 Received: (at 16346) by debbugs.gnu.org; 9 Jan 2014 16:12:53 +0000 Received: from localhost ([127.0.0.1]:44071 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W1IE0-0000bB-Az for submit@debbugs.gnu.org; Thu, 09 Jan 2014 11:12:53 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:30715) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W1IDw-0000ay-J1 for 16346@debbugs.gnu.org; Thu, 09 Jan 2014 11:12:49 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFFFxKG9/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDiYSFBgNJIgeBsEtkQoDiGGcGYFegxU X-IPAS-Result: Av4EABK/CFFFxKG9/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDiYSFBgNJIgeBsEtkQoDiGGcGYFegxU X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="44565541" Received: from 69-196-161-189.dsl.teksavvy.com (HELO pastel.home) ([69.196.161.189]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 09 Jan 2014 11:12:48 -0500 Received: by pastel.home (Postfix, from userid 20848) id ECAC1603C4; Thu, 9 Jan 2014 11:12:47 -0500 (EST) From: Stefan Monnier To: Leo Liu Subject: Re: bug#16346: 24.3; electric-pair-mode close-paren issue Message-ID: References: <878uuuy7g1.fsf@gmail.com> Date: Thu, 09 Jan 2014 11:12:47 -0500 In-Reply-To: (Leo Liu's message of "Mon, 06 Jan 2014 08:48:24 +0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 16346 Cc: 16346@debbugs.gnu.org, =?windows-1252?B?Sm/jbyBU4XZvcmE=?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) > The idea behind eldoc-post-insert-mode is not to show the eldoc messages > all the time which can be kinda distracting. Some editing environments > (maybe Matlab) also only show the arglist after inserting (. But you can get the same result with suitable use of eldoc-remove-command. > In general I find the arglist (eldoc) most useful when editing text. Agreed. But I usually need it *just before* typing. IOW, I navigate to the point where I want to write, then look at the eldoc info, then start typing. Sometimes the navigation is not in eldoc-message-commands, so I need to do something like "C-b C-f" to get eldoc to come up, but with eldoc-post-insert-mode it's worse, because the obvious "equivalent" of "SPC DEL" does not end with a self-insert so I need to do SPC, then read eldoc, then DEL which I find even more annoying. > Also getting the arglist can be expensive. For example in octave it has > to ask the running process (which can get stuck when the process is in > the middle of doing something else). In other cases it has to make > remote calls. Not sure why that's relevant. Stefan From debbugs-submit-bounces@debbugs.gnu.org Thu Jan 09 22:24:36 2014 Received: (at 16346) by debbugs.gnu.org; 10 Jan 2014 03:24:36 +0000 Received: from localhost ([127.0.0.1]:44528 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W1Si3-00057H-GY for submit@debbugs.gnu.org; Thu, 09 Jan 2014 22:24:36 -0500 Received: from mail-pb0-f51.google.com ([209.85.160.51]:52060) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W1Shz-000577-Tx for 16346@debbugs.gnu.org; Thu, 09 Jan 2014 22:24:32 -0500 Received: by mail-pb0-f51.google.com with SMTP id up15so3882722pbc.38 for <16346@debbugs.gnu.org>; Thu, 09 Jan 2014 19:24:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:face:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=uGUhSNWueQjnx2WiQd85Rn9bH8bQpS94KMfr66afwjE=; b=B9cMVT62WoWyBEwvTrNQkpVPjBTXiJawShnFE/vFDOu0tSs/rp/kvHTNKlchPW/Y2l jA9YWSe1A7Ic9v9N5d4qECHnCXWpTg82V5a7G1EJHyVZ4i03mFyBSmWFOvChBqyEl6Z6 8XzkELOw+9ITdYJMsf7Mus7NHZmcJBphN8qwGy7gSddD+CtLnVlkb0Q2t9auYGHwBPHp zX65rnbX33sWqLvai8rrCPR8/L2g/J8VYkxhJekaypncc3kxOOTb2FzLikFw41/6TkKf w4OpgLiW8hZB1Irs+Gjht2QfPqYHQPZJhllccHyXZItWwHharGaKgBU2Fw0BiIF5dtB7 jZPQ== X-Received: by 10.69.8.225 with SMTP id dn1mr8176739pbd.54.1389324270902; Thu, 09 Jan 2014 19:24:30 -0800 (PST) Received: from Zeuss-MacBook.local ([221.217.244.203]) by mx.google.com with ESMTPSA id ao1sm13465008pbc.18.2014.01.09.19.24.27 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Jan 2014 19:24:29 -0800 (PST) From: Leo Liu To: Stefan Monnier Subject: Re: bug#16346: 24.3; electric-pair-mode close-paren issue References: <878uuuy7g1.fsf@gmail.com> Face: iVBORw0KGgoAAAANSUhEUgAAACkAAAApAQAAAACAGz1bAAABKElEQVQYlWNg3NIt5FDPUPt7 4+X79Qyucz5/ugik+L2PBgKpyphaIK921q23QDnG0NBQoMr/vaWl9f8ZLL78uPv5PwN7RETfzXoG jhmFz27XM0RXmpuY/WfY+fv0Mc56BvFybfXA/wwL5t/wF61n2PU59axXPcOVzbmSW/8zrNt1benC /ww70hqUU/4zKCtrT9jwn8FhwynbufUMendE2aLqGRpdX9al1zM8eh17lKeeQcTMrdD5P8P3j/YT Q/8zXHSb7p1Qz/C4OM2JuZ7hgtI7K6AjqsMnf8j4z8C6xG1tw3+GqpqvsVn/GTzmpD9j/8/wP/oZ S/l/Bka+QO/g/wy15ueeFQL9N1O8mPU/g+umV3t1gdT0/1bTgHLqYVeXAlWKpMWt+w8Az82C9nHf X0cAAAAASUVORK5CYII= Date: Fri, 10 Jan 2014 11:24:24 +0800 In-Reply-To: (Stefan Monnier's message of "Thu, 09 Jan 2014 11:12:47 -0500") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (OS X 10.9.1) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 16346 Cc: 16346@debbugs.gnu.org, =?iso-8859-1?Q?Jo=E3o_T=E1vora?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On 2014-01-10 00:12 +0800, Stefan Monnier wrote: > But you can get the same result with suitable use of eldoc-remove-command. But in case of a read-only buffer, one may want the normal eldoc to show arglist. So there is two use cases: one when editing and the other when reading others code. I only enable eldoc-mode manually i.e. M-x eldoc-mode when I need it. >> In general I find the arglist (eldoc) most useful when editing text. > > Agreed. But I usually need it *just before* typing. IOW, I navigate to > the point where I want to write, then look at the eldoc info, then start > typing. Sometimes the navigation is not in eldoc-message-commands, so > I need to do something like "C-b C-f" to get eldoc to come up, but with > eldoc-post-insert-mode it's worse, because the obvious "equivalent" of > "SPC DEL" does not end with a self-insert so I need to do SPC, then read > eldoc, then DEL which I find even more annoying. But then when you go anywhere that you don't want to edit code (such as just to copy some text) eldoc also prints the arglist. The latter happens more often in my editing habit that it can be annoying. But maybe eldoc-post-insert-mode (maybe even a new name eldoc-edit-mode?) can check on char changes instead? Is this better? >> Also getting the arglist can be expensive. For example in octave it has >> to ask the running process (which can get stuck when the process is in >> the middle of doing something else). In other cases it has to make >> remote calls. > > Not sure why that's relevant. For example, if a heavy job is running in the inferior octave buffer, one normally don't want any movement to send a request to it asking for arglist. It is my impression that eldoc might do that. Leo From debbugs-submit-bounces@debbugs.gnu.org Thu Jan 09 23:11:39 2014 Received: (at 16346) by debbugs.gnu.org; 10 Jan 2014 04:11:39 +0000 Received: from localhost ([127.0.0.1]:44553 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W1TRa-0006aU-JI for submit@debbugs.gnu.org; Thu, 09 Jan 2014 23:11:38 -0500 Received: from mail-pb0-f53.google.com ([209.85.160.53]:56453) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W1TRZ-0006aK-D9 for 16346@debbugs.gnu.org; Thu, 09 Jan 2014 23:11:37 -0500 Received: by mail-pb0-f53.google.com with SMTP id ma3so3907199pbc.12 for <16346@debbugs.gnu.org>; Thu, 09 Jan 2014 20:11:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:face:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=aftPYWWUCbTxtYIJG0ChXCYOxFSepButT5k1IptZmyI=; b=tcvTasHYCm9+/JietF9PaIRHwq639zmOfMQ80mxAn23MBpeMflZVnC8mQ9Ch41KdPy mCChJkcDJsxAwUSdEawEnCfC2rG0jJYBcm6PVsYFcoVxvKTC5uO99zTGkQ7Oh99dxec1 FFwEOJguciv+RakwAV7+bSlGMitNyjTXPRnH3LTon5EhnVzoHyA3a/A/LBqTPPEoAMiJ OC1tNSnQLci9kFCqV7XXURjyC0IxAw7Z8a2mtIAI2elRyCzeYekoVUwpP9//uzGLBUy6 8DuQ83oXA3hLm0BIVKbb5Z7bZMTefVuaq1CzO6oJqDbhlAP6CZyfxnj2xDIt6T3dnsnG wj7A== X-Received: by 10.67.3.68 with SMTP id bu4mr8321288pad.144.1389327096620; Thu, 09 Jan 2014 20:11:36 -0800 (PST) Received: from Zeuss-MacBook.local ([221.217.244.203]) by mx.google.com with ESMTPSA id pq1sm13722068pbc.8.2014.01.09.20.11.33 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Jan 2014 20:11:36 -0800 (PST) From: Leo Liu To: Stefan Monnier Subject: Re: bug#16346: 24.3; electric-pair-mode close-paren issue References: <878uuuy7g1.fsf@gmail.com> Face: iVBORw0KGgoAAAANSUhEUgAAACgAAAAoAgMAAADxkFD+AAAADFBMVEUvT09qWs3/pQD///+J kUVcAAAAAWJLR0QAiAUdSAAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9cBBwMLOd3veKQA AACuSURBVBjTldE9CgIxEAXgB+lEyFUC2wo5ikdZ8DSypxhMY7H9VuIVwlqkGRgnm59VsHGafIQ3 CZlAtmKIRaHETgYa12lqvEsPYKf8wXHsPGfqPaUM0g9aJPKFXkmNQmSDqwzz4Fpgpz+6WAPY2z5o uPJJpu0uypcl4nyCibMLQ8lCiVjayLoQvw5LsVKQuHPRR958HZbOcVsKeepcLxpByjycGvnKmY+c MBvrtyjfe0vmuLvdq/kAAAAASUVORK5CYII= Date: Fri, 10 Jan 2014 12:11:26 +0800 In-Reply-To: (Leo Liu's message of "Fri, 10 Jan 2014 11:24:24 +0800") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (OS X 10.9.1) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 16346 Cc: 16346@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On 2014-01-10 11:24 +0800, Leo Liu wrote: > But maybe eldoc-post-insert-mode (maybe even a new name > eldoc-edit-mode?) can check on char changes instead? Is this better? Stefan, do you think this is better? With the following patch, eldoc-edit-mode no longer depends on post-self-insert-hook. diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el index 3a7f08f5..1da6c0ab 100644 --- a/lisp/emacs-lisp/eldoc.el +++ b/lisp/emacs-lisp/eldoc.el @@ -173,19 +173,29 @@ (define-minor-mode eldoc-mode (remove-hook 'post-command-hook 'eldoc-schedule-timer) (remove-hook 'pre-command-hook 'eldoc-pre-command-refresh-echo-area))) +(defvar-local eldoc-edit-should-print nil) + +(defun eldoc-after-change (beg end len) + (and (or (> len 0) (and (zerop len) (> end beg))) + (setq eldoc-edit-should-print t))) + ;;;###autoload -(define-minor-mode eldoc-post-insert-mode nil +(define-minor-mode eldoc-edit-mode nil :group 'eldoc :lighter (:eval (if eldoc-mode "" - (concat eldoc-minor-mode-string "|i"))) + (concat eldoc-minor-mode-string "|e"))) (setq eldoc-last-message nil) (let ((prn-info (lambda () - (unless eldoc-mode - (eldoc-print-current-symbol-info))))) - (if eldoc-post-insert-mode - (add-hook 'post-self-insert-hook prn-info nil t) - (remove-hook 'post-self-insert-hook prn-info t)))) + (when (and (not eldoc-mode) eldoc-edit-should-print) + (ignore-errors (eldoc-print-current-symbol-info)) + (setq eldoc-edit-should-print nil))))) + (if eldoc-edit-mode + (progn + (add-hook 'post-command-hook prn-info nil t) + (add-hook 'after-change-functions 'eldoc-after-change nil t)) + (remove-hook 'post-command-hook prn-info t) + (remove-hook 'after-change-functions 'eldoc-after-change t)))) -(add-hook 'eval-expression-minibuffer-setup-hook 'eldoc-post-insert-mode) +(add-hook 'eval-expression-minibuffer-setup-hook 'eldoc-edit-mode) ;;;###autoload (defun turn-on-eldoc-mode () @@ -309,7 +319,7 @@ (defvar eldoc-documentation-function nil (defun eldoc-print-current-symbol-info () (condition-case err - (and (or (eldoc-display-message-p) eldoc-post-insert-mode) + (and (or (eldoc-display-message-p) eldoc-edit-mode) (if eldoc-documentation-function (eldoc-message (funcall eldoc-documentation-function)) (let* ((current-symbol (eldoc-current-symbol)) From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 10 09:14:11 2014 Received: (at 16346) by debbugs.gnu.org; 10 Jan 2014 14:14:11 +0000 Received: from localhost ([127.0.0.1]:44869 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W1cqg-00015I-Jo for submit@debbugs.gnu.org; Fri, 10 Jan 2014 09:14:10 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:51156) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W1cqe-00015A-Fl for 16346@debbugs.gnu.org; Fri, 10 Jan 2014 09:14:09 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFFFxKG9/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDiYSFBgNJIgeBsEtkQoDiGGcGYFegxU X-IPAS-Result: Av4EABK/CFFFxKG9/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDiYSFBgNJIgeBsEtkQoDiGGcGYFegxU X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="44638875" Received: from 69-196-161-189.dsl.teksavvy.com (HELO pastel.home) ([69.196.161.189]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 10 Jan 2014 09:14:07 -0500 Received: by pastel.home (Postfix, from userid 20848) id 444916045A; Fri, 10 Jan 2014 09:14:07 -0500 (EST) From: Stefan Monnier To: Leo Liu Subject: Re: bug#16346: 24.3; electric-pair-mode close-paren issue Message-ID: References: <878uuuy7g1.fsf@gmail.com> Date: Fri, 10 Jan 2014 09:14:07 -0500 In-Reply-To: (Leo Liu's message of "Fri, 10 Jan 2014 11:24:24 +0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 16346 Cc: 16346@debbugs.gnu.org, =?windows-1252?B?Sm/jbyBU4XZvcmE=?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) >> But you can get the same result with suitable use of eldoc-remove-command. > But in case of a read-only buffer, one may want the normal eldoc to show > arglist. So there is two use cases: one when editing and the other when > reading others code. I only enable eldoc-mode manually i.e. M-x > eldoc-mode when I need it. So you want an eldoc-subdued-mode which only gives you info in some very restricted cases (e.g. self-insert-command) and which you can dynamically enable/disable in specific buffers. Making eldoc-message-commands buffer-local would let us do that fairly easily. > But then when you go anywhere that you don't want to edit code (such as > just to copy some text) eldoc also prints the arglist. Right. And it doesn't bother me because if I don't want to see the eldoc info, I just don't look at the echo area. > The latter happens more often in my editing habit that it can > be annoying. We obviously have different tastes/habits ;-) > But maybe eldoc-post-insert-mode (maybe even a new name > eldoc-edit-mode?) can check on char changes instead? I don't understand what you mean by "char changes". Ah, you mean using an after-change-function? I don't really like that. I'm not sure what problem it is supposed to avoid. >>> Also getting the arglist can be expensive. For example in octave it has >>> to ask the running process (which can get stuck when the process is in >>> the middle of doing something else). In other cases it has to make >>> remote calls. >> Not sure why that's relevant. > For example, if a heavy job is running in the inferior octave buffer, > one normally don't want any movement to send a request to it asking for > arglist. But neither do you want to send such a request just because you inserted a char. So, the problem really applies to bother cases. I find it hard to believe that the problem would really be much more serious in one case then in the other: either it's serious in both cases, or it's bearable in both cases. Stefan PS: I think some version of eldoc-mode should be enabled by default. It's too late for 24.4, but: for the one after. From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 10 11:46:49 2014 Received: (at 16346) by debbugs.gnu.org; 10 Jan 2014 16:46:49 +0000 Received: from localhost ([127.0.0.1]:45416 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W1fEP-0005cR-4A for submit@debbugs.gnu.org; Fri, 10 Jan 2014 11:46:49 -0500 Received: from mail-pd0-f177.google.com ([209.85.192.177]:48083) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W1fEN-0005bx-2d for 16346@debbugs.gnu.org; Fri, 10 Jan 2014 11:46:47 -0500 Received: by mail-pd0-f177.google.com with SMTP id q10so4721873pdj.8 for <16346@debbugs.gnu.org>; Fri, 10 Jan 2014 08:46:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:face:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=TNyrkTdJZJLXKWjD/mwleNlHON2bTJuxegO4foZZQJs=; b=RXxMe3QL/N9nVcoEMX2vwnc4VoP/Sj8uCLCr5amYJq2idHjAT3BIV+WOFEiaUta0hU kyysRLwuTPAPkUYZdgK5Ik8qKBy5dh2dwLADcdlmT9+kz5jOVeeyD5KIco02DoHjqhPS RonNdsUKOKUSZM2XnFZOe7neBOFhE3nu3UySq6Y+Dwh7y+USpilwxJGSMKcRUth/ARHY e4Yv6r6yqLyqLwmEIBUf8bTdDFKiYKXtXpB8WYxktoi/bUskzhdSfZlONwmKSgPNoqg2 tn/+L+oZ4fYX8pbgSTSwfHEC3j+bT7+q0UNYb7GyA/S8gPRAmvfINWMNHcmtptWeSl0i /hHQ== X-Received: by 10.68.203.197 with SMTP id ks5mr12746021pbc.14.1389372405601; Fri, 10 Jan 2014 08:46:45 -0800 (PST) Received: from Zeuss-MacBook.local ([123.119.85.96]) by mx.google.com with ESMTPSA id qz9sm18687897pbc.3.2014.01.10.08.46.42 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Jan 2014 08:46:44 -0800 (PST) From: Leo Liu To: Stefan Monnier Subject: Re: bug#16346: 24.3; electric-pair-mode close-paren issue References: <878uuuy7g1.fsf@gmail.com> Face: iVBORw0KGgoAAAANSUhEUgAAACgAAAAoBAMAAAB+0KVeAAAAGFBMVEUzRVhbQj4eZqO6SjnT eWpxnMetm5b6/PmidmqrAAAAAWJLR0QAiAUdSAAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1F B9cBBwMLBfKABCMAAAFoSURBVCjPtZI9a8MwEIaFoc7aYDdelQMna0Em3tsSr0XUeE2Q6a22a+v+ fk8fSSBkbDUI6dHpfe9OEvRgiD+ApqKPJgJeB6iUUXWESjUe/ig38AJrhqqvaU2nTIXbNvOQ40fe qdry4kyGoVWsfCQalXpHnJGM01wjWdYbMlXNFdsZDO69m9aqNqxEJqTEgbM5OF7wlEfIoll1Ked4 LbM5X2EdILLokEdmI8z7g5cKED0cuTC930TYhy7ZDekkXVGw/L60TguJePPxcJF48lpsSUWEA/Ju jGFNgJOXc4Hz7TmAdBeu5Ve4AEjOi2/2jfd3cAJZ+IbNrvdjgBZY01b+HTuG3cLws6BJZqVOj/pp T0OqVwx3rFq+QmJwx3loK5JSLEhDIt62+mtC2C+SrAUxEbV6C6v2BRbd6pILBKFpepKZJHgGgrKF sptSUUoczpwg2pQ7ZH1tgs0ou/917mzz6Cs2//C978cv5l07L02orIEAAAAASUVORK5CYII= Date: Sat, 11 Jan 2014 00:46:37 +0800 In-Reply-To: (Stefan Monnier's message of "Fri, 10 Jan 2014 09:14:07 -0500") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (OS X 10.9.1) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 16346 Cc: 16346@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) On 2014-01-10 22:14 +0800, Stefan Monnier wrote: > So you want an eldoc-subdued-mode which only gives you info in some very > restricted cases (e.g. self-insert-command) and which you can > dynamically enable/disable in specific buffers. > > Making eldoc-message-commands buffer-local would let us do that fairly easily. > >> But then when you go anywhere that you don't want to edit code (such as >> just to copy some text) eldoc also prints the arglist. > > Right. And it doesn't bother me because if I don't want to see the > eldoc info, I just don't look at the echo area. I haven't built that habit. If there is nothing to show in the status area show nothing which is what I expect. In practice, even if my eyes don't literally look at the echo area, they still grab a bit of my attention. > We obviously have different tastes/habits ;-) > >> But maybe eldoc-post-insert-mode (maybe even a new name >> eldoc-edit-mode?) can check on char changes instead? > > I don't understand what you mean by "char changes". > Ah, you mean using an after-change-function? I don't really like that. > I'm not sure what problem it is supposed to avoid. The SPC DEL thing that you mentioned and this bug. [snipped 9 lines] > But neither do you want to send such a request just because you inserted > a char. So, the problem really applies to bother cases. I find it hard > to believe that the problem would really be much more serious in one > case then in the other: either it's serious in both cases, or it's > bearable in both cases. > > > Stefan > > > PS: I think some version of eldoc-mode should be enabled by default. > It's too late for 24.4, but: for the one after. OK I don't mind taking eldoc-post-insert-mode out completely. Let me know if you want me to. It is new in 24.4 so better go now if it has to go. I can put it in my init file if I need it. Leo From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 10 12:20:53 2014 Received: (at 16346) by debbugs.gnu.org; 10 Jan 2014 17:20:53 +0000 Received: from localhost ([127.0.0.1]:45435 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W1flM-0006nC-SM for submit@debbugs.gnu.org; Fri, 10 Jan 2014 12:20:53 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:12019) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W1flK-0006n0-Kp for 16346@debbugs.gnu.org; Fri, 10 Jan 2014 12:20:51 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFFFxKG9/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDiYSFBgNJIgeBsEtkQoDiGGcGYFegxU X-IPAS-Result: Av4EABK/CFFFxKG9/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDiYSFBgNJIgeBsEtkQoDiGGcGYFegxU X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="44658136" Received: from 69-196-161-189.dsl.teksavvy.com (HELO pastel.home) ([69.196.161.189]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 10 Jan 2014 12:20:49 -0500 Received: by pastel.home (Postfix, from userid 20848) id 850166045A; Fri, 10 Jan 2014 12:20:49 -0500 (EST) From: Stefan Monnier To: Leo Liu Subject: Re: bug#16346: 24.3; electric-pair-mode close-paren issue Message-ID: References: <878uuuy7g1.fsf@gmail.com> Date: Fri, 10 Jan 2014 12:20:49 -0500 In-Reply-To: (Leo Liu's message of "Sat, 11 Jan 2014 00:46:37 +0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 16346 Cc: 16346@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) >>> But maybe eldoc-post-insert-mode (maybe even a new name >>> eldoc-edit-mode?) can check on char changes instead? >> I don't understand what you mean by "char changes". >> Ah, you mean using an after-change-function? I don't really like that. >> I'm not sure what problem it is supposed to avoid. > The SPC DEL thing that you mentioned Ah, right, it would cause the DEL to also emit the eldoc info. > and this bug. Using a buffer-local eldoc-message-commands which only contains self-insert-command would also fix this bug. > OK I don't mind taking eldoc-post-insert-mode out completely. Let me > know if you want me to. It is new in 24.4 so better go now if it has to > go. I can put it in my init file if I need it. I think the idea is fine, but using post-self-insert-hook turns out to be a bad idea, I think (tho I liked it, initially). Could you try and re-implement it as a minor mode that enables eldoc-mode and tweaks eldoc-message-commands buffer-locally, to see if that works better? Stefan From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 10 23:38:41 2014 Received: (at 16346) by debbugs.gnu.org; 11 Jan 2014 04:38:41 +0000 Received: from localhost ([127.0.0.1]:45928 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W1qLI-0002Sx-Il for submit@debbugs.gnu.org; Fri, 10 Jan 2014 23:38:41 -0500 Received: from mail-pa0-f47.google.com ([209.85.220.47]:36181) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W1qLF-0002Sl-Sf for 16346@debbugs.gnu.org; Fri, 10 Jan 2014 23:38:38 -0500 Received: by mail-pa0-f47.google.com with SMTP id kq14so5581224pab.20 for <16346@debbugs.gnu.org>; Fri, 10 Jan 2014 20:38:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:face:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=x8naBFeGiCpZlmmbCErdydQLnKdL2Onqr6uiSxUyZZg=; b=uLMR+1DusKlan9Di315UcNkY1fctA4r2Mdu2DtjWptMFV5xhX7oDTXEtICjtFMx4da 1Tlrrk/xJO4u604WxeZK/54+hEowMOCucIi1M0WoAFBKqup2rgg0Udk4YeQC3jfIXWac SqeMhiUsLyk638Lnggp2fVH47ASCQ0bYxDQAFzkPwCEIVs9HSFuTUbZM4DJIIixfiyhk 21L51/b1UeJ4zzl5a8ze0l1vtIa0BRIDsk2/O1++YF5lQsRjSNWj2VtOIyq4eN77cHAz hvPX5x48IEI23/l8C8wQdjLYdzzh6ykRo9pWZKv0J6EVqgDnPWyXe8Y3vr4LKF+3rBEF AYLg== X-Received: by 10.66.248.227 with SMTP id yp3mr16055080pac.116.1389415116928; Fri, 10 Jan 2014 20:38:36 -0800 (PST) Received: from Zeuss-MacBook.local ([123.119.85.96]) by mx.google.com with ESMTPSA id dq3sm21187570pbc.35.2014.01.10.20.38.34 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Jan 2014 20:38:36 -0800 (PST) From: Leo Liu To: Stefan Monnier Subject: Re: bug#16346: 24.3; electric-pair-mode close-paren issue References: <878uuuy7g1.fsf@gmail.com> Face: iVBORw0KGgoAAAANSUhEUgAAACgAAAAoBAMAAAB+0KVeAAAAElBMVEUAAAAAAP+LRRP0pGC+ vr7///+7mT1iAAAAAWJLR0QAiAUdSAAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9cBBwMO DhglKe4AAAEsSURBVCjPbZNBboQwDEV/Cd4X9QJRThApmn0XYW+Jyf2v0m+HhqDBgiAe9rcTG7QH w/1Vn2Ar8gBb/ocywSN3qK9T3z4eFDB4eApocBpeBs1RSykoJd8gQcm8pGmHXFso3ajnmsqV0TnY DQkOfXUfN5NwaI7AWTVOyEhcu1aHmdWItHddUVUcUgUBCkitu8V6ditHVOVdqzl2EQ1ZVGTbdK0V 7cqn8vWzoU5Q/bF9Y/Y0cRU1xwkys5dJ+Dt6pBDWifcNQml8Gh2JVmPSoQzo7en0grswkxrUGYJ7 0hSxxAGr7ZMwYcHIzprpi7TENEE1xtiYxixRlCfPBsUUrwHD7uGIwATrbnODJcVrPpVn3hxiGloe m/S+z3CtuzUSMo83N4DPH+F0evwR3P4A2k+75838OKQAAAAASUVORK5CYII= Date: Sat, 11 Jan 2014 12:38:31 +0800 In-Reply-To: (Stefan Monnier's message of "Fri, 10 Jan 2014 12:20:49 -0500") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (OS X 10.9.1) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 16346 Cc: 16346@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On 2014-01-11 01:20 +0800, Stefan Monnier wrote: > I think the idea is fine, but using post-self-insert-hook turns out to > be a bad idea, I think (tho I liked it, initially). > Could you try and re-implement it as a minor mode that enables > eldoc-mode and tweaks eldoc-message-commands buffer-locally, to see if > that works better? The following patch seems to do it. Comments? === modified file 'lisp/emacs-lisp/eldoc.el' --- lisp/emacs-lisp/eldoc.el 2014-01-06 23:34:05 +0000 +++ lisp/emacs-lisp/eldoc.el 2014-01-11 04:31:35 +0000 @@ -62,6 +62,11 @@ :type 'number :group 'eldoc) +(defcustom eldoc-print-after-edit nil + "If non-nil eldoc info is only shown when editing." + :type 'boolean + :group 'eldoc) + ;;;###autoload (defcustom eldoc-minor-mode-string (purecopy " ElDoc") "String to display in mode line when ElDoc Mode is enabled; nil for none." @@ -150,6 +155,16 @@ "The function used by `eldoc-message' to display messages. It should receive the same arguments as `message'.") +(defvar eldoc-edit-message-commands + (let ((cmds (make-vector 31 0)) + (re (regexp-opt '("delete" "insert" "edit" "electric" "newline")))) + (mapatoms (lambda (s) + (and (commandp s) + (string-match re (symbol-name s)) + (intern (symbol-name s) cmds))) + obarray) + cmds)) + ;;;###autoload (define-minor-mode eldoc-mode @@ -168,25 +183,13 @@ (setq eldoc-last-message nil) (if eldoc-mode (progn + (when eldoc-print-after-edit + (setq-local eldoc-message-commands eldoc-edit-message-commands)) (add-hook 'post-command-hook 'eldoc-schedule-timer nil t) (add-hook 'pre-command-hook 'eldoc-pre-command-refresh-echo-area t)) - (remove-hook 'post-command-hook 'eldoc-schedule-timer) - (remove-hook 'pre-command-hook 'eldoc-pre-command-refresh-echo-area))) - -;;;###autoload -(define-minor-mode eldoc-post-insert-mode nil - :group 'eldoc :lighter (:eval (if eldoc-mode "" - (concat eldoc-minor-mode-string "|i"))) - (setq eldoc-last-message nil) - (let ((prn-info (lambda () - (unless eldoc-mode - (eldoc-print-current-symbol-info))))) - (if eldoc-post-insert-mode - (add-hook 'post-self-insert-hook prn-info nil t) - (remove-hook 'post-self-insert-hook prn-info t)))) - -;; FIXME: This changes Emacs's behavior when the file is loaded! -(add-hook 'eval-expression-minibuffer-setup-hook 'eldoc-post-insert-mode) + (kill-local-variable 'eldoc-message-commands) + (remove-hook 'post-command-hook 'eldoc-schedule-timer t) + (remove-hook 'pre-command-hook 'eldoc-pre-command-refresh-echo-area t))) ;;;###autoload (defun turn-on-eldoc-mode () @@ -264,8 +267,10 @@ ;; This doesn't seem to be required for Emacs 19.28 and earlier. (defun eldoc-pre-command-refresh-echo-area () (and eldoc-last-message - (if (eldoc-display-message-no-interference-p) - (eldoc-message eldoc-last-message) + (if (and (eldoc-display-message-no-interference-p) + (symbolp this-command) + (intern-soft (symbol-name this-command) eldoc-message-commands)) + (eldoc-message eldoc-last-message) (setq eldoc-last-message nil)))) ;; Decide whether now is a good time to display a message. @@ -283,9 +288,7 @@ ;; Check various conditions about the current environment that might make ;; it undesirable to print eldoc messages right this instant. (defun eldoc-display-message-no-interference-p () - (and eldoc-mode - (not executing-kbd-macro) - (not (and (boundp 'edebug-active) edebug-active)))) + (not (or executing-kbd-macro (bound-and-true-p edebug-active)))) ;;;###autoload @@ -309,7 +312,7 @@ ;; This is run from post-command-hook or some idle timer thing, ;; so we need to be careful that errors aren't ignored. (with-demoted-errors "eldoc error: %s" - (and (or (eldoc-display-message-p) eldoc-post-insert-mode) + (and (eldoc-display-message-p) (if eldoc-documentation-function (eldoc-message (funcall eldoc-documentation-function)) (let* ((current-symbol (eldoc-current-symbol)) === modified file 'lisp/simple.el' --- lisp/simple.el 2014-01-09 01:59:19 +0000 +++ lisp/simple.el 2014-01-11 04:28:32 +0000 @@ -1387,6 +1387,7 @@ (lambda () (add-hook 'completion-at-point-functions #'lisp-completion-at-point nil t) + (eldoc-mode 1) (run-hooks 'eval-expression-minibuffer-setup-hook)) (read-from-minibuffer prompt initial-contents read-expression-map t From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 11 00:35:28 2014 Received: (at 16346) by debbugs.gnu.org; 11 Jan 2014 05:35:28 +0000 Received: from localhost ([127.0.0.1]:45962 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W1rEF-00047I-Tm for submit@debbugs.gnu.org; Sat, 11 Jan 2014 00:35:28 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:43329) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W1rED-000478-HE for 16346@debbugs.gnu.org; Sat, 11 Jan 2014 00:35:26 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFFFxKG9/2dsb2JhbABEvw4Xc4IeAQEEAVYjEAsOJhIUGA0kiB4GwS2RCgOIYZwZgV6DFQ X-IPAS-Result: Av4EABK/CFFFxKG9/2dsb2JhbABEvw4Xc4IeAQEEAVYjEAsOJhIUGA0kiB4GwS2RCgOIYZwZgV6DFQ X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="44709903" Received: from 69-196-161-189.dsl.teksavvy.com (HELO pastel.home) ([69.196.161.189]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 11 Jan 2014 00:35:24 -0500 Received: by pastel.home (Postfix, from userid 20848) id A30426045A; Sat, 11 Jan 2014 00:35:24 -0500 (EST) From: Stefan Monnier To: Leo Liu Subject: Re: bug#16346: 24.3; electric-pair-mode close-paren issue Message-ID: References: <878uuuy7g1.fsf@gmail.com> Date: Sat, 11 Jan 2014 00:35:24 -0500 In-Reply-To: (Leo Liu's message of "Sat, 11 Jan 2014 12:38:31 +0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 16346 Cc: 16346@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) >> I think the idea is fine, but using post-self-insert-hook turns out to >> be a bad idea, I think (tho I liked it, initially). >> Could you try and re-implement it as a minor mode that enables >> eldoc-mode and tweaks eldoc-message-commands buffer-locally, to see if >> that works better? > The following patch seems to do it. Comments? Looks good from here. How do you like its behavior? Stefan From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 11 01:11:49 2014 Received: (at 16346) by debbugs.gnu.org; 11 Jan 2014 06:11:49 +0000 Received: from localhost ([127.0.0.1]:45972 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W1rnQ-0005AC-TJ for submit@debbugs.gnu.org; Sat, 11 Jan 2014 01:11:49 -0500 Received: from mail-pb0-f43.google.com ([209.85.160.43]:45800) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W1rnO-0005A2-4N for 16346@debbugs.gnu.org; Sat, 11 Jan 2014 01:11:47 -0500 Received: by mail-pb0-f43.google.com with SMTP id rq2so5331016pbb.2 for <16346@debbugs.gnu.org>; Fri, 10 Jan 2014 22:11:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:face:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=mc5Lccsgbxt3PTLRDxqlOJ6fYs+Mx6iwRKo9JUGsrkU=; b=KzCCK5t3L4hWrKXVM1guZQAK3MlJyxshfs4yyM3Nzfyxxvu/JTdX4yO+JWG4vNOw+H Ly//nRo4TK7QiVWxC6DtoMJJ3rCIMaMWIOGsn0vj1kYI81mN0PSzTXtwmWifOuGNNbZn hUsgLoL3viaRXldjChPZ3QeF9UWeYZ1ooaoIZYR7Ly6Gwj58PJ0nC6eFHsudJGXMi0N3 Wg70izlxuNEyHG6rX9hqxisge/NOhrc0Jcb8S/Fb+gZkUD/HPgmnGXmr/d8keDFaHt1Y FlZIWjA+oYDvbAoSPZ7kWyFJaCOR0CC31i8qEYup3nEFODb7vs0wGPG0nq7BfIc8gnwL RBHQ== X-Received: by 10.66.142.233 with SMTP id rz9mr16702920pab.71.1389420705161; Fri, 10 Jan 2014 22:11:45 -0800 (PST) Received: from Zeuss-MacBook.local ([123.119.85.96]) by mx.google.com with ESMTPSA id sy10sm27832699pac.15.2014.01.10.22.11.42 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Jan 2014 22:11:44 -0800 (PST) From: Leo Liu To: Stefan Monnier Subject: Re: bug#16346: 24.3; electric-pair-mode close-paren issue References: <878uuuy7g1.fsf@gmail.com> Face: iVBORw0KGgoAAAANSUhEUgAAACgAAAAoBAMAAAB+0KVeAAAAG1BMVEUAAAA9Cgm3Hx1WWFWA gn+WmJWsrqv4+vcCAwCRl2MkAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAAAYoA AAGKATOXMFgAAAAHdElNRQfXAQwDNR+ZJmElAAABIklEQVQoz22SPW+DQAyGWUq65qasd9PNUSX4 AZHK2C1rJy5jpDS4IwRVup9dn7GNafpKIPPgzztXFSujqq1eM2n8h22oMkvxI/i9C97kRfMRUN55 dS3BrsAwBXUtMLAO4lryh8kTjOxKpQNniNxAgZOEe4bZwsDTFhKdqZRLNII4OQNHhEuq/RMkm6Cj TnnEA/fk0BorcYn5qA3oaeAxbaBOLrX+9G48NZ2Fzc2tzDM8Q+tMypEOqYHh8mAWaaK3U/cDMOT5 aMZMABgPXc7zPMs1A8DXO756GFJ/4fMEq47hTsAdn5avoxZ4ywl0c2w4Flu2Ybeyb3S+EqxX2DYA H8veJGEDTnHnrXvRaPyt+2kSfK6rfBZ2tUtfP/mR+pR6sX8BUZ/cDV7tvkoAAAAASUVORK5CYII= Date: Sat, 11 Jan 2014 14:11:38 +0800 In-Reply-To: (Stefan Monnier's message of "Sat, 11 Jan 2014 00:35:24 -0500") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (OS X 10.9.1) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 16346 Cc: 16346@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On 2014-01-11 13:35 +0800, Stefan Monnier wrote: > Looks good from here. How do you like its behavior? > > > Stefan Seems to work well for me. If you have no objection I will install the following final patch. Have to build eldoc-edit-message-commands at the time of enabling eldoc-mode because loading packages may add new edit commands. (time penalty is about 0.03s, hope this isn't too bad.) === modified file 'lisp/emacs-lisp/eldoc.el' --- lisp/emacs-lisp/eldoc.el 2014-01-06 23:34:05 +0000 +++ lisp/emacs-lisp/eldoc.el 2014-01-11 06:10:50 +0000 @@ -62,6 +62,12 @@ :type 'number :group 'eldoc) +(defcustom eldoc-print-after-edit nil + "If non-nil eldoc info is only shown when editing. +Changing the value requires toggling `eldoc-mode'." + :type 'boolean + :group 'eldoc) + ;;;###autoload (defcustom eldoc-minor-mode-string (purecopy " ElDoc") "String to display in mode line when ElDoc Mode is enabled; nil for none." @@ -150,6 +156,16 @@ "The function used by `eldoc-message' to display messages. It should receive the same arguments as `message'.") +(defun eldoc-edit-message-commands () + (let ((cmds (make-vector 31 0)) + (re (regexp-opt '("delete" "insert" "edit" "electric" "newline")))) + (mapatoms (lambda (s) + (and (commandp s) + (string-match re (symbol-name s)) + (intern (symbol-name s) cmds))) + obarray) + cmds)) + ;;;###autoload (define-minor-mode eldoc-mode @@ -168,25 +184,13 @@ (setq eldoc-last-message nil) (if eldoc-mode (progn + (when eldoc-print-after-edit + (setq-local eldoc-message-commands (eldoc-edit-message-commands))) (add-hook 'post-command-hook 'eldoc-schedule-timer nil t) (add-hook 'pre-command-hook 'eldoc-pre-command-refresh-echo-area t)) - (remove-hook 'post-command-hook 'eldoc-schedule-timer) - (remove-hook 'pre-command-hook 'eldoc-pre-command-refresh-echo-area))) - -;;;###autoload -(define-minor-mode eldoc-post-insert-mode nil - :group 'eldoc :lighter (:eval (if eldoc-mode "" - (concat eldoc-minor-mode-string "|i"))) - (setq eldoc-last-message nil) - (let ((prn-info (lambda () - (unless eldoc-mode - (eldoc-print-current-symbol-info))))) - (if eldoc-post-insert-mode - (add-hook 'post-self-insert-hook prn-info nil t) - (remove-hook 'post-self-insert-hook prn-info t)))) - -;; FIXME: This changes Emacs's behavior when the file is loaded! -(add-hook 'eval-expression-minibuffer-setup-hook 'eldoc-post-insert-mode) + (kill-local-variable 'eldoc-message-commands) + (remove-hook 'post-command-hook 'eldoc-schedule-timer t) + (remove-hook 'pre-command-hook 'eldoc-pre-command-refresh-echo-area t))) ;;;###autoload (defun turn-on-eldoc-mode () @@ -264,8 +268,10 @@ ;; This doesn't seem to be required for Emacs 19.28 and earlier. (defun eldoc-pre-command-refresh-echo-area () (and eldoc-last-message - (if (eldoc-display-message-no-interference-p) - (eldoc-message eldoc-last-message) + (if (and (eldoc-display-message-no-interference-p) + (symbolp this-command) + (intern-soft (symbol-name this-command) eldoc-message-commands)) + (eldoc-message eldoc-last-message) (setq eldoc-last-message nil)))) ;; Decide whether now is a good time to display a message. @@ -283,9 +289,7 @@ ;; Check various conditions about the current environment that might make ;; it undesirable to print eldoc messages right this instant. (defun eldoc-display-message-no-interference-p () - (and eldoc-mode - (not executing-kbd-macro) - (not (and (boundp 'edebug-active) edebug-active)))) + (not (or executing-kbd-macro (bound-and-true-p edebug-active)))) ;;;###autoload @@ -309,7 +313,7 @@ ;; This is run from post-command-hook or some idle timer thing, ;; so we need to be careful that errors aren't ignored. (with-demoted-errors "eldoc error: %s" - (and (or (eldoc-display-message-p) eldoc-post-insert-mode) + (and (eldoc-display-message-p) (if eldoc-documentation-function (eldoc-message (funcall eldoc-documentation-function)) (let* ((current-symbol (eldoc-current-symbol)) === modified file 'lisp/progmodes/octave.el' --- lisp/progmodes/octave.el 2014-01-10 10:35:36 +0000 +++ lisp/progmodes/octave.el 2014-01-11 06:02:44 +0000 @@ -154,12 +154,8 @@ ["Insert Function" octave-insert-defun t] ["Update Function File Comment" octave-update-function-file-comment t] "---" - ["Function Syntax Hints" (call-interactively - (if (fboundp 'eldoc-post-insert-mode) - 'eldoc-post-insert-mode - 'eldoc-mode)) - :style toggle :selected (or (bound-and-true-p eldoc-post-insert-mode) - (bound-and-true-p eldoc-mode)) + ["Function Syntax Hints" (eldoc-mode 'toggle) + :style toggle :selected (bound-and-true-p eldoc-mode) :help "Display function signatures after typing `SPC' or `('"] ["Delimiter Matching" show-paren-mode :style toggle :selected show-paren-mode === modified file 'lisp/simple.el' --- lisp/simple.el 2014-01-09 01:59:19 +0000 +++ lisp/simple.el 2014-01-11 04:28:32 +0000 @@ -1387,6 +1387,7 @@ (lambda () (add-hook 'completion-at-point-functions #'lisp-completion-at-point nil t) + (eldoc-mode 1) (run-hooks 'eval-expression-minibuffer-setup-hook)) (read-from-minibuffer prompt initial-contents read-expression-map t From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 11 22:35:38 2014 Received: (at 16346) by debbugs.gnu.org; 12 Jan 2014 03:35:38 +0000 Received: from localhost ([127.0.0.1]:47277 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W2Bpo-0001wE-C1 for submit@debbugs.gnu.org; Sat, 11 Jan 2014 22:35:37 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:23016) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W2Bpl-0001w2-Bk for 16346@debbugs.gnu.org; Sat, 11 Jan 2014 22:35:34 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFFFxKG9/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDiYSFBgNJIgeBsEtkQoDiGGcGYFegxU X-IPAS-Result: Av4EABK/CFFFxKG9/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDiYSFBgNJIgeBsEtkQoDiGGcGYFegxU X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="44755485" Received: from 69-196-161-189.dsl.teksavvy.com (HELO fmsmemgm.homelinux.net) ([69.196.161.189]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 11 Jan 2014 22:35:32 -0500 Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id 2BAA5AE1FA; Sat, 11 Jan 2014 22:35:32 -0500 (EST) From: Stefan Monnier To: Leo Liu Subject: Re: bug#16346: 24.3; electric-pair-mode close-paren issue Message-ID: References: <878uuuy7g1.fsf@gmail.com> Date: Sat, 11 Jan 2014 22:35:32 -0500 In-Reply-To: (Leo Liu's message of "Sat, 11 Jan 2014 14:11:38 +0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 16346 Cc: 16346@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) > If you have no objection I will install the following final patch. OK Stefan From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 11 23:22:01 2014 Received: (at 16346-done) by debbugs.gnu.org; 12 Jan 2014 04:22:01 +0000 Received: from localhost ([127.0.0.1]:47298 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W2CYi-0003F3-MD for submit@debbugs.gnu.org; Sat, 11 Jan 2014 23:22:01 -0500 Received: from mail-pa0-f53.google.com ([209.85.220.53]:40354) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W2CYg-0003Et-Iw for 16346-done@debbugs.gnu.org; Sat, 11 Jan 2014 23:21:59 -0500 Received: by mail-pa0-f53.google.com with SMTP id hz1so6361539pad.12 for <16346-done@debbugs.gnu.org>; Sat, 11 Jan 2014 20:21:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:face:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=JTRjyspOL8db6J7RHI7ga7pZXrnTlNfzpwBwpyG32l8=; b=OJqdSfvpN4DYelNZfG9UtdVTaqMHMElDyl9cPkccMB/6YbL7bFlXsjn5OoqD9EzEUM aWv0261+aTTefwkM3tu6+aHJjrBlhHto7ROS0mpOaoz/BwUlx3bTb5VLJVkAhFSz/Dsv tsw5RW3txKyfVPyXGZnyNuO224dsLXAcLbGZ/Q/+dvJUCckJ4FMIbKXiJiM1U2tgofHg P2LjSQ9kQwiJwhrZqWvoVWPYiYlK2uYxEG1O9JVsTD1LijmVrarTZK+JmAAfE+aDjbRm dOVZVePDBPl97R8OLxFZznauTcT6K99DuDbPPmz/1pAxSq/TZS+OQQOvoIYNAaQ48OpS UxzA== X-Received: by 10.68.106.130 with SMTP id gu2mr21396545pbb.59.1389500517222; Sat, 11 Jan 2014 20:21:57 -0800 (PST) Received: from Zeuss-MacBook.local ([222.130.182.219]) by mx.google.com with ESMTPSA id un5sm36028873pab.3.2014.01.11.20.21.55 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 11 Jan 2014 20:21:56 -0800 (PST) From: Leo Liu To: Stefan Monnier Subject: Re: bug#16346: 24.3; electric-pair-mode close-paren issue References: <878uuuy7g1.fsf@gmail.com> Face: iVBORw0KGgoAAAANSUhEUgAAACgAAAAoAgMAAADxkFD+AAAADFBMVEUvT09qWs3/pQD///+J kUVcAAAAAWJLR0QAiAUdSAAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9cBBwMLOd3veKQA AACuSURBVBjTldE9CgIxEAXgB+lEyFUC2wo5ikdZ8DSypxhMY7H9VuIVwlqkGRgnm59VsHGafIQ3 CZlAtmKIRaHETgYa12lqvEsPYKf8wXHsPGfqPaUM0g9aJPKFXkmNQmSDqwzz4Fpgpz+6WAPY2z5o uPJJpu0uypcl4nyCibMLQ8lCiVjayLoQvw5LsVKQuHPRR958HZbOcVsKeepcLxpByjycGvnKmY+c MBvrtyjfe0vmuLvdq/kAAAAASUVORK5CYII= Date: Sun, 12 Jan 2014 12:21:50 +0800 In-Reply-To: (Stefan Monnier's message of "Sat, 11 Jan 2014 22:35:32 -0500") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (OS X 10.9.1) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 16346-done Cc: 16346-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Fixed 24.4 On 2014-01-12 11:35 +0800, Stefan Monnier wrote: >> If you have no objection I will install the following final patch. > > OK > > > Stefan OK installed and closing this bug. Thanks for your time. Leo From unknown Mon Jun 23 23:49:09 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 09 Feb 2014 12:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator