Code Monkey home page Code Monkey logo

anzu's People

Contributors

agreselin avatar akicho8 avatar bbatsov avatar bcc32 avatar cedricporter avatar gonewest818 avatar hartzell avatar kiwanami avatar kosh04 avatar lemonbreezes avatar okamsn avatar purcell avatar swsnr avatar syohex avatar tarsius avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

anzu's Issues

Replace in visual selection

Is it possible to use anzu in selected region?
For example I have this line

foo foo foo

I press V to select the line and use anzu-replace-at-cursor-thing but it shows

No symbol at cursor!!

optionally pre-fill minibuffer prompt with thing-at-point

It would be great if I could use a variant of anzu-query-replace with the current thing-at-point pre-filled into the prompt. anzu-query-replace-at-cursor fixes the replacement candidate and I'd like to be able to edit the candidate before I start replacing. Would that be possible?

Confused about `-thing` versions of replacement functions

I'm confused about how the "thing" versions of the query replace functions work, I'd love it if you could give a more detailed explanation. I'd be happy to update the README.md and PR if if/when I understand what's going on.

I've been trying to figure things out using a bit of Go code:

type Inputs struct {
	Corrections []*Correction
	Features    []*Feature
	Oligos      []*Oligo
	Plasmids    []*Plasmid
}

The docs say this for anzu-query-replace-at-cursor

anzu-query-replace-at-cursor
Same as anzu-query-replace except from-string is symbol at cursor

If I call it with the cursor sitting on 'Feature', it prompts Query replace regexp \_<Feature\_> with:

The docs for anzu-query-replace-at-cursor-thing say this:

anzu-query-replace-at-cursor-thing
Same as anzu-query-replace-at-cursor except replaced region is specified by anzu-replace-at-cursor-thing.

If I call it the cursor sitting on 'Feature', it prompts Query replace regexp \_<Feature\_> with: (same as above).

The documentation for anzu-replace-at-cursor-thing say this:

anzu-replace-at-cursor-thing
Same as anzu-query-replace-at-cursor-thing except not query. This command is useful in refactoring such as changing variable name in the function.

which seems circular. I get that it's the non-query version of anzu-query-replace-at-cursor-thing but can't figure out how the 'thing' version is different from the non-thing version.

The definition of anzu-replace-at-cursor-thing,

(defun anzu-replace-at-cursor-thing ()
  "anzu-query-replace-at-cursor-thing without query."
  (interactive)
  (let ((orig (point-marker)))
    (anzu--query-replace-common t
                                :at-cursor t
                                :thing anzu-replace-at-cursor-thing
                                :query nil)
    (goto-char (marker-position orig))
    (set-marker orig nil)))

uses anzu-replace-at-cursor-thing, which seems recursive and just leaves me confused....

I feel like I might be missing something simple/obvious, but....

Can you explain/demonstrate how the the -thing versions are different?

THANKS!

query-replace-regexp: Error when entering "\" in replacement pattern

It's normally possible to use \\1 in the replacement text to insert backreferences, but Anzu gets upset by this. As soon as I type \ at the replacement text prompt, this happens:

Debugger entered--Lisp error: (error "Invalid use of `\\' in replacement text")
  replace-match("\\" t)
  anzu--evaluate-occurrence(#<overlay from 1977 to 1980 in terms_of_use.html.haml> "\\" 0)
  anzu--append-replaced-string(#<buffer terms_of_use.html.haml> 64 43994 t 2198)
  #[0 "BYTECODE" [64 43994 t 2198 #<buffer terms_of_use.html.haml> internal--before-with-selected-window active-minibuffer-window minibuffer-window funcall make-byte-code 0 BYTECODE" vconcat vector [internal--after-with-selected-window] 2 "\n\n(fn)" select-window norecord anzu--append-replaced-string] 8 "\n\n(fn)"]()
  apply(#[0 "BYTECODE" [64 43994 t 2198 #<buffer terms_of_use.html.haml> internal--before-with-selected-window active-minibuffer-window minibuffer-window funcall make-byte-code 0 "BYTECODE" vconcat vector [internal--after-with-selected-window] 2 "\n\n(fn)" select-window norecord anzu--append-replaced-string] 8 "\n\n(fn)"] nil)
  byte-code("BYTECODE" [timer apply 5 6] 4)
  timer-event-handler([t 0 0 50000 repeat #[0 "BYTECODE" [64 43994 t 2198 #<buffer terms_of_use.html.haml> internal--before-with-selected-window active-minibuffer-window minibuffer-window funcall make-byte-code 0 "BYTECODE" vconcat vector [internal--after-with-selected-window] 2 "\n\n(fn)" select-window norecord anzu--append-replaced-string] 8 "\n\n(fn)"] nil idle 0])
  read-from-minibuffer("Query replace regexp \\([0-9]+\\)\\.  with: " nil nil nil query-replace-history nil t)
  anzu--read-to-string("\\([0-9]+\\)\\. " "Query replace regexp" 64 43994 t 2198)
  anzu--query-replace-read-to("\\([0-9]+\\)\\. " "Query replace regexp" 64 43994 t 2198)
  anzu--query-replace-common(t :prefix-arg 1)
  anzu-query-replace-regexp(1)
  #<subr call-interactively>(anzu-query-replace-regexp nil nil)
  ad-Advice-call-interactively(#<subr call-interactively> anzu-query-replace-regexp nil nil)
  apply(ad-Advice-call-interactively #<subr call-interactively> (anzu-query-replace-regexp nil nil))
  call-interactively(anzu-query-replace-regexp nil nil)
  command-execute(anzu-query-replace-regexp)

anzu-query-replace-regexp dies if `^` is input as pattern on a region

Steps to reproduce:

  1. Activate a region (C-SPC) and select at least two lines (C-n C-n)
  2. Invoke M-x anzu-query-replace-regexp
  3. Hit ^

And you'll see a Lisp error: Invalid search bound (wrong side of point)

A backtrace shows it is raised in re-search-forward called by anzu--count-and-highlight-matched.

anzu-query-replace: counter can be wrong when using suggested query/replace criteria

As reported in #93.

With case-fold-search set to t in a buffer containing:

Gee AB ab AB ab AB ab.

Do, in sequence,

  1. anzu-query-replace e RET RET -- the counter is (1/2) -- quit and go back at the bol (C-a), then
  2. anzu-query-replace ab RET RET -- the counter is (1/6) -- C-a, then
  3. anzu-query-replace RET (accepting the proposed replacement ab → ); the counter wrongly shows (1/2).

This last bug has proved rather hard to reproduce consistently. If I run all the other tests, including those with case-fold-search set to nil, then set case-fold-search to t again and run this one, at point 3 the counter becomes (1/6) instead of (1/2). If you can't reproduce point 3, do another replacement of "e", quit and do an additional one using the suggested replacement, I get (1/6) instead of (1/2) sometimes. The heart of the matter is that sometimes Anzu appears to use the previous replacement's count when performing another one using the suggested completion.

Additionally, with case-fold-search set to nil in the same buffer:

  1. anzu-query-replace "ab" with "cd": offers to replace each "ab" with "cd" , counts correctly to 3 matches; HOWEVER a second anzu-query-replace and accepting the default criteria (ab → cd) results in an incorrect count of 6 matches.

  2. anzu-query-replace "AB" with "CD": offers to replace each "AB" with "CD", counts correctly to 3 matches; again repeating the same query replace with default arguments results in an incorrect count of 6 matches.

migemo-isearch-enable-p

anzu--search-all-position の中でmigemo-isearch-enable-pを評価している箇所がありますね。
anzu-use-migemotのとき、かつmigemoがロードされていないときには未定義変数の評価でエラーになります。
(featurep 'migemo)migemo-isearch-enable-pの評価の直前に挟むとよりロバストになると思いましたがいかがでしょうか。

"migemization" of anzu.el

Following text is written by Japanese only.

現状,migemoでローマ字検索するときにはモードラインの表示が (0/0) となりますが,
migemo対応できるとさらに便利かと思いました.
実装の難易度は測りかねますが.

Immediate jump to first occurence

Hi,

when using anzu-query-replace, if I type a string that exists in the buffer but that string is not visible on the screen (e.g., because the string appears after the last line displayed), I won't see anzu matching anything. It would be great if anzu could show me the first match as soon as it finds one, even if it is not on the screen.

The display in modeline is not accurate now

I am using latest master source compiled emacs. Recently I found the Anzu doesn't work as before.
The total matched number are correct, but the current number isn't correct and bigger than the total number.

For example, I will emacs -Q to start, then M-x package-list-packages, then isearch "tree", there are 11 matches, use C-s to navigate, there will be 1/11, 2/11, then 4/11, no 3/11.

My emacs version:
GNU Emacs 27.0.50 (build 15, x86_64-pc-linux-gnu, GTK+ Version 3.22.11)
of 2018-10-09

[Feature Request] replace globally in current things

e.g.

def as_indexed_json(options = {})
    _attributes = attributes.as_json
    _attributes["status"] ||= 0  <== cursor is here
    _attributes.as_json(:except => "additional_fields")
end

run (anzu-replace-at-cursor-thing), it just replace last _attributes,
replace worked like this, but, I thought if I definition myself thing,
I hope can replace 3 occur _attributes in current method.

Thanks.

Nice to have: different face for failure

Hello. Super tool I already use for years now... Don't understand this isn't basic into Emacs yet, but that's another story.

Now, my wish would be to have a different face when there is no match. For example, we could then have the indicator in the modeline:

  • with a green background when there are matches,
  • with a red background as soon as we search for a pattern that's not present in the buffer.

That'd visually help to focus on the searches.

Thanks for considering it!

UPDATE -- In fact, the more general approch would consist in having 3 faces: one when there "0 out of 0 matches" (= nothing found, or nothing specified yet), another when there are "xx out of yy matches" (where xx < yy = many possible matches) and finally one when there are "xx out of yy matches" (where xx = yy, that is only one match available).

replace isearch-query-replace-regexp to anzu search.

I often use replace like following:

step one:

Search something with C-s

step two:

If found, invoke isearch-query-replace-regexp with a shortcut,
it can use isearch result as search, and ask the replace strings.

Thanks.

"Wrong type argument: stringp, nil" error with version 0.33+ installed from package.el

Thanks for creating this wonderful package first of all.

I'm using anzu.el on my Emacs 24.3.1 with migemo.
I have the following setting to make the (x/y) display bigger.

(custom-set-faces
 '(anzu-mode-line ((t (:foreground "dark blue" :weight ultra-bold :height 2.0))))
 '(font-latex-subscript-face ((t nil)))
 '(font-latex-superscript-face ((t nil))))

Up until version 0.32 the anzu I-search was working fine with correct numbers shown in the mode-line. However, after 0.33 installed from package.el I get "Wrong type argument: stringp, nil" and (0/0) regardless of where the cursor is.

So I deleted anzu.el from package.el, and installed 0.34 by copying https://raw.githubusercontent.com/syohex/emacs-anzu/master/anzu.el file directly, and for some reason this worked without problem.

I was wondering if the additional files related to package.el is causing some problem.

Thanks for your attention.

screen shot 2014-03-27 at 6 42 23 pm

Case-Sensitive Replace

I'm having problems trying to do case-sensitive Regex-Replacing with Anzu. I've enabled anzu-query-replace-regexp in my .emacs like so:

(global-set-key (kbd "C-r") 'anzu-query-replace-regexp)

Now the problem is that the replacement function seems to be case-insensitive, which really sucks and also makes no sense because it's regular expressions. I've tried toggling case-fold-search and also tried this snippet:

(global-set-key (kbd "C-r")
                 (lambda ()
                  (interactive)
                   (let ((case-fold-search nil))
                     (call-interactively 'anzu-query-replace-regexp))))

But neither seem to make the replacement-search case-sensitive. Any suggestions?

Priority of `anzu-match-{1,2,3}` faces

Should the anzu-match-{1,2,3} faces be put with a higher priority? Either they are overriden by isearch, or I do not know where they're supposed to appear.

case-folding behavior of `anzu-isearch-query-replace`

Imagine the user does an isearch-forward and toggles a case sensitive search with M-c. The subsequent anzu-isearch-query-replace should not only search for the prior search string, but it should also use the case-sensitivity specified in the prior search. That's not the case.

Example. The buffer contains

anzu Anzu anzu

Searching for "anzu" will match all three words. Searching for "Anzu" will match just the middle word. Searching for "anzu" with M-c will match the first and last word.

However, after a case-sensitive (M-c) search with the string "anzu", the subsequent anzu-isearch-query-replace will always ask to replace all three words. This is the case that needs to be fixed, because the M-c should be honored in the query-replace.

anzu-query-replace-regexp and repeat-complex-command

When I use anzu-query-replace-regexp and want to repeat the same replace at a later time using repeat-complex-command it does not come up in the history. However, if I use query-replace-regexp it does.

It would be great if I could repeat my last replace using the command history.

anzu-query-replace-regexp: match-substitute-replacement: Invalid use of ‘\’ in replacement text

Hi, thanks for taking over maintenance of this.

When a replacement contains \, is passed to anzu-query-replace-regexp the following error occurs:

match-substitute-replacement: Invalid use of ‘\’ in replacement text

For example:

be_\(truthy\|falsey\) -> be \,(if (string= \1 "truthy") "true" "false")

This gets highlighted correctly:

Screen Shot 2020-04-22 at 6 42 20 PM

But the replacement fails with the above error.

M-x query-replace-regexp works.

anzu does not work well along with `multi-isearch-buffers`

When calling multi-isearch-buffers, anzu is automatically activated. The bug happens when the search goes to the 2nd+ specified buffers.

To reproduce the problem, here are the basic steps:

  1. Call multi-isearch-buffers.
  2. Specify at least two buffers to search on.
  3. Search for a term that is present in the second or other buffer (not only in the first buffer).
  4. Hit Return to stop the search when finding the term in a buffer other than the first one. Here, everything would be fine on that buffer.
  5. Return to the first buffer (simply by switch-to-buffer, for example). Now you should notice that the anzu part on the mode-line is still active. Anything typed on that buffer is considered for the search. The search goes on not on that first buffer but on the other buffers selected for multi-isearch-buffers in step 2.

Another non-supportive characteristic in this scenario is that when searching from the second buffer on with multi-isearch-buffers, mode-line no longer indicates the anzu is activated (maybe it is not, in fact).

byte-compile warning

Hi,

Thank you for your work.

This is a little report of anzu.el.

When anzu.el is byte-compiled, following warning messages are displayed.
I think it can be fixed easily.

In anzu--search-all-position:
anzu.el:63:15:Warning: assignment to free variable `anzu--cached-positions'

In anzu-mode:
anzu.el:124:6:Warning: remove-hook called with 4 arguments, but accepts only
    2-3

Thanks,
Akira

[feature request]: suppot "delete-matching-lines"

delete-matching-lines is an useful built-in command in Emacs. But it's very possible that some necessary lines are also deleted by oversight without highlight. So I think it'd be nice if anzu also support delete-matching-lines.

'anzu-replace-threshold' is ignored for 'anzu-query-replace'

Hello. Thanks a lot for this great package.

Here is reproducing steps:
$ emacs -Q

(package-initialize)
(require 'anzu)
(global-anzu-mode 1)

and open the latest anzu.el file.

C-s a shows (1/1000+) as default anzu-search-threshold is set to 1000.
However M-x - anzu-query-replace a shows (1650 replace) although anzu-replace-threshold is set to default 1000 too.
I also found same result with anzu-query-replace-regexp.

Thanks.

Anzu doesn't work for regexp search

I use the following in my configuration for searching:

(global-set-key (kbd "C-s") 'isearch-forward-regexp)
(global-set-key (kbd "C-r") 'isearch-backward-regexp)

Anzu works well when I do regular text searches, but when I try to do a search for ^I searching freezes after typing the ^ and won't allow me to type anything afterwards.

If I disable anzu-mode, I'm able to search using regexp again.

anzu-isearch-query-replace: counter is wrong

  1. In a buffer containing
AB ab AB ab AB ab.

Perform an isearch-forward for "ab" and the counter correctly shows 6 matches.

Then perform an anzu-isearch-query-replace "ab" to "cd" and the counter shows 3 total matches but offers to replace 6 strings, (1/3), (2/3), (3/3), (4/3), (5/3), (6/3).

  1. In the same buffer perform isearch-forward for "AB" and the counter correctly shows 3 matches.

Then perform anzu-isearch-query-replace "AB" to "cd" and the three "AB" strings are replaced but the counter shows (1/3), (3/3), (5/3).

PCRE mode support

Hello,

I like anzu, but I also like pcre-mode, and they do not like each other.

Would you be interested in a pull request to make anzu work with pcre-mode when present, so users can type in pcre-like regexes? I was doing this using a bunch of horrible advices around internal anzu functions but it tends to get broken by updates.

Integration with Evil

With Evil installed:

  • Press / to start incremental search.
  • Type "text" -> anzu will show (1/5) in mode line
  • Hit Enter to start searching, use n and N to navigate.

After you hit Enter, anzu information disappears from the mode line. This is fine, because selection also disappears. But when you press n or N, selection reappears for a couple of seconds, and cursor moves to the next/previous match.

I expect anzu information also to appear for a couple of seconds after I press n or N.

Currently, anzu information does not appear after hitting n or N.


Maybe I am missing something obvious here?

I can see that vim-anzu provides the following mappings

nmap n <Plug>(anzu-n-with-echo)
nmap N <Plug>(anzu-N-with-echo)

Is there a similar configuration to remap evil's n and N?

`anzu-query-replace-regexp` when use previous regex text contains '\,()'

Question:

I can replace text contains ,(func ) for the first time,
but I can not use it again or othes based on it. (type <↑> and use it again)

anzu version : 20190303.1701

regexp text

\(\w+\)\s-+\([a-z_]+\).*?///< \(.*?\)$ -> {"\2", &app_data->mer_st.\2, "\3", PTS_DB_TYPE_\,(upcase \1), sizeof(app_data->mer_st.\2)},

Debug Info

Debugger entered--Lisp error: (error "Invalid use of ‘\\’ in replacement text")
  replace-match("{\"\\2\", &app_data->mer_st.\\2, \"\\3\", PTS_DB_TYPE_\\,(..." nil nil #("bigint  mer_map_id;                     ///< 商户id" 0 19 (fontified t) 19 40 (fontified t c-is-sws t c-in-sws t) 40 41 (face font-lock-comment-delimiter-face fontified t c-is-sws t c-in-sws t) 41 43 (face font-lock-comment-delimiter-face fontified t c-in-sws t) 43 49 (face font-lock-comment-face fontified t c-in-sws t)) nil)
  match-substitute-replacement("{\"\\2\", &app_data->mer_st.\\2, \"\\3\", PTS_DB_TYPE_\\,(..." nil nil)
  perform-replace("\\(\\w+\\)\\s-+\\([a-z_]+\\).*?///< \\(.*?\\)$" "{\"\\2\", &app_data->mer_st.\\2, \"\\3\", PTS_DB_TYPE_\\,(..." t t nil nil nil 5137 6729)
  apply(perform-replace ("\\(\\w+\\)\\s-+\\([a-z_]+\\).*?///< \\(.*?\\)$" "{\"\\2\", &app_data->mer_st.\\2, \"\\3\", PTS_DB_TYPE_\\,(..." t t nil nil nil 5137 6729))
  anzu--query-replace-common(t :prefix-arg 1)
  anzu-query-replace-regexp(1)
  funcall-interactively(anzu-query-replace-regexp 1)
  call-interactively(anzu-query-replace-regexp nil nil)
  command-execute(anzu-query-replace-regexp)

Steps

  1. call anzu-query-replace-regexp
  2. type ↑ to find a previous regex text with function
  3. modify or not , then press ENTER

Is there any more details I need to offer here?

Thanks a lot !

args-out-of-range in anzy-query-replace

This happens both in anzy-query-replace and anzy-query-replace-regexp`. The happens more ofter in bigger files. It does not happen all the time. I can retry and it might work.
Prot.c is exactly 54698 bytes long, but I see 54699 in the stacktrace.

Debugger entered--Lisp error: (args-out-of-range #<buffer prot.c> 0 1)
  buffer-substring-no-properties(0 1)
  perform-replace("tube " "Tube *" t nil nil nil nil 7179 54699 nil nil)
  query-replace("tube " "Tube *" nil 7179 54699)
  apply(query-replace ("tube " "Tube *" nil 7179 54699))
  anzu--query-replace-common(nil :prefix-arg 1)
  anzu-query-replace(1)
  funcall-interactively(anzu-query-replace 1)
  #<subr call-interactively>(anzu-query-replace nil nil)
  apply(#<subr call-interactively> anzu-query-replace (nil nil))
  call-interactively@ido-cr+-record-current-command(#<subr call-interactively> anzu-query-replace nil nil)
  apply(call-interactively@ido-cr+-record-current-command #<subr call-interactively> (anzu-query-replace nil nil))
  call-interactively(anzu-query-replace nil nil)
  command-execute(anzu-query-replace)

Anzu doesn't work

I tried anzu-query-replace & anzu-query-replace-regexp but it seems does not work

Am I missed something ?

anim

Anzu Version: 20161017.907
GNU Emacs 25.1.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.11) of 2017-09-15, modified by Debian
Debian 9

dired-do-query-replace-regexp problems

Hello,

First of all thanks for making this awesome package! I have ran into an issue when using anzu that must be either some misconfiguration on my part or some clash between anzu and dired-do-query-replace-regexp.

Steps to reproduce:

  1. Use anzu-query-replace on a buffer. It works fine.
  2. Then do find-name-dired in that same directory (or possibly any other directory I guess), for all files with * wildcard and select all files with t.
  3. One you press Q in the dired buffer which should execute dired-do-query-replace-regexp you get an error.

The error is:

query-replace-descr: Wrong type argument: listp, "_active"

where "_active" is basically the previous string you tried to replace.

Here is a backtrace. I was simply experimenting with the search string being the same as the replace string here. It happens also when they are different:

Debugger entered--Lisp error: (wrong-type-argument listp "_active")
  mapconcat(isearch-text-char-description ("_active" . "_active") "")
  query-replace-descr(("_active" . "_active"))
  query-replace-read-from("Query replace regexp in marked files" t)
  query-replace-read-args("Query replace regexp in marked files" t t)
  (let ((common (query-replace-read-args "Query replace regexp in marked files" t t))) (list (nth 0 common) (nth 1 common) (nth 2 common)))
  call-interactively(dired-do-query-replace-regexp nil nil)
  command-execute(dired-do-query-replace-regexp)

Any help would be greatly appreciated. I really like Anzu but I also want to have dired's search and replace functionality.

anzu--state is global

I'm new to emacs so I'm not entirely sure, but I'm configuring the mode-line myself instead of using the default consing mechanism. So I set anzu-mode-line-update-function to my own function and anzu-cons-mode-line-p to nil. It works well. The only (major) problem is that if I search in one buffer, all of them show the same information with respect to anzu, in the mode-line.

I believe this is because the anzu--state variable is global, which is what I use to determine if the anzu stuff should be shown in my mode-line. It happens to work out fine in the default mechanism because it's only checked once to determine whether or not to cons the anzu stuff to the buffer-local mode-line. However, if you don't use a cons mechanism or otherwise update the mode-line once in response to anzu, then all of the windows will show this.

I managed to resolve this by doing this:

(add-hook 'anzu-mode-hook (lambda () (make-local-variable 'anzu--state)))

Now my mode-line is working as expected: searching in one buffer in a window won't set the anzu stuff in my mode-line for every window. I'm not sure if this is the preferred way to fix this though.

anzu-query-replace behaviour deviates from query-replace during recursive edits

Apologies, but I don't have the time (or probably the expertise) to look into the cause of this, but I noticed that during recursive editing the anzu version of query-replace does not update the matches.

To reproduce, open a blank buffer and enter:

a
b
a
b

Move the point to the beginning of the buffer and use M-x query-replace to replace a with x. Before accepting the changes, type C-r to enter a recursive edit. Move to the end of the file and add a newline with another a like so:

a
b
a
b
a

Now exit recursive edit (C-M-c). The new a is also highlighted. You can change all a's with 3x y or !, resulting in:

x
b
x
b
x

Performing the same operations with anzu-query-replace results in only the first two a's being replaced:

x
b
x
b
a

I'm not sure if this is something that's technically difficult to solve, or just overlooked as it's probably not commonly come across. I hope the later, but either way I thought it would be helpful to open an issue.

Add spaces around expression in mode-line

Would you accept adding one space before and one space after the expressions such as "(%d/%d)"?
Or add an option?

That'd allow us not to redefine several functions if we want such a display.

Thanks!

Anzu's counter is case insensitive even if isearch is case sensitive

Hello. In a buffer containing

Anzu please count right

if I do C-s M-c anzu isearch fails but Anzu counts one match (the counter is (0/1)). I use Anzu 0.62 on Emacs 25.2; my set-up for Anzu is

(require 'anzu)
(global-anzu-mode)
(define-key isearch-mode-map [remap isearch-query-replace]  #'anzu-isearch-query-replace)
(define-key isearch-mode-map [remap isearch-query-replace-regexp] #'anzu-isearch-query-replace-regexp)

Anzu should use the minor-mode-alist of isearch-mode

Anzu is a really cool mode, but I wish it would replace the entry for isearch-mode in minor-mode-alist and not mess with the rest of my mode-line since I have it heavily customized. Something like

(setcar (cdr (assq 'isearch-mode minor-mode-alist))
        '(:eval
          (anzu--update-mode-line-default anzu--current-posion anzu--total-matched)))

works for me, but then it appears in my mode-line twice. At the very least I would like to be able to turn off adding itself to the mode-line so that I could add it myself.

feature request: Anzu in iedit

iedit provide some functionalities that overlap isearch; from iedit mode, you can navigate from one match to the previous/next one.

The current implementation provides a count for the number of matches, but no information about the current match. It would be nice to be able to get anzu working in iedit mode too.

anzu-query-replace-regexp: Match data clobbered by buffer modification hooks

When I run that command, there is often that “Match data clobbered by buffer modification hooks” error.

Running with

(let ((inhibit-modification-hooks t)) (call-interactively #'anzu-query-replace-regexp))

seems to be a workaround.

Detailed backtrace:

Debugger entered--Lisp error: (error "Match data clobbered by buffer modification hooks")
  replace-match("githash_subject_map" nil nil)
  replace-match-maybe-edit("githash_subject_map" nil nil t (791 807 #<buffer is-patch-reverted>) nil)
  perform-replace("subject_hash_map" "githash_subject_map" t t nil nil nil 1 2325)
  apply(perform-replace ("subject_hash_map" "githash_subject_map" t t nil nil nil 1 2325))
  anzu--query-replace-common(t :prefix-arg 1)
  anzu-query-replace-regexp(1)
  funcall-interactively(anzu-query-replace-regexp 1)
  call-interactively(anzu-query-replace-regexp nil nil)
  command-execute(anzu-query-replace-regexp)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.