Simplify webpaste/get-lang-alist-with-overrides implementation

Just append stuff, it doesn't matter anyways since you always read
from the beginning anyways and overrides, removal and addition works
the same like this anyways.
master
Elis Axelsson 9 years ago
parent 0e4ac51b57
commit 9ddc6170ae
No known key found for this signature in database
GPG Key ID: D57EFA625C9A925F
  1. 16
      webpaste.el

@ -287,21 +287,13 @@ return it to the user."
(defun webpaste/get-lang-alist-with-overrides (overrides)
"Fetches lang-alist with OVERRIDES applied."
;; Copy original list to temporary list
(let ((lang-alist webpaste/default-lang-alist))
;; Go through list of overrides
;; Go through list of overrides and append them to the temporary list
(dolist (override-element overrides)
;; Set key and value from override list
(let ((key (car override-element))
(value (cdr override-element)))
;; If the element doesn't exist, add it
(unless (assoc (car override-element) lang-alist)
(cl-pushnew (cons key value) lang-alist))
;; If the element in the list is changed
(unless (equal (cdr (assoc key lang-alist)) value)
(cl-pushnew (cons key value) lang-alist))))
(cl-pushnew override-element lang-alist))
;; Return temporary list
lang-alist))

Loading…
Cancel
Save