4545 " Update to date current path.
4646Use this variable when you don't have the `default-directory' up to date." )
4747
48+ (defvar dashboard-ls--record-path nil
49+ " Record of the current working directory." )
50+
51+ (defun dashboard-ls--current-path ()
52+ " Return the current path the user is on."
53+ (setq dashboard-ls--record-path (or dashboard-ls-path default-directory))
54+ dashboard-ls--record-path)
55+
4856(defun dashboard-ls--insert-dir (list-size )
4957 " Add the list of LIST-SIZE items from current directory."
5058 (dashboard-insert-section
5159 " Current Directories:"
52- (let* ((current-dir (or dashboard-ls-path default-directory ))
60+ (let* ((current-dir (dashboard-ls--current-path ))
5361 (dir-lst (when (f-dir-p current-dir) (f-directories current-dir)))
5462 (opt-dir-lst '()))
5563 (dolist (dir dir-lst)
@@ -59,14 +67,15 @@ Use this variable when you don't have the `default-directory' up to date.")
5967 (reverse opt-dir-lst))
6068 list-size
6169 (dashboard-get-shortcut 'ls-directories )
62- `(lambda (&rest ignore) (find-file-existing , el ))
70+ `(lambda (&rest ignore)
71+ (find-file-existing (concat dashboard-ls--record-path , el )))
6372 (abbreviate-file-name el)))
6473
6574(defun dashboard-ls--insert-file (list-size )
6675 " Add the list of LIST-SIZE items from current files."
6776 (dashboard-insert-section
6877 " Current Files:"
69- (let* ((current-dir (or dashboard-ls-path default-directory ))
78+ (let* ((current-dir (dashboard-ls--current-path ))
7079 (file-lst (when (f-dir-p current-dir) (f-files current-dir)))
7180 (opt-file-lst '()))
7281 (dolist (file file-lst)
@@ -76,7 +85,8 @@ Use this variable when you don't have the `default-directory' up to date.")
7685 (reverse opt-file-lst))
7786 list-size
7887 (dashboard-get-shortcut 'ls-files )
79- `(lambda (&rest ignore) (find-file-existing , el ))
88+ `(lambda (&rest ignore)
89+ (find-file-existing (concat dashboard-ls--record-path , el )))
8090 (abbreviate-file-name el)))
8191
8292(provide 'dashboard-ls )
0 commit comments