summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2016-03-06 01:20:53 -0500
committerKyle Meyer <kyle@kyleam.com>2016-03-06 01:20:53 -0500
commit51d956233c747e93a5fb2aabafd9e3d09666b904 (patch)
treeeebeae3cad88cbc1d0872e2fbd6fe21aa1f7992f
parent02fc78dd4c2f7fa347b9ec59d7aa8fb5fcf7cba8 (diff)
downloadbog-51d956233c747e93a5fb2aabafd9e3d09666b904.tar.gz
Make cl-set-difference compatibility function
-rw-r--r--bog.el15
1 files changed, 9 insertions, 6 deletions
diff --git a/bog.el b/bog.el
index 75412d3..f5123fc 100644
--- a/bog.el
+++ b/bog.el
@@ -462,6 +462,14 @@ If NO-CONTEXT is non-nil, immediately fall back."
(unless (fboundp 'outline-show-all)
(defalias 'outline-show-all 'show-all))
+(defun bog--set-difference (list1 list2)
+ (let ((sdiff (cl-set-difference list1 list2 :test #'string=)))
+ ;; As of Emacs 25.1, `cl-set-difference' keeps the order of LIST1
+ ;; rather than leaving it reversed.
+ (if (string-lessp (nth 0 sdiff) (nth 1 sdiff))
+ sdiff
+ (nreverse sdiff))))
+
(defun bog-list-orphan-citekeys (&optional file)
"List citekeys that appear in notes but don't have a heading.
With prefix argument FILE, include only orphan citekeys from that
@@ -477,12 +485,7 @@ file."
(insert "\n")
(dolist (file files)
(let* ((text-cks (bog-non-heading-citekeys-in-file file))
- (nohead-cks (cl-set-difference text-cks heading-cks
- :test #'string=)))
- ;; As of Emacs 25.1, `cl-set-difference' keeps the order of
- ;; LIST1 rather than leaving it reversed.
- (unless (string-lessp (nth 0 nohead-cks) (nth 1 nohead-cks))
- (setq nohead-cks (nreverse nohead-cks)))
+ (nohead-cks (bog--set-difference text-cks heading-cks)))
(when nohead-cks
(insert (format "* %s\n\n%s\n\n"
(file-name-nondirectory file)