diff options
author | Kyle Meyer <kyle@kyleam.com> | 2016-03-06 01:20:53 -0500 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2016-03-06 01:20:53 -0500 |
commit | 51d956233c747e93a5fb2aabafd9e3d09666b904 (patch) | |
tree | eebeae3cad88cbc1d0872e2fbd6fe21aa1f7992f /bog.el | |
parent | 02fc78dd4c2f7fa347b9ec59d7aa8fb5fcf7cba8 (diff) | |
download | bog-51d956233c747e93a5fb2aabafd9e3d09666b904.tar.gz |
Make cl-set-difference compatibility function
Diffstat (limited to 'bog.el')
-rw-r--r-- | bog.el | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -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) |