[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/spell-fu bd00417a0e 09/86: Improve status messages when ge
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/spell-fu bd00417a0e 09/86: Improve status messages when generating word-list & cache |
Date: |
Thu, 7 Jul 2022 12:03:38 -0400 (EDT) |
branch: elpa/spell-fu
commit bd00417a0e716056b42d56eb8f2b53d8738b82ee
Author: Campbell Barton <ideasman42@gmail.com>
Commit: Campbell Barton <ideasman42@gmail.com>
Improve status messages when generating word-list & cache
---
spell-fu.el | 129 +++++++++++++++++++++++++++++++-----------------------------
1 file changed, 67 insertions(+), 62 deletions(-)
diff --git a/spell-fu.el b/spell-fu.el
index 7de1a7b9c5..80c375d301 100644
--- a/spell-fu.el
+++ b/spell-fu.el
@@ -239,39 +239,41 @@ Argument WORDS-FILE the file to write the word list into."
(when (or (not has-words-file) is-dict-outdated)
- (message "Generating words %S" words-file)
- (with-temp-buffer
- ;; Optional: insert personal dictionary, stripping header and
inserting a newline.
- (when has-dict-personal
- (insert-file-contents ispell-personal-dictionary)
- (goto-char (point-min))
- (when (looking-at "personal_ws\-")
- (delete-region (line-beginning-position) (1+ (line-end-position))))
- (goto-char (point-max))
- (unless (eq ?\n (char-after))
- (insert "\n")))
-
- (let
- ( ;; Use the pre-configured aspell binary, or call aspell directly.
- (aspell-bin
- (or
- (and
- (bound-and-true-p ispell-really-aspell)
- (bound-and-true-p ispell-program-name))
- (executable-find "aspell")))
- (dict (spell-fu--dictionary)))
-
- (cond
- ((string-equal dict "default")
- (call-process aspell-bin nil t nil "dump" "master"))
- (t
- (call-process aspell-bin nil t nil "-d" dict "dump" "master"))))
-
- ;; Case insensitive sort is important if this is used for
`ispell-complete-word-dict'.
- ;; Which is a handy double-use for this file.
- (let ((sort-fold-case t))
- (sort-lines nil (point-min) (point-max)))
- (write-region nil nil words-file nil 0)))))
+ (spell-fu--with-message-prefix "Spell-fu generating words: "
+ (message "%S" (file-name-nondirectory words-file))
+
+ (with-temp-buffer
+ ;; Optional: insert personal dictionary, stripping header and
inserting a newline.
+ (when has-dict-personal
+ (insert-file-contents ispell-personal-dictionary)
+ (goto-char (point-min))
+ (when (looking-at "personal_ws\-")
+ (delete-region (line-beginning-position) (1+
(line-end-position))))
+ (goto-char (point-max))
+ (unless (eq ?\n (char-after))
+ (insert "\n")))
+
+ (let
+ ( ;; Use the pre-configured aspell binary, or call aspell directly.
+ (aspell-bin
+ (or
+ (and
+ (bound-and-true-p ispell-really-aspell)
+ (bound-and-true-p ispell-program-name))
+ (executable-find "aspell")))
+ (dict (spell-fu--dictionary)))
+
+ (cond
+ ((string-equal dict "default")
+ (call-process aspell-bin nil t nil "dump" "master"))
+ (t
+ (call-process aspell-bin nil t nil "-d" dict "dump"
"master"))))
+
+ ;; Case insensitive sort is important if this is used for
`ispell-complete-word-dict'.
+ ;; Which is a handy double-use for this file.
+ (let ((sort-fold-case t))
+ (sort-lines nil (point-min) (point-max)))
+ (write-region nil nil words-file nil 0))))))
;; ---------------------------------------------------------------------------
@@ -284,19 +286,25 @@ The resulting cache is returned as a minor optimization
for first-time loading,
where we need to create this data in order to write it,
save some time by not spending time reading it back."
- (message "Generating cache %S" cache-file)
(let ((word-table nil))
- (with-temp-buffer
- (insert-file-contents-literally words-file)
- (setq word-table (make-hash-table :test 'equal :size (count-lines
(point-min) (point-max))))
- (while (not (eobp))
- (let ((l (buffer-substring-no-properties (line-beginning-position)
(line-end-position))))
- ;; Value of 't' is just for simplicity, it's no used except for
check the item exists.
- (puthash (downcase l) t word-table)
- (forward-line 1))))
-
- ;; Write write it to a file.
- (with-temp-buffer (prin1 word-table (current-buffer)) (write-region nil
nil cache-file nil 0))
+
+ (spell-fu--with-message-prefix "Spell-fu generating cache: "
+ (message "%S" (file-name-nondirectory cache-file))
+
+ (with-temp-buffer
+ (insert-file-contents-literally words-file)
+ (setq word-table
+ (make-hash-table :test 'equal :size (count-lines (point-min)
(point-max))))
+ (while (not (eobp))
+ (let ((l (buffer-substring-no-properties (line-beginning-position)
(line-end-position))))
+ ;; Value of 't' is just for simplicity, it's no used except for
check the item exists.
+ (puthash (downcase l) t word-table)
+ (forward-line 1))))
+
+ ;; Write write it to a file.
+ (with-temp-buffer
+ (prin1 word-table (current-buffer))
+ (write-region nil nil cache-file nil 0)))
;; Return the resulting word table.
word-table))
@@ -321,23 +329,20 @@ save some time by not spending time reading it back."
(unless (file-directory-p spell-fu-directory)
(make-directory spell-fu-directory))
- ;; Generate word-list on demand.
- (spell-fu--with-message-prefix "Spell-Fu: "
-
- (let
- ( ;; Get the paths of both files, ensure the cache file is newer,
- ;; otherwise regenerate it.
- (words-file (spell-fu--words-file))
- (cache-file (spell-fu--cache-file)))
-
- (spell-fu--word-list-ensure words-file)
-
- ;; Load cache or create it, creating it returns the cache
- ;; to avoid some slow-down on first load.
- (setq spell-fu--cache-table
- (if (and (file-exists-p cache-file) (not (spell-fu--file-is-older
cache-file words-file)))
- (spell-fu--cache-words-load cache-file)
- (spell-fu--cache-from-word-list words-file cache-file))))))
+ (let
+ ( ;; Get the paths of both files, ensure the cache file is newer,
+ ;; otherwise regenerate it.
+ (words-file (spell-fu--words-file))
+ (cache-file (spell-fu--cache-file)))
+
+ (spell-fu--word-list-ensure words-file)
+
+ ;; Load cache or create it, creating it returns the cache
+ ;; to avoid some slow-down on first load.
+ (setq spell-fu--cache-table
+ (if (and (file-exists-p cache-file) (not (spell-fu--file-is-older
cache-file words-file)))
+ (spell-fu--cache-words-load cache-file)
+ (spell-fu--cache-from-word-list words-file cache-file)))))
;; ---------------------------------------------------------------------------
- [nongnu] elpa/spell-fu 2c792330ac 18/86: Case insensitive sort lines as a list (not in the buffer), (continued)
- [nongnu] elpa/spell-fu 2c792330ac 18/86: Case insensitive sort lines as a list (not in the buffer), ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu 03114080c8 20/86: Add requirements at the top of the file, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu fe557e3dff 21/86: Be explicit about using macro that sets values in-place, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu 33a28e0df5 41/86: fix: encode word to utf-8 generating the cache, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu 7770c005c4 47/86: Cleanup minor name change for spell-fu function name, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu 866044304f 50/86: Check if faces can be used on property change, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu 8f780a874c 66/86: Reduce idle overlay fragmentation, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu 4fc84a9028 69/86: Fix spell-fu-directory's documentation, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu 53bd2b24c6 81/86: Cleanup: add spell-fu--canonicalize-word utility function, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu a5a06e150a 02/86: Fix error comparing times of cache to word-list, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu bd00417a0e 09/86: Improve status messages when generating word-list & cache,
ELPA Syncer <=
- [nongnu] elpa/spell-fu afeb1fd46f 10/86: readme: add some TODO's, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu b7e5cf3d73 11/86: Fix missing checks that ispell variables are bound before use, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu 30be3683b2 12/86: readme: update settings docs, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu 18724c2e53 14/86: Avoid potentially accessing the same files time multiple times, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu 8e8711f1fa 22/86: Add TODO's to the readme, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu 88d803e994 26/86: Cleanup: use updated auto-formatting results, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu db0eef27ab 33/86: Add: spell-fu-goto-next-error, spell-fu-goto-previous-error, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu a7db587471 36/86: Remove redundant escaping, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu c58be13845 39/86: Fix #3 default word regex now excludes trailing apostrophes, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu 98424adbea 42/86: adds helper routine to get lang from dict, ELPA Syncer, 2022/07/07