You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I can't edit the results when there is only one result group. I get the error Text is read-only. Furthermore, when hitting C-c C-p a second time and attemptinging to delete a whole line is: wgrep-mark-deletion: Not a grep result.
If I copy the file with the matches to another file and re-run I can edit the results, and wgrep-ag works as normal.
Another work-around is to turn off grouped results.
Edit:
After a little more investigating I think the problem is with the wgrep-ag-prepare-header/footer function. I am reasonably certain that the the issue is this line: (re-search-backward result-line-regexp nil t) -- because that matches the File: line, it effectively marks the entire last group as part of the footer. I haven't been able to fix it yet, however.
Edit2:
I've submit a fix in #61, but I read in the repo owner's profile that they don't have time to maintain their modules. Thus you may want to work around this issue locally, as I'm doing. Here's how I'm doing that:
;; This fixes the last group not being editable until it's fixed
;; upstream, cf https://github.com/mhayashi1120/Emacs-wgrep/pull/61
(eval-after-load "wgrep-ag"
'(defun wgrep-ag-prepare-header/footer ()
(save-excursion
(goto-char (point-min))
;; Look for the first useful result line.
(if (re-search-forward (concat wgrep-ag-grouped-result-file-regexp
"\\|"
wgrep-ag-ungrouped-result-regexp))
(add-text-properties (point-min) (line-beginning-position)
'(read-only t wgrep-header t))
;; No results in this buffer, let's mark the whole thing as
;; header.
(add-text-properties (point-min) (point-max)
'(read-only t wgrep-header t)))
;; OK, header dealt with. Now let's try find the footer.
(goto-char (point-max))
(re-search-backward "^\\(?:-[^:]+?:[[:digit:]]+:[[:digit:]]+:\\)" nil t)
;; Point is now at the beginning of the result nearest the end
;; of the buffer, AKA the last result. Move to the start of
;; the line after the last result, and mark everything from
;; that line forward as wgrep-footer. If we can't move to the
;; line after the last line then there apparently is no
;; footer.
(when (zerop (forward-line 1))
(add-text-properties (point) (point-max)
'(read-only t wgrep-footer t))))))
The text was updated successfully, but these errors were encountered:
@zenspider I think that is the case, yes. If you use package.el, it may work if you pin to unstable MELPA? Personally I use straight.el and use this recipe to get the latest and greatest:
I can't edit the results when there is only one result group. I get the error
Text is read-only
. Furthermore, when hittingC-c C-p
a second time and attemptinging to delete a whole line is:wgrep-mark-deletion: Not a grep result
.If I copy the file with the matches to another file and re-run I can edit the results, and wgrep-ag works as normal.
Another work-around is to turn off grouped results.
Edit:
After a little more investigating I think the problem is with the
wgrep-ag-prepare-header/footer
function. I am reasonably certain that the the issue is this line:(re-search-backward result-line-regexp nil t)
-- because that matches theFile:
line, it effectively marks the entire last group as part of the footer. I haven't been able to fix it yet, however.Edit2:
I've submit a fix in #61, but I read in the repo owner's profile that they don't have time to maintain their modules. Thus you may want to work around this issue locally, as I'm doing. Here's how I'm doing that:
The text was updated successfully, but these errors were encountered: