Skip to content

Commit

Permalink
legit rebase: start rebase mode when opening the git-rebase-todo file
Browse files Browse the repository at this point in the history
  • Loading branch information
vindarel committed Nov 21, 2024
1 parent 4b55d34 commit 370ce1d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions extensions/legit/legit-rebase.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ and
:keymap *legit-rebase-mode-keymap*)
(setf (variable-value 'enable-syntax-highlight) t))

(define-file-associations legit-rebase-mode
((:file-namestring "git-rebase-todo")
(:file-namestring "git-rebase-todo.backup")))


;; Use commits with a keypress:
(define-key *legit-rebase-mode-keymap* "p" 'rebase-mark-line-pick)
(define-key *legit-rebase-mode-keymap* "r" 'rebase-mark-line-reword)
Expand Down
15 changes: 15 additions & 0 deletions src/file.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,21 @@
(get mode 'file-mode-associations))

(defmacro define-file-associations (mode specs)
"Associate a mode to a list of file names so that the files are always open in this mode.
Specs are in the form (:spec \"filename\"),
Available specs:
:file-namestring
Example:
(define-file-associations makefile-mode
((:file-namestring \"Makefile\")
(:file-namestring \"makefile\")))
See also DEFINE-FILE-TYPE."
`(setf (file-mode-associations ',mode) ',specs))

(defun get-file-mode (pathname)
Expand Down

0 comments on commit 370ce1d

Please sign in to comment.