emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/webpaste 9ddc617 133/298: Simplify webpaste/get-lang-alist


From: ELPA Syncer
Subject: [nongnu] elpa/webpaste 9ddc617 133/298: Simplify webpaste/get-lang-alist-with-overrides implementation
Date: Thu, 9 Dec 2021 18:59:59 -0500 (EST)

branch: elpa/webpaste
commit 9ddc6170ae04e752dc7dfce298617262e3fa28a3
Author: Elis Axelsson <elis.axelsson@gmail.com>
Commit: Elis Axelsson <elis.axelsson@gmail.com>

    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.
---
 webpaste.el | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/webpaste.el b/webpaste.el
index 0a72d88..ee88d44 100644
--- a/webpaste.el
+++ b/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))
 
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]