emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: electric-pair-mode as a minor mode?


From: João Távora
Subject: Re: electric-pair-mode as a minor mode?
Date: Wed, 15 Apr 2015 22:32:41 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (darwin)

Dmitry Gutov <address@hidden> writes:

> On 04/13/2015 01:16 AM, address@hidden (João Távora) wrote:
>
>> (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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]