From 28b53dcc638f24300fd038b494accffc09ff7b3a Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Mon, 8 Dec 2014 23:36:01 -0500 Subject: Avoid ambiguous use of 'notes' In general, 'notes' are used to refer to Org file in `bog-note-directory'. Rename `bog-citekey-from-notes' (and related selection functions), which refer to the context around the point in an Org file, not the collection of note files. --- bog-tests.el | 22 +++++++++++----------- bog.el | 28 ++++++++++++++++------------ 2 files changed, 27 insertions(+), 23 deletions(-) diff --git a/bog-tests.el b/bog-tests.el index 8263b5d..598dc31 100644 --- a/bog-tests.el +++ b/bog-tests.el @@ -196,36 +196,36 @@ some text some text" (should (equal (bog-citekey-from-tree) citekey))))) -;; `bog-citekey-from-notes' +;; `bog-citekey-from-surroundings' -(ert-deftest bog-citekey-from-notes-on-heading () +(ert-deftest bog-citekey-from-surroundings-on-heading () (let ((citekey "name2010word")) (bog-tests--with-temp-text " * top level ** some text" - (should (equal (bog-citekey-from-notes) citekey))))) + (should (equal (bog-citekey-from-surroundings) citekey))))) -(ert-deftest bog-citekey-from-notes-before-text-citekey () +(ert-deftest bog-citekey-from-surroundings-before-text-citekey () (let ((citekey "name2010word")) (bog-tests--with-temp-text " * top level ** other2000key some text and " - (should (equal (bog-citekey-from-notes) citekey))))) + (should (equal (bog-citekey-from-surroundings) citekey))))) -(ert-deftest bog-citekey-from-notes-after-text-citekey () +(ert-deftest bog-citekey-from-surroundings-after-text-citekey () (let ((citekey "name2010word")) (bog-tests--with-temp-text " * top level ** other2000key some text and " - (should (equal (bog-citekey-from-notes) citekey))))) + (should (equal (bog-citekey-from-surroundings) citekey))))) -(ert-deftest bog-citekey-from-notes-on-text-citekey () +(ert-deftest bog-citekey-from-surroundings-on-text-citekey () (let ((citekey "name2010word")) (bog-tests--with-temp-text " @@ -233,14 +233,14 @@ some text and " ** other2000key some text and " (forward-char) - (should (equal (bog-citekey-from-notes) citekey))))) + (should (equal (bog-citekey-from-surroundings) citekey))))) -(ert-deftest bog-citekey-from-notes-no-citekey () +(ert-deftest bog-citekey-from-surroundings-no-citekey () (bog-tests--with-temp-text " * top level ** second" - (should-not (bog-citekey-from-notes)))) + (should-not (bog-citekey-from-surroundings)))) ;;; File functions diff --git a/bog.el b/bog.el index a23773f..22178fc 100644 --- a/bog.el +++ b/bog.el @@ -202,16 +202,16 @@ If NO-CONTEXT is non-nil, immediately fall back." (,context-method) (bog-select-citekey (,collection-method))))) -(bog-selection-method "notes-or-files" - bog-citekey-from-notes +(bog-selection-method "surroundings-or-files" + bog-citekey-from-surroundings bog-all-file-citekeys) -(bog-selection-method "notes-or-bibs" - bog-citekey-from-notes +(bog-selection-method "surroundings-or-bibs" + bog-citekey-from-surroundings bog-bib-citekeys) -(bog-selection-method "notes-or-all" - bog-citekey-from-notes +(bog-selection-method "surroundings-or-all" + bog-citekey-from-surroundings bog-all-citekeys) (bog-selection-method "point-or-buffer-headings" @@ -252,7 +252,7 @@ be preceded by a characters in `bog-allowed-before-citekey'." (when (looking-at bog-citekey-format) (match-string-no-properties 0)))) -(defun bog-citekey-from-notes () +(defun bog-citekey-from-surroundings () "Get the citekey from the context of the Org file." (or (bog-citekey-at-point) (bog-citekey-from-tree))) @@ -351,7 +351,8 @@ With prefix argument NO-CONTEXT, a prompt will open to select from citekeys for all associated files. This same prompt will be opened if locating a citekey from context fails." (interactive "P") - (bog--find-citekey-file (bog-citekey-from-notes-or-files no-context))) + (bog--find-citekey-file + (bog-citekey-from-surroundings-or-files no-context))) (defun bog--find-citekey-file (citekey) (let* (citekey-file @@ -392,7 +393,8 @@ opened if locating a citekey from context fails. If the citekey file prompt is slow to appear, consider enabling `bog-use-citekey-cache'." (interactive "P") - (bog--rename-staged-file-to-citekey (bog-citekey-from-notes-or-all no-context))) + (bog--rename-staged-file-to-citekey + (bog-citekey-from-surroundings-or-all no-context))) (defun bog--rename-staged-file-to-citekey (citekey) (let* ((staged-files (bog-staged-files)) @@ -477,7 +479,7 @@ from citekeys for all BibTeX files. This same prompt will be opened if locating a citekey from context fails." (interactive "P") (funcall bog-find-citekey-bib-func - (bog-citekey-from-notes-or-bibs no-context))) + (bog-citekey-from-surroundings-or-bibs no-context))) (defun bog-find-citekey-bib-file (citekey) "Open BibTeX file of CITEKEY contained in `bog-bib-directory'." @@ -598,7 +600,8 @@ opened if locating a citekey from context fails. If the citekey file prompt is slow to appear, consider enabling `bog-use-citekey-cache'." (interactive "P") - (bog--search-citekey-on-web (bog-citekey-from-notes-or-all no-context))) + (bog--search-citekey-on-web + (bog-citekey-from-surroundings-or-all no-context))) (defun bog--search-citekey-on-web (citekey) (browse-url (bog-citekey-as-search-url citekey))) @@ -739,7 +742,8 @@ The citekey will be taken from the text under point if it matches not found, a prompt will open to select from all citekeys present in notes." (interactive "P") - (bog-search-notes todo-only (bog-citekey-from-notes-or-all nil))) + (bog-search-notes todo-only + (bog-citekey-from-surroundings-or-all nil))) (defun bog-sort-topic-headings-in-buffer (&optional sorting-type) "Sort topic headings in this buffer. -- cgit v1.2.3