1

In Dired, with point on a file name, I invoke dired-do-delete and confirm. The line disappears, as it normally does when a file is deleted. But the file is not in fact deleted, as I can see by e.g. opening the relevant folder with MacOS Finder or refreshing the Dired buffer (which causes the line to reappear). No error is emitted (so toggle-debug-on-error doesn't help), and the problem occurs only sometimes and for no apparent reason, so I'm finding it hard to diagnose. I include output from profiler, in case it allows others to identify possible causes.

      2,135,063  98% - command-execute
      2,135,063  98%  - funcall-interactively
      1,294,448  59%   - dired-do-delete
      1,292,160  59%    - dired-internal-do-deletions
      1,292,160  59%     - apply
      1,292,160  59%      - all-the-icons-dired--refresh-advice
      1,262,479  58%       - #<subr dired-internal-do-deletions>
      1,197,929  55%        - dired-mark-pop-up
      1,197,929  55%         - yes-or-no-p
        142,618   6%          - read-from-minibuffer
         10,160   0%           - redisplay_internal (C function)
          8,480   0%            - eval
          8,184   0%               doom-modeline-segment--debug
            168   0%               doom-modeline-segment--window-number
             32   0%             - doom-modeline-format--main
             16   0%              - format-mode-line
             16   0%               - eval
             16   0%                  doom-modeline-segment--major-mode
             32   0%               doom-modeline-segment--buffer-position
             32   0%               doom-modeline-segment--major-mode
             32   0%             - doom-modeline-format--project
             16   0%              - format-mode-line
             16   0%               - eval
             16   0%                  doom-modeline-segment--major-mode
          1,680   0%              menu-bar-update-buffers
          1,504   0%             mu4e~proc-filter
            620   0%           - minibuffer-inactive-mode
            620   0%            - run-mode-hooks
            620   0%               run-hooks
            310   0%           - minibuffer-mode
            310   0%            - run-mode-hooks
            310   0%               run-hooks
            168   0%           - gcmh-register-idle-gc
            168   0%            - run-with-timer
            168   0%             - run-at-time
            120   0%              - timer-activate
            120   0%                 timer--activate
             24   0%                timer-set-time
             96   0%           - undo-auto--undoable-change
             96   0%            - undo-auto--boundary-ensure-timer
             96   0%             - run-at-time
             72   0%              - timer-activate
             72   0%                 timer--activate
             24   0%                timer-set-time
             16   0%             command-execute
         58,261   2%        - dired-delete-file
         58,261   2%         - delete-file
         58,261   2%          - apply
         55,189   2%           - #<subr delete-file>
         55,189   2%            - move-file-to-trash
         55,189   2%             - system-move-file-to-trash
         55,189   2%              - shell-command
         55,189   2%               - apply
         55,189   2%                - shell-command--shell-command-with-editor-mode
         54,165   2%                 - #<subr shell-command>
         54,165   2%                  - shell-command-on-region
         14,336   0%                   - format-insert-file
         14,336   0%                    - set-auto-coding
         14,336   0%                       find-auto-coding
         10,278   0%                     #<compiled -0x14fd729686068967>
          7,168   0%                   - delete-file
          7,168   0%                    - apply
          7,168   0%                     - org-roam-db-autosync--delete-file-a
          5,120   0%                        org-roam-file-p
            604   0%                   - fundamental-mode
            604   0%                    - run-mode-hooks
            604   0%                     - run-hooks
            294   0%                      - yas-global-mode-enable-in-buffers
            294   0%                       - yas-minor-mode-on
            294   0%                          yas-minor-mode
          3,072   0%           - org-roam-db-autosync--delete-file-a
          1,024   0%              org-roam-file-p
          3,312   0%        - dired-fun-in-all-buffers
          2,288   0%         - dired-delete-entry
          2,288   0%          - dired-remove-entry
          2,288   0%           - dired-goto-file
          2,288   0%            - dired-goto-file-1
          1,024   0%               dired-switches-escape-p
            240   0%             - dired-get-filename
            240   0%              - dired-current-directory
            240   0%               - dired-subtree--get-ov
            240   0%                  dired-subtree--get-all-ovs-at-point
          1,024   0%           dired-buffers-for-dir
          1,024   0%          mapcar
            494   0%        - progress-reporter-done
            494   0%           apply
            309   0%        - make-progress-reporter
            309   0%         - progress-reporter-do-update
            309   0%            apply
         21,497   0%       - all-the-icons-dired--refresh
         12,744   0%        - dired-get-filename
          8,184   0%           dired-switches-escape-p
          4,560   0%         - dired-current-directory
          4,560   0%          - dired-subtree--get-ov
          4,560   0%             dired-subtree--get-all-ovs-at-point
            400   0%          all-the-icons-dired--remove-all-overlays
          1,264   0%    - dired-get-filename
          1,024   0%       dired-switches-escape-p
            240   0%     - dired-current-directory
            240   0%      - dired-subtree--get-ov
            240   0%         dired-subtree--get-all-ovs-at-point
        838,711  38%   - ps/profiler-toggle
        838,711  38%    - if
          1,287   0%     - profiler-start
          1,287   0%        apply
            880   0%   - dired-previous-line
            880   0%    - dired-next-line
            880   0%     - line-move
            320   0%      - line-move-1
            320   0%       - #<compiled 0x1054ea3f9d096532>
            320   0%          line-move-finish
         21,436   0% - redisplay_internal (C function)
         16,388   0%  - jit-lock-function
         16,388   0%   - jit-lock-fontify-now
         16,388   0%    - jit-lock--run-functions
         16,388   0%     - #<compiled 0x1fe4443f05ec5afe>
         16,388   0%      - font-lock-fontify-region
         16,388   0%         font-lock-default-fontify-region
          2,344   0%  - eval
          2,048   0%     doom-modeline-segment--buffer-default-directory
            168   0%     doom-modeline-segment--window-number
             32   0%   - doom-modeline-format--main
             16   0%    - format-mode-line
             16   0%     - eval
             16   0%        doom-modeline-segment--major-mode
             32   0%     doom-modeline-segment--buffer-position
             32   0%     doom-modeline-segment--major-mode
             32   0%   - doom-modeline-format--project
             16   0%    - format-mode-line
             16   0%     - eval
             16   0%        doom-modeline-segment--major-mode
          1,680   0%    menu-bar-update-buffers
          1,024   0%    kill-this-buffer-enabled-p
          3,194   0% - timer-event-handler
          3,018   0%  - apply
          2,922   0%   - help-at-pt-maybe-display
          2,922   0%    - display-local-help
            860   0%       apply
             21   0%       substitute-command-keys
             96   0%   - blink-cursor-start
             96   0%    - blink-cursor--start-timer
             96   0%     - run-with-timer
             96   0%      - run-at-time
             48   0%         timer-set-time
             48   0%       - timer-activate
             48   0%          timer--activate
             80   0%    timer-inc-time
             72   0%  - timer-activate
             72   0%     timer--activate
            336   0% - gcmh-register-idle-gc
            336   0%  - run-with-timer
            336   0%   - run-at-time
            264   0%    - timer-activate
            264   0%       timer--activate
             72   0%      timer-set-time
              0   0%   ...
5
  • 1
    I'm on mac, plain emacs 27.1 and the method call stack looks quite different from your profiling stack. I would try to find what is the actual shell command is being run at system-move-file-to-trash. I would see if I could point that instead to to a wrapper shell script that logs the real delete shell command before calling it. Nov 18, 2021 at 10:44
  • I'll post my questions as separate comments. First: does an immediate repeat attempt to delete the same file (always/sometimes) succeed or fail? Nov 24, 2021 at 14:52
  • Second: when a deletion fails, has the copy-to-trash part of the operation succeeded? Nov 24, 2021 at 14:53
  • Third: what happens if you set delete-by-moving-to-trash to nil? Nov 24, 2021 at 14:54
  • Thanks for the questions. I'll provide answers next time the problem occurs (it may take days for that to happen).
    – Pablo
    Nov 24, 2021 at 18:14

1 Answer 1

0

This shouldn't happen. Sounds like a bug in your Emacs version on the platform you're using.

If you see the same problem when you start Emacs using emacs -Q (no init file), the please consider filing a bug report, using M-x report-emacs-bug.

If you don't see the same thing without your init file, then bisect your init file to find the culprit.

1
  • Thanks. I would normally bisect the init file, but in this case the error occurs only sometimes, as noted, so that approach can't really help me isolate the cause of the problem.
    – Pablo
    Nov 17, 2021 at 17:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.