Skip to content

Commit fcebf65

Browse files
committed
Provide parseclj-alist-merge for older Emacsen
1 parent ece9648 commit fcebf65

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Unreleased
22

3+
## 1.0.4 (2021-09-30)
4+
5+
- Provide parseclj-alist-merge, since we can't use `(map-merge 'alist)` yet in Emacs 25/26.
6+
37
## 1.0.3 (2021-09-29)
48

59
- Remove remaining a.el usage (this time for real)

parseclj-alist.el

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,17 @@ For example: (parseclj-hash-table :foo 123 :bar 456)"
7777
kv-pairs)
7878
hash-map))
7979

80+
(defun parseclj-alist-merge (l1 l2)
81+
"Merge two association lists."
82+
;; Emacs 27: (map-merge 'alist l1 l2)
83+
(let ((keys (delete-dups (append (mapcar #'car l1) (mapcar #'car l2))))
84+
(res '()))
85+
(seq-doseq (key keys)
86+
(push (or (assoc key l2)
87+
(assoc key l1))
88+
res))
89+
(nreverse res)))
90+
8091
(provide 'parseclj-alist)
8192

8293
;;; parseclj-alist.el ends here

parseclj.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
;; Author: Arne Brasseur <[email protected]>
66
;; Keywords: lisp clojure edn parser
77
;; Package-Requires: ((emacs "25"))
8-
;; Version: 1.0.3
8+
;; Version: 1.0.4
99

1010
;; This file is not part of GNU Emacs.
1111

0 commit comments

Comments
 (0)