Skip to content

Commit 810600a

Browse files
committed
refine path+ for runtime efficient
1 parent 9e13de3 commit 810600a

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

Diff for: config/fn.el

+8-8
Original file line numberDiff line numberDiff line change
@@ -588,14 +588,14 @@ Call FN with the path if FN is non-nil."
588588
(defun path+ (root &rest path)
589589
"Append a list of PATH to ROOT."
590590
(declare (indent 1))
591-
(cond ((null root) nil)
592-
((null path) (if (strrchr root ?/) root (concat root "/")))
593-
(t (apply #'path+
594-
(concat (if (strrchr root ?/) root (concat root "/"))
595-
(if (strrchr (car path) ?/)
596-
(car path)
597-
(concat (car path) "/")))
598-
(cdr path)))))
591+
(and root
592+
(unless (strrchr root ?/) (setq root (concat root "/")))
593+
(cond ((null path) (if (strrchr root ?/) root (concat root "/")))
594+
(t (apply #'path+
595+
(concat root (if (strrchr (car path) ?/)
596+
(car path)
597+
(concat (car path) "/")))
598+
(cdr path))))))
599599

600600
(defun path- (file)
601601
"Return the parent path of FILE."

0 commit comments

Comments
 (0)