Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
  • 15 commits
  • 4 files changed
  • 0 commit comments
  • 5 contributors
Commits on Sep 26, 2013
@ruediger ruediger git-commit-mode: Add menu.
Signed-off-by: Rüdiger Sonderfeld <ruediger@c-plusplus.de>
9be05ce
Commits on Oct 01, 2013
@npostavs npostavs don't require saveplace
If the user hasn't setup saveplace in their config, requiring saveplace
causes them to get a useless .emacs-places in the home directory. To
avoid triggering a compilation warning, we check if `save-place' is
bound.

f5b36db had changed from calling `toggle-save-place' to setting
`save-place' but still checked if `toggle-save-place' was fbound,
830b538 then required saveplace to quiet the compiler.
6983f93
Commits on Oct 05, 2013
@PureAbstract git-rebase-mode : Fix auto-mode-alist
 Add an end-of-string (\') marker to avoid spurious matches
1109ae2
Commits on Oct 09, 2013
@praet praet `gitconfig-indent-line': compare `char-after' with `[' using `equal'
Calling `newline-and-indent' with point being @ `point-max' resulted in
a `wrong-type-argument' error due to `gitconfig-indent-line' trying to
compare `char-after's return value (which is nil @ eob) to `[' using
`=', which expects both of its arguments to be numbers or markers.

Signed-off-by: Pieter Praet <pieter@praet.org>
cf8f442
@praet praet `git-commit-save-message': only save commit msg if it contains actual…
… text

Avoid filling up `log-edit-comment-ring' with empty commit messages
by checking whether the commit message contains any actual text
(i.e. word chars that aren't part of a comment) before saving it.

Signed-off-by: Pieter Praet <pieter@praet.org>
ec3775e
@praet praet `git-commit-save-message': only save commit msg if it's unique
Avoid filling up `log-edit-comment-ring' with duplicate commit messages
(and potentially clobbering useful history in the process) when cycling
through it using `git-commit-{prev,next}-message'.

Signed-off-by: Pieter Praet <pieter@praet.org>
d25b364
Commits on Oct 10, 2013
@npostavs npostavs tell newcomment.el # is only comment at line start
Otherwise we get things like this:

A typical commit message referencing issue #xxx that is long enough to
                                           #need filling,

This is not related to fontifying of comments which already applies only
to lines beginning with #. It's also not related to the syntax-table;
middle of line #s still have comment syntax, but apparently this has no
effect.

Fixes #67.
f2af42d
Commits on Oct 13, 2013
@tarsius tarsius Merge pull request #63 from ruediger/menu
git-commit-mode: Add menu.
b29e3f4
@tarsius tarsius Merge pull request #65 from npostavs/no-saveplace
don't require saveplace
46ab348
@tarsius tarsius Merge pull request #66 from PureAbstract/fix-rebase-mode-auto-mode-alist
git-rebase-mode : Fix auto-mode-alist
d9207d0
@tarsius tarsius Merge pull request #69 from praet/config-indent-err
`gitconfig-indent-line': compare `char-after' with `[' using `equal'
38082e9
@tarsius tarsius Merge pull request #70 from praet/commit-save-msg
Commit message history fixes
016420c
@tarsius tarsius Merge pull request #71 from npostavs/start-line-comment2
tell newcomment.el # is only comment at line start (v2)
0aac877
@tarsius tarsius Makefile: handle all libs and make more like Magit's c43f41d
@tarsius tarsius Makefile: let user override EMACS and EFLAGS 7bd60a7
Showing with 53 additions and 18 deletions.
  1. +15 −12 Makefile
  2. +36 −4 git-commit-mode.el
  3. +1 −1 git-rebase-mode.el
  4. +1 −1 gitconfig-mode.el
View
27 Makefile
@@ -1,17 +1,20 @@
-EMACS = emacs
-EMACSFLAGS =
-BYTECOMPILEFORM = (progn \
- (setq byte-compile-dest-file-function (lambda (fn) "$@")) \
- (byte-compile-file "$<"))
+EMACS ?= emacs
+EFLAGS ?=
-OBJECTS = git-commit-mode.elc gitconfig-mode.elc gitignore-mode.elc
+ELS = git-commit-mode.el
+ELS += git-rebase-mode.el
+ELS += gitattributes-mode.el
+ELS += gitconfig-mode.el
+ELS += gitignore-mode.el
+ELCS = $(ELS:.el=.elc)
-.PHONY: build
-build : $(OBJECTS)
+.PHONY: lisp
+lisp: $(ELCS)
.PHONY: clean
-clean :
- rm -f $(OBJECTS)
+clean:
+ @echo "Cleaning..."
+ @rm -f $(ELCS)
-%.elc : %.el
- $(EMACS) -Q --batch $(EMACSFLAGS) -f batch-byte-compile $<
+%.elc: %.el
+ @$(EMACS) $(EFLAGS) -Q -batch -f batch-byte-compile $<
View
40 git-commit-mode.el
@@ -63,7 +63,6 @@
(require 'log-edit)
(require 'ring)
-(require 'saveplace)
(require 'server)
;;; Options
@@ -207,6 +206,34 @@ default comments in git commit messages"
map)
"Key map used by `git-commit-mode'.")
+;;; Menu
+
+(require 'easymenu)
+(easy-menu-define git-commit-mode-menu git-commit-mode-map
+ "Git Commit Mode Menu"
+ '("Commit"
+ ["Previous" git-commit-prev-message t]
+ ["Next" git-commit-next-message t]
+ "-"
+ ["Ack" git-commit-ack :active t
+ :help "Insert an 'Acked-by' header"]
+ ["Sign-Off" git-commit-signoff :active t
+ :help "Insert a 'Signed-off-by' header"]
+ ["Tested-by" git-commit-test :active t
+ :help "Insert a 'Tested-by' header"]
+ ["Reviewed-by" git-commit-review :active t
+ :help "Insert a 'Reviewed-by' header"]
+ ["CC" git-commit-cc t
+ :help "Insert a 'Cc' header"]
+ ["Reported" git-commit-reported :active t
+ :help "Insert a 'Reported-by' header"]
+ ["Suggested" git-commit-suggested t
+ :help "Insert a 'Suggested-by' header"]
+ "-"
+ ["Save" git-commit-save-message t]
+ ["Cancel" git-commit-abort t]
+ ["Commit" git-commit-commit t]))
+
;;; Committing
(defvar git-commit-commit-hook nil
@@ -282,8 +309,9 @@ The commit message is saved to the kill ring."
"Save current message to `log-edit-comment-ring'."
(interactive)
(let ((message (buffer-string)))
- (when (or (ring-empty-p log-edit-comment-ring)
- (not (equal message (ring-ref log-edit-comment-ring 0))))
+ (when (and (string-match "^\\s-*\\sw" message)
+ (or (ring-empty-p log-edit-comment-ring)
+ (not (ring-member log-edit-comment-ring message))))
(ring-insert log-edit-comment-ring message))))
(defun git-commit-prev-message (arg)
@@ -554,8 +582,12 @@ basic structure of and errors in git commit messages."
(concat paragraph-start "\\|*\\|("))
;; Treat lines starting with a hash/pound as comments
(set (make-local-variable 'comment-start) "#")
+ (set (make-local-variable 'comment-start-skip)
+ (concat "^" (regexp-quote comment-start) "+"
+ "\\s-*"))
+ (set (make-local-variable 'comment-use-syntax) nil)
;; Do not remember point location in commit messages
- (when (fboundp 'toggle-save-place)
+ (when (boundp 'save-place)
(setq save-place nil))
;; If the commit summary is empty, insert a newline after point
(when (string= "" (buffer-substring-no-properties
View
2 git-rebase-mode.el
@@ -372,7 +372,7 @@ By default, this is the same except for the \"pick\" command."
;;;###autoload
(add-to-list 'auto-mode-alist
- '("git-rebase-todo" . git-rebase-mode))
+ '("/git-rebase-todo\\'" . git-rebase-mode))
(provide 'git-rebase-mode)
;; Local Variables:
View
2 gitconfig-mode.el
@@ -63,7 +63,7 @@ Return t if so, or nil otherwise."
(was-in-indent (gitconfig-point-in-indentation-p)))
(beginning-of-line)
(delete-horizontal-space)
- (unless (= (char-after) ?\[)
+ (unless (equal (char-after) ?\[)
(insert-char ?\t 1))
(if was-in-indent
(back-to-indentation)

No commit comments for this range

Something went wrong with that request. Please try again.