Skip to content

Commit

Permalink
Add a shim for grep-edit
Browse files Browse the repository at this point in the history
grep-edit is a major mode introduced in Emacs 31 which enables the
editing of Grep results, by typing 'e' in '*grep*' buffers. 'C-c C-c'
exits this mode and saves changes.
  • Loading branch information
gs-101 committed Nov 10, 2024
1 parent 38af7f1 commit cca68db
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions meow-shims.el
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,28 @@ Argument ENABLE non-nil means turn on."
(advice-remove 'wgrep-finish-edit #'meow--switch-to-motion)
(advice-remove 'wgrep-save-all-buffers #'meow--switch-to-motion)))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; grep-edit


(defvar meow--grep-edit-setup nil
"Wheter already setup grep-edit.")

(defvar grep-edit-mode-hook)

(declare-function grep-edit-save-changes "grep")

(defun meow--setup-grep-edit (enable)
"Setup grep-edit.
Argument ENABLE non-nil means turn on."
(if enable
(progn
(add-hook 'grep-edit-mode-hook #'meow--switch-to-normal)
(advice-add #'grep-edit-save-changes :after #'meow--switch-to-motion))
(remove-hook 'grep-edit-mode-hook #'meow--switch-to-normal)
(advice-remove 'grep-edit-save-changes #'meow--switch-to-motion)))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; wdired

Expand Down Expand Up @@ -382,6 +404,7 @@ Argument ENABLE non-nil means turn on."
(eval-after-load "macrostep" (lambda () (meow--setup-macrostep t)))

Check warning on line 404 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (26.3, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 404 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (27.1, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 404 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (28.2, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.
(eval-after-load "wdired" (lambda () (meow--setup-wdired t)))

Check warning on line 405 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (26.3, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 405 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (27.1, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 405 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (28.2, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.
(eval-after-load "wgrep" (lambda () (meow--setup-wgrep t)))

Check warning on line 406 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (26.3, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 406 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (27.1, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 406 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (28.2, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.
(eval-after-load "grep" (lambda () (meow--setup-grep-edit t)))

Check warning on line 407 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (26.3, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 407 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (27.1, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 407 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (28.2, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.
(eval-after-load "polymode" (lambda () (meow--setup-polymode t)))

Check warning on line 408 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (26.3, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 408 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (27.1, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 408 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (28.2, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.
(eval-after-load "sly" (lambda () (meow--setup-sly t)))

Check warning on line 409 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (26.3, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 409 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (27.1, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 409 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (28.2, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.
(eval-after-load "realgud" (lambda () (meow--setup-realgud t)))

Check warning on line 410 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (27.1, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 410 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (28.2, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.
Expand All @@ -399,6 +422,7 @@ Argument ENABLE non-nil means turn on."
(when meow--rectangle-mark-setup (meow--setup-rectangle-mark nil))
(when meow--wdired-setup (meow--setup-wdired nil))
(when meow--wgrep-setup (meow--setup-wgrep nil))
(when meow--grep-edit-setup (meow--setup-grep-edit nil))
(when meow--polymode-setup (meow--setup-polymode nil))
(when meow--which-key-setup (meow--setup-which-key nil))
;; (when meow--diff-hl-setup (meow--setup-diff-hl nil))
Expand Down

0 comments on commit cca68db

Please sign in to comment.