From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Yuri D'Elia Newsgroups: gmane.emacs.devel Subject: Re: electric-pair-mode as a minor mode? Date: Fri, 27 Mar 2015 09:04:34 +0100 Message-ID: <55150F12.9060903@thregr.org> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1427443530 24314 80.91.229.3 (27 Mar 2015 08:05:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 27 Mar 2015 08:05:30 +0000 (UTC) Cc: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= , emacs-devel@gnu.org To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Mar 27 09:05:22 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YbPGa-0004So-Rb for ged-emacs-devel@m.gmane.org; Fri, 27 Mar 2015 09:05:20 +0100 Original-Received: from localhost ([::1]:48734 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbPGZ-0001UB-Rk for ged-emacs-devel@m.gmane.org; Fri, 27 Mar 2015 04:05:19 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59448) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbPGJ-0001Ri-C3 for emacs-devel@gnu.org; Fri, 27 Mar 2015 04:05:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YbPGF-000568-CO for emacs-devel@gnu.org; Fri, 27 Mar 2015 04:05:03 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:40058) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbPGF-00055x-5e for emacs-devel@gnu.org; Fri, 27 Mar 2015 04:04:59 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1YbPGD-0004Ed-N1 for emacs-devel@gnu.org; Fri, 27 Mar 2015 09:04:57 +0100 Original-Received: from 193.106.183.18 ([193.106.183.18]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 27 Mar 2015 09:04:52 +0100 Original-Received: from wavexx by 193.106.183.18 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 27 Mar 2015 09:04:52 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 46 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 193.106.183.18 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.5.0 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:184368 Archived-At: On 03/27/2015 03:18 AM, Stefan Monnier wrote: >> Incremental searching with eletric-pairing is frustrating as opposed to >> being helpful as the search is "temporarily broken" as soon as the pair >> is inserted. > > [ I'm curious to know more about those isearch and minibuffer cases > because I haven't bumped into them. Not that it makes any difference > to the following. ] It's just a nuisance. If I'm performing an isearch, looking for "foo(bar", the matching will, of course, stop to find anything at "foo()" just before I kill the closing paren. There's no harm done, but I realized I never truly had to close a paren in isearch before, I just RET-ed away. And given that the cursor momentarily goes back to the starting point, I find it distracting since I'm scanning visually the buffer... >> I made eletric-pair-mode nil/buffer-local in the hooks that I need, >> but somehow I feel electric-pair-mode should be a regular minor mode. > > Hmm, electric-pair-mode *is* a regular minor mode. Maybe you mean > that it should be buffer-local because you'd only want to enable it in > a few specific major modes? [ just terminology here, isn't anything which is not global-minor automatically buffer local? ] > We could very well define an electric-pair-local-mode, like we did with > electric-indent-local-mode. In the mean time, you should be able to > hack it with something like: If it's not a big issue, I would definitely do it. I'm actually thinking that's something I would selectively turn on in the base 'prog-mode-hook myself. > (electric-pair-mode 1) > (setq-default electric-pair-mode nil) > > (add-hook 'foo-mode-hook > (lambda () (setq-local electric-pair-mode t))) That's basically what I'm doing, but in reverse at the moment (I turn it off selectively).