syl20bnr / spacemacs

A community-driven Emacs distribution - The best editor is neither Emacs nor Vim, it's Emacs *and* Vim!
http://spacemacs.org
GNU General Public License v3.0
23.69k stars 4.9k forks source link

`SPC s p` and `SPC s P` behave the same for searching projects #12783

Closed clwgg closed 4 years ago

clwgg commented 5 years ago

Description :octocat:

Both spacemacs/helm-project-smart-do-search and spacemacs/helm-project-smart-do-search-region-or-symbol insert the string under the cursor when searching a project in orgmode

Reproduction guide :beetle:

Observed behaviour: :eyes: :broken_heart: both SPC s p and SPC s P insert the string under the cursor into helm search

Expected behaviour: :heart: :smile: SPC s p should only open helm to search the project, while SPC s P should insert the string under the cursor into the search

System Info :computer:

Backtrace :paw_prints:

<<BACKTRACE IF RELEVANT>>
duianto commented 5 years ago

I'm seeing the expected behavior in both Linux and Windows.

With this test.org file:

* abc
def
* ghi
jkl

In a directory that has been (ma)git initialized SPC g i:

System Info

Pop!_OS
#### System Info :computer:
- OS: gnu/linux
- Emacs: 26.1
- Spacemacs: 0.300.0
- Spacemacs branch: develop (rev. fdd38eec9)
- Graphic display: t
- Distribution: spacemacs
- Editing style: vim
- Completion: helm
- Layers:
```elisp
(auto-completion emacs-lisp dart git helm
                 (lsp :variables lsp-dart-analysis-sdk-dir "~/development/flutter/bin/cache/dart-sdk")
                 multiple-cursors org treemacs version-control)
```
- System configuration features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 THREADS LIBSYSTEMD LCMS2
Windows Home 1903
#### System Info :computer:
- OS: windows-nt
- Emacs: 26.3
- Spacemacs: 0.300.0
- Spacemacs branch: develop (rev. fdd38eec9)
- Graphic display: t
- Distribution: spacemacs
- Editing style: vim
- Completion: helm
- Layers:
```elisp
(autohotkey auto-completion
            (dart :variables dart-server-sdk-path "c:/src/flutter/bin/cache/dart-sdk/" dart-server-enable-analysis-server t)
            emacs-lisp ess git helm html
            (lsp :variables lsp-clients-dart-server-command "~/AppData/Roaming/Pub/Cache/bin/dart_language_server" lsp-dart-analysis-sdk-dir "c:/src/flutter/bin/cache/dart-sdk/")
            multiple-cursors org php spell-checking syntax-checking treemacs version-control vinegar)
```
- System configuration features: XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS THREADS LCMS2
clwgg commented 5 years ago

hmm, that's strange. I just double-checked again, and I still see the behavior I report. Are these bindings / functions only controlled through spacemacs directly, or is there any other package I should look into / reinstall? Do you have any other pointers on how to go about debugging this?

Thanks a lot for your help!

duianto commented 5 years ago

I might have found the source.

The default search-tools list in .spacemacs on the develop branch is: dotspacemacs-search-tools '("rg" "ag" "pt" "ack" "grep")

This means that the first installed search tool is used. I have both of these search tools installed:

and the expected behavior is observed with both of them.

But I don't have pt installed, and when I remove rg and ag from the search tools list: dotspacemacs-search-tools '("pt" "ack" "grep")

Then both SPC s p and SPC s P behave the same: A HELM grep buffer opens with the word under the cursor pre populated at the prompt.

clwgg commented 5 years ago

Great find, thanks a lot for this! Installing rg or ag did indeed solve the reported problem.

However, something new has surfaced: When I searched projects with helm-grep, I used a .projectile file in my project folder to exclude certain paths from searching. Now, using helm-ag, these filters seem to be getting ignored. Do you, by chance, have any pointers on that too?

Many thanks!

duianto commented 5 years ago

This thread seems to have some suggestions for using a .agignore file and enabling a helm-ag-use-agignore variable. https://www.reddit.com/r/emacs/comments/3wynaj/spacemacs_helmag_is_not_ignoring_files/

I don't know if a .projectile file can be used for filtering results.

clwgg commented 5 years ago

The .agignore didn't seem to work, but according to this I tried a .ignore file, which works great!

Thanks for you help! Feel free to close this from my end, unless you'd like to keep it open if the helm-grep behavior should be followed up upon.

duianto commented 5 years ago

In case someone else wonders if the .agignore file can be made to work.

The next comment on that silver searcher page says:

.agignore The .agignore file was removed in favor of .ignore as part of the 2.0.0 release.

https://github.com/ggreer/the_silver_searcher/wiki/Advanced-Usage#agignore

github-actions[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!