From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: electric-pair-mode as a minor mode? Date: Thu, 26 Mar 2015 22:18:33 -0400 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1427422759 13660 80.91.229.3 (27 Mar 2015 02:19:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 27 Mar 2015 02:19:19 +0000 (UTC) Cc: =?windows-1252?B?Sm/jbyBU4XZvcmE=?= , emacs-devel@gnu.org To: Yuri D'Elia Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Mar 27 03:19:09 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 1YbJrF-0008AL-SL for ged-emacs-devel@m.gmane.org; Fri, 27 Mar 2015 03:18:50 +0100 Original-Received: from localhost ([::1]:47280 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbJrE-0007Bk-Ic for ged-emacs-devel@m.gmane.org; Thu, 26 Mar 2015 22:18:48 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44760) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbJr1-0007BP-2B for emacs-devel@gnu.org; Thu, 26 Mar 2015 22:18:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YbJqy-0001Rc-C4 for emacs-devel@gnu.org; Thu, 26 Mar 2015 22:18:34 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:36996) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbJqy-0001RV-8W for emacs-devel@gnu.org; Thu, 26 Mar 2015 22:18:32 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgUFAGvvdVRBbthL/2dsb2JhbAA3gVOhb4EIgXUBAQQBViMFCws0EhQYDSSIE6IRi30PAQ4EAk8Dgz4DA4NtBKg7gTcP X-IPAS-Result: AgUFAGvvdVRBbthL/2dsb2JhbAA3gVOhb4EIgXUBAQQBViMFCws0EhQYDSSIE6IRi30PAQ4EAk8Dgz4DA4NtBKg7gTcP X-IronPort-AV: E=Sophos;i="5.01,1,1400040000"; d="scan'208";a="114701422" Original-Received: from 65-110-216-75.cpe.pppoe.ca (HELO fmsmemgm.homelinux.net) ([65.110.216.75]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 26 Mar 2015 22:18:31 -0400 Original-Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id E8517AE0BE; Thu, 26 Mar 2015 22:18:33 -0400 (EDT) In-Reply-To: (Yuri D'Elia's message of "Thu, 26 Mar 2015 20:51:47 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.181 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:184354 Archived-At: > I'd like to disable electric-pair-mode in certain buffers. > Probably the most important example is the minibuffer. > 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. ] > 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? 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: (electric-pair-mode 1) (setq-default electric-pair-mode nil) (add-hook 'foo-mode-hook (lambda () (setq-local electric-pair-mode t))) > When editing regular text, as opposed to code, I also occasionally > switch it off because I find it distracting. I think I would agree that it should be less eager in text modes (i.e. in modes where syntax-ppss gives notoriously unreliable results). I'm pretty sure that can be done fairly easily, by fixing a few concrete cases. Stefan