Skip to content

Commit

Permalink
ekg-setup-notes-buffer' setq-local' default-directory' to ekg-db-…
Browse files Browse the repository at this point in the history
…file' parent directory. (#182)

This makes sure all ekg notes buffer have the same directory.
  • Loading branch information
monkpearman authored Sep 28, 2024
1 parent 4dbea88 commit 839c6ce
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions doc/ekg.org
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ triples library is already installed.
- Fix display of extended structured data in notes.
- Add contrib directory and =ekg-email= as a contribution to import emails to notes in a structured way.
- Fix inlines not expanding in the contextual notes in =ekg-llm=.
- Set =default-directory= to db location in notes buffers (by [[https://github.com/monkpearman][S Pearman]]).
** Version 0.6.3
- Fix issue in trying to get a single-valued item to show up in the metadata line.
- Remove the never-used named, email, and person schema.
Expand Down
2 changes: 2 additions & 0 deletions doc/ekg.texi
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@ Fix display of extended structured data in notes.
Add contrib directory and @samp{ekg-email} as a contribution to import emails to notes in a structured way.
@item
Fix inlines not expanding in the contextual notes in @samp{ekg-llm}.
@item
Set @samp{default-directory} to db location in notes buffers (by @uref{https://github.com/monkpearman, S Pearman}).
@end itemize

@node Version 063
Expand Down
10 changes: 9 additions & 1 deletion ekg.el
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,13 @@ non-nil, it will be used as the filename, otherwise
ekg-db-file-obsolete
ekg-db-file))

(defun ekg--notes-directory ()
"Return the directory ekg notes buffers have as the default directory.
This will be the location of the database file."
(file-name-directory
(or (ekg-db-file)
triples-default-database-filename)))

;; `ekg-connect' will do things that might themselves call `ekg-connect', so we
;; need to protect against an infinite recursion.
(defalias 'ekg-connect
Expand Down Expand Up @@ -2009,7 +2016,8 @@ notes are created with additional tags TAGS."
(let ((buf (get-buffer-create (format "*ekg %s*" name))))
(set-buffer buf)
(ekg--show-notes name notes-func tags)
(switch-to-buffer buf)))
(switch-to-buffer buf)
(setq-local default-directory (ekg--notes-directory))))

(defun ekg-sort-by-creation-time (a b)
"Used to pass to `sort', which will supply A and B."
Expand Down

0 comments on commit 839c6ce

Please sign in to comment.