From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: joaotavora@gmail.com (=?utf-8?B?Sm/Do28gVMOhdm9yYQ==?=) Newsgroups: gmane.emacs.devel Subject: Re: electric-pair-mode as a minor mode? Date: Wed, 15 Apr 2015 22:32:41 +0100 Message-ID: References: <552A9FD2.8040307@yandex.ru> <552AFB4D.4090407@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1429133848 9971 80.91.229.3 (15 Apr 2015 21:37:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 15 Apr 2015 21:37:28 +0000 (UTC) Cc: Lars Magne Ingebrigtsen , Stefan Monnier , emacs-devel@gnu.org To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Apr 15 23:37:28 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 1YiUzv-00077S-2P for ged-emacs-devel@m.gmane.org; Wed, 15 Apr 2015 23:37:27 +0200 Original-Received: from localhost ([::1]:34223 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YiUzu-0006ip-EM for ged-emacs-devel@m.gmane.org; Wed, 15 Apr 2015 17:37:26 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39296) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YiUvR-0005dj-HF for emacs-devel@gnu.org; Wed, 15 Apr 2015 17:32:50 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YiUvO-00008H-B4 for emacs-devel@gnu.org; Wed, 15 Apr 2015 17:32:49 -0400 Original-Received: from mail-wg0-x231.google.com ([2a00:1450:400c:c00::231]:34407) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YiUvO-00008B-38 for emacs-devel@gnu.org; Wed, 15 Apr 2015 17:32:46 -0400 Original-Received: by wgso17 with SMTP id o17so61031916wgs.1 for ; Wed, 15 Apr 2015 14:32:45 -0700 (PDT) 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:content-transfer-encoding; bh=8lx1M2p4j6XOWnH8dtfelcfV+6jbaWdYo5ZrgBKO/rE=; b=nG+ZeGiPeuLNSkVhZszXqAA4Zljhsxj+cwQ3FhwKz+5y6Djg/xWtvXUvpqCIG2F60f o9FW91vKrZxrGci1GPeZIOtkhgIO1qbJJta4FMsYl/RSNTM/1cj4aiXzWOMckzPVVEQA HLycdlpQkrGUaLhuAqCGh2uBtLtNgM79kmooUVs3Q6h3VxXQu+zkLxPMdOuhLD2+3141 YLkfcb8NkiEl/5HForKPNAdhfJEgca57AlP1cBhDbhy64pVMRwxmSL5O9FlNBOPjjnG1 KCQwhuJeJTaCRFDtYHeezuCk9Tf9sVAkXs1ZU1TI7AFsE6/cGSG/Oy08GsN1YrKeQHk7 CQRA== X-Received: by 10.194.184.45 with SMTP id er13mr39984854wjc.71.1429133565372; Wed, 15 Apr 2015 14:32:45 -0700 (PDT) Original-Received: from king.yourcompany.com (31.57.37.188.rev.vodafone.pt. [188.37.57.31]) by mx.google.com with ESMTPSA id gu7sm21658852wib.21.2015.04.15.14.32.43 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Apr 2015 14:32:44 -0700 (PDT) In-Reply-To: <552AFB4D.4090407@yandex.ru> (Dmitry Gutov's message of "Mon, 13 Apr 2015 02:10:05 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (darwin) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c00::231 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:185488 Archived-At: Dmitry Gutov writes: > On 04/13/2015 01:16 AM, joaotavora@gmail.com (Jo=C3=A3o T=C3=A1vora) wrot= e: > >> (I pressed `M-p', not `M-n'). > > Right, that. > >> That's right. Although I can't resist asking why these "Summary" and >> "Author" hints/cookies can't be some display-only element like a >> before-string in an overlay. Why are they implemented as actual buffer >> text? > > I guess partly because it can be handled similarly to mail buffers > (and maybe, at some point, some code can be merged). Actually, once I view a commit message like an email message (which it mostly is), things indeed start to make more sense. > And while "Summary:" could be implemented as a before-string on an > overlay (or even purely with font-lock, maybe), other headers need > extra processing: transform the value, move it to a different part of > the buffer, etc. Aside from "Author" and "Signed-Off-By", we can > encounter "Fixes:" and now, after the ChangeLogs conversion, > "Copyright-paperwork-exempt:" and "Also-By:" (or some alternative > thereof). Yeah, the problem is clearly the other headers, not Summary: > And good luck saving/restoring overlays in M-n/M-p > implementations. Text prop-based implementation would handle this > better, but how to use them in this context isn't necessarily apparent > to me. Don't see any particular problem should be restoring overlays. >> Never tried it. Didn't know they existed even. I make commits from >> vc-dir and command line alternately as is more convenient, so I >> `log-edit-mode' in COMMIT_EDITMSG for a consistent UI. > > I'm guessing git-commit-mode from MELPA would probably be a better > fit, even if it has different interface. Yes, sticking to log-edit is good. >>> Maybe somewhere in `before-save-hook' of the new major mode? >> Won't kick in when the buffer doesn't need saving. > But COMMIT_EDITMSG needs to be saved, doesn't it? Only if you change it. If the .git/COMMIT_EDITMSG is there for some reason and you don't want to change it (perhaps you ammended something else in the commit), then `before-save-hook' won't kick in. >> Got it in my .emacs, but perhaps this could be installed, seems generic >> enough. > > It should probably handle other headers as well. I don't know if Git > allows to set arguments like --author or --signed-off-by via some > special comments in the commit file, but if it did, that would allow > to unify the implementations nicely. Indeed. I thought it did, but I can't find any documentation for it. (1+ for the git skeptics I guess :-)). If there's interest, I'll ask somewhere and come up with a more robust patch.