Skip to content

Commit

Permalink
Fix uppon prev
Browse files Browse the repository at this point in the history
  • Loading branch information
c0001 committed Apr 15, 2024
1 parent d2171ef commit 3b54376
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
4 changes: 3 additions & 1 deletion elements/core/tentacles/entropy-emacs-basic.el
Original file line number Diff line number Diff line change
Expand Up @@ -3697,7 +3697,9 @@ mechanism as older ver."
(unless (eq major-mode 'image-dired-thumbnail-mode)
(image-dired-thumbnail-mode))
(entropy/emacs--image-dired-update-thumbnail-buffname-core
buf))
buf)
(entropy/emacs-set-buffer-local-fallback-default-directory
temporary-file-directory))
buf))
(advice-add 'image-dired-create-thumbnail-buffer
:override
Expand Down
25 changes: 25 additions & 0 deletions elements/core/wasteland/func-binds/entropy-emacs-defun.el
Original file line number Diff line number Diff line change
Expand Up @@ -4362,6 +4362,31 @@ See also `entropy/emacs-return-as-default-directory'."
`(entropy/emacs-return-as-default-directory
,@body))))

(defun entropy/emacs-set-buffer-local-fallback-default-directory
(fallback-default-directory)
"Made buffer-local `default-directory' fallback to
FALLBACK-DEFAULT-DIRECTORY only when the current one is not
existed.

This function existed since many occasions in emacs calling
process within a buffer whose `default-directory' is missing, and
the whole procedure failed due to this but the exact procedure
was not related to that default-directory i.e. they can be ran
successfully in any place as `default-directory'."
(let ((cdfd (entropy/emacs-return-as-default-directory
default-directory))
fdfd)
(unless (file-directory-p cdfd)
(setq fdfd
(entropy/emacs-return-as-default-directory
fallback-default-directory))
(if (file-directory-p fdfd)
(setq-local default-directory fdfd)
(signal 'file-missing
(list "Setting fallback current directory"
"No such file or directory"
fdfd))))))

(defun entropy/emacs-apply-func-with-fallback-default-directory
(fn fallback-default-directory &rest args)
"Apply function FN with ARGS as normal with current
Expand Down

0 comments on commit 3b54376

Please sign in to comment.