Fix: open-today-log failed when opening from root of project
simplified locate-dominating-file call, by using the version from the documentation
This commit is contained in:
@@ -36,13 +36,13 @@
|
||||
"Open today's log file in log/YYYY-MM-DD.md format.
|
||||
Creates the log directory if it doesn't exist."
|
||||
(interactive)
|
||||
(let* ((git-root (locate-dominating-file (or buffer-file-name default-directory) ".git"))
|
||||
(log-dir (concat (if git-root (file-name-directory git-root) default-directory) "log"))
|
||||
(date-str (format-time-string "%Y-%m-%d"))
|
||||
(let* ((git-root (locate-dominating-file "." ".git"))
|
||||
(log-dir (concat git-root "log"))
|
||||
(date-str (format-time-string "%Y-%m-%d")))
|
||||
(unless (file-directory-p log-dir)
|
||||
(make-directory log-dir t))
|
||||
(let ((file-name (concat log-dir "/" date-str ".md")))
|
||||
(if (file-exists-p file-name)
|
||||
(find-file file-name)
|
||||
(progn (find-file file-name)
|
||||
(insert (format "# %s\n\n" date-str))))))))
|
||||
(find-file file-name)
|
||||
(progn (find-file file-name)
|
||||
(insert (format "# %s\n\n" date-str)))))))
|
||||
|
||||
Reference in New Issue
Block a user