Skip to content

Commit 5472238

Browse files
cxxxrclaude
andauthored
fix(skk-mode): fix user dictionary loading and priority (#2096)
- Fix bug where *dictionary-loaded-p* was set to t even when no dictionary was found, causing subsequent load attempts to be skipped - Prioritize user dictionary (~/.skk/SKK-JISYO.L) over system dictionaries - Add warning message when no dictionary is found Co-authored-by: Claude Opus 4.5 <[email protected]>
1 parent 230494b commit 5472238

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

extensions/skk-mode/dictionary.lisp

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@
88
(in-package :lem-skk-mode/dictionary)
99

1010
(defvar *skk-dictionary-paths*
11-
'("/usr/share/skk/SKK-JISYO.L"
11+
'("~/.skk/SKK-JISYO.L"
12+
"/usr/share/skk/SKK-JISYO.L"
1213
"/usr/share/skk/SKK-JISYO.M"
1314
"/usr/local/share/skk/SKK-JISYO.L"
14-
"/usr/local/share/skk/SKK-JISYO.M"
15-
"~/.skk/SKK-JISYO.L")
16-
"List of paths to search for SKK dictionary files.")
15+
"/usr/local/share/skk/SKK-JISYO.M")
16+
"List of paths to search for SKK dictionary files.
17+
User dictionary (~/.skk/SKK-JISYO.L) is searched first.")
1718

1819
(defvar *skk-user-dictionary-path*
1920
"~/.skk/user-jisyo"
@@ -103,13 +104,19 @@ SKK-JISYO format: reading /candidate1/candidate2;annotation/.../"
103104
(clrhash *skk-dictionary*)
104105
(setf *skk-dictionary* (make-hash-table :test 'equal)))
105106
;; Load main dictionary
106-
(let ((dict-path (find-dictionary-file)))
107+
(let ((dict-path (find-dictionary-file))
108+
(loaded nil))
107109
(when dict-path
108-
(load-dictionary-file dict-path *skk-dictionary*)))
109-
;; Load user dictionary (higher priority - loaded after main)
110-
(let ((user-path (expand-path *skk-user-dictionary-path*)))
111-
(load-dictionary-file user-path *skk-dictionary*))
112-
(setf *dictionary-loaded-p* t)))
110+
(setf loaded (load-dictionary-file dict-path *skk-dictionary*)))
111+
;; Load user dictionary (higher priority - loaded after main)
112+
(let ((user-path (expand-path *skk-user-dictionary-path*)))
113+
(when (load-dictionary-file user-path *skk-dictionary*)
114+
(setf loaded t)))
115+
;; Only mark as loaded if at least one dictionary was found
116+
(setf *dictionary-loaded-p* loaded)
117+
(unless loaded
118+
(warn "SKK: No dictionary found. Searched paths: ~{~A~^, ~}"
119+
*skk-dictionary-paths*)))))
113120

114121
(defun lookup-candidates (reading)
115122
"Look up conversion candidates for READING.

0 commit comments

Comments
 (0)