um-journal-path should return default-directory when it can't find the glob
otherwise embark-act will barf with a nil value
This commit is contained in:
parent
2e885655af
commit
45825c7935
1 changed files with 13 additions and 9 deletions
14
elisp/um.el
14
elisp/um.el
|
|
@ -86,12 +86,16 @@
|
||||||
;; find-file-at-point
|
;; find-file-at-point
|
||||||
|
|
||||||
;; the journal/ serves as content origin, so it must be treated specially.
|
;; the journal/ serves as content origin, so it must be treated specially.
|
||||||
(setq um-journal-path (car (seq-filter
|
(defun um-journal-path()
|
||||||
|
(or (car (seq-filter
|
||||||
(lambda (path)
|
(lambda (path)
|
||||||
;; this way I don't have to hardcode the full path:
|
;; this way I don't have to hardcode the full path:
|
||||||
(string-match um-journal-path-glob path))
|
(string-match um-journal-path-glob path))
|
||||||
;; stores all project roots in a list of strings:
|
;; stores all project roots in a list of strings:
|
||||||
(project-known-project-roots))))
|
(project-known-project-roots)))
|
||||||
|
;; fallback if not found
|
||||||
|
default-directory
|
||||||
|
))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; find-file C-x C-f solution
|
;; find-file C-x C-f solution
|
||||||
|
|
@ -101,7 +105,7 @@
|
||||||
;; TODO: reuse same fallback logic as the embark advice if I keep this.
|
;; TODO: reuse same fallback logic as the embark advice if I keep this.
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun um-journal-find-file ()
|
(defun um-journal-find-file ()
|
||||||
(let ((default-directory um-journal-path)
|
(let ((default-directory (um-journal-path))
|
||||||
(thing (thing-at-point 'filename))
|
(thing (thing-at-point 'filename))
|
||||||
)
|
)
|
||||||
(expand-file-name thing))
|
(expand-file-name thing))
|
||||||
|
|
@ -144,7 +148,7 @@ in the root dir.
|
||||||
(cl-loop for project-path in
|
(cl-loop for project-path in
|
||||||
(seq-remove
|
(seq-remove
|
||||||
(lambda (path)
|
(lambda (path)
|
||||||
(or (string-match um-journal-path path)
|
(or (string-match (um-journal-path) path)
|
||||||
(when (project-current)
|
(when (project-current)
|
||||||
(string-match (caddr (project-current)) path))
|
(string-match (caddr (project-current)) path))
|
||||||
))
|
))
|
||||||
|
|
@ -156,7 +160,7 @@ in the root dir.
|
||||||
))
|
))
|
||||||
|
|
||||||
;; journal path
|
;; journal path
|
||||||
(let ((default-directory um-journal-path))
|
(let ((default-directory (um-journal-path)))
|
||||||
(funcall origfunc))
|
(funcall origfunc))
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue