Fix some file permissions errors
Occurs when deferred packages are loaded while in an unreadable or non-existent directory.
This commit is contained in:
parent
43ebba886f
commit
8766499b0d
4 changed files with 19 additions and 7 deletions
|
@ -298,7 +298,12 @@ This value is cached. If REFRESH-P, then don't use the cached value."
|
||||||
(lambda (&rest _)
|
(lambda (&rest _)
|
||||||
(doom-log "Loading deferred package %s from %s" ',name ',fn)
|
(doom-log "Loading deferred package %s from %s" ',name ',fn)
|
||||||
(condition-case e
|
(condition-case e
|
||||||
(require ',name)
|
;; If `default-directory' is a directory that doesn't
|
||||||
|
;; exist or is unreadable, Emacs throws up file-missing
|
||||||
|
;; errors, so we set it to a directory we know exists and
|
||||||
|
;; is readable.
|
||||||
|
(let ((default-directory doom-emacs-dir))
|
||||||
|
(require ',name))
|
||||||
((debug error)
|
((debug error)
|
||||||
(message "Failed to load deferred package %s: %s" ',name e)))
|
(message "Failed to load deferred package %s: %s" ',name e)))
|
||||||
(when-let (deferral-list (assq ',name doom--deferred-packages-alist))
|
(when-let (deferral-list (assq ',name doom--deferred-packages-alist))
|
||||||
|
|
|
@ -344,7 +344,13 @@ intervals."
|
||||||
(when-let (req (if reqs (pop reqs)))
|
(when-let (req (if reqs (pop reqs)))
|
||||||
(doom-log "Incrementally loading %s" req)
|
(doom-log "Incrementally loading %s" req)
|
||||||
(condition-case e
|
(condition-case e
|
||||||
(or (while-no-input (require req nil t) t)
|
(or (while-no-input
|
||||||
|
;; If `default-directory' is a directory that doesn't exist
|
||||||
|
;; or is unreadable, Emacs throws up file-missing errors, so
|
||||||
|
;; we set it to a directory we know exists and is readable.
|
||||||
|
(let ((default-directory doom-emacs-dir))
|
||||||
|
(require req nil t))
|
||||||
|
t)
|
||||||
(push req reqs))
|
(push req reqs))
|
||||||
((error debug)
|
((error debug)
|
||||||
(message "Failed to load '%s' package incrementally, because: %s"
|
(message "Failed to load '%s' package incrementally, because: %s"
|
||||||
|
|
|
@ -40,7 +40,8 @@ flycheck issues with direnv and on nix."
|
||||||
"Don't try to update direnv if the executable isn't present."
|
"Don't try to update direnv if the executable isn't present."
|
||||||
:around #'direnv--maybe-update-environment
|
:around #'direnv--maybe-update-environment
|
||||||
(if (executable-find "direnv")
|
(if (executable-find "direnv")
|
||||||
(funcall orig-fn)
|
(when (file-readable-p (or buffer-file-name default-directory))
|
||||||
|
(funcall orig-fn))
|
||||||
(doom-log "Couldn't find direnv executable")))
|
(doom-log "Couldn't find direnv executable")))
|
||||||
|
|
||||||
(direnv-mode +1))
|
(direnv-mode +1))
|
||||||
|
|
|
@ -288,10 +288,10 @@ controlled by `+doom-dashboard-pwd-policy'."
|
||||||
(doom-log "Changed dashboard's PWD to %s" pwd)
|
(doom-log "Changed dashboard's PWD to %s" pwd)
|
||||||
(setq-local default-directory pwd))
|
(setq-local default-directory pwd))
|
||||||
(let ((new-pwd (+doom-dashboard--get-pwd)))
|
(let ((new-pwd (+doom-dashboard--get-pwd)))
|
||||||
(when (and new-pwd (file-directory-p new-pwd))
|
(when (and new-pwd (file-accessible-directory-p new-pwd))
|
||||||
(unless (string-suffix-p "/" new-pwd)
|
(+doom-dashboard-update-pwd
|
||||||
(setq new-pwd (concat new-pwd "/")))
|
(concat (directory-file-name new-pwd)
|
||||||
(+doom-dashboard-update-pwd new-pwd)))))
|
"/"))))))
|
||||||
|
|
||||||
(defun +doom-dashboard-reload (&optional force)
|
(defun +doom-dashboard-reload (&optional force)
|
||||||
"Update the DOOM scratch buffer (or create it, if it doesn't exist)."
|
"Update the DOOM scratch buffer (or create it, if it doesn't exist)."
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue