-
-
Notifications
You must be signed in to change notification settings - Fork 391
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
helm-run-after-exit not passing the previous match keyword into next helm session, only if previous match is not result. #2663
Comments
"Billy.Zheng" ***@***.***> writes:
1. ( ) text/plain (*) text/html
What happened?
this issue is a follow-up to the previous issue.
It work as you said, but only partly.
anyway, just describe issue here, not need check old one.
I wrote some function like following:
(defun helm-git-grep-get-input-symbol ()
"Get input symbol."
(if (not mark-active)
(thing-at-point 'symbol)
(when (use-region-p)
(buffer-substring (region-beginning) (region-end)))))
(defun helm-grep-do-git-grep-hacked (arg)
"Preconfigured `helm' for git-grepping `default-directory'.
With a prefix arg ARG git-grep the whole repository."
(interactive "P")
(require 'helm-files)
(helm-grep-git-1 default-directory arg nil (helm-git-grep-get-input-symbol)))
(defun helm-quit-and-do-git-grep-on-project ()
"Drop into `helm-grep-do-git-grep' on entire project from `helm'."
(interactive)
(with-helm-alive-p
(helm-run-after-exit #'helm-grep-do-git-grep-hacked t)))
(global-set-key (kbd "M-r") 'helm-grep-do-git-grep-hacked)
(define-key helm-grep-map (kbd "M-r") 'helm-quit-and-do-git-grep-on-project)
The function is simple
(1) when i run M-r the first time, it use helm-grep-git on default-directory only,
(2) if i could not found the expected result, i will pressing M-r again, i will fallback do git-grep on project instead, use same match as
(1).
It works well there was matched result when run (1).
But, if there is no matched result when run (1), try again use (2), i have to re typing the match keyword again.
So, i consider there is something need improve for helm-run-after-exit
There is no need to improve helm-run-after-exit, it does the job as
expected, just let the time to Helm to exit, otherwise your
helm-git-grep-get-input-symbol function will run on the helm-buffer and
BTW will find nothing interesting at point; To do this use a timer:
(defun helm-grep-do-git-grep-hacked (arg)
"Preconfigured `helm' for git-grepping `default-directory'.
With a prefix arg ARG git-grep the whole repository."
(interactive "P")
(require 'helm-files)
(run-at-time 0.1 nil #'helm-grep-git-1
default-directory arg nil
(helm-git-grep-get-input-symbol)))
…--
Thierry
|
sorry, it not work, please let me use a concrete example for describe my issue.
the issue here is, i have to retyping above issue is not exists if there is match result when the first time typing 'M-r'. Thanks |
"Billy.Zheng" ***@***.***> writes:
1. ( ) text/plain (*) text/html
sorry, it not work, please let me use a concrete example for describe my issue.
1 open a file
2 move cursor into a non-text blank place
3 M-r to run helm-grep-do-git-grep-hacked
4 typing "local-set-key", i assume there is no matched result in current file. (this is the key difference, if there is even only one
match, this function work as expect)
5 next, i try M-r again, want to match local-set-key on the project
the issue here is, i have to retyping local-set-key to start, but i typing it once before.
With the code I sent, it IS working fine here, for the reasons I
mentionned in previous post.
above issue is not exists if there is match result when the first time typing 'M-r'.
I hardly see why.
… Thanks
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.
--
Thierry
|
Sorry, still not work as expected. When the is no matched result the first time, git grep exit with code 1 like this. (see screenshot) And, when i pressing M-r again, just a blank pattern here. (see screenshot) I even set the timer to 1s, this has severely impacted the helm-grep use experience. but, still bank there. Thanks. |
"Billy.Zheng" ***@***.***> writes:
1. ( ) text/plain (*) text/html
Sorry, still not work as expected.
Try this instead:
(defun helm-grep-do-git-grep-hacked (arg)
"Preconfigured `helm' for git-grepping `default-directory'.
With a prefix arg ARG git-grep the whole repository."
(interactive "P")
(require 'helm-files)
(run-at-time 0.1 nil #'helm-grep-git-1
default-directory arg nil
(or helm-pattern
(helm-git-grep-get-input-symbol))))
NOTE: I am still wondering why you regularly insist to use the INPUT argument when
what we have actually in Helm works perfectly i.e. starting from
helm-find-files.
…--
Thierry
|
works like a charm! thank you very much!
I probably rely on a small number of (not so correct) helm usages heavily, if i don't understood wrong, what you mean is, prefer to start from |
BTW, one of reason i don't like use helm-find-files is, the keybinding of |
Wired, after use the last config, it could found the matching result even my cursor is under a symbol which should always matched because it exists on current file. But, anyway, i understood the key, following is the complete work solution: (defun helm-git-grep-get-input-symbol ()
"Get input symbol."
(if (not mark-active)
(thing-at-point 'symbol)
(when (use-region-p)
(buffer-substring (region-beginning) (region-end)))))
(defun helm-grep-do-git-grep-on-symbol (arg)
"Preconfigured `helm' for git-grepping `default-directory'.
With a prefix arg ARG git-grep the whole repository."
(interactive "P")
(require 'helm-files)
(helm-grep-git-1 default-directory arg nil (helm-git-grep-get-input-symbol)))
(defun helm-grep-do-git-grep-on-previous-pattern (arg)
"Preconfigured `helm' for git-grepping `default-directory'.
With a prefix arg ARG git-grep the whole repository."
(interactive "P")
(run-at-time 0.1 nil #'helm-grep-git-1
default-directory arg nil
helm-pattern))
(defun helm-quit-and-do-git-grep-on-project ()
"Drop into `helm-grep-do-git-grep' on entire project from `helm'."
(interactive)
(with-helm-alive-p
(helm-run-after-exit #'helm-grep-do-git-grep-on-previous-pattern t)))
(global-set-key (kbd "M-r") 'helm-grep-do-git-grep-on-symbol)
(define-key helm-grep-map (kbd "M-r") 'helm-quit-and-do-git-grep-on-project) Thank thierry alot! |
"Billy.Zheng" ***@***.***> writes:
1. ( ) text/plain (*) text/html
BTW, one of reason i don't like use helm-find-files is, the keybinding of helm-toggle-visible-mark-forward is not so easy to use for a
(Chinese) user like me, because after installed IM(e.g. fcitx5), this process live forever, and intercept the Ctrl + Space always.
If so this is an issue with your system and Emacs, not only with helm-find-files which
uses a standard keymap like any other mode.
… —
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.
--
Thierry
|
What happened?
this issue is a follow-up to the previous issue.
It work as you said, but only partly.
anyway, just describe issue here, not need check old one.
I wrote some function like following:
The function is simple
(1) when i run
M-r
the first time, it use helm-grep-git on default-directory only,(2) if i could not found the expected result, i will pressing
M-r
again, i will fallback do git-grep on project instead, use same match as(1)
.It works well there was matched result when run (1).
But, if there is no matched result when run (1), try again use (2), i have to re typing the match keyword again.
So, i consider there is something need improve for
helm-run-after-exit
, thanks!How to reproduce?
As above
Helm Version
Master branch
Emacs Version
Emacs-29.1
OS
GNU/Linux
Relevant backtrace (if possible)
No response
Minimal configuration
The text was updated successfully, but these errors were encountered: