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

dired-do-flagged-delete confirmation is not shown in minibuffer when using counsel #1660

Closed
bbo2adwuff opened this issue Jul 10, 2018 · 10 comments

Comments

@bbo2adwuff
Copy link

commented Jul 10, 2018

When flagging a file for deletion in dired and call dired-do-flagged-delete then I expect to see the message to confirm the deletion (yes or no).

Instead I see following in the minibuffer:
emacs_dired_delete

I can type just anything (and see the results in the minibuffer appearing) but after clicking ENTER I see in the last line Please answer yes or no.

My ivy setup looks like this

(ivy-mode t)
(setq enable-recursive-minibuffers t)
(setq ivy-use-virtual-buffers t)
(setq ivy-virtual-abbreviate 'full)
(setq ivy-initial-inputs-alist nil)
(setq ivy-use-selectable-prompt t)
(counsel-mode t)
(counsel-projectile-mode t)
(setq counsel-find-file-at-point t)
(setq counsel-projectile-grep-initial-input (quote (quote (ivy-thing-at-point))))
(define-key global-map [remap find-file] 'counsel-find-file)
(define-key global-map [remap isearch-forward] 'swiper)
(define-key global-map (kbd "C-c C-f") 'counsel-file-jump)
(setq ivy-re-builders-alist
      '((t . ivy--regex-ignore-order)))

Problem persists when I comment everything out except of (ivy-mode t).

@bbo2adwuff

This comment has been minimized.

Copy link
Author

commented Jul 10, 2018

Just realized when opening emacs without the .emacs.desktop file then the issue is gone.
Afterwards when opening emacs with the very same .emacs.desktop file again the issue doesn't appear again.

But when working in emacs the issue occurs again and can again be resolved by starting emacs without the desktop file and then start it with the desktop file again. Well, kind of a work around.

@basil-conto

This comment has been minimized.

Copy link
Collaborator

commented Jul 10, 2018

Can't reproduce here with any version of Emacs between 24-27, but then I don't use desktop.el.

I mainly wanted to point out that major and minor mode functions are almost always documented as accepting a single optional argument which is either nil, a number, or the symbol toggle. So I would recommend you write (ivy-mode) or (ivy-mode 1), etc. for enabling, and (ivy-mode 0) or (ivy-mode -1), etc. for disabling, even if it often doesn't make a difference in practice.

@basil-conto

This comment has been minimized.

Copy link
Collaborator

commented Jul 10, 2018

The nested quotes for counsel-projectile-grep-initial-input also seem a bit unusual.

@bbo2adwuff

This comment has been minimized.

Copy link
Author

commented Jul 11, 2018

Thank you for your quick replies!
Oh the nested quote was not on purpose. I didn't even realize that I put two quotes 😖

I use the numbers for the modes now. But as you already expected, it doesn't seem to make a difference in practice.

Before I was not sure how to reproduce, but now I found it:

  1. Open emacs.

  2. Open dired (not in a project though).

  3. Select file for deletion.
    Result: Minibuffer as expected (i.e. confirmation prompt).

  4. Switch to buffer with a Rnw file of any project.

  5. Switch back to dired buffer.

  6. Select file for deletion.
    Result: Counsel's Switch to buffer in minibuffer.

Issue persists restarts when using desktop-save-mode. The only workaround that I found so far is to start without the desktop file, then repeat steps 1-3.

As the issue only occurs when opening Rnw files I guess it might be due to ess.
When not loading ess and then visiting Rnw files, then the issue does not occur.

@abo-abo

This comment has been minimized.

Copy link
Owner

commented Jul 11, 2018

@bbo2adwuff
That's quite a lot of custom config to reproduce the bug. I'm not sure I can do it easily on my machine. I suggest you edebug ivy-completing-read and see what is happening.

@bbo2adwuff

This comment has been minimized.

Copy link
Author

commented Jul 17, 2018

Sorry I was away for some days.
edebug ivy-completing-read didn't return anything useful.

But I realized that I made it much more complicated than it is.

How to reproduce:

  1. Open emacs with following init file (depends on your ess and ivy version installed):
(add-to-list 'load-path "~/.emacs.d/elpa/ess-20180708.601/")
(add-to-list 'load-path "~/.emacs.d/elpa/ivy-20180705.807/")
(require 'package)
(require 'ess)
(require 'ivy)
(ivy-mode 1)
  1. Open just any Rnw file. (You can, for example, following as text.Rnw and open it in emacs):
\documentclass{article}
\begin{document}
<<a>>=
1 + 1
@ 
\end{document}
  1. Try anything with a dialog in minibuffer. For example, dired-do-flagged-delete, rgrep, etc.
    Then you don't see the expected dialog in the minibuffer, but the ivy dialog.
@abo-abo

This comment has been minimized.

Copy link
Owner

commented Jul 17, 2018

OK, after a long debug session I've traced the bug to ess-noweb-mode:

(mapc 'ess-noweb-make-variable-permanent-local
          '(ess-noweb-mode
            ess-local-process-name ;; also made permanent in ess-mode, but let it be
            ess-dialect
            ess-language
            after-change-functions
            before-change-functions
            ess-noweb-narrowing
            ess-noweb-chunk-vector
            post-command-hook
            isearch-mode-hook
            isearch-mode-end-hook
            ess-noweb-doc-mode
            ess-noweb-code-mode
            ess-noweb-default-code-mode
            ess-noweb-last-chunk-index))

So what they do here is modify many built-in variables that weren't meant to be permanent buffer-local. Specifically post-command-hook - this breaks Ivy.

I think this is a major bug in ESS since they change the behavior of whole Emacs just for purpose of a major-mode. Since you're a user of ESS, please report the bug there. I'll make a temporary fix in Ivy.

@bbo2adwuff

This comment has been minimized.

Copy link
Author

commented Jul 17, 2018

Perfect! Thanks a lot!

@lionel-

This comment has been minimized.

Copy link

commented Jul 17, 2018

Sorry about that painful debug session @abo-abo. We're slowly modernising the codebase and some parts of ESS no longer have active maintainers unfortunately.

@abo-abo

This comment has been minimized.

Copy link
Owner

commented Jul 17, 2018

@lionel- No problem, and good luck.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.