emacsorphanage / helm-ag

The silver searcher with helm interface
493 stars 76 forks source link

helm-ag--do-ag-up-one-level don't auto refresh result when up one level folder. #326

Closed zw963 closed 3 years ago

zw963 commented 5 years ago

("ag" "--nocolor" "--nogroup" "--ignore=.min.js" "--ignore=.js" "--ignore=.json" "--ignore=.log" "--ignore=TAGS" "--ignore=tags" "--ignore=test-reports" "--ignore=\#\#" "--ignore=.\#" "--ignore=*~" "Faraday" "lib/faraday/adapter.rb")

Actual behavior

When i run helm-do-ag-this-file for lib/fadaray/adapter.rb, i got 3 result, it is expected. in this case, when I press Ctrl+l (helm-ag-do-ag-up-one-level), i can see the folder in helm search bar is switched to parent folder, but, the really result keep no changed. (still 3 result)

Expected behavior

I can very ensure, should return many result. (i guess the bug maybe is: ag still search only one file, not parent folder)

My personal settings:

(setq
 ;; 必须开启 follow 模式, 才能有跟随 buffer 的 follow 效果.
 helm-follow-mode-persistent t
 helm-ag-base-command "ag --nocolor --nogroup"
 helm-ag-insert-at-point 'symbol
 helm-ag-fuzzy-match t
 helm-ag-ignore-patterns '("*.min.js" "*.js" "*.json" "*.log" "TAGS" "tags" "test-reports" "\\#*\\#" ".\\#*" "*~")
 )
(require 'helm-ag)

Thanks

zw963 commented 5 years ago

Following is a gif to reproduce: deepin-screen-recorder_emacs_20181224145913.gif

https://zw963.github.io/images/2721357924623.gif

zw963 commented 5 years ago

I can confirm when use helm-do-ag instead of helm-do-ag-this-file, it works, but, not working with helm-do-ag-this-file,

if when search in current file, can do search based on current directory all files use press 'C-j', and based on one leave up directory again when press 'C-j' again, that will be a very good experience.

zw963 commented 4 years ago

Any update on this? if i describe not clear enough? thank you.

zw963 commented 4 years ago

Maybe what i described is not so clear, in fact, i workaround this, and basically achieve the same effect, following is my config:

(defun helm-quit-and-helm-do-ag-current-directory ()
  "Drop into `helm-do-ag-current-directory' from `helm'."
  (interactive)
  (with-helm-alive-p
    (helm-run-after-exit (lambda () (helm-do-ag default-directory)))
    ))

(global-set-key (kbd "C-r") 'helm-do-ag-this-file)
(define-key helm-ag-map [(control r)] 'helm-quit-and-helm-do-ag-current-directory)
  1. When i want to search some content in current file, press Ctrl+r
  2. If i am not find out expected result, press Ctrl+r again, will search on current directory.
  3. If still not found, Press Ctrl+J, search on one leave up directory.
  4. Repeat step 3, until find out expected result.

The feature what i expected is, if we can omit step 2, Ctrl+j search on current directory directly, will be appreciated a lot, anyway, consider current directory as a up level of current file, is a meanful default.