D464: Use an unambigious path suffix for the commit editor file.
Sean Farley
sean at farley.io
Tue Aug 22 05:04:38 UTC 2017
mbolin (Michael Bolin) <phabricator at mercurial-scm.org> writes:
> mbolin created this revision.
> Herald added a subscriber: mercurial-devel.
> Herald added a reviewer: hg-reviewers.
>
> REVISION SUMMARY
> Changes the path for a commit editor file from `/tmp/hg-editor-XXXXXX.txt` to
> `/tmp/hg-editor-XXXXXX.hgcommit.txt`.
>
> Some editors (such as Atom) make it possible to statically define a [TextMate]
> grammar for files with a particular suffix. For example, because Git reliably
> uses `.git/COMMIT_EDITMSG` and `.git/MERGE_MSG` as the paths for commit-type
> messages, it is trivial to define a grammar that is applied when files of
> either name are opened in Atom:
>
> https://github.com/atom/language-git/blob/v0.19.1/grammars/git%20commit%20message.cson#L4-L5
>
> Because Hg currently uses the generic `.txt` suffix, it is much harder to
> disambiguate whether the file is an arbitrary text file as opposed to one
> created for the specific purpose of authoring an Hg commit message.
>
> It would be nice to update all of the other similar uses of temp files in Hg,
> but this seemed like the most impactful place to start.
This is actually why I created the `editortmpinhg' experimental setting.
If I understand correctly, that should be enough to statically match
`.hg/hg-editor-*.txt'. In fact, that's what I do here in my emacs
thingy:
https://bitbucket.org/seanfarley/mahgic/src/default/lisp/hg-commit.el#hg-commit.el-348
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 800 bytes
Desc: not available
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-devel/attachments/20170821/0c142a69/attachment.asc>
More information about the Mercurial-devel
mailing list