summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2020-08-14 10:13:29 -0700
committerSean Whitton <spwhitton@spwhitton.name>2020-08-14 10:13:29 -0700
commit8107ca9a08dfe2cb8a8a5c0012ebd6296d20b773 (patch)
treee2e107f6570e406f25c6f25c9248ddd90578b693
parent4d45cc6c74f722cf80560bf5d99ca1b2d383b1b3 (diff)
downloaddotfiles-8107ca9a08dfe2cb8a8a5c0012ebd6296d20b773.tar.gz
replace use of dash.el in init-notmuch.el
-rw-r--r--.emacs.d/init-notmuch.el3
-rw-r--r--.emacs.d/init-spw.el12
2 files changed, 13 insertions, 2 deletions
diff --git a/.emacs.d/init-notmuch.el b/.emacs.d/init-notmuch.el
index 4981ae8e..c2e0465a 100644
--- a/.emacs.d/init-notmuch.el
+++ b/.emacs.d/init-notmuch.el
@@ -3,7 +3,6 @@
;;; Code:
(require 'cl-lib)
-(require 'dash)
(require 'notmuch)
(require 'notmuch-hello)
@@ -223,7 +222,7 @@ Two ways to read:
(apply-partially
(lambda (connec &rest queries)
(mapconcat (lambda (query) (concat "(" query ")"))
- (-flatten queries)
+ (spw/flatten queries)
(concat " " connec " ")))
word))
(disjoin (connective "or"))
diff --git a/.emacs.d/init-spw.el b/.emacs.d/init-spw.el
index 7900a6ad..9e135de6 100644
--- a/.emacs.d/init-spw.el
+++ b/.emacs.d/init-spw.el
@@ -1641,6 +1641,18 @@ making indirect clones."
(interactive (list (read-library-name)))
(find-file-other-window (locate-library (concat library ".el"))))
+(defun spw/flatten (list)
+ "Non-destructive list flatten."
+ (nreverse (spw/flatten-and-reverse list)))
+
+(defun spw/flatten-and-reverse (list)
+ "Non-destructive list flatten and reverse."
+ (let (accum)
+ (dolist (element list accum)
+ (if (atom element)
+ (push element accum)
+ (setq accum (append (spw/flatten-and-reverse element) accum))))))
+
;;;; Composing mail