• R/O
  • HTTP
  • SSH
  • HTTPS

tamago-tsunagi: コミット

Tamago-tsunagiのGitリポジトリです。


コミットメタ情報

リビジョン455d7aa6087b667fb6121ab34c75df85eb4d8ed7 (tree)
日時2014-11-16 11:34:55
作者Mitsutoshi NAKANO <bkbin005@rink...>
コミッターMitsutoshi NAKANO

ログメッセージ

Imported FreeBSD's patches

This commit also includes enhancements from Debian, some of which are:

- Partial support for Wnn7/Wnn8.
- Support connection to cannaserver using UNIX domain socket.

modified: egg-com.el
modified: egg.el
modified: egg/wnn.el
modified: egg/wnnrpc.el
new file: helper/Makefile
modified: its.el
modified: menudiag.el

変更サマリ

差分

--- a/egg-com.el
+++ b/egg-com.el
@@ -828,9 +828,10 @@ V: Fixed length string (0x00 terminated). This takes 2 args (data length)."
828828 ;; Do not move the point, leave it where it was.
829829 (defmacro comm-accept-process-output ()
830830 `(let ((p (point)))
831- (if (null (accept-process-output proc comm-accept-timeout))
832- (egg-error "backend timeout (comm-accept-process-output)"))
833- (goto-char p)))
831+ (with-local-quit
832+ (if (null (accept-process-output proc comm-accept-timeout))
833+ (egg-error "backend timeout (comm-accept-process-output)"))
834+ (goto-char p))))
834835
835836 (defmacro comm-require-process-output (n)
836837 `(if (< (point-max) (+ (point) ,n))
@@ -839,10 +840,11 @@ V: Fixed length string (0x00 terminated). This takes 2 args (data length)."
839840 (defun comm-wait-for-space (proc n)
840841 (let ((p (point))
841842 (r (+ (point) n)))
842- (while (< (point-max) r)
843- (if (null (accept-process-output proc comm-accept-timeout))
844- (egg-error "backend timeout (comm-wait-for-space)"))
845- (goto-char p))))
843+ (with-local-quit
844+ (while (< (point-max) r)
845+ (if (null (accept-process-output proc comm-accept-timeout))
846+ (egg-error "backend timeout (comm-wait-for-space)"))
847+ (goto-char p)))))
846848
847849 (defmacro comm-following+forward-char ()
848850 `(prog1
--- a/egg.el
+++ b/egg.el
@@ -167,16 +167,22 @@
167167 (setq egg-modefull-mode t)
168168 (its-define-select-keys egg-modefull-map))
169169 (setq egg-modeless-mode t))
170- (setq inactivate-current-input-method-function 'egg-mode)
170+ (set (if (boundp 'deactivate-current-input-method-function)
171+ 'deactivate-current-input-method-function
172+ 'inactivate-current-input-method-function)
173+ 'egg-mode)
171174 (setq describe-current-input-method-function 'egg-help)
172- (make-local-hook 'input-method-activate-hook)
175+ (if (fboundp 'make-local-hook)
176+ (eval '(make-local-hook 'input-method-activate-hook)))
173177 (add-hook 'input-method-activate-hook 'its-set-mode-line-title nil t)
174178 (if (eq (selected-window) (minibuffer-window))
175179 (add-hook 'minibuffer-exit-hook 'egg-exit-from-minibuffer))
176180 (run-hooks 'egg-mode-hook)))
177181
178182 (defun egg-exit-from-minibuffer ()
179- (inactivate-input-method)
183+ (if (boundp 'deactivate-input-method)
184+ deactivate-input-method
185+ inactivate-input-method)
180186 (if (<= (minibuffer-depth) 1)
181187 (remove-hook 'minibuffer-exit-hook 'egg-exit-from-minibuffer)))
182188
@@ -184,7 +190,10 @@
184190
185191 (defun egg-self-insert-char ()
186192 (interactive)
187- (its-start last-command-char (and (eq last-command 'egg-use-context)
193+ (its-start (if (boundp 'last-command-event)
194+ last-command-event
195+ last-command-char)
196+ (and (eq last-command 'egg-use-context)
188197 egg-context)))
189198
190199 (defun egg-remove-all-text-properties (from to &optional object)
--- a/egg/wnn.el
+++ b/egg/wnn.el
@@ -82,6 +82,10 @@ wnn-uniq-kanji: Use only one among same kanji candidates."
8282 (const wnn-uniq)
8383 (const wnn-uniq-kanji)))
8484
85+(defcustom egg-wnn-helper-path "egg-helper"
86+ "path of wnn unix domain connection helper program"
87+ :group 'wnn :type 'file)
88+
8589 (defcustom wnn-jserver nil
8690 "jserver hostname list. Use N-th port, if hostname is followed
8791 by ':' and digit N."
@@ -99,11 +103,21 @@ by ':' and digit N."
99103 by ':' and digit N."
100104 :group 'wnn :type '(repeat string))
101105
106+(setq wnn-jserverenv "JSERVER")
107+(setq wnn-cserverenv "CSERVER")
108+(setq wnn-tserverenv "TSERVER")
109+(setq wnn-kserverenv "KSERVER")
110+
102111 (defcustom wnn-jport 22273 "jserver port number" :group 'wnn :type 'integer)
103112 (defcustom wnn-cport 22289 "cserver port number" :group 'wnn :type 'integer)
104113 (defcustom wnn-tport 22321 "tserver port number" :group 'wnn :type 'integer)
105114 (defcustom wnn-kport 22305 "kserver port number" :group 'wnn :type 'integer)
106115
116+(defcustom wnn-judpath "/tmp/jd_sockV4" "jserver unix domain socket name" :group 'wnn :type 'string)
117+(defcustom wnn-cudpath "/tmp/cd_sockV4" "cserver unix domain socket name" :group 'wnn :type 'string)
118+(defcustom wnn-tudpath "/tmp/td_sockV4" "tserver unix domain socket name" :group 'wnn :type 'string)
119+(defcustom wnn-kudpath "/tmp/kd_sockV4" "kserver unix domain socket name" :group 'wnn :type 'string)
120+
107121 (defmacro wnn-backend-plist ()
108122 ''(egg-initialize-backend wnn-init
109123 egg-start-conversion wnn-start-conversion
@@ -559,11 +573,11 @@ by ':' and digit N."
559573 bunsetsu))
560574
561575 (defvar wnn-server-info-list
562- ;; language server port hostname proc coding-system
563- '((Japanese jserver wnn-jport wnn-jserver "Wnn" (fixed-euc-jp fixed-euc-jp))
564- (Chinese-GB cserver wnn-cport wnn-cserver "cWnn" (fixed-euc-py-cn fixed-euc-zy-cn))
565- (Chinese-CNS tserver wnn-tport wnn-tserver "tWnn" (fixed-euc-py-tw fixed-euc-zy-tw))
566- (Korean kserver wnn-kport wnn-kserver "kWnn" (fixed-euc-kr fixed-euc-kr))))
576+ ;; language server port hostname unixdomain serverenv proc coding-system
577+ '((Japanese jserver wnn-jport wnn-jserver wnn-judpath wnn-jserverenv "Wnn" (fixed-euc-jp fixed-euc-jp))
578+ (Chinese-GB cserver wnn-cport wnn-cserver wnn-cudpath wnn-cserverenv "cWnn" (fixed-euc-py-cn fixed-euc-zy-cn))
579+ (Chinese-CNS tserver wnn-tport wnn-tserver wnn-tudpath wnn-tserverenv "tWnn" (fixed-euc-py-tw fixed-euc-zy-tw))
580+ (Korean kserver wnn-kport wnn-kserver wnn-kudpath wnn-kserverenv "kWnn" (fixed-euc-kr fixed-euc-kr))))
567581
568582 (defsubst wnn-server-get-info (lang)
569583 (or (assq lang wnn-server-info-list)
@@ -577,12 +591,16 @@ by ':' and digit N."
577591 (symbol-value (nth 2 info)))
578592 (defsubst wnn-server-hostname (info)
579593 (symbol-value (nth 3 info)))
594+(defsubst wnn-server-udpath-name (info)
595+ (symbol-value (nth 4 info)))
596+(defsubst wnn-server-env-name (info)
597+ (symbol-value (nth 5 info)))
580598 (defsubst wnn-server-proc-name (info)
581- (nth 4 info))
599+ (nth 6 info))
582600 (defsubst wnn-server-buffer-name (info)
583601 (concat " *" (wnn-server-proc-name info) "*"))
584602 (defsubst wnn-server-coding-system (info)
585- (nth 5 info))
603+ (nth 7 info))
586604
587605 (defconst wnn-accept-charset-alist
588606 '((Chinese-CNS ascii chinese-sisheng chinese-cns11643-1 chinese-cns11643-2)))
@@ -1209,9 +1227,11 @@ Return the list of bunsetsu."
12091227 (port (wnn-server-port server-info))
12101228 (hostname-list (wnn-server-hostname server-info))
12111229 (proc-name (wnn-server-proc-name server-info))
1230+ (udpath (wnn-server-udpath-name server-info))
1231+ (serverenv (wnn-server-env-name server-info))
12121232 (msg-form "Wnn: connecting to %S at %s...")
12131233 (user-name (user-login-name))
1214- buf hostname myname port-off proc result msg)
1234+ buf hostname port-off proc result msg)
12151235 (unwind-protect
12161236 (progn
12171237 (setq buf (generate-new-buffer (wnn-server-buffer-name server-info)))
@@ -1225,13 +1245,24 @@ Return the list of bunsetsu."
12251245 (setq hostname-list (list hostname-list)))
12261246 (while (and hostname-list (null proc))
12271247 (setq hostname (or (car hostname-list) "")
1228- hostname-list (cdr hostname-list)
1229- myname (if (equal hostname "") "unix" wnn-system-name))
1230- (if (null (string-match ":" hostname))
1231- (setq port-off 0)
1232- (setq port-off (string-to-int (substring hostname (match-end 0)))
1233- hostname (substring hostname 0 (match-beginning 0))))
1234- (and (equal hostname "") (setq hostname "localhost"))
1248+ hostname-list (cdr hostname-list))
1249+ (if (or (and (getenv serverenv)
1250+ (string-match "^unix$" (getenv serverenv)))
1251+ (and (null (getenv serverenv))
1252+ (or (equal hostname "")
1253+ (string-match "^unix$" hostname))))
1254+ (progn
1255+ (setq hostname "unix"
1256+ family 'local
1257+ port udpath))
1258+ (progn
1259+ (setq hostname (or (getenv serverenv) hostname "localhost"))
1260+ (if (null (string-match ":" hostname))
1261+ (setq port-off 0)
1262+ (setq port-off (string-to-number (substring hostname (match-end 0)))
1263+ hostname (substring hostname 0 (match-beginning 0))))
1264+ (setq family nil)))
1265+ (setq host hostname)
12351266 (let ((inhibit-quit save-inhibit-quit))
12361267 (if (and msg
12371268 (null (y-or-n-p (format "%s failed. Try to %s? "
@@ -1241,16 +1272,22 @@ Return the list of bunsetsu."
12411272 server-type hostname))
12421273 (message "%s" msg)
12431274 (let ((inhibit-quit save-inhibit-quit))
1244- (condition-case nil
1245- (setq proc (open-network-stream proc-name buf hostname
1246- (+ port port-off)))
1247- ((error quit))))
1248- (when proc
1275+ (if (fboundp 'make-network-process)
1276+ (condition-case nil
1277+ (setq proc (make-network-process :name proc-name :buffer buf :host host :service port :family family))
1278+ ((error quit)))
1279+ (if (string-match "^unix$" hostname)
1280+ (let ((process-connection-type nil))
1281+ (setq proc (start-process proc-name buf egg-wnn-helper-path port)))
1282+ (condition-case nil
1283+ (setq proc (open-network-stream proc-name buf hostname port))
1284+ (error quit)))))
1285+ (when (processp proc)
12491286 (process-kill-without-query proc)
12501287 (set-process-coding-system proc 'binary 'binary)
12511288 (set-process-sentinel proc 'wnn-comm-sentinel)
12521289 (set-marker-insertion-type (process-mark proc) t)
1253- (setq result (wnnrpc-open proc myname user-name))
1290+ (setq result (wnnrpc-open proc host user-name))
12541291 (when (numberp result)
12551292 (delete-process proc)
12561293 (setq proc nil))))
--- a/egg/wnnrpc.el
+++ b/egg/wnnrpc.el
@@ -714,8 +714,14 @@
714714 ,send-expr ,@rcv-exprs))
715715
716716 (defmacro wnnrpc-get-result (&rest body)
717- `(let (result)
718- (comm-unpack (i) result)
717+ `(let (result resulth)
718+ (comm-unpack (w w) resulth result)
719+ (cond ((and (= result 65535) (= resulth 65535))
720+ (setq result -1))
721+ ((= resulth (lsh (lsh resulth 16) -16))
722+ (setq result (+ (lsh resulth 16) result)))
723+ (t
724+ (error "overflow")))
719725 (if (< result 0)
720726 (progn
721727 (comm-unpack (i) result)
--- /dev/null
+++ b/helper/Makefile
@@ -0,0 +1,8 @@
1+# $FreeBSD: tags/RELEASE_10_0_0/editors/tamago/files/patch-egg-Makefile 317394 2013-05-05 05:23:29Z hrs $
2+
3+PROG= egg-helper
4+SRCS= egg-helper.c
5+
6+MAN=
7+
8+.include <bsd.prog.mk>
--- a/its.el
+++ b/its.el
@@ -397,7 +397,7 @@ This variable override `its-delete-by-keystroke'."
397397 (defun its-self-insert-char ()
398398 (interactive)
399399 (let ((inhibit-read-only t)
400- (key last-command-char)
400+ (key last-command-event)
401401 (cursor (get-text-property (point) 'its-cursor))
402402 (syl (get-text-property (1- (point)) 'its-syl)))
403403 (cond
@@ -1264,7 +1264,7 @@ Return last state."
12641264 (interactive "P")
12651265 (let ((syl (and (null (get-text-property (point) 'its-cursor))
12661266 (get-text-property (1- (point)) 'its-syl))))
1267- (if (its-keyseq-acceptable-p (vector last-command-char) syl)
1267+ (if (its-keyseq-acceptable-p (vector last-command-event) syl)
12681268 (its-self-insert-char)
12691269 (its-kick-convert-region n))))
12701270
--- a/menudiag.el
+++ b/menudiag.el
@@ -296,7 +296,7 @@
296296 (defun menudiag-goto-item ()
297297 (interactive)
298298 (menudiag-check-current-menu)
299- (let ((ch last-command-char)
299+ (let ((ch last-command-event)
300300 (n 0))
301301 (setq n (menudiag-char-to-item-num ch))
302302 (if (>= n (length menudiag-line))
@@ -503,7 +503,8 @@
503503 (make-local-variable 'inhibit-read-only)
504504 (setq buffer-read-only t
505505 inhibit-read-only nil)
506- (make-local-hook 'post-command-hook)
506+ (if (fboundp 'make-local-hook)
507+ (eval '(make-local-hook 'post-command-hook)))
507508 (add-hook 'post-command-hook 'menudiag-selection-align-to-item nil t)
508509 (use-local-map menudiag-selection-map)
509510 (setq mode-name "Menudiag Selection")
@@ -619,7 +620,7 @@
619620 (unless (eq last-command 'menudiag-selection-goto)
620621 (setq menudiag-goto-number-list nil
621622 menudiag-original-point (point)))
622- (setq menudiag-goto-number-list (cons (- last-command-char ?0)
623+ (setq menudiag-goto-number-list (cons (- last-command-event ?0)
623624 menudiag-goto-number-list))
624625 (menudiag-selection-goto-internal))
625626
旧リポジトリブラウザで表示