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

Embark export (grep-buffer) interaction doesn't work #5

Open
mdbergmann opened this issue Dec 17, 2022 · 1 comment
Open

Embark export (grep-buffer) interaction doesn't work #5

mdbergmann opened this issue Dec 17, 2022 · 1 comment

Comments

@mdbergmann
Copy link

In order to use occur mode and make edits using wgrep consult-ag doesn't seem to behave as consult-grep.

See this link where the interaction with Embark export is described:
https://github.com/minad/consult/#embark-integration

So I think the same workflow:

consult-grep -> embark-export to grep-mode buffer -> wgrep for editing of all matches.

Should work for consult-ag.

@gopar
Copy link

gopar commented Nov 30, 2023

Similar issue but not sure if its the same problem.

Here is the stack trace for `toggle-debug-on-error`
Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  file-name-directory(nil)
  embark-export-dired(("~/personal/yump/tests/utils.py:25:48:        from ..." "~/personal/yump/tests/utils.py:28:16:        user ..." "~/personal/yump/apps/users/models.py:13:9:    def ..." "~/personal/yump/apps/users/models.py:26:21:       ..." "~/personal/yump/apps/users/tests/test_service.py:7..." "~/personal/yump/apps/users/tests/test_service.py:1..." "~/personal/yump/apps/users/tests/factories.py:13:5..." "~/personal/yump/apps/users/tests/factories.py:41:3..." "~/personal/yump/apps/users/tests/factories.py:47:2..." "~/personal/yump/apps/users/tests/factories.py:53:4..." "~/personal/yump/apps/users/tests/test_views.py:7:5..." "~/personal/yump/apps/users/tests/test_views.py:33:..." "~/personal/yump/apps/users/tests/test_views.py:67:..." "~/personal/yump/apps/users/tests/test_models.py:6:..." "~/personal/yump/apps/users/tests/test_models.py:14..." "~/personal/yump/apps/invoice/tests/factories.py:10..." "~/personal/yump/apps/invoice/tests/factories.py:25..."))
  embark-export()
  funcall-interactively(embark-export)
  call-interactively(embark-export nil nil)
  command-execute(embark-export)
  #f(compiled-function (&rest args) #<bytecode 0x1803121c729f339e>)(:action embark-export :quit t :orig-type file :orig-target #("tests/utils.py:25:48:        from apps.users.tests..." 0 14 (filename "tests/utils.py" row "25" column "48" face (consult-file)) 14 15 (filename "tests/utils.py" row "25" column "48") 15 17 (filename "tests/utils.py" row "25" column "48" face (consult-line-number)) 17 18 (filename "tests/utils.py" row "25" column "48") 18 20 (filename "tests/utils.py" row "25" column "48" face (consult-line-number)) 20 79 (filename "tests/utils.py" row "25" column "48")) :bounds nil :type file :target #("tests/utils.py:25:48:        from apps.users.tests..." 0 14 (filename "tests/utils.py" row "25" column "48" face (consult-file)) 14 15 (filename "tests/utils.py" row "25" column "48") 15 17 (filename "tests/utils.py" row "25" column "48" face (consult-line-number)) 17 18 (filename "tests/utils.py" row "25" column "48") 18 20 (filename "tests/utils.py" row "25" column "48" face (consult-line-number)) 20 79 (filename "tests/utils.py" row "25" column "48")))
  apply(#f(compiled-function (&rest args) #<bytecode 0x1803121c729f339e>) :action embark-export :quit t (:orig-type file :orig-target #("tests/utils.py:25:48:        from apps.users.tests..." 0 14 (filename "tests/utils.py" row "25" column "48" face (consult-file)) 14 15 (filename "tests/utils.py" row "25" column "48") 15 17 (filename "tests/utils.py" row "25" column "48" face (consult-line-number)) 17 18 (filename "tests/utils.py" row "25" column "48") 18 20 (filename "tests/utils.py" row "25" column "48" face (consult-line-number)) 20 79 (filename "tests/utils.py" row "25" column "48")) :bounds nil :type file :target #("tests/utils.py:25:48:        from apps.users.tests..." 0 14 (filename "tests/utils.py" row "25" column "48" face (consult-file)) 14 15 (filename "tests/utils.py" row "25" column "48") 15 17 (filename "tests/utils.py" row "25" column "48" face (consult-line-number)) 17 18 (filename "tests/utils.py" row "25" column "48") 18 20 (filename "tests/utils.py" row "25" column "48" face (consult-line-number)) 20 79 (filename "tests/utils.py" row "25" column "48"))))
  embark--run-around-action-hooks(embark-export (:orig-type file :orig-target #("tests/utils.py:25:48:        from apps.users.tests..." 0 14 (filename "tests/utils.py" row "25" column "48" face (consult-file)) 14 15 (filename "tests/utils.py" row "25" column "48") 15 17 (filename "tests/utils.py" row "25" column "48" face (consult-line-number)) 17 18 (filename "tests/utils.py" row "25" column "48") 18 20 (filename "tests/utils.py" row "25" column "48" face (consult-line-number)) 20 79 (filename "tests/utils.py" row "25" column "48")) :bounds nil :type file :target #("tests/utils.py:25:48:        from apps.users.tests..." 0 14 (filename "tests/utils.py" row "25" column "48" face (consult-file)) 14 15 (filename "tests/utils.py" row "25" column "48") 15 17 (filename "tests/utils.py" row "25" column "48" face (consult-line-number)) 17 18 (filename "tests/utils.py" row "25" column "48") 18 20 (filename "tests/utils.py" row "25" column "48" face (consult-line-number)) 20 79 (filename "tests/utils.py" row "25" column "48"))) t)
  embark--act(embark-export (:orig-type file :orig-target #("tests/utils.py:25:48:        from apps.users.tests..." 0 14 (filename "tests/utils.py" row "25" column "48" face (consult-file)) 14 15 (filename "tests/utils.py" row "25" column "48") 15 17 (filename "tests/utils.py" row "25" column "48" face (consult-line-number)) 17 18 (filename "tests/utils.py" row "25" column "48") 18 20 (filename "tests/utils.py" row "25" column "48" face (consult-line-number)) 20 79 (filename "tests/utils.py" row "25" column "48")) :bounds nil :type file :target #("tests/utils.py:25:48:        from apps.users.tests..." 0 14 (filename "tests/utils.py" row "25" column "48" face (consult-file)) 14 15 (filename "tests/utils.py" row "25" column "48") 15 17 (filename "tests/utils.py" row "25" column "48" face (consult-line-number)) 17 18 (filename "tests/utils.py" row "25" column "48") 18 20 (filename "tests/utils.py" row "25" column "48" face (consult-line-number)) 20 79 (filename "tests/utils.py" row "25" column "48"))) t)
  embark-act(nil)
  funcall-interactively(embark-act nil)
  call-interactively(embark-act nil nil)
  command-execute(embark-act)
  read-from-minibuffer(#("Consult ag:  (Project yump): " 22 26 (help-echo "~/personal/yump/")) "#" (keymap (10 . minibuffer-complete-and-exit) (13 . minibuffer-complete-and-exit) keymap (menu-bar keymap (minibuf "Minibuf" keymap (tab menu-item "Complete" minibuffer-complete :help "Complete as far as possible") (space menu-item "Complete Word" minibuffer-complete-word :help "Complete at most one word") (63 menu-item "List Completions" minibuffer-completion-help :help "Display all possible completions") "Minibuf")) (M-down . minibuffer-next-completion) (M-up . minibuffer-previous-completion) (27 keymap (13 . minibuffer-choose-completion) (103 keymap (27 keymap (99 . switch-to-completions))) (118 . switch-to-completions)) (prior . switch-to-completions) (63 . minibuffer-completion-help) (32 . minibuffer-complete-word) (backtab . minibuffer-complete) (9 . minibuffer-complete) keymap (menu-bar keymap (minibuf "Minibuf" keymap (previous menu-item "Previous History Item" previous-history-element :help "Put previous minibuffer history element in the min...") (next menu-item "Next History Item" next-history-element :help "Put next minibuffer history element in the minibuf...") (isearch-backward menu-item "Isearch History Backward" isearch-backward :help "Incrementally search minibuffer history backward") (isearch-forward menu-item "Isearch History Forward" isearch-forward :help "Incrementally search minibuffer history forward") (return menu-item "Enter" exit-minibuffer :key-sequence "\15" :help "Terminate input and exit minibuffer") (quit menu-item "Quit" abort-recursive-edit :help "Abort input and exit minibuffer") "Minibuf")) (24 keymap (down . minibuffer-complete-defaults) (up . minibuffer-complete-history)) (13 . exit-minibuffer) (10 . exit-minibuffer) (7 . minibuffer-keyboard-quit) (C-tab . file-cache-minibuffer-complete) (9 . self-insert-command) (XF86Back . previous-history-element) (up . previous-line-or-history-element) (prior . previous-history-element) (XF86Forward . next-history-element) (down . next-line-or-history-element) (next . next-history-element) (27 keymap (60 . minibuffer-beginning-of-buffer) (114 . consult-history) (115 . consult-history) (112 . previous-history-element) (110 . next-history-element))) nil nil nil nil)
  #f(compiled-function (prompt collection &optional predicate require-match initial-input hist def inherit-input-method) "Default method for reading from the minibuffer with completion.\nSee `completing-read' for the meaning of the arguments." #<bytecode -0x5b3c7847e28fc27>)(#("Consult ag:  (Project yump): " 22 26 (help-echo "~/personal/yump/")) #f(compiled-function (str pred action) #<bytecode -0x850c8b12e989654>) nil t "#" nil nil nil)
  apply((#f(compiled-function (prompt collection &optional predicate require-match initial-input hist def inherit-input-method) "Default method for reading from the minibuffer with completion.\nSee `completing-read' for the meaning of the arguments." #<bytecode -0x5b3c7847e28fc27>) #("Consult ag:  (Project yump): " 22 26 (help-echo "~/personal/yump/")) #f(compiled-function (str pred action) #<bytecode -0x850c8b12e989654>) nil t "#" nil nil nil))
  #f(compiled-function (&rest app) #<bytecode -0x1139303dd54f3167>)(#f(compiled-function (prompt collection &optional predicate require-match initial-input hist def inherit-input-method) "Default method for reading from the minibuffer with completion.\nSee `completing-read' for the meaning of the arguments." #<bytecode -0x5b3c7847e28fc27>) #("Consult ag:  (Project yump): " 22 26 (help-echo "~/personal/yump/")) #f(compiled-function (str pred action) #<bytecode -0x850c8b12e989654>) nil t "#" nil nil nil)
  apply(#f(compiled-function (&rest app) #<bytecode -0x1139303dd54f3167>) (#f(compiled-function (prompt collection &optional predicate require-match initial-input hist def inherit-input-method) "Default method for reading from the minibuffer with completion.\nSee `completing-read' for the meaning of the arguments." #<bytecode -0x5b3c7847e28fc27>) #("Consult ag:  (Project yump): " 22 26 (help-echo "~/personal/yump/")) #f(compiled-function (str pred action) #<bytecode -0x850c8b12e989654>) nil t "#" nil nil nil))
  vertico--advice(#f(compiled-function (prompt collection &optional predicate require-match initial-input hist def inherit-input-method) "Default method for reading from the minibuffer with completion.\nSee `completing-read' for the meaning of the arguments." #<bytecode -0x5b3c7847e28fc27>) #("Consult ag:  (Project yump): " 22 26 (help-echo "~/personal/yump/")) #f(compiled-function (str pred action) #<bytecode -0x850c8b12e989654>) nil t "#" nil nil nil)
  apply(vertico--advice #f(compiled-function (prompt collection &optional predicate require-match initial-input hist def inherit-input-method) "Default method for reading from the minibuffer with completion.\nSee `completing-read' for the meaning of the arguments." #<bytecode -0x5b3c7847e28fc27>) (#("Consult ag:  (Project yump): " 22 26 (help-echo "~/personal/yump/")) #f(compiled-function (str pred action) #<bytecode -0x850c8b12e989654>) nil t "#" nil nil nil))
  completing-read-default(#("Consult ag:  (Project yump): " 22 26 (help-echo "~/personal/yump/")) #f(compiled-function (str pred action) #<bytecode -0x850c8b12e989654>) nil t "#" nil nil nil)
  completing-read(#("Consult ag:  (Project yump): " 22 26 (help-echo "~/personal/yump/")) #f(compiled-function (str pred action) #<bytecode -0x850c8b12e989654>) nil t "#" nil nil nil)
  #f(compiled-function () #<bytecode 0xa79476b765ded48>)()
  consult--with-preview-1(any #f(compiled-function (action cand) #<bytecode -0x1e58569616947598>) #f(compiled-function (narrow input cand) #<bytecode -0x16caee6d35e2c641>) #f(compiled-function (&rest args2) #<bytecode -0xae2e9a6da946a3f>) #f(compiled-function () #<bytecode 0xa79476b765ded48>))
  consult--read-1(#f(compiled-function (action) #<bytecode 0x12aa3c5f3ae95bb7>) :prompt #("Consult ag:  (Project yump): " 22 26 (help-echo "~/personal/yump/")) :lookup consult--lookup-member :state #f(compiled-function (action cand) #<bytecode -0x1e58569616947598>) :initial "#" :require-match t :category file :sort nil :prompt "Select: " :preview-key any :sort t :lookup #f(compiled-function (selected &rest _) #<bytecode 0x16ffc4caa42b639b>))
  apply(consult--read-1 #f(compiled-function (action) #<bytecode 0x12aa3c5f3ae95bb7>) (:prompt #("Consult ag:  (Project yump): " 22 26 (help-echo "~/personal/yump/")) :lookup consult--lookup-member :state #f(compiled-function (action cand) #<bytecode -0x1e58569616947598>) :initial "#" :require-match t :category file :sort nil :prompt "Select: " :preview-key any :sort t :lookup #f(compiled-function (selected &rest _) #<bytecode 0x16ffc4caa42b639b>)))
  consult--read(#f(compiled-function (action) #<bytecode 0x12aa3c5f3ae95bb7>) :prompt #("Consult ag:  (Project yump): " 22 26 (help-echo "~/personal/yump/")) :lookup consult--lookup-member :state #f(compiled-function (action cand) #<bytecode -0x1e58569616947598>) :initial "#" :require-match t :category file :sort nil)
  consult-ag()
  funcall-interactively(consult-ag)
  call-interactively(consult-ag nil nil)
  command-execute(consult-ag)

Might be related to another issue I have is that when I do previous-history-element I don't get the previous prompt I used but the entire line that the prompt returned.

eg I searched for "milk", hit enter on match. I run consult-ag again,press M-p for previous search and I get something like:

file.txt:line:col text that matched milk like this

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