Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 3 additions & 57 deletions skk-develop.el
Original file line number Diff line number Diff line change
Expand Up @@ -83,50 +83,6 @@
(unless (file-exists-p fn)
(url-copy-file (format "%s%s" url f) fn)))))

(defun skk-get-generate-gzip-d (dir)
"$BB(@J(B gzip -d"
(and (not (executable-find "gzip"))
(eq system-type 'windows-nt)
(not (file-exists-p (expand-file-name "gzip-d.ps1" dir)))
(skk-get-generate-gzip-d-1 dir)))

(defun skk-get-generate-gzip-d-1 (dir)
"$BMW(B powershell"
(with-temp-buffer
(insert "$infile = $args[0]" 10)
(insert "$outfile = ( $infile -replace '\.gz$','' )" 10)
(insert "$input = New-Object System.IO.FileStream $inFile, ( [IO.FileMode]::Open ), ( [IO.FileAccess]::Read ), ( [IO.FileShare]::Read )" 10)
(insert "$gzipStream = New-Object System.IO.Compression.GzipStream $input, ( [IO.Compression.CompressionMode]::Decompress )" 10)
(insert "$output = New-Object System.IO.FileStream $outFile, ( [IO.FileMode]::Create ), ( [IO.FileAccess]::Write ), ( [IO.FileShare]::None )" 10)
(insert "$buffer = New-Object byte[](1024)" 10)
(insert "while( $true ) {" 10)
(insert " $read = $gzipstream.Read( $buffer, 0, 1024 )" 10)
(insert " if ( $read -le 0 ) {break}" 10)
(insert " $output.Write( $buffer, 0, $read )" 10)
(insert "}" 10)
(insert "$input.Close()" 10)
(insert "$gzipStream.Close()" 10)
(insert "$output.Close()" 10)
(write-region (point-min) (point-max)
(expand-file-name "gzip-d.ps1" dir))))

(defun skk-get-expand-gzip (dir)
"DIR."
(let* ((ps (convert-standard-filename (expand-file-name "gzip-d.ps1" dir)))
(cmd (cond ((executable-find "gzip")
"gzip -d")
((file-exists-p ps)
(message "skk-get: Use powershell version of the simple gzip.")
(format "powershell.exe -executionpolicy remotesigned -file %s" (shell-quote-argument ps)))
(t
(error "skk-get: gzip command could not be found. Aborts.")))))
(dolist (f (directory-files dir t ".gz"))
(let ((fn (convert-standard-filename f)))
(message "skk-get: expand %s..." fn)
(shell-command (format "%s %s" cmd (shell-quote-argument fn)))
(when (file-exists-p fn)
(delete-file fn))))))

(defun skk-get-expand-tar (dir)
"DIR."
;; (let (fn)
Expand All @@ -149,10 +105,7 @@
(let ((jisyo-dir (expand-file-name dir)))
(skk-get-mkdir jisyo-dir)
(skk-get-download jisyo-dir)
(skk-get-generate-gzip-d jisyo-dir)
(skk-get-expand-gzip jisyo-dir)
(when (fboundp 'tar--extract) ; GNU Emacs 24.4 $B$+$i(B
(skk-get-expand-tar jisyo-dir)))
(skk-get-expand-tar jisyo-dir))
(message "skk-get...done")
nil)

Expand All @@ -161,12 +114,7 @@
'before-init-hook
(lambda ()
(eval-after-load "font-lock"
;; `lisp-font-lock-keywords-2' is an alias for `lisp-el-font-lock-keywords-2'.
;; `lisp-font-lock-keywords-2' is obsolete since 24.4;
;; use `lisp-el-font-lock-keywords-2' instead.
'(set (if (boundp 'lisp-el-font-lock-keywords-2)
'lisp-el-font-lock-keywords-2
'lisp-font-lock-keywords-2)
'(set 'lisp-el-font-lock-keywords-2
(nconc
(list (list (concat "(\\(\\(skk-\\)?def\\("
;; Function type declarations.
Expand Down Expand Up @@ -194,9 +142,7 @@
(list (list "(\\(skk-error\\)\\>"
'(1 font-lock-warning-face)))

(symbol-value (if (boundp 'lisp-el-font-lock-keywords-2)
'lisp-el-font-lock-keywords-2
'lisp-font-lock-keywords-2)))))
(symbol-value 'lisp-el-font-lock-keywords-2))))
;;
(put 'skk-deflocalvar 'doc-string-elt 3)))

Expand Down
9 changes: 1 addition & 8 deletions skk-isearch.el
Original file line number Diff line number Diff line change
Expand Up @@ -350,9 +350,6 @@ Optional argument PREFIX is appended if given."
(push 'toggle-input-method commands))
(skk-isearch-find-keys-define map commands 'skk-isearch-skk-mode))

(if (fboundp 'isearch-other-control-char) ;2013-10-08 Remove functions
(define-key map [?\C-x t] 'isearch-other-control-char)) ; GNU Emacs 24.4 $B$+$iGQ;_(B

(define-key map [?\C-0] 'skk-isearch-start-henkan)
(define-key map [?\C-1] 'skk-isearch-start-henkan)
(define-key map [?\C-2] 'skk-isearch-start-henkan)
Expand Down Expand Up @@ -674,9 +671,7 @@ If the current mode is different from previous, remove it first."
(skk-isearch-wrapper-1))

(t
(skk-unread-event event)
(if (fboundp 'isearch-other-control-char) ; 2013-10-08 Remove functions.
(isearch-other-control-char)))))) ; GNU Emacs 24.4 $B$+$iGQ;_(B
(skk-unread-event event)))))


;;
Expand Down Expand Up @@ -780,8 +775,6 @@ If the current mode is different from previous, remove it first."
(add-hook 'before-init-hook skk-isearch-really-early-advice)))

(put 'digit-argument 'isearch-command t)
(if (fboundp 'isearch-other-control-char) ; 2013-10-08 Remove functions
(put 'isearch-other-control-char 'isearch-command t)) ; GNU Emacs 24.4 $B$+$iGQ;_(B
(put 'skk-isearch-delete-char 'isearch-command t)
(put 'skk-isearch-exit 'isearch-command t)
(put 'skk-isearch-keyboard-quit 'isearch-command t)
Expand Down
15 changes: 8 additions & 7 deletions tar-util.el
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,17 @@ Return buffer object."
(let* ((path (expand-file-name archive))
(buffer (file-name-nondirectory path)))

;; バッファ名にtarの拡張子がある場合、バッファのコーディングが適切
;; に設定されない。この結果、以下の2つのskk-getでダウンロードした
;; バッファ名に tar の拡張子がある場合、バッファのコーディングが適切
;; に設定されない。この結果、skk-get でダウンロードした
;; 以下の2つのファイルが展開されない。
;; 対処として、拡張子を``tar''→``archive''に変更する。
;; 対処として、拡張子を ``tar'' → ``archive'' に変更する。
;; - SKK-JISYO.edict.tar
;; - zipcode.tar

;; 参考
;; バッファのコーディングの自動設定は、以下のルートで否決。
;; 拡張子が .tar のままだと、Emacs 内部の set-auto-coding ルーチンにおいて
;; コーディング系の自動判別が機能しない(以下の処理ルートで抑制されるため)。
;; これを回避するため、一時的に拡張子を .archive へ置換している。
;; (tar--extract desc)
;; (funcall set-auto-coding-function name (- end start))
;; (set-auto-coding filename size)
Expand All @@ -111,9 +113,8 @@ Return buffer object."
(set-buffer (get-buffer-create buffer))
(set-buffer-multibyte nil)
(insert-file-contents-literally path)
(when (fboundp 'zlib-decompress-region)
(zlib-decompress-region (point-min) ; GNU Emacs 24 以降であれば
(point-max)))) ; 直接 tar.gz いける (事前の gzip -d 不要)
(zlib-decompress-region (point-min)
(point-max)))
(current-buffer))

;;;###autoload
Expand Down
Loading