emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/org-remark e58c6ae139 1/6: chg: var/func names to align


From: ELPA Syncer
Subject: [elpa] externals/org-remark e58c6ae139 1/6: chg: var/func names to align with GNU convention: path -> file name
Date: Sat, 5 Feb 2022 07:57:41 -0500 (EST)

branch: externals/org-remark
commit e58c6ae139ea1f856033e4779887354a568d89f2
Author: Noboru Ota <me@nobiot.com>
Commit: Noboru Ota <me@nobiot.com>

    chg: var/func names to align with GNU convention: path -> file name
    
    Regarding user option `org-remark-notes-file-path`, the GNU convention is to
    call this a "file name" rather than a "path"; "path" is only used for lists 
of
    directories as in `load-path` (pointed out by Stefan Monnier; thank you).
    
    To align with the GNU convention, the following changes are done.  Users 
should
    not have to change their existing customization as the old names are 
aliased to
    the new ones.
    
    User option:
    - org-remark-notes-file-path -> org-remark-notes-file-name
    
    Function:
    - org-remark-notes-file-path-function -> org-remark-notes-file-name-function
    
    Private Function:
    - org-remark-notes-get-file-path -> org-remark-notes-get-file-name
    
    `org-remark-notes-file-path` and `org-remark-notes-file-path-function` are 
used
    by existing customization, thus both explicitly made obsolete and aliased 
to the
    new file-name equivalents.
---
 org-remark-global-tracking.el | 43 ++++++++++++++++++++++++++-----------------
 org-remark.el                 | 18 +++++++++---------
 2 files changed, 35 insertions(+), 26 deletions(-)

diff --git a/org-remark-global-tracking.el b/org-remark-global-tracking.el
index 3eee93e2d2..74aa683a72 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: 01 February 2022
+;; Last modified: 05 February 2022
 ;; Package-Requires: ((emacs "27.1") (org "9.4"))
 ;; Keywords: org-mode, annotation, writing, note-taking, marginal notes
 
@@ -31,7 +31,7 @@
 
 (declare-function org-remark-mode "org-remark")
 
