Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

show "%d/%d" in the mode line #79

Closed
LuhengStat opened this issue Feb 1, 2018 · 4 comments
Closed

show "%d/%d" in the mode line #79

LuhengStat opened this issue Feb 1, 2018 · 4 comments

Comments

@LuhengStat
Copy link

When the iedit occur is working, the mode line shows the total number of the matching words.
Does there exists some settings to replace the info of mode line with "%d/%d", such as "1/20",
which 1 means the word is the first one, and 20 is the total matching words. Thanks.

@victorhge
Copy link
Owner

No. Iedit does not trace the indexes of any occurrences. So there is no easy way to get the numerator.

But I think it is a good idea to have it. I will look into it and see what I can do about it.

@LuhengStat
Copy link
Author

Thanks. There has some codes that can add this part for isearch, which maybe helpful. I found these from others in the internet, but cannot remember where I got them. Best.

;; show the search results number
(defun MyDef-isearch-update-post-hook()
(let (suffix num-before num-after num-total-set-keyal)
(setq num-before (count-matches isearch-string (point-min) (point)))
(setq num-after (count-matches isearch-string (point) (point-max)))
(setq num-total (+ num-before num-after))
(setq suffix (if (= num-total 0)
""
(format " [%d of %d]" num-before num-total)))
(setq isearch-message-suffix-add suffix)
(isearch-message)))
(add-hook 'isearch-update-post-hook 'MyDef-isearch-update-post-hook)

@victorhge
Copy link
Owner

victorhge commented Feb 8, 2018

With the latest commit, the mode line is showed in the way of that you expected. Please have a try.

@LuhengStat
Copy link
Author

Great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants