Skip to content

Instantly share code, notes, and snippets.

@christianberg
Created December 11, 2012 09:14

Revisions

  1. @re5et re5et revised this gist Aug 30, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion magit-commit-babysitter-advice.el
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,7 @@
    (setq bad-commit-message "Commit message should begin with a capital letter."))
    (end-of-line)
    (if (> (current-column) 50)
    (setq bad-commit-message "First line is too long, keep it to under 50"))
    (setq bad-commit-message "First line is too long, keep it to under 50."))
    (goto-line 2)
    (if (and
    (= (line-number-at-pos) 2)
  2. @re5et re5et revised this gist Aug 30, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion magit-log-edit-hook.el
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    (add-hook
    'magit-log-edit-mode-hook
    (lambda ()
    (flyspell-mode)
    (flyspell-mode) ;; spelling is important bro.
    (set-fill-column 72)))
  3. @re5et re5et revised this gist Aug 30, 2012. 2 changed files with 24 additions and 24 deletions.
    46 changes: 23 additions & 23 deletions magit-commit-babysitter-advice.el
    Original file line number Diff line number Diff line change
    @@ -1,25 +1,25 @@
    (defadvice magit-log-edit-commit (around magit-commit-babysitter)
    "Make sure we have a nice commit message."
    (let ((bad-commit-message nil)
    (case-fold-search nil))
    (save-excursion
    (beginning-of-buffer)
    (unless (string-match "[A-Z]" (string (char-after (point-min))))
    (setq bad-commit-message "Commit message should begin with a capital letter."))
    (end-of-line)
    (if (> (current-column) 50)
    (setq bad-commit-message "First line is too long, keep it to under 50"))
    (goto-line 2)
    (if (and
    (= (line-number-at-pos) 2)
    (not (equal (point-at-bol) (point-at-eol)))
    (setq bad-commit-message "The second line should be blank if there is more than one line.")))
    (while (not (equal (point) (point-max)))
    (forward-line)
    (end-of-line)
    (if (> (current-column) 72)
    (setq bad-commit-message "You have lines that are too long, keep them under 72.")))
    (if bad-commit-message
    (message bad-commit-message)
    ad-do-it))))
    "Make sure we have a nice commit message."
    (let ((bad-commit-message nil)
    (case-fold-search nil))
    (save-excursion
    (beginning-of-buffer)
    (unless (string-match "[A-Z]" (string (char-after (point-min))))
    (setq bad-commit-message "Commit message should begin with a capital letter."))
    (end-of-line)
    (if (> (current-column) 50)
    (setq bad-commit-message "First line is too long, keep it to under 50"))
    (goto-line 2)
    (if (and
    (= (line-number-at-pos) 2)
    (not (equal (point-at-bol) (point-at-eol)))
    (setq bad-commit-message "The second line should be blank if there is more than one line.")))
    (while (not (equal (point) (point-max)))
    (forward-line)
    (end-of-line)
    (if (> (current-column) 72)
    (setq bad-commit-message "You have lines that are too long, keep them under 72.")))
    (if bad-commit-message
    (message bad-commit-message)
    ad-do-it))))
    (ad-activate 'magit-log-edit-commit)
    2 changes: 1 addition & 1 deletion magit-log-edit-hook.el
    Original file line number Diff line number Diff line change
    @@ -2,4 +2,4 @@
    'magit-log-edit-mode-hook
    (lambda ()
    (flyspell-mode)
    (set-fill-column 72)))
    (set-fill-column 72)))
  4. @re5et re5et revised this gist Aug 30, 2012. 2 changed files with 0 additions and 0 deletions.
    File renamed without changes.
  5. @re5et re5et created this gist Aug 30, 2012.
    25 changes: 25 additions & 0 deletions magit commit babysitter advice
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    (defadvice magit-log-edit-commit (around magit-commit-babysitter)
    "Make sure we have a nice commit message."
    (let ((bad-commit-message nil)
    (case-fold-search nil))
    (save-excursion
    (beginning-of-buffer)
    (unless (string-match "[A-Z]" (string (char-after (point-min))))
    (setq bad-commit-message "Commit message should begin with a capital letter."))
    (end-of-line)
    (if (> (current-column) 50)
    (setq bad-commit-message "First line is too long, keep it to under 50"))
    (goto-line 2)
    (if (and
    (= (line-number-at-pos) 2)
    (not (equal (point-at-bol) (point-at-eol)))
    (setq bad-commit-message "The second line should be blank if there is more than one line.")))
    (while (not (equal (point) (point-max)))
    (forward-line)
    (end-of-line)
    (if (> (current-column) 72)
    (setq bad-commit-message "You have lines that are too long, keep them under 72.")))
    (if bad-commit-message
    (message bad-commit-message)
    ad-do-it))))
    (ad-activate 'magit-log-edit-commit)
    5 changes: 5 additions & 0 deletions magit log edit hook
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    (add-hook
    'magit-log-edit-mode-hook
    (lambda ()
    (flyspell-mode)
    (set-fill-column 72)))