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

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

[elpa] externals/greader 28c08e9d6f 2/9: greader.el: modified


From: ELPA Syncer
Subject: [elpa] externals/greader 28c08e9d6f 2/9: greader.el: modified
Date: Tue, 16 Jul 2024 03:58:08 -0400 (EDT)

branch: externals/greader
commit 28c08e9d6f01b8de9ce9d1509b2bd4380ba058ba
Author: Michelangelo Rodriguez <michelangelo.rodriguez@gmail.com>
Commit: Michelangelo Rodriguez <michelangelo.rodriguez@gmail.com>

    greader.el: modified
    
    - Function `greader-dict--get-key-from-word simplified.
    - other minor fixes.
---
 greader-dict.el | 34 ++++++++++++----------------------
 1 file changed, 12 insertions(+), 22 deletions(-)

diff --git a/greader-dict.el b/greader-dict.el
index 4907156bee..4529a3e674 100644
--- a/greader-dict.el
+++ b/greader-dict.el
@@ -162,7 +162,7 @@
                                        (filter
                                         . "\%f")
                                        (word . ""))
-  "item types and relative prefixes.")
+  "Item types and relative prefixes.")
 
 ;; This function saves the contents of the hash table.
 (defvar greader-dict-directory (concat user-emacs-directory
@@ -415,30 +415,20 @@ Return nil if KEY is not present in `greader-dictionary'."
    ((gethash word greader-dictionary)
     word)
    (t
-    (let ((reduced-dictionary (make-hash-table :test 'ignore-case)))
+    (let ((reduced-dictionary (make-hash-table :test 'ignore-case))
+         (key nil))
       (dolist (item (greader-dict--get-matches 'match))
        (puthash item (gethash item greader-dictionary)
                 reduced-dictionary))
-      (let ((key nil))
-       (catch 'matched
-         (maphash
-          (lambda (k _v)
-            (let* ((result (string-remove-suffix
-                            greader-dict-match-indicator k))
-                   (candidate-matches (string-split result "\\W" t)))
-              (setq candidate-matches (sort candidate-matches
-                                            (lambda (s1 s2) (>
-                                                             (length
-                                                              s1)
-                                                             (length
-                                                              s2)))))
-              (dolist (candidate candidate-matches)
-                ;; (message "%s" (concat "matching " candidate " against " 
word "..."))
-                (when (string-match candidate word)
-                  ;; (message "Matched!")
-                  (setq key (concat k greader-dict-match-indicator))
-                  (throw 'matched key)))))
-          reduced-dictionary)))))))
+      (catch 'key-matched
+       (maphash
+        (lambda (k _v)
+          (setq k (string-remove-suffix greader-dict-match-indicator k))
+          (when (string-match k word)
+            (setq key (concat k greader-dict-match-indicator))
+            (throw 'key-matched key)))
+        reduced-dictionary))
+      key      ))))
 
 ;; This function checks that, in the string you pass to it, there are
 ;; effectively words to be replaced. If so, use apis



reply via email to

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