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: Sun, 12 Apr 2015 23:16:57 +0100 Message-ID: References: <552A9FD2.8040307@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 1428877039 9639 80.91.229.3 (12 Apr 2015 22:17:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 12 Apr 2015 22:17:19 +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 Mon Apr 13 00:17:19 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 1YhQBq-0002yU-DG for ged-emacs-devel@m.gmane.org; Mon, 13 Apr 2015 00:17:18 +0200 Original-Received: from localhost ([::1]:46412 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YhQBp-0003tY-Hi for ged-emacs-devel@m.gmane.org; Sun, 12 Apr 2015 18:17:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45653) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YhQBd-0003tP-SH for emacs-devel@gnu.org; Sun, 12 Apr 2015 18:17:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YhQBa-0001Vx-MS for emacs-devel@gnu.org; Sun, 12 Apr 2015 18:17:05 -0400 Original-Received: from mail-wi0-x22c.google.com ([2a00:1450:400c:c05::22c]:34338) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YhQBa-0001VF-CA for emacs-devel@gnu.org; Sun, 12 Apr 2015 18:17:02 -0400 Original-Received: by widjs5 with SMTP id js5so51750456wid.1 for ; Sun, 12 Apr 2015 15:17:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-type:content-transfer-encoding; bh=xmNywzBqIbCwpkwguTVhX3MGpBj58gnkANI6i33G2WM=; b=x9TT5xvfRtBxD3+jYZxIAhxuBy5kkuy4lw+ajEEGmbLMhaZyGkOzj8xyEfcZ3indf8 RlkoVYJ5T1eXoXea876F1tWCQ9G6jH41MFGkLX8Za59JvD74E5qx4/XbmboWPtuW8/GB Mv/NaVOcQ1Zlg8NoDEYzD32Q2t0g49QRR0qVg7zjuoeuQsXpFwtUYHEfpnm0P9b69/hw kX9qIgV8Aoppsdu6lRil39DVBm5uYeuU8Cs66NWkxFZIXu3F/motTGEzhtiPJsysoNvh dMJ2FSiONj2DU+lvoMRmzACH1O+eN1vyhF/k25kNo7nUGf3+JqWOq73nCjkNjzwwTSUH 9H/g== X-Received: by 10.194.175.137 with SMTP id ca9mr21224781wjc.67.1428877021514; Sun, 12 Apr 2015 15:17:01 -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 i8sm8671139wiy.23.2015.04.12.15.16.59 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 12 Apr 2015 15:17:00 -0700 (PDT) In-Reply-To: <552A9FD2.8040307@yandex.ru> (Dmitry Gutov's message of "Sun, 12 Apr 2015 19:39:46 +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:c05::22c 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:185362 Archived-At: Dmitry Gutov writes: > On 04/12/2015 04:16 PM, joaotavora@gmail.com (Jo=C3=A3o T=C3=A1vora) wrot= e: > >> As a side note, a spurious "Summary: " prefix slipped through in the >> first line of the commit message, since I ammended my local commit from >> the command line, with emacsclient as EDITOR and then used M-p >> `log-edit-previous-comment' to pull in the last message. I saw >> 'Summary:' fontified so assumed it would be killed by `log-edit-mode'. > > Thoughts: > > - I wonder why you didn't have the existing message already filled in > the buffer, so you'd had to press `M-n'. (I pressed `M-p', not `M-n'). But true, in recent tests I see always see the last commit message when I commit --amend. Perhaps I had amended some more times and wanted to go to some intermediate version. I dunno anymore. > - This kind of commit message buffers should probably use a different > major mode: after all, the format of the contents is different. 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? > - vc-git supports the "amend" feature, so you shouldn't have had to > use the command line; although it's a bit awkward when you want just > to edit the message, and there are no changes in any files: then > `vc-next-action' doesn't even initiate commit. We should integrate it > with `log-view-modify-change-comment'. 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. > Maybe somewhere in `before-save-hook' of the new major mode? Won't kick in when the buffer doesn't need saving. This seems works nicely though: (defun log-edit--commit-editmsg-done () ;; no idea why `log-edit-callback' is called with `call-interactive' (interactive) (save-excursion (goto-char (point-min)) (when (and (search-forward-regexp "^Summary:[ \t]+" (line-end-posit= ion) t) (y-or-n-p "Possibly spurious \"Summary:\" header detecte= d. Remove?")) (delete-region (match-beginning 0) (match-end 0)))) (save-buffer) (server-edit)) =20=20=20=20=20 (define-derived-mode log-edit--commit-editmsg-mode log-edit-mode "Log-E= dit*" "Special version of `log-edit-mode' for .git/COMMIT_EDITMSG." (set (make-local-variable 'log-edit-callback) 'log-edit--commit-editmsg-done) (setq default-directory (file-name-directory (directory-file-name def= ault-directory)))) =20=20=20=20=20 (add-to-list 'auto-mode-alist '("\\.git/COMMIT_EDITMSG" . log-edit--com= mit-editmsg-mode)) Got it in my .emacs, but perhaps this could be installed, seems generic enough. OTOH, git log --grep '^Summary:' seems to indicate this happens only once every 5-6 years Jo=C3=A3o