sekka 0.9.2 → 0.9.3
Sign up to get free protection for your applications and to get access to all the features.
- data/emacs/sekka.el +76 -4
- data/lib/sekka/jisyo-db.nnd +2 -2
- data/lib/sekka/sekkaversion.rb +1 -1
- metadata +5 -5
data/emacs/sekka.el
CHANGED
@@ -41,6 +41,16 @@
|
|
41
41
|
:type 'string
|
42
42
|
:group 'sekka)
|
43
43
|
|
44
|
+
(defcustom sekka-server-url-2 ""
|
45
|
+
"SekkaサーバーのURLを指定する。"
|
46
|
+
:type 'string
|
47
|
+
:group 'sekka)
|
48
|
+
|
49
|
+
(defcustom sekka-server-url-3 ""
|
50
|
+
"SekkaサーバーのURLを指定する。"
|
51
|
+
:type 'string
|
52
|
+
:group 'sekka)
|
53
|
+
|
44
54
|
(defcustom sekka-server-timeout 10
|
45
55
|
"Sekkaサーバーと通信する時のタイムアウトを指定する。(秒数)"
|
46
56
|
:type 'integer
|
@@ -124,11 +134,16 @@ non-nil で明示的に呼びだすまでGoogleIMEは起動しない。"
|
|
124
134
|
|
125
135
|
(defvar sekka-sticky-shift nil "*Non-nil であれば、Sticky-Shiftを有効にする")
|
126
136
|
(defvar sekka-mode nil "漢字変換トグル変数")
|
127
|
-
(
|
137
|
+
(defun sekka-modeline-string ()
|
138
|
+
;; 接続先sekka-serverのホスト名を表示する。
|
139
|
+
(format " Sekka[%s]" (if current-sekka-server-url
|
140
|
+
(url-host
|
141
|
+
(url-generic-parse-url current-sekka-server-url))
|
142
|
+
"")))
|
128
143
|
(defvar sekka-select-mode nil "候補選択モード変数")
|
129
144
|
(or (assq 'sekka-mode minor-mode-alist)
|
130
145
|
(setq minor-mode-alist (cons
|
131
|
-
'(sekka-mode
|
146
|
+
'(sekka-mode (:eval (sekka-modeline-string)))
|
132
147
|
minor-mode-alist)))
|
133
148
|
|
134
149
|
|
@@ -144,6 +159,8 @@ non-nil で明示的に呼びだすまでGoogleIMEは起動しない。"
|
|
144
159
|
(cons 'sekka-select-mode sekka-select-mode-map))
|
145
160
|
minor-mode-map-alist)))
|
146
161
|
|
162
|
+
|
163
|
+
|
147
164
|
;;;
|
148
165
|
;;; hooks
|
149
166
|
;;;
|
@@ -172,6 +189,9 @@ non-nil で明示的に呼びだすまでGoogleIMEは起動しない。"
|
|
172
189
|
(insert string)))))
|
173
190
|
|
174
191
|
|
192
|
+
;;; 現在のsekka-serverの接続先
|
193
|
+
(defvar current-sekka-server-url nil)
|
194
|
+
|
175
195
|
;;; 候補選択モード用
|
176
196
|
(defvar sekka-history-stack '()) ; 過去に変換した、場所と変換候補の状態を保存しておくスタック
|
177
197
|
;; データ構造は以下の通り。
|
@@ -253,6 +273,9 @@ non-nil で明示的に呼びだすまでGoogleIMEは起動しない。"
|
|
253
273
|
;;
|
254
274
|
(defun sekka-init ()
|
255
275
|
(when (not sekka-init)
|
276
|
+
;; 現在のsekka-serverの接続先
|
277
|
+
(defvar current-sekka-server-url sekka-server-url) ;; 第一候補で初期化しておく。
|
278
|
+
|
256
279
|
;; ユーザー語彙のロード + サーバーへの登録
|
257
280
|
(sekka-register-userdict-internal)
|
258
281
|
|
@@ -279,6 +302,31 @@ non-nil で明示的に呼びだすまでGoogleIMEは起動しない。"
|
|
279
302
|
("method" . "normal")
|
280
303
|
)))
|
281
304
|
|
305
|
+
|
306
|
+
;;
|
307
|
+
;; 接続先を次候補のsekka-serverに切りかえる
|
308
|
+
;;
|
309
|
+
(defun sekka-next-sekka-server ()
|
310
|
+
(defun sekka-next-sekka-server-message(str varname)
|
311
|
+
(message (format "If you have %s sekka-server, please set the `%s' variable." str varname))
|
312
|
+
(sit-for 5))
|
313
|
+
|
314
|
+
(cond
|
315
|
+
((string-equal current-sekka-server-url
|
316
|
+
sekka-server-url)
|
317
|
+
(if (< 0 (length sekka-server-url-2))
|
318
|
+
(setq current-sekka-server-url sekka-server-url-2)
|
319
|
+
(sekka-next-sekka-server-message "second" "sekka-server-url-2")))
|
320
|
+
((string-equal current-sekka-server-url
|
321
|
+
sekka-server-url-2)
|
322
|
+
(if (< 0 (length sekka-server-url-3))
|
323
|
+
(setq current-sekka-server-url sekka-server-url-3)
|
324
|
+
(sekka-next-sekka-server-message "third" "sekka-server-url-3")))
|
325
|
+
(t
|
326
|
+
(when (< 0 (length sekka-server-url))
|
327
|
+
(setq current-sekka-server-url sekka-server-url)))))
|
328
|
+
|
329
|
+
|
282
330
|
;;
|
283
331
|
;; ローマ字で書かれた文章をSekkaサーバーを使って変換する
|
284
332
|
;;
|
@@ -290,6 +338,30 @@ non-nil で明示的に呼びだすまでGoogleIMEは起動しない。"
|
|
290
338
|
;; ("method" . "normal")
|
291
339
|
;; )
|
292
340
|
(defun sekka-rest-request (func-name arg-alist)
|
341
|
+
(defun one-request (func-name arg-alist)
|
342
|
+
(let ((result (sekka-rest-request-sub func-name arg-alist)))
|
343
|
+
(if (or
|
344
|
+
(string-match-p "^curl: [(]6[)] " result) ;; Couldn't resolve host 'aaa.example.com'
|
345
|
+
(string-match-p "^curl: [(]7[)] " result) ;; Couldn't connect to host 'localhost'
|
346
|
+
)
|
347
|
+
(progn
|
348
|
+
(sekka-next-sekka-server)
|
349
|
+
nil)
|
350
|
+
result)))
|
351
|
+
|
352
|
+
(or
|
353
|
+
(one-request func-name arg-alist)
|
354
|
+
(one-request func-name arg-alist)
|
355
|
+
(one-request func-name arg-alist)
|
356
|
+
(concat
|
357
|
+
"Error: All sekka-server are down. "
|
358
|
+
" " sekka-server-url
|
359
|
+
" " sekka-server-url-2
|
360
|
+
" " sekka-server-url-3)))
|
361
|
+
|
362
|
+
|
363
|
+
|
364
|
+
(defun sekka-rest-request-sub (func-name arg-alist)
|
293
365
|
(if sekka-psudo-server
|
294
366
|
(cond
|
295
367
|
((string-equal func-name "henkan")
|
@@ -314,7 +386,7 @@ non-nil で明示的に呼びだすまでGoogleIMEは起動しない。"
|
|
314
386
|
(format " --max-time %d " sekka-server-timeout)
|
315
387
|
" --insecure "
|
316
388
|
" --header 'Content-Type: application/x-www-form-urlencoded' "
|
317
|
-
(format "%s%s " sekka-server-url func-name)
|
389
|
+
(format "%s%s " current-sekka-server-url func-name)
|
318
390
|
(sekka-construct-curl-argstr (cons
|
319
391
|
'("format" . "sexp")
|
320
392
|
arg-alist))
|
@@ -1552,7 +1624,7 @@ point から行頭方向に同種の文字列が続く間を漢字変換しま
|
|
1552
1624
|
(setq default-input-method "japanese-sekka")
|
1553
1625
|
|
1554
1626
|
(defconst sekka-version
|
1555
|
-
"0.9.
|
1627
|
+
"0.9.3" ;;SEKKA-VERSION
|
1556
1628
|
)
|
1557
1629
|
(defun sekka-version (&optional arg)
|
1558
1630
|
"入力モード変更"
|
data/lib/sekka/jisyo-db.nnd
CHANGED
@@ -242,10 +242,10 @@
|
|
242
242
|
(let ([d (. (Date.new 0) to_s)])
|
243
243
|
(if (and (kvs.pure_put! "key_for_ping" d)
|
244
244
|
(string=? (kvs.get "key_for_ping") d))
|
245
|
-
(STDERR.puts "Info: database file
|
245
|
+
(STDERR.puts "Info: database file is clean")
|
246
246
|
;; 正常に読み書きできないようであれば、データベースを修復する
|
247
247
|
(begin
|
248
|
-
(STDERR.puts "Info: database file
|
248
|
+
(STDERR.puts "Info: database file is NOT clean. try to fix...")
|
249
249
|
(kvs.fixdb)
|
250
250
|
(STDERR.puts "Info: done."))))
|
251
251
|
(to-arr (list kvs cachesv)))))
|
data/lib/sekka/sekkaversion.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sekka
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 61
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
|
-
-
|
10
|
-
version: 0.9.
|
9
|
+
- 3
|
10
|
+
version: 0.9.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Kiyoka Nishiyama
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-10-03 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rspec
|
@@ -339,7 +339,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
339
339
|
requirements: []
|
340
340
|
|
341
341
|
rubyforge_project:
|
342
|
-
rubygems_version: 1.
|
342
|
+
rubygems_version: 1.8.10
|
343
343
|
signing_key:
|
344
344
|
specification_version: 3
|
345
345
|
summary: Sekka is a SKK like input method.
|