freehoo-devel
[Top][All Lists]
Advanced

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

[Freehoo-devel] [PATCH : freehoo] count of words loaded


From: Vikas Gorur
Subject: [Freehoo-devel] [PATCH : freehoo] count of words loaded
Date: Sun, 15 May 2005 18:56:03 +0530

Hi folks,

My /usr/share/dict/words file didn't exist and thus tab completion of
words wasn't working. Freehoo nevertheless continues happily. Hence I
thought printing a count of words loaded would be nice, since if the
file didn't load it would show 0 and the user would know there was a
problem.

Vikas Gorur
--
It's worth being in CS just for the jokes
http://vikas.thepyromania.com

---- CUT HERE ----
diff -pruN freehoo/extensions/mr-oxford.scm
freehoo-hacked/extensions/mr-oxford.scm
--- freehoo/extensions/mr-oxford.scm    2005-03-28 14:14:18.000000000 +0530
+++ freehoo-hacked/extensions/mr-oxford.scm     2005-05-15
18:41:58.512442632 +0530
@@ -20,13 +20,16 @@


 (display "Loading words from sorted dictionary [/usr/share/dict/words]... ")
-(catch 'system-error
-       (lambda ()
-        (for-each-line (lambda (word)
-                         (fh-dict-add-word-sorted! word))
+(let ((word-count 0))
+  (catch 'system-error
+        (lambda ()
+          (for-each-line (lambda (word)
+                           (fh-dict-add-word-sorted! word)
+                           (set! word-count (1+ word-count)))
                        "/usr/share/dict/words"))
-       (lambda args #f))
-(display "done.\n")
+        (lambda args #f))
+  (display "done.\n")
+  (display word-count) (display " words added.\n"))

 ;; Add sent-words to readline context"
 (add-hook! fh-message-send-hook




reply via email to

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