aboutsummaryrefslogtreecommitdiff
path: root/lisp/git-commit.el
AgeCommit message (Collapse)Author
2024-08-08Release version 4.0.0v4.0.0Jonas Bernoulli
2024-07-30git-commit-propertize-diff: Remove ancient backward compatibilityJonas Bernoulli
`font-lock-ensure' exists since Emacs 25.1.
2024-07-13Bump dependenciesJonas Bernoulli
2024-06-23Use string-join instead of mapconcatJonas Bernoulli
2024-06-18Fix docstring typoPark Zhou
2024-05-20git-commit: Disable auto-filling for summary lineJonas Bernoulli
The coloring of the overflowing characters makes sure we notice that we have gone over the limit, and should be enough to make us consider other options. If we decide to go ahead and violate the limit anyway, we should not have to manually revert the effect of the auto-filling.
2024-05-09Fix typosJonas Bernoulli
Or one typo, which ended up being copy-pasted.
2024-05-06Use while-let moreJonas Bernoulli
2024-05-02git-commit-ensure-comment-gap: New hook functionJonas Bernoulli
This restores the useful part of the functionality removed in [1: 150eed71b9], while making it possible to disable even that, in case there is disagreement on its usefulness (and to move it out of sight and to have an obvious place to document it). 1: 2024-04-29 150eed71b98597018cc4a47d1c50c3f56b747eef git-commit-setup: Remove a mildly questionable tweak
2024-04-29Drop support for Emacs 25Jonas Bernoulli
2024-04-29Bump dependenciesJonas Bernoulli
2024-04-29Revert "git-commit-search-message-{backward,forward}: Don't use format-prompt"Jonas Bernoulli
This reverts commit 463a3550e27ab1cb0dc53afb0199f2e50660f24c. We can use `format-prompt' now because it is provided by the `compat' package.
2024-04-29git-commit-setup: Remove a mildly questionable tweakJonas Bernoulli
The removed code was added in [1: fb66888fcd]. If the buffer is completely empty, this changes it to instead contain a single empty line. This does not seem desirable, without further justification. Unfortunately that was not provided in the commit and the mentioned issue is from the old "git-commit-mode" repository, which does not exist anymore. I assume that this was either done because some user enabled `indicate-buffer-boundaries' and then didn't like how that looks for empty buffers, or because this once was necessary for our font-lock to work properly. If it was the latter, that is not the case anymore. This does not affect the outcome of Git porcelain commands. (And if it did there would be nothing to prevent the user from removing the trailing newline again.) It is Github, which produces corrupted commit messages that lack the trailing newline by default, not Git. I am removing this because it makes an already long function even longer and it is yet another thing one has to consider when reasoning about this function. If someone really wants this for some reason, then a hook function can be used. If it turns out there is some real benefit to this, then we can revert the removal. 1: 2013-09-14 fb66888fcdeb334f183e67d26b58a98c6ad2124c `git-commit-mode': insert a newline after commit summary line
2024-04-29git-commit-setup: Cosmetic rearrangementJonas Bernoulli
It makes sense for the usage message to be handled last and for the header-line setup (which also provides usage information), to be placed next to that (but not after that, as was the case before). Doing these thing *after* running the hook (as we already did) makes sense, since that makes it possible to use the hook to tweak the information.
2024-04-29Make discouraged use of git-commit-mode-hook safer and more convenientJonas Bernoulli
`git-commit-mode' is a minor-mode, as opposed to being the major-mode used in commit message buffers (as its name may suggest, and many users seem to assume). We therefore decided a long time ago that `git-commit-hook-mode' should not be used and provided `git-commit-setup-hook' as an alternative. Despite that, users keep trying to use it anyway, and often that leads to issues. It doesn't help that this hook has a generic generated docstring, which does nothing to discourage its use. Instead of continuing to tell users not to use this hook, one by one, or taking more drastic measures to prevent its use, just make it an alias for `git-commit-setup-hook'. (It is also too late to instead remove *that* hook.) Prevent `git-commit-mode-hook' from being run when `git-commit-mode' is enabled. It is now run a bit later under the `git-commit-setup-hook' name, while also demoting errors. Demoting errors is important, because errors that occur here, are (1) hard to debug (because there is no backtrace), (2) common (due to user errors), and (3) they outright prevent committing. It also makes a difference that the hook is run slightly later now. Some things that would fail at the earlier time, actually work at the later time. For example, functions that rely on font-lock being setup (which is reasonable to do if you wrongly assume that `git-commit-mode' is a major-mode), as many seem to do, only works at the later time. Also move the call to `git-commit-mode' itself further down. In summary, it seems safest *and* most convenient, to just let users add to the same hook under two different names, and to run it at the appropriate time, while demoting errors.
2024-04-15Update contact informationJonas Bernoulli
2024-03-21git-commit-cd-to-toplevel: New optionJonas Bernoulli
Closes #4973.
2024-03-21git-commit-setup: Let-bind gitdir to default-directoryJonas Bernoulli
At this point this makes no difference, but it makes the diff for the next commit more readable.
2024-03-21git-commit-setup: Cleanup commentsJonas Bernoulli
2024-02-29Only hook up git-commit-setup-font-lock-in-buffer once mode is enabledJonas Bernoulli
2024-02-21git-commit-turn-on-flyspell: Don't check below cut-lineAdam Jones
When `commit.verbose' is set to true in git's configuration, a special line will be added to the (temporary) commit message. All content below this will be ignored by git when constructing the eventual commit message. This is defined as `cut_line' in wt-status.c in git's source: https://github.com/git/git/blob/3e0d3cd5c7def4808247caf168e17f2bbf47892b/wt-status.c#L38-L39 I noticed that, for exceptionally large commits, magit was triggering a commensurately large flyspell operation. This appears to be a small oversight in the logic of `git-commit-turn-on-flyspell'. This commit attempts fix the performance issue by instructing flyspell to ignore all lines after `cut_line'.
2024-01-23Move a variable alias before the new definitionJonas Bernoulli
Unlike face and function aliases, variable aliases should be declared before the actual definition.
2024-01-23Correct target of obsolete alias git-commit-known-pseudo-headersOla Nilsson
2024-01-01Bump copyright yearsJonas Bernoulli
2023-12-04Bump dependenciesJonas Bernoulli
2023-10-30git-commit-mode-map: Actually set the parent mapJonas Bernoulli
That was the intention in [1: 546071e888]. Closes #5038. 1: 2023-10-27 546071e888db4e4fd2baff116438e8d57b6f127b git-commit-mode-map: Factor out redundant bindings
2023-10-28git-commit: Avoid rxJonas Bernoulli
2023-10-27git-commit: Restore detailed trailer fontificationJonas Bernoulli
2023-10-27git-commit: Separate options' docstring bodies from first linesJonas Bernoulli
2023-10-27git-commit-mode-map: Factor out redundant bindingsJonas Bernoulli
2023-10-27git-commit-mode-menu: Drop unnecessary :active keywordJonas Bernoulli
I.e., consistently use the [NAME CALLBACK ENABLE] form, instead of randomly mixing that with [NAME CALLBACK [KEYWORD ARG]...].
2023-10-27git-commit: Order trailers the same in various placesJonas Bernoulli
2023-10-27git-commit--insert-trailer: Use git-commit--trailer-regexpJonas Bernoulli
2023-10-27git-commit--trailer-regexp: Match known trailers even if lacking mailJonas Bernoulli
Until now we only highlighted trailers that end with "<mail>" to avoid false-positives. Now we additionally look for the known trailers listed in `git-commit-trailers', which doesn't increase the risk by much.
2023-10-27git-commit--trailer-regexp: New functionJonas Bernoulli
2023-10-27git-commit--insert-trailer: New functionJonas Bernoulli
This allows inserting trailers with values that don't involve an email address. Re #5031.
2023-10-27git-commit: Mention trailer insertion menu in the commentaryJonas Bernoulli
It is more convenient than the direct bindings in the minor-mode keymap, because who can remember those?
2023-10-27git-commit: Replace the term "(pseudo) header" with "trailer"Jonas Bernoulli
Nothing about "pseudo header" is accurate, while "trailer" makes perfect sense and happens to be the term Git uses.
2023-10-15git-commit: Ignore leading comment when inserting headersMagnar Sveen
It is suggested in several places on the internet to use a git commit template, for instance here [1]. These often include a header comment: # Title: Summary, imperative, start upper case, don't end with a period # No more than 50 chars. #### 50 chars is here: # [1]: https://gist.github.com/lisawolderiksen/a7b99d94c92c6671181611be1641c733 This change ensures that headers are inserted after this leading comment (meaning there are no empty lines before it), instead of above it. Headers are still inserted before the comments added by Git itself.
2023-09-24Ensure a seq version with seq-keep is usedJonas Bernoulli
For older Emacs releases we depend on an updated `seq' release from GNU ELPA, for `seq-keep'. Unfortunately something else may already have required `seq', before `package' had a chance to put the more recent version earlier on the `load-path', and thus the outdated built-in version might be loaded. If that is the case, unload it and require `seq' again, to load the new version. If you are wondering whether it is worth the trouble, keep in mind that going forward we might want to use other additions in the future. Also I really want to use this function. I was the one who suggested its addition because it was one of the few significant gaps in `seq' and `cl-lib' in comparison to `dash'. Closes #5011.
2023-09-24Depend on seq-2.24 in all packagesJonas Bernoulli
In [1: 84eaa203f3] we only did this for `magit' itself. 1: 2023-09-21 84eaa203f3c70d55f29fbe6a8d6d9d5334cb6818 Use seq-keep instead of delq and mapcar This is not strictly necessary for `git-commit' because there we don't *currently* use `seq-keep', but in the future we might very well start using it there as well, without remembering that a dependency has to be added. So let's just do it now.
2023-09-12git-commit-insert-header: Fix determining locationJonas Bernoulli
Closes #5005.
2023-09-03When inserting pseudo header, always prompt with a prefix argumentJonas Bernoulli
Closes #4998.
2023-08-21Silence check-declareJonas Bernoulli
2023-08-21Silence byte-compilerJonas Bernoulli
2023-08-21git-commit-setup-font-lock: Set comment-end to the empty stringJonas Bernoulli
Some major-modes used while editing commit messages, may set that variable and other `comment-*' variables to values that are not compatible with Git's understanding of comments, which always only uses a comment character at the beginning, either the default "#" or what is specified using `core.commentchar'. Git's understanding of how comments are delimited takes precedence over the major-modes style, because it is Git that strips the comments. `markdown-mode', for example, sets `comment-start' to "<!--" and `comment-end' to "-->"; and we failed to override the latter until now. Furthermore, `markdown-fill-paragraph' does not handle Git-style comments, which is to be expected, but forces us neutralize it when called on a comment. This is not necessary for any of the other modes we suggest for `git-commit-major-mode'. Closes #4990. Replaces #4991.
2023-08-21git-commit-setup-*: CosmeticsJonas Bernoulli
Use `when' instead of (or rather in a addition to) `and', because the value does not matter. These functions are called for side-effects.
2023-08-21git-commit-setup: Fix auto-mode-alist for remote filesEyal Soha
The filename added to `auto-mode-alist' must be stripped of the remote part, if any, because that is what `set-auto-mode--apply-alist') does when it matches filenames. Fixes #4987.
2023-07-31Use `and' instead of `when' or `unless' if value mattersJonas Bernoulli
2023-05-21git-commit-usage-message: Fix docstring typoKyle Meyer