diff --git a/core/autoload/files.el b/core/autoload/files.el index 20a16d634f7..8881d40e34f 100644 --- a/core/autoload/files.el +++ b/core/autoload/files.el @@ -36,12 +36,20 @@ This is used by `file-exists-p!' and `project-file-exists-p!'." `(file-exists-p ,filevar)) ,filevar))))) -(defun doom--path (&rest segments) - (let ((segments (delq nil segments)) +;;;###autoload +(defun doom-path (&rest segments) + "Constructs a file path from SEGMENTS. +Ignores `nil' elements in SEGMENTS." + (let ((segments (remq nil segments)) + file-name-handler-alist dir) (while segments - (setq dir (expand-file-name (car segments) dir) - segments (cdr segments))) + (setq segment (pop segments) + dir (expand-file-name + (if (listp segment) + (apply #'doom-path dir segment) + segment) + dir))) dir)) ;;;###autoload @@ -49,28 +57,16 @@ This is used by `file-exists-p!' and `project-file-exists-p!'." "Construct a path from SEGMENTS and expand glob patterns. Returns nil if the path doesn't exist. Ignores `nil' elements in SEGMENTS." - (let* (case-fold-search - (dir (apply #'doom--path segments))) - (if (string-match-p "[[*?]" dir) - (file-expand-wildcards dir t) - (if (file-exists-p dir) - dir)))) - -;;;###autoload -(defun doom-path (&rest segments) - "Constructs a file path from SEGMENTS. -Ignores `nil' elements in SEGMENTS." - (if segments - (apply #'doom--path segments) - (file!))) + (let (case-fold-search) + (file-expand-wildcards (apply #'doom-path segments) t))) ;;;###autoload (defun doom-dir (&rest segments) "Constructs a path from SEGMENTS. See `doom-path'. Ignores `nil' elements in SEGMENTS." - (when-let (path (apply #'doom-path segments)) - (directory-file-name (file-name-directory path)))) + (when-let (path (doom-path segments)) + (directory-file-name path))) ;;;###autoload (cl-defun doom-files-in diff --git a/core/autoload/packages.el b/core/autoload/packages.el index 8355da24d8a..10265a14a20 100644 --- a/core/autoload/packages.el +++ b/core/autoload/packages.el @@ -164,8 +164,8 @@ each package." (mapc (fn! ((cat . mod)) (if-let (packages-file (pcase cat - (:private (doom-glob doom-private-dir "packages.el")) - (:core (doom-glob doom-core-dir "packages.el")) + (:private (car (doom-glob doom-private-dir "packages.el"))) + (:core (car (doom-glob doom-core-dir "packages.el"))) (_ (doom-module-locate-path cat mod "packages.el")))) (with-current-buffer (or (get-file-buffer packages-file) diff --git a/core/cli/autoloads.el b/core/cli/autoloads.el index 16ccefe09b6..7ec4cb6eedf 100644 --- a/core/cli/autoloads.el +++ b/core/cli/autoloads.el @@ -52,7 +52,7 @@ one wants that.") in (append (list doom-core-dir) (cdr (doom-module-load-path 'all-p)) (list doom-private-dir)) - if (doom-glob dir "autoload.el") collect it + if (doom-glob dir "autoload.el") collect (car it) if (doom-glob dir "autoload/*.el") append it) (mapcan #'doom-glob doom-autoloads-files)) nil) diff --git a/core/cli/byte-compile.el b/core/cli/byte-compile.el index 86f39936626..6ed8084f8a4 100644 --- a/core/cli/byte-compile.el +++ b/core/cli/byte-compile.el @@ -16,11 +16,9 @@ and your private config files, respectively. To recompile your packages, use 'doom build' instead." (doom-cli-byte-compile (if (or core-p private-p) - (append (when core-p - (list (doom-glob doom-emacs-dir "init.el") - doom-core-dir)) - (when private-p - (list doom-private-dir))) + (append (if core-p (doom-glob doom-emacs-dir "init.el")) + (if core-p (list doom-core-dir)) + (if private-p (list doom-private-dir))) (or (y-or-n-p (concat "WARNING: Changes made to your config after compiling it won't take effect until\n" "this command is rerun or you run 'doom clean'! It will also make error backtraces\n" @@ -28,11 +26,11 @@ and your private config files, respectively. To recompile your packages, use "If you intend to use it anyway, remember this or it will come back to bite you!\n\n" "Continue anyway?")) (user-error "Aborted")) - (append (list (doom-glob doom-emacs-dir "init.el") - doom-core-dir) - (cl-remove-if-not + (append (doom-glob doom-emacs-dir "init.el") + (list doom-core-dir) + (seq-filter ;; Only compile Doom's modules - (lambda (path) (file-in-directory-p path doom-emacs-dir)) + (doom-rpartial #'file-in-directory-p doom-emacs-dir) ;; Omit `doom-private-dir', which is always first (cdr (doom-module-load-path))))) recompile-p diff --git a/modules/email/notmuch/autoload.el b/modules/email/notmuch/autoload.el index dd440f67f0e..1110b36d540 100644 --- a/modules/email/notmuch/autoload.el +++ b/modules/email/notmuch/autoload.el @@ -44,7 +44,7 @@ (doom-glob (or (getenv "XDG_CONFIG_HOME") "~/.config") "isync/mbsyncrc")) - (format "-c %S" config-file) + (format "-c %S" (car config-file)) ""))) (`offlineimap "offlineimap && notmuch new") diff --git a/modules/lang/dart/config.el b/modules/lang/dart/config.el index 7cc52f939a7..5fcda378bbc 100644 --- a/modules/lang/dart/config.el +++ b/modules/lang/dart/config.el @@ -6,7 +6,7 @@ :config (when (and (featurep! +flutter) IS-LINUX) (when-let (path (doom-glob "/opt/flutter/bin/cache/dart-sdk")) - (setq flutter-sdk-path path))) + (setq flutter-sdk-path (car path)))) (set-ligatures! '(dart-mode) ;; Functional :def "Function"