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

helm-project-smart-do-search breaks and errors, doesn't jump to correct line #15437

Closed
Davidj361 opened this issue Mar 30, 2022 · 12 comments
Closed
Labels
- Bug tracker - Helm Should report upstream stale marked as a stale issue/pr (usually by a bot)

Comments

@Davidj361
Copy link

Davidj361 commented Mar 30, 2022

Description :octocat:

Doing spacemacs/helm-project-smart-do-search and searching for 'supp' in this code gives an error of:
Search failed: there is an unmatched expression somewhere or we are at the beginning/end of file. [4 times]

void foobar(Foo1 * foo1, Bar1 * bar2)
{
    if (((foo->supp)&&(foo1->sec || d.s ||
        (foo->offset &&
            (abs(bar2->sec) >=
          foo->offset)))) || ((!foo->supp) && (foo1->sec))){
}

Reproduction guide 🪲

  • Start Emacs
  • create directory for files below
  • put code from above into test.c
  • create a .projectile in the same directory
  • SPC / OR SPC s p
  • Search for 'supp'
  • You will get an error and the jump won't take you to the right line.

Observed behaviour: 👀 💔

2022-03-30.13-52-31.mp4

When I jump to the entry it doesn't jump to the right line and instead jumps to the starting curly brace '{'.

Expected behaviour: ❤️ 😄

When I jump to the entry it should take me to the correct line such as line 3.

System Info 💻

  • OS: gnu/linux
  • Emacs: 27.2
  • Spacemacs: 0.999.0
  • Spacemacs branch: develop (rev. 18ad975)
  • Graphic display: t
  • Distribution: spacemacs
  • Editing style: vim
  • Completion: helm
  • Layers:
(auto-completion emacs-lisp helm helpful dap lsp markdown multiple-cursors
                 (org :variables org-startup-indented t org-indent-mode t)
                 (c-c++ :variables c-c++-backend 'lsp-clangd)
                 spell-checking syntax-checking treemacs)
  • System configuration features: XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND GPM DBUS GSETTINGS GLIB NOTIFY INOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS LIBSYSTEMD JSON PDUMPER LCMS2 GMP

Backtrace 🐾

Debugger entered--Lisp error: (scan-error "Unbalanced parentheses" 39 202)
  scan-sexps(39 1)
  forward-sexp(1)
  hs-forward-sexp((39 40 #<buffer test.c>) 1)
  hs-find-block-beginning()
  #f(compiled-function (&optional end) "Select a block and show it.\nWith prefix arg, reposition at END.  Upon completion, point is\nrepositioned and the normal hook `hs-show-hook' is run.\nSee documentation for functions `hs-hide-block' and `run-hooks'." (interactive "P") #<bytecode 0x1593c8bc1a65>)(nil)
  ad-Advice-hs-show-block(#f(compiled-function (&optional end) "Select a block and show it.\nWith prefix arg, reposition at END.  Upon completion, point is\nrepositioned and the normal hook `hs-show-hook' is run.\nSee documentation for functions `hs-hide-block' and `run-hooks'." (interactive "P") #<bytecode 0x1593c8bc1a65>))
  apply(ad-Advice-hs-show-block #f(compiled-function (&optional end) "Select a block and show it.\nWith prefix arg, reposition at END.  Upon completion, point is\nrepositioned and the normal hook `hs-show-hook' is run.\nSee documentation for functions `hs-hide-block' and `run-hooks'." (interactive "P") #<bytecode 0x1593c8bc1a65>) nil)
  hs-show-block()
  helm-goto-char(56)
  helm-ag--find-file-action("test.c:3:    if (((foo->supp)&&(foo1->sec || d.s |..." find-file nil)
  helm-ag--action-find-file("test.c:3:    if (((foo->supp)&&(foo1->sec || d.s |...")
  helm-execute-selection-action-1()
  helm-execute-selection-action()
  helm-internal(helm-source-do-ag "" nil nil nil "*helm-ag*" (keymap (3 keymap ...) (12 . helm-ag--do-ag-up-one-level) keymap (normal-state keymap "Auxiliary keymap for..." ...) (left . helm-ag--previous-file) (right . helm-ag--next-file) (24 keymap ...) (12 . helm-ag--up-one-level) (3 keymap ... ... ... ... ...) keymap (C-iso-lefttab . helm-follow-action-backward) (26 . helm-select-action) (tab . helm-execute-persistent-action) (33554440 . describe-key) (33554443 . helm-follow-action-backward) (33554442 . helm-follow-action-forward) (17 . ace-jump-helm-line) (f13 lambda nil ... ...) (f12 lambda nil ... ...) ...) nil helm-ag--helm-history)
  apply(helm-internal (helm-source-do-ag "" nil nil nil "*helm-ag*" (keymap ... ... keymap ... ... ... ... ... ... keymap ... ... ... ... ... ... ... ... ... ...) nil helm-ag--helm-history))
  helm(helm-source-do-ag "" nil nil nil "*helm-ag*" (keymap (3 keymap ...) (12 . helm-ag--do-ag-up-one-level) keymap (normal-state keymap "Auxiliary keymap for..." ...) (left . helm-ag--previous-file) (right . helm-ag--next-file) (24 keymap ...) (12 . helm-ag--up-one-level) (3 keymap ... ... ... ... ...) keymap (C-iso-lefttab . helm-follow-action-backward) (26 . helm-select-action) (tab . helm-execute-persistent-action) (33554440 . describe-key) (33554443 . helm-follow-action-backward) (33554442 . helm-follow-action-forward) (17 . ace-jump-helm-line) (f13 lambda nil ... ...) (f12 lambda nil ... ...) ...) nil helm-ag--helm-history)
  apply(helm (helm-source-do-ag "" nil nil nil "*helm-ag*" (keymap ... ... keymap ... ... ... ... ... ... keymap ... ... ... ... ... ... ... ... ... ...) nil helm-ag--helm-history))
  helm(:sources helm-source-do-ag :buffer "*helm-ag*" :keymap (keymap (3 keymap ...) (12 . helm-ag--do-ag-up-one-level) keymap (normal-state keymap "Auxiliary keymap for..." ...) (left . helm-ag--previous-file) (right . helm-ag--next-file) (24 keymap ...) (12 . helm-ag--up-one-level) (3 keymap ... ... ... ... ...) keymap (C-iso-lefttab . helm-follow-action-backward) (26 . helm-select-action) (tab . helm-execute-persistent-action) (33554440 . describe-key) (33554443 . helm-follow-action-backward) (33554442 . helm-follow-action-forward) (17 . ace-jump-helm-line) (f13 lambda nil ... ...) (f12 lambda nil ... ...) ...) :input "" :history helm-ag--helm-history)
  helm-do-ag--helm(nil nil)
  helm-do-ag("/home/dj/tmp/test/")
  (let* ((root-helm-ag-base-command "rg --smart-case --no-heading --color=never --line-...") (helm-ag-base-command (if spacemacs-helm-rg-max-column-number (concat root-helm-ag-base-command " --max-columns=" (number-to-string spacemacs-helm-rg-max-column-number)) root-helm-ag-base-command))) (helm-do-ag dir))
  spacemacs/helm-files-do-rg("/home/dj/tmp/test/")
  (if dir (spacemacs/helm-files-do-rg dir) (message "error: Not in a project."))
  (let ((dir (projectile-project-root))) (if dir (spacemacs/helm-files-do-rg dir) (message "error: Not in a project.")))
  spacemacs/helm-project-do-rg()
  funcall-interactively(spacemacs/helm-project-do-rg)
  call-interactively(spacemacs/helm-project-do-rg)
  (let ((projectile-require-project-root nil)) (call-interactively (spacemacs//helm-do-search-find-tool "helm-project-do" dotspacemacs-search-tools default-inputp)))
  spacemacs/helm-project-smart-do-search()
  funcall-interactively(spacemacs/helm-project-smart-do-search)
  call-interactively(spacemacs/helm-project-smart-do-search nil nil)
  command-execute(spacemacs/helm-project-smart-do-search)
@Davidj361 Davidj361 changed the title helm-project-smart-do-search breaks and errors, doesn't jump to correct line helm-project-smart-do-search breaks and errors, doesn't jump to correct line Mar 30, 2022
@smile13241324
Copy link
Collaborator

smile13241324 commented Mar 31, 2022

The issue comes from hs-minor-mode which is used by helm internally which seems to have an issue with the open curly bracket.

The build in version of this package is used in spacemacs-evil therefore its active. Please open a bug report upstream.

Edit:
As a fast workaround you can disable this mode, then helm will not use it and the error should be gone.

@Davidj361
Copy link
Author

Please open a bug report upstream.

What do you mean? Not sure where that is.

@lebensterben
Copy link
Contributor

@Davidj361 helm

@Davidj361
Copy link
Author

Davidj361 commented Mar 31, 2022

Not sure how I can test this in a minimal configuration. Running emacs-helm.sh doesn't show the command and complains about helm-core missing.
https://github.com/emacs-helm/helm

image

@Davidj361
Copy link
Author

Davidj361 commented Mar 31, 2022

I've tried setting up helm from scratch in emacs via HOME=/tmp/emacs emacs with an .emacs file below

(setq-default indent-tabs-mode nil)

(require 'package)

(setq package-archives
      '(
        ("gnu" . "https://elpa.gnu.org/packages/")
        ;; ("melpa" . "https://melpa.org/packages/")
        ("nongnu" . "https://elpa.nongnu.org/nongnu/")
        ))

(let ((my-pkgs '(helm)))
  (when (seq-remove 'package-installed-p my-pkgs)
    (package-refresh-contents)
    (mapc (lambda (pkg) (package-install pkg t)) my-pkgs)))

But M-x doesn't show helm-project-smart-do-search as a command in helm. I'm not sure if I can bug report this on the upstream helm as helm-project-smart-do-search isn't a command there.

@lebensterben
Copy link
Contributor

lebensterben commented Mar 31, 2022

I will investigate.

As for now, try to use ivy or compleseus as replacement for helm.

@Davidj361
Copy link
Author

Davidj361 commented Mar 31, 2022

Made an issue on helm-ag

emacsorphanage/helm-ag#389

@thanhvg
Copy link
Contributor

thanhvg commented Apr 1, 2022

It's not a helm problem, in Spacemacs, turn off volatile-highlights-mode (spc thv) then your problem will be gone. volatile-highlights is really old and shouldn't be on by default. It adds a bunch of advice functions including the one that screws up hs-show-block.

If you want some fancy highlight use nav-flash layer and set vim-style-visual-feedback t in your dot file.

   dotspacemacs-editing-style '(vim :variables
                                    vim-style-visual-feedback t
                                    vim-style-remap-Y-to-y$ t
                                    vim-style-retain-visual-state-on-shift t
                                    vim-style-visual-line-move-text nil
                                    vim-style-ex-substitute-global nil)

@lebensterben
Copy link
Contributor

good point. a replacement for vhs should be used.

@Davidj361
Copy link
Author

It's not a helm problem, in Spacemacs, turn off volatile-highlights-mode (spc thv) then your problem will be gone. volatile-highlights is really old and shouldn't be on by default. It adds a bunch of advice functions including the one that screws up hs-show-block.

@thanhvg @lebensterben

volatile-highlights-mode is not the problem afaik

  1. When I turn off volatile-highlights-mode I still have the issue of the search result taking me to the wrong line, see my vid.
2022-04-05.09-10-45.mp4
  1. I can replicate the same problem with bare minimal emacs with just the helm and helm-ag packages.

emacsorphanage/helm-ag#389

2022-03-31.16-23-44.mp4

@thanhvg
Copy link
Contributor

thanhvg commented Apr 5, 2022

@Davidj361 oops my bad, thanks for trying.

@github-actions
Copy link

github-actions bot commented Apr 5, 2023

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!

@github-actions github-actions bot added the stale marked as a stale issue/pr (usually by a bot) label Apr 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- Bug tracker - Helm Should report upstream stale marked as a stale issue/pr (usually by a bot)
Projects
None yet
Development

No branches or pull requests

4 participants