-(defcustom org-remark-notes-file-path "marginalia.org"
+(defcustom org-remark-notes-file-name "marginalia.org"
   "Define the file path to store the location of highlights and write 
annotations.
 It can be either a string or function.
 
@@ -40,14 +40,18 @@ file.  The default is \"marginalia.org\".  It will be one 
marginal
 notes file per directory.  Ensure that it is an Or file.
 
 If it is a function, the default function is
-`org-remark-notes-file-path-function'.  It returns a file name
+`org-remark-notes-file-name-function'.  It returns a file name
 like this: \"FILE-notes.org\" by adding \"-notes.org\" as a
 suffix to the file name without the extension."
   :group 'org-remark
   :safe #'stringp
   :type '(choice
           (file "marginalia.org")
-          (function org-remark-notes-file-path-function)))
+          (function org-remark-notes-file-name-function)))
+
+(defvaralias 'org-remark-notes-file-path 'org-remark-notes-file-name)
+(make-obsolete-variable
+ 'org-remark-notes-file-path 'org-remark-notes-file-name "0.2.0")
 
 ;;;###autoload
 (define-minor-mode org-remark-global-tracking-mode
@@ -68,18 +72,34 @@ readable, the function automatically activates 
`org-remark'."
     ;; Deactivate
     (remove-hook 'find-file-hook #'org-remark-auto-on))))
 
+(defun org-remark-notes-file-name-function ()
+  "Return a marginal notes file name for the current buffer.
+
+This is the default function for the customizing variable
+`org-remark-notes-file-path' for its funciton option.
+
+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 (buffer-file-name)) "-notes.org"))
+
+(defalias
+  'org-remark-notes-file-path-function 'org-remark-notes-file-name-function)
+(make-obsolete
+ 'org-remark-notes-file-path-function 'org-remark-notes-file-name-function 
"0.2.0" )
+
 ;;;; Private Functions
 
 (defun org-remark-auto-on ()
   "Automatically activates `org-remark-mode' for current buffer when relevant.
 This function is meant to be addd to `find-file-hook' by
 `org-remark-global-tracking-mode'."
-  (when-let (notes-file (org-remark-notes-get-file-path))
+  (when-let (notes-file (org-remark-notes-get-file-name))
     (when (file-readable-p notes-file)
       (unless (featurep 'org-remark) (require 'org-remark))
       (org-remark-mode +1))))
 
-(defun org-remark-notes-get-file-path ()
+(defun org-remark-notes-get-file-name ()
   "Return the file path to the marginal notes for current buffer.
 This function looks at customization variable
 `org-remark-notes-file-path'.  If it is a string, return it as
@@ -90,17 +110,6 @@ value."
     ;; If not function, assume string and return it as the file path.
     org-remark-notes-file-path))
 
-(defun org-remark-notes-file-path-function ()
-  "Return a marginal notes file name for the current buffer.
-
-This is the default function for the customizing variable
-`org-remark-notes-file-path' for its funciton option.
-
-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 (buffer-file-name)) "-notes.org"))
-
 (provide 'org-remark-global-tracking)
 
 ;;; org-remark-global-tracking.el ends here
diff --git a/org-remark.el b/org-remark.el
index 3004fe486f..6d38dc9c58 100644
--- a/org-remark.el
+++ b/org-remark.el
@@ -6,7 +6,7 @@
 ;; URL: https://github.com/nobiot/org-remark
 ;; Version: 0.2.0
 ;; Created: 22 December 2020
-;; Last modified: 04 February 2022
+;; Last modified: 05 February 2022
 ;; Package-Requires: ((emacs "27.1") (org "9.4"))
 ;; Keywords: org-mode, annotation, writing, note-taking, marginal-notes
 
@@ -104,7 +104,7 @@ It is a local variable and is a list of overlays.  Each 
overlay
 represents a highlighted text region.
 
 On `save-buffer' each highlight will be saved in the notes file at
-the path returned by `org-remark-notes-get-file-path'.")
+the path returned by `org-remark-notes-get-file-name'.")
 
 (defvar-local org-remark-highlights-hidden nil
   "Keep hidden/shown state of the highlights in current buffer.")
@@ -330,7 +330,7 @@ region.
 
 A Org headline entry for the highlght will be created in the
 marginal notes file specified by
-`org-remark-notes-get-file-path'.  If the file does not exist
+`org-remark-notes-get-file-name'.  If the file does not exist
 yet, it will be created.
 
 When this function is called from Elisp, ID can be
@@ -647,7 +647,7 @@ marginal notes file.  The expected values are nil, :load and
 :change.
 
 A Org headline entry for the highlght will be created in the
-marginal notes file specified by `org-remark-notes-get-file-path'.
+marginal notes file specified by `org-remark-notes-get-file-name'.
 If the file does not exist yet, it will be created.
 
 When this function is called from Elisp, ID can be optionally
@@ -743,7 +743,7 @@ source with using ORGID."
          (id (plist-get props 'org-remark-id))
          (text (org-with-wide-buffer (buffer-substring-no-properties beg end)))
          (orgid (org-remark-highlight-get-org-id beg))
-         (notes-buf (find-file-noselect (org-remark-notes-get-file-path)))
+         (notes-buf (find-file-noselect (org-remark-notes-get-file-name)))
          (line-num (org-current-line beg)))
     (with-current-buffer notes-buf
       (when (featurep 'org-remark-convert-legacy) 
(org-remark-convert-legacy-data))
@@ -850,7 +850,7 @@ notes file of the current buffer.  This function ensures 
there is
 only one of the marginal notes buffer per session."
   ;; Compare the target marginal notes buffer and current marginal notes 
buffer.
   ;; For the latter, we need the base buffer of an indirect buffer.
-  (let ((cbuf (find-file-noselect (org-remark-notes-get-file-path)))
+  (let ((cbuf (find-file-noselect (org-remark-notes-get-file-name)))
         (ibuf (when (buffer-live-p org-remark-last-notes-buffer)
                 org-remark-last-notes-buffer)))
     (unless (eq (buffer-base-buffer ibuf) cbuf)
@@ -920,10 +920,10 @@ load the highlights"
 
 (defun org-remark-highlights-get ()
   "Return a list of highlights from the marginal notes file path.
-The file path is returned by `org-remark-notes-get-file-path'.
+The file path is returned by `org-remark-notes-get-file-name'.
 Each highlight is a list in the following structure:
     (ID (BEG . END) LABEL)"
-  (when-let ((notes-buf (find-file-noselect (org-remark-notes-get-file-path)))
+  (when-let ((notes-buf (find-file-noselect (org-remark-notes-get-file-name)))
              (source-path (org-remark-source-path (buffer-file-name))))
     ;; TODO check if there is any relevant notes for the current file
     ;; This can be used for adding icon to the highlight
@@ -1086,5 +1086,5 @@ function extends the behavior and looks for the word at 
point"
 ;;; org-remark.el ends here
 
 ;; Local Variables:
-;; org-remark-notes-file-path: "README.org"
+;; org-remark-notes-file-name: "README.org"
 ;; End:



reply via email to

[Prev in Thread] Current Thread [Next in Thread]