[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org-remark 20d33d995d 1/6: feat: extend support for non
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org-remark 20d33d995d 1/6: feat: extend support for non-file-visiting buffer |
Date: |
Fri, 23 Dec 2022 10:57:56 -0500 (EST) |
branch: externals/org-remark
commit 20d33d995d8309916a7f4ec9cff32b0ed6deacb3
Author: Noboru Ota <me@nobiot.com>
Commit: Noboru Ota <me@nobiot.com>
feat: extend support for non-file-visiting buffer
Features:
- For non-file-visiting buffer, now the default note file name is
"marginalia.org" *in the user emacs directory*: e.g.
~/.config/emacs/marginaliaorg, ~/emacs.d/marginalia.org, etc.
- For non-file-visiting buffer and if it is not viewed with EWW,
Org-remark now assumes the source name is the buffer's name.
Description:
This is continuation of the stream of fetures that EWW support opened
up. For buffers that are not visiting a file in general, default
functions to find the notes and source files need adjustment. This is
especially important when 'org-remark-notes-file-name-function' is
selected from the user option. This assumes FILE exsits and creates a
note FILE-notes.org. For non-file-visiting buffers, now default note
file name is marginalia.org in the user emacs directory.
The treatment of source file's name requires more work. Returning the
buffer's name is not really useful (e.g. "*Info*" for all the nodes). I
believe it reqiures a handler specific to each context.
Changed file and functions:
* org-remark-global-tracking.el
(org-remark-notes-file-name-function):
(org-remark-notes-get-file-name):
(org-remark-source-find-file-name):
---
org-remark-global-tracking.el | 38 ++++++++++++++++++++++++++------------
1 file changed, 26 insertions(+), 12 deletions(-)
diff --git a/org-remark-global-tracking.el b/org-remark-global-tracking.el
index 445db3d183..415eb84f59 100644
--- a/org-remark-global-tracking.el
+++ b/org-remark-global-tracking.el
@@ -5,7 +5,7 @@
;; Author: Noboru Ota <me@nobiot.com>
;; URL: https://github.com/nobiot/org-remark
;; Created: 15 August 2021
-;; Last modified: 14 December 2022
+;; Last modified: 23 December 2022
;; Package-Requires: ((emacs "27.1") (org "9.4"))
;; Keywords: org-mode, annotation, note-taking, marginal-notes, wp
@@ -84,9 +84,13 @@ This is the default function for the customizing variable
When the current buffer is visiting a file, the name of marginal
notes file will be \"FILE-notes.org\", adding \"-notes.org\" as a
suffix to the file name without the extension."
- (concat (file-name-sans-extension
- (file-name-nondirectory (org-remark-source-find-file-name)))
- "-notes.org"))
+ (if buffer-file-name
+ (concat (file-name-sans-extension
+ (file-name-nondirectory (org-remark-source-find-file-name)))
+ "-notes.org")
+ ;; If buffer is not visiting a file, a default file name.
+ ;; TODO this should be configurable
+ (expand-file-name "marginalia.org" user-emacs-directory)))
(defalias
'org-remark-notes-file-path-function 'org-remark-notes-file-name-function)
@@ -109,18 +113,28 @@ This function is meant to be added to `find-file-hook' by
"Return the name of marginal notes file for current buffer."
(if (functionp org-remark-notes-file-name)
(funcall org-remark-notes-file-name)
- ;; If not function, assume string and return it as the file path.
- org-remark-notes-file-name))
+ ;; If not function, assume string and return it as the file name.
+ ;; TODO when buffer is not visitng a file, assume file resides in
+ ;; `user-emacs-directory'
+ (if buffer-file-name org-remark-notes-file-name
+ (expand-file-name org-remark-notes-file-name user-emacs-directory))))
(defun org-remark-source-find-file-name ()
"Assumes that we are currently in the source buffer.
-Returns the filename for the soure buffer. We use this filename
+Returns the filename for the source buffer. We use this filename
to identify the source buffer in all operations related to
-marginalia."
- (if (eq major-mode 'eww-mode)
- (let ((url-parsed (url-generic-parse-url (eww-current-url))))
- (concat (url-host url-parsed) (url-filename url-parsed)))
- (buffer-file-name)))
+marginal notes."
+ (let ((filename buffer-file-name))
+ (unless filename
+ (if (eq major-mode 'eww-mode)
+ (let ((url-parsed (url-generic-parse-url (eww-current-url))))
+ (setq filename
+ (concat (url-host url-parsed) (url-filename url-parsed))))
+ ;; TODO Abstract this and move the EWW specific one
+ ;; If not, return the buffer's name as is
+ ;; EWW, Info, etc. may need their respective handler.
+ (setq filename (buffer-name))))
+ filename))
(provide 'org-remark-global-tracking)
- [elpa] externals/org-remark updated (618d603939 -> 31b4971b97), ELPA Syncer, 2022/12/23
- [elpa] externals/org-remark 166d3c8a82 4/6: feat: Modules and org-remark-eww module, ELPA Syncer, 2022/12/23
- [elpa] externals/org-remark aadd65def5 5/6: fix: Slience compilation warning, ELPA Syncer, 2022/12/23
- [elpa] externals/org-remark b46deaee0d 2/6: docs: replace TODO comment in source, ELPA Syncer, 2022/12/23
- [elpa] externals/org-remark 20d33d995d 1/6: feat: extend support for non-file-visiting buffer,
ELPA Syncer <=
- [elpa] externals/org-remark 48907778f4 3/6: fix :org-remark-link: prop for EWW, ELPA Syncer, 2022/12/23
- [elpa] externals/org-remark 31b4971b97 6/6: feat(module): create link to source other than file:, ELPA Syncer, 2022/12/23