Skip to content

Commit

Permalink
Make toggle-text-mode work in git-rebase-mode buffers
Browse files Browse the repository at this point in the history
Magit's git-rebase-mode uses a different mode and a different keymap from the
main Magit buffer. toggle-text-mode also needs to disable read-only-mode in
rebase-mode buffers.
  • Loading branch information
emlun authored and condy0919 committed Aug 5, 2024
1 parent 525463e commit e49d8e9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion modes/magit/evil-collection-magit.el
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,9 @@ using `evil-collection-magit-toggle-text-mode'"
(evil-collection-define-key evil-collection-magit-state 'magit-mode-map
"\C-t" 'evil-collection-magit-toggle-text-mode
"\\" 'evil-collection-magit-toggle-text-mode)
(evil-collection-define-key evil-collection-magit-state 'git-rebase-mode-map
"\C-t" 'evil-collection-magit-toggle-text-mode
"\\" 'evil-collection-magit-toggle-text-mode)

(defvar evil-collection-magit-last-mode nil
"Used to store last magit mode before entering text mode using
Expand All @@ -662,10 +665,11 @@ using `evil-collection-magit-toggle-text-mode'"
(defun evil-collection-magit-toggle-text-mode ()
"Switch to `text-mode' and back from magit buffers."
(interactive)
(cond ((derived-mode-p 'magit-mode)
(cond ((derived-mode-p 'magit-mode 'git-rebase-mode)
(setq evil-collection-magit-last-mode major-mode)
(message "Switching to text-mode")
(text-mode)
(read-only-mode -1)
(evil-collection-magit-toggle-text-minor-mode 1)
(evil-normalize-keymaps))
((and (eq major-mode 'text-mode)
Expand Down

0 comments on commit e49d8e9

Please sign in to comment.