From 51d956233c747e93a5fb2aabafd9e3d09666b904 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sun, 6 Mar 2016 01:20:53 -0500 Subject: Make cl-set-difference compatibility function --- bog.el | 15 +++++++++------ 1 file 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) -- cgit v1.2.3