From fbaa4793b183cb0fdac6404125e9024fc2cd4670 Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" Date: Thu, 25 Jun 2020 12:09:51 +0100 Subject: Makefile: Allow specifying Emacs version with var --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e3d5987..fbcd942 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ +EMACS ?= emacs LOAD_PATH ?= -BATCH = emacs -Q --batch $(LOAD_PATH) +BATCH = $(EMACS) -Q --batch $(LOAD_PATH) all: bog.elc bog-autoloads.el -- cgit v1.2.3 From 6184e74ca8256d322276b50b0a4ea2ab072bb83a Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" Date: Thu, 25 Jun 2020 15:06:51 +0100 Subject: Use lexical-binding and byte-compile tests * Makefile (test, clean): Byte-compile test suite to catch more errors. * bog-tests.el: Use lexical-binding. Remove the need for cl-lib by replacing single cl-gensym with make-symbol. Declare 'citekey' as a special variable. Add footer line. (bog-tests-with-temp-dir): Replace cl-gensym with make-symbol. (bog-tests-with-temp-text): Allow instrumenting for debugging. Evaluate arguments only once. Don't assume 'citekey' is bound. Pass non-nil FIXEDCASE and LITERAL arguments to replace-match. Simplify with buffer rather than string manipulation. (bog-file-citekeys/multiple-variants): Fix typo caught by byte-compilation. * bog.el: Use lexical-binding. Quote function symbols as such. (bog--with-citekey-cache): Allow instrumenting for debugging. Replace cl-gensym with make-symbol. (bog-selection-method): Simplify and reindent. (bog--agenda-map): New keymap. (bog--with-search-lprops): Use it instead of generating it on the fly. Allow instrumenting for debugging. Don't use org-let which calls eval without lexical-binding. Bind uninterned symbol around body. Use unwind-protect to ensure org-lprops are restored. (bog-search-notes, bog-agenda-redo): Unquote body passed to bog--with-search-lprops now that it no longer uses org-let. (bog-command-map): Make docstring consistent with that of other keymaps. --- Makefile | 6 ++--- bog-tests.el | 41 ++++++++++++++++++----------------- bog.el | 71 +++++++++++++++++++++++++++++++++--------------------------- 3 files changed, 63 insertions(+), 55 deletions(-) diff --git a/Makefile b/Makefile index fbcd942..d85bb40 100644 --- a/Makefile +++ b/Makefile @@ -6,13 +6,13 @@ BATCH = $(EMACS) -Q --batch $(LOAD_PATH) all: bog.elc bog-autoloads.el .PHONY: test -test: bog.elc - @$(BATCH) -L . -l bog-tests.el \ +test: bog.elc bog-tests.elc + @$(BATCH) -L . -l bog-tests.elc \ --eval "(ert-run-tests-batch-and-exit '(not (tag interactive)))" .PHONY: clean clean: - $(RM) bog.elc bog-autoloads.el + $(RM) bog.elc bog-autoloads.el bog-tests.elc %.elc: %.el @$(BATCH) -L . -f batch-byte-compile $< diff --git a/bog-tests.el b/bog-tests.el index b1b2ea1..3a1539c 100644 --- a/bog-tests.el +++ b/bog-tests.el @@ -1,4 +1,4 @@ -;;; bog-tests.el --- Tests for Bog +;;; bog-tests.el --- Tests for Bog -*- lexical-binding: t -*- ;; Copyright (C) 2013-2016 Kyle Meyer @@ -19,15 +19,17 @@ ;;; Code: +(require 'bog) (require 'ert) (require 'org) -(require 'cl-lib) -(require 'bog) + +(with-no-warnings ;; Silence "lacks a prefix" warning. + (defvar citekey)) ;; Modified from magit-tests.el. (defmacro bog-tests-with-temp-dir (&rest body) (declare (indent 0) (debug t)) - (let ((dir (cl-gensym))) + (let ((dir (make-symbol "dir"))) `(let ((,dir (file-name-as-directory (make-temp-file "dir" t)))) (unwind-protect (let ((default-directory ,dir)) ,@body) @@ -44,21 +46,18 @@ value of the variable `citekey'. If the string \"\" appears in TEXT then remove it and place the point there before running BODY, otherwise place the point at the beginning of the inserted text." - (declare (indent 1)) - `(let* ((inside-text (if (stringp ,text) ,text (eval ,text))) - (is-citekey (string-match "" inside-text))) - (when (and is-citekey citekey) - (setq inside-text (replace-match citekey nil nil inside-text))) - (with-temp-buffer - (org-mode) - (let ((point (string-match "" inside-text))) - (if point - (progn - (insert (replace-match "" nil nil inside-text)) - (goto-char (1+ (match-beginning 0)))) - (insert inside-text) - (goto-char (point-min)))) - ,@body))) + (declare (indent 1) (debug t)) + `(with-temp-buffer + (org-mode) + (insert ,text) + (goto-char (point-min)) + (when (and (bound-and-true-p citekey) + (search-forward "" nil t)) + (replace-match citekey t t)) + (goto-char (point-min)) + (when (search-forward "" nil t) + (replace-match "" t t)) + ,@body)) ;;; Citekey functions @@ -410,7 +409,7 @@ some text" (concat citekey ".txt") (concat citekey "_0.pdf") (concat citekey "-supplement.pdf"))) - found-files) + files-found) (make-directory bog-file-directory) (dolist (var variants) (write-region "" nil (expand-file-name var bog-file-directory))) @@ -582,3 +581,5 @@ some text" (sort (bog--find-duplicates (list "a" "b" "c" "b" "a")) #'string-lessp)))) + +;;; bog-tests.el ends here diff --git a/bog.el b/bog.el index e7ceada..2739caf 100644 --- a/bog.el +++ b/bog.el @@ -1,4 +1,4 @@ -;;; bog.el --- Extensions for research notes in Org mode +;;; bog.el --- Extensions for research notes in Org mode -*- lexical-binding: t -*- ;; Copyright (C) 2013-2016 Kyle Meyer @@ -133,7 +133,7 @@ non-nil." rename." :type 'directory) -(defcustom bog-find-citekey-bib-func 'bog-find-citekey-bib-file +(defcustom bog-find-citekey-bib-func #'bog-find-citekey-bib-file "Function used to find BibTeX entry for citekey. Default is `bog-find-citekey-bib-file', which locates single @@ -180,7 +180,7 @@ files with the format .* and *., where is matched by this regular expression.." :type 'regexp) -(defcustom bog-file-renaming-func 'bog-file-ask-on-conflict +(defcustom bog-file-renaming-func #'bog-file-ask-on-conflict "Function used to rename staged files. This function should accept a file name and a citekey as arguments and return the name of the final file. Currently the @@ -348,8 +348,8 @@ Keys match values in `bog-use-citekey-cache'.") "Execute BODY, maybe using cached citekey values for KEY. Use cached values if `bog-use-citekey-cache' is non-nil for KEY. Cached values are updated to the return values of BODY." - (declare (indent 1)) - (let ((use-cache-p (cl-gensym "use-cache-p"))) + (declare (indent 1) (debug t)) + (let ((use-cache-p (make-symbol "use-cache-p"))) `(let* ((,use-cache-p (bog--use-cache-p ,key)) (citekeys (or (and ,use-cache-p (cdr (assq ,key bog--citekey-cache))) @@ -463,11 +463,11 @@ behavior: ,(format "Select citekey with `%s'. Fall back on `%s'. If NO-CONTEXT is non-nil, immediately fall back." - (symbol-name context-method) - (symbol-name collection-method)) - (or (and no-context (bog-select-citekey (,collection-method))) - (,context-method) - (bog-select-citekey (,collection-method))))) + context-method + collection-method) + (or (and no-context (bog-select-citekey (,collection-method))) + (,context-method) + (bog-select-citekey (,collection-method))))) (bog-selection-method "surroundings-or-files" bog-citekey-from-surroundings @@ -1181,25 +1181,32 @@ level `bog-refile-maxlevel' are considered." (cdr (assoc-string (completing-read "File: " note-paths) note-paths)))) +(defvar bog--agenda-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map org-agenda-mode-map) + (define-key map "r" 'bog-agenda-redo) + (define-key map "g" 'bog-agenda-redo) + map) + "Local keymap for Bog-related agendas.") + (defmacro bog--with-search-lprops (&rest body) "Execute BODY with Bog-related agenda values. Restore the `org-lprops' property value for `org-agenda-redo-command' after executing BODY." - (declare (indent 0)) - `(let ((org-lprops (get 'org-agenda-redo-command 'org-lprops)) - (bog-lprops '((org-agenda-buffer-name "*Bog search*") - (org-agenda-files (bog-notes)) - org-agenda-text-search-extra-files - org-agenda-sticky))) - (put 'org-agenda-redo-command 'org-lprops bog-lprops) - (put 'org-agenda-files 'org-restrict nil) - (org-let bog-lprops ,@body) - (use-local-map (let ((map (make-sparse-keymap))) - (set-keymap-parent map org-agenda-mode-map) - (define-key map "r" 'bog-agenda-redo) - (define-key map "g" 'bog-agenda-redo) - map)) - (put 'org-agenda-redo-command 'org-lprops org-lprops))) + (declare (indent 0) (debug t)) + (let ((bog-lprops '((org-agenda-buffer-name "*Bog search*") + (org-agenda-files (bog-notes)) + org-agenda-text-search-extra-files + org-agenda-sticky)) + (org-lprops (make-symbol "org-lprops"))) + `(let ((,org-lprops (get 'org-agenda-redo-command 'org-lprops))) + (unwind-protect + (let ,bog-lprops + (put 'org-agenda-redo-command 'org-lprops ',bog-lprops) + (put 'org-agenda-files 'org-restrict nil) + ,@body + (use-local-map bog--agenda-map)) + (put 'org-agenda-redo-command 'org-lprops ,org-lprops))))) ;;;###autoload (defun bog-search-notes (&optional todo-only string) @@ -1209,7 +1216,7 @@ STRING is non-nil, use it as the search term (instead of prompting for one)." (interactive "P") (bog--with-search-lprops - '(org-search-view todo-only string))) + (org-search-view todo-only string))) ;;;###autoload (defun bog-search-notes-for-citekey (&optional todo-only) @@ -1230,7 +1237,7 @@ If the citekey prompt is slow to appear, consider enabling the (defun bog-agenda-redo (&optional all) (interactive "P") (bog--with-search-lprops - '(org-agenda-redo all))) + (org-agenda-redo all))) (defun bog-sort-topic-headings-in-buffer (&optional sorting-type) "Sort topic headings in this buffer. @@ -1265,8 +1272,8 @@ argument CURRENT-BUFFER, limit to heading citekeys from the current buffer." (interactive "P") (let ((citekey-func (if current-buffer - 'bog-heading-citekeys-in-wide-buffer - 'bog-all-heading-citekeys))) + #'bog-heading-citekeys-in-wide-buffer + #'bog-all-heading-citekeys))) (insert (bog-select-citekey (funcall citekey-func))))) ;;;###autoload @@ -1403,7 +1410,7 @@ Topic headings are determined by `bog-topic-heading-level'." (define-key map "v" 'bog-view-mode) (define-key map "y" 'bog-insert-heading-citekey) map) - "Map for Bog commands. + "Keymap for Bog commands. In Bog mode, these are under `bog-keymap-prefix'. `bog-command-map' can also be bound to a key outside of Bog mode.") @@ -1430,11 +1437,11 @@ if ARG is omitted or nil. (cond (bog-mode (if (derived-mode-p 'org-mode) - (add-hook 'org-font-lock-hook 'bog-fontify-non-heading-citekeys) + (add-hook 'org-font-lock-hook #'bog-fontify-non-heading-citekeys) (font-lock-add-keywords nil bog-citekey-font-lock-keywords))) (t (if (derived-mode-p 'org-mode) - (remove-hook 'org-font-lock-hook 'bog-fontify-non-heading-citekeys) + (remove-hook 'org-font-lock-hook #'bog-fontify-non-heading-citekeys) (font-lock-remove-keywords nil bog-citekey-font-lock-keywords)) (when (bound-and-true-p bog-view-mode) (bog-view-mode -1)))) -- cgit v1.2.3 From 30fc844a24954601ff3294a43c89f2407760e024 Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" Date: Thu, 25 Jun 2020 14:45:26 +0100 Subject: Reindent code Fix indentation and flatten the progn in bog-mode. --- bog-tests.el | 110 ++++++++++++++++++++++++++++++----------------------------- bog.el | 29 ++++++++-------- 2 files changed, 70 insertions(+), 69 deletions(-) diff --git a/bog-tests.el b/bog-tests.el index 3a1539c..267c10f 100644 --- a/bog-tests.el +++ b/bog-tests.el @@ -240,22 +240,22 @@ some text and " (ert-deftest bog-citekeys-in-buffer () (should (equal '("abc1900def" "ghi1950jkl" "mno2000pqr") - (bog-tests-with-temp-text - " + (bog-tests-with-temp-text + " * abc1900def ghi1950jkl * mno2000pqr * mno2000pqr" - (sort (bog-citekeys-in-buffer) #'string-lessp))))) + (sort (bog-citekeys-in-buffer) #'string-lessp))))) (ert-deftest bog-heading-citekeys-in-buffer () (should (equal '("abc1900def" "mno2000pqr") - (bog-tests-with-temp-text - " + (bog-tests-with-temp-text + " * abc1900def ghi1950jkl * mno2000pqr" - (bog-heading-citekeys-in-buffer))))) + (bog-heading-citekeys-in-buffer))))) (ert-deftest bog-next-non-heading-citekey/default-arg () (let ((citekey "name2010word")) @@ -352,69 +352,71 @@ other2000key " (ert-deftest bog-all-file-citekeys () (bog-tests-with-temp-dir - (let ((bog-file-directory (expand-file-name "citekey-files"))) - (make-directory bog-file-directory) - (let ((default-directory bog-file-directory)) - (make-directory "key2000butdir")) - (write-region "" nil (expand-file-name "nokey.pdf" bog-file-directory)) - (write-region "" nil (expand-file-name "one2010key.pdf" bog-file-directory)) - (write-region "" nil (expand-file-name "two1980key.txt" bog-file-directory)) - (should (equal (bog-all-file-citekeys) - '("one2010key" "two1980key")))))) + (let ((bog-file-directory (expand-file-name "citekey-files"))) + (make-directory bog-file-directory) + (let ((default-directory bog-file-directory)) + (make-directory "key2000butdir")) + (write-region "" nil (expand-file-name "nokey.pdf" bog-file-directory)) + (write-region "" nil (expand-file-name "one2010key.pdf" + bog-file-directory)) + (write-region "" nil (expand-file-name "two1980key.txt" + bog-file-directory)) + (should (equal (bog-all-file-citekeys) + '("one2010key" "two1980key")))))) (ert-deftest bog-rename-staged-file-to-citekey/one-file () (bog-tests-with-temp-dir - (let ((bog-stage-directory (expand-file-name "stage")) - (bog-file-directory (expand-file-name "citekey-files")) - (citekey "name2010word")) - (make-directory bog-stage-directory) - (make-directory bog-file-directory) - (write-region "" nil (expand-file-name "one.pdf" bog-stage-directory)) - (bog-tests-with-temp-text - " + (let ((bog-stage-directory (expand-file-name "stage")) + (bog-file-directory (expand-file-name "citekey-files")) + (citekey "name2010word")) + (make-directory bog-stage-directory) + (make-directory bog-file-directory) + (write-region "" nil (expand-file-name "one.pdf" bog-stage-directory)) + (bog-tests-with-temp-text + " * top level ** some text" - (bog-rename-staged-file-to-citekey)) - (should (file-exists-p (expand-file-name - (concat citekey ".pdf") bog-file-directory))) - (should-not (file-exists-p (expand-file-name - "one.pdf" bog-stage-directory)))))) + (bog-rename-staged-file-to-citekey)) + (should (file-exists-p (expand-file-name + (concat citekey ".pdf") bog-file-directory))) + (should-not (file-exists-p (expand-file-name + "one.pdf" bog-stage-directory)))))) (ert-deftest bog-rename-staged-file-to-citekey/one-file-subdir () (bog-tests-with-temp-dir - (let ((bog-stage-directory (expand-file-name "stage")) - (bog-file-directory (expand-file-name "citekey-files")) - (citekey "name2010word") - (bog-subdirectory-group 2)) - (make-directory bog-stage-directory) - (make-directory bog-file-directory) - (write-region "" nil (expand-file-name "one.pdf" bog-stage-directory)) - (bog-tests-with-temp-text - " + (let ((bog-stage-directory (expand-file-name "stage")) + (bog-file-directory (expand-file-name "citekey-files")) + (citekey "name2010word") + (bog-subdirectory-group 2)) + (make-directory bog-stage-directory) + (make-directory bog-file-directory) + (write-region "" nil (expand-file-name "one.pdf" bog-stage-directory)) + (bog-tests-with-temp-text + " * top level ** some text" - (bog-rename-staged-file-to-citekey)) - (should (file-exists-p (expand-file-name - (concat "2010/" citekey ".pdf") bog-file-directory))) - (should-not (file-exists-p (expand-file-name - "one.pdf" bog-stage-directory)))))) + (bog-rename-staged-file-to-citekey)) + (should (file-exists-p (expand-file-name (concat "2010/" citekey ".pdf") + bog-file-directory))) + (should-not (file-exists-p (expand-file-name + "one.pdf" bog-stage-directory)))))) (ert-deftest bog-file-citekeys/multiple-variants () (bog-tests-with-temp-dir - (let* ((bog-file-directory (expand-file-name "citekey-files")) - (citekey "name2010word") - (variants (list (concat citekey ".pdf") - (concat citekey ".txt") - (concat citekey "_0.pdf") - (concat citekey "-supplement.pdf"))) - files-found) - (make-directory bog-file-directory) - (dolist (var variants) - (write-region "" nil (expand-file-name var bog-file-directory))) - (setq files-found (bog-citekey-files citekey)) - (should (= (length files-found) 4))))) + (let* ((bog-file-directory (expand-file-name "citekey-files")) + (citekey "name2010word") + (variants (list (concat citekey ".pdf") + (concat citekey ".txt") + (concat citekey "_0.pdf") + (concat citekey "-supplement.pdf"))) + files-found) + (make-directory bog-file-directory) + (dolist (var variants) + (write-region "" nil (expand-file-name var bog-file-directory))) + (setq files-found (bog-citekey-files citekey)) + (should (= (length files-found) 4))))) ;;; BibTeX functions diff --git a/bog.el b/bog.el index 2739caf..f36e41b 100644 --- a/bog.el +++ b/bog.el @@ -1142,7 +1142,7 @@ If the citekey prompt is slow to appear, consider enabling the (citekey (bog-citekey-from-point-or-all-headings no-context)) (marker (with-current-buffer (or (buffer-base-buffer) (current-buffer)) - (bog--find-citekey-heading-in-notes citekey)))) + (bog--find-citekey-heading-in-notes citekey)))) (if marker (with-current-buffer (marker-buffer marker) (org-with-wide-buffer @@ -1433,20 +1433,19 @@ if ARG is omitted or nil. \\{bog-mode-map}" :lighter " Bog" - (progn - (cond - (bog-mode - (if (derived-mode-p 'org-mode) - (add-hook 'org-font-lock-hook #'bog-fontify-non-heading-citekeys) - (font-lock-add-keywords nil bog-citekey-font-lock-keywords))) - (t - (if (derived-mode-p 'org-mode) - (remove-hook 'org-font-lock-hook #'bog-fontify-non-heading-citekeys) - (font-lock-remove-keywords nil bog-citekey-font-lock-keywords)) - (when (bound-and-true-p bog-view-mode) - (bog-view-mode -1)))) - (when font-lock-mode - (funcall bog-font-lock-function)))) + (cond + (bog-mode + (if (derived-mode-p 'org-mode) + (add-hook 'org-font-lock-hook #'bog-fontify-non-heading-citekeys) + (font-lock-add-keywords nil bog-citekey-font-lock-keywords))) + (t + (if (derived-mode-p 'org-mode) + (remove-hook 'org-font-lock-hook #'bog-fontify-non-heading-citekeys) + (font-lock-remove-keywords nil bog-citekey-font-lock-keywords)) + (when (bound-and-true-p bog-view-mode) + (bog-view-mode -1)))) + (when font-lock-mode + (funcall bog-font-lock-function))) ;;; View minor mode -- cgit v1.2.3 From 03dbdd2644e680cc6a1aeb6fc6f48f155a6d38fe Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" Date: Thu, 25 Jun 2020 14:49:41 +0100 Subject: bog-mode: Modify org-font-lock-hook buffer-locally --- bog.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bog.el b/bog.el index f36e41b..7a58f19 100644 --- a/bog.el +++ b/bog.el @@ -1436,11 +1436,11 @@ if ARG is omitted or nil. (cond (bog-mode (if (derived-mode-p 'org-mode) - (add-hook 'org-font-lock-hook #'bog-fontify-non-heading-citekeys) + (add-hook 'org-font-lock-hook #'bog-fontify-non-heading-citekeys nil t) (font-lock-add-keywords nil bog-citekey-font-lock-keywords))) (t (if (derived-mode-p 'org-mode) - (remove-hook 'org-font-lock-hook #'bog-fontify-non-heading-citekeys) + (remove-hook 'org-font-lock-hook #'bog-fontify-non-heading-citekeys t) (font-lock-remove-keywords nil bog-citekey-font-lock-keywords)) (when (bound-and-true-p bog-view-mode) (bog-view-mode -1)))) -- cgit v1.2.3 From 51dc396d816b29762837d252315225327adef435 Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" Date: Thu, 25 Jun 2020 12:51:03 +0100 Subject: bog.el: Use defalias for compatibility shims Using defalias avoids byte-compiler warnings and is less intrusive. --- bog.el | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/bog.el b/bog.el index 7a58f19..ee56d3a 100644 --- a/bog.el +++ b/bog.el @@ -499,8 +499,10 @@ If NO-CONTEXT is non-nil, immediately fall back." ;;;; Other ;; `show-all' is obsolete as of Emacs 25.1. -(unless (fboundp 'outline-show-all) - (defalias 'outline-show-all 'show-all)) +(defalias 'bog--outline-show-all + (if (fboundp 'outline-show-all) + #'outline-show-all + 'show-all)) (defun bog--set-difference (list1 list2) (let ((sdiff (cl-set-difference list1 list2 :test #'string=))) @@ -532,7 +534,7 @@ file." (mapconcat #'identity nohead-cks "\n")))))) (org-mode) (bog-mode 1) - (outline-show-all) + (bog--outline-show-all) (goto-char (point-min))) (pop-to-buffer bufname))) @@ -1381,7 +1383,7 @@ Topic headings are determined by `bog-topic-heading-level'." (defvar bog-citekey-font-lock-keywords '((bog-fontify-non-heading-citekeys . bog-citekey-face))) -(defvar bog-font-lock-function +(defalias 'bog--font-lock-function (if (fboundp 'font-lock-flush) #'font-lock-flush #'font-lock-fontify-buffer)) @@ -1445,7 +1447,7 @@ if ARG is omitted or nil. (when (bound-and-true-p bog-view-mode) (bog-view-mode -1)))) (when font-lock-mode - (funcall bog-font-lock-function))) + (bog--font-lock-function))) ;;; View minor mode -- cgit v1.2.3 From 008dacdb88968a04817666bfe682561d34967e4e Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" Date: Thu, 25 Jun 2020 12:51:21 +0100 Subject: bog-citekey-face: Use modern face spec syntax --- bog.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bog.el b/bog.el index ee56d3a..719002a 100644 --- a/bog.el +++ b/bog.el @@ -1366,7 +1366,7 @@ Topic headings are determined by `bog-topic-heading-level'." ;;; Font-lock (defface bog-citekey-face - '((t (:inherit org-link :underline nil))) + '((t :inherit org-link :underline nil)) "Face used to highlight text that matches `bog-citekey-format'.") (defun bog-fontify-non-heading-citekeys (limit) -- cgit v1.2.3 From 795e6b100126de11c2343ed3dc539c3cd4b17bad Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" Date: Fri, 26 Jun 2020 09:16:19 +0100 Subject: bog--with-search-lprops: Simplify using cl-letf --- bog.el | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/bog.el b/bog.el index 719002a..16def76 100644 --- a/bog.el +++ b/bog.el @@ -1198,17 +1198,13 @@ Restore the `org-lprops' property value for (declare (indent 0) (debug t)) (let ((bog-lprops '((org-agenda-buffer-name "*Bog search*") (org-agenda-files (bog-notes)) - org-agenda-text-search-extra-files - org-agenda-sticky)) - (org-lprops (make-symbol "org-lprops"))) - `(let ((,org-lprops (get 'org-agenda-redo-command 'org-lprops))) - (unwind-protect - (let ,bog-lprops - (put 'org-agenda-redo-command 'org-lprops ',bog-lprops) - (put 'org-agenda-files 'org-restrict nil) - ,@body - (use-local-map bog--agenda-map)) - (put 'org-agenda-redo-command 'org-lprops ,org-lprops))))) + (org-agenda-text-search-extra-files ()) + (org-agenda-sticky nil)))) + `(cl-letf (((get 'org-agenda-redo-command 'org-lprops) ',bog-lprops) + ,@bog-lprops) + (put 'org-agenda-files 'org-restrict nil) + ,@body + (use-local-map bog--agenda-map)))) ;;;###autoload (defun bog-search-notes (&optional todo-only string) -- cgit v1.2.3 From c2cbbd99e2b6b9b79c15acec025333089dbea920 Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" Date: Fri, 26 Jun 2020 09:20:00 +0100 Subject: Update copyright notices for 2020 --- bog-tests.el | 1 + bog.el | 1 + 2 files changed, 2 insertions(+) diff --git a/bog-tests.el b/bog-tests.el index 267c10f..01c7f08 100644 --- a/bog-tests.el +++ b/bog-tests.el @@ -1,6 +1,7 @@ ;;; bog-tests.el --- Tests for Bog -*- lexical-binding: t -*- ;; Copyright (C) 2013-2016 Kyle Meyer +;; Copyright (C) 2020 Basil L. Contovounesios ;; Author: Kyle Meyer diff --git a/bog.el b/bog.el index 16def76..2e1d5d9 100644 --- a/bog.el +++ b/bog.el @@ -1,6 +1,7 @@ ;;; bog.el --- Extensions for research notes in Org mode -*- lexical-binding: t -*- ;; Copyright (C) 2013-2016 Kyle Meyer +;; Copyright (C) 2020 Basil L. Contovounesios ;; Author: Kyle Meyer ;; URL: https://github.com/kyleam/bog -- cgit v1.2.3