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

Support a buffer with missing file-name #19

Closed
wants to merge 1 commit into from

Conversation

terlar
Copy link

@terlar terlar commented Nov 27, 2018

This is caused by a transient state when deleting files with wdired.

As mentioned in #18 this doesn't work well together with wdired-mode. I have managed to get it working by doing the following:

(defvar-local +wdired-icons-enabled nil)
(defun +wdired-before-start-advice ()
  "Execute when switching from `dired' to `wdired'."
  (setq +wdired-icons-enabled (if (bound-and-true-p all-the-icons-dired-mode)
                                  1 0))
  (when (bound-and-true-p all-the-icons-dired-mode)
    (all-the-icons-dired-mode 0)))
(defun +wdired-after-finish-advice ()
  "Execute when switching from `wdired' to `dired'"
  (when (boundp 'all-the-icons-dired-mode)
    (all-the-icons-dired-mode +wdired-icons-enabled)))
(advice-add 'wdired-change-to-wdired-mode :before #'+wdired-before-start-advice)
(advice-add 'wdired-change-to-dired-mode :after #'+wdired-after-finish-advice)

That works for renaming files, etc. But when deleting a file you end up in a state while
the file-name is blank for a while (that is how you remove files). With this safeguard to
skip actions when there is no filename we won't run into any nil errors.

This is caused by a transient state when deleting files with `wdired`.
@torgeir
Copy link

torgeir commented Mar 31, 2020

The suggested fix works for me too.

@terlar
Copy link
Author

terlar commented Mar 31, 2020

This should have been fixed on master via this commit:
8f0858a#diff-1cb694fb78131dbb71ce622763d9e08cR80

@terlar terlar closed this Mar 31, 2020
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

Successfully merging this pull request may close these issues.

2 participants