Skip to content
Browse files

hacked in support for ack-mode buffers

  • Loading branch information...
1 parent f701229 commit 4793442ec4ff6be77c5a0fa484a64d5e512c9558 @rakete committed
Showing with 16 additions and 5 deletions.
  1. +16 −5 wgrep.el
View
21 wgrep.el
@@ -204,7 +204,10 @@ a file."
;;;###autoload
(defun wgrep-setup ()
"Setup wgrep preparation."
- (define-key grep-mode-map wgrep-enable-key 'wgrep-change-to-wgrep-mode)
+ (cond ((eq major-mode 'grep-mode)
+ (define-key grep-mode-map wgrep-enable-key 'wgrep-change-to-wgrep-mode))
+ ((eq major-mode 'ack-mode)
+ (define-key ack-mode-map wgrep-enable-key 'wgrep-change-to-wgrep-mode)))
;; delete previous wgrep overlays
(wgrep-cleanup-overlays (point-min) (point-max))
(remove-hook 'post-command-hook 'wgrep-maybe-echo-error-at-point t)
@@ -430,7 +433,10 @@ a file."
(remove-hook 'after-change-functions 'wgrep-after-change-function t)
;; do not remove `wgrep-maybe-echo-error-at-point' that display
;; errors at point
- (use-local-map grep-mode-map)
+ (cond ((eq major-mode 'grep-mode)
+ (use-local-map grep-mode-map))
+ ((eq major-mode 'ack-mode)
+ (use-local-map ack-mode-map)))
(set-buffer-modified-p nil)
(setq buffer-undo-list nil)
(setq buffer-read-only t))
@@ -519,7 +525,8 @@ When the *grep* buffer is huge, this might freeze your Emacs
for several minutes.
"
(interactive)
- (unless (eq major-mode 'grep-mode)
+ (unless (or (eq major-mode 'grep-mode)
+ (eq major-mode 'ack-mode))
(error "Not a grep buffer"))
(unless (wgrep-process-exited-p)
(error "Active process working"))
@@ -721,7 +728,7 @@ This change will be applied when \\[wgrep-finish-edit]."
(defun wgrep-cleanup-temp-buffer ()
"Cleanup temp buffer in *grep* buffer."
- (when (memq major-mode '(grep-mode))
+ (when (memq major-mode '(grep-mode ack-mode))
(let ((grep-buffer (current-buffer)))
(dolist (buf (buffer-list))
(with-current-buffer buf
@@ -871,9 +878,13 @@ NEW may be nil this means deleting whole line."
;;;###autoload(add-hook 'grep-setup-hook 'wgrep-setup)
(add-hook 'grep-setup-hook 'wgrep-setup)
+;;;###autoload(add-hook 'ack-setup-hook 'wgrep-setup)
+(add-hook 'ack-mode-hook 'wgrep-setup)
+
;; For `unload-feature'
(defun wgrep-unload-function ()
- (remove-hook 'grep-setup-hook 'wgrep-setup))
+ (remove-hook 'grep-setup-hook 'wgrep-setup)
+ (remove-hook 'ack-mode-hook 'wgrep-setup))
(provide 'wgrep)

0 comments on commit 4793442

Please sign in to comment.
Something went wrong with that request. Please try again.