……微妙にマイナーな気もしますが、好きなエディタ?ですので。
カスタマイズが LISP を切り貼りしなきゃいけないのが、ちょっと難易度高いんでしょうか。設定自体はテキストなので、バックアップなどはむしろ、やり易いと思うのですが……。
ファイラ上で Ctrl+8 を押すとメニューが出て、下記の事が出来るようになります。
エンコード、デコード
- BASE64
- uu encode
- MD5
- SHA-1
uubase64.l とでも名前を付けて site-lisp に保存し、siteinit.l に、(require "uubase64") とでも書いて再ダンプすれば動くでしょう、たぶん。
(provide "uubase64")
;;; BASE64 and UU エンコード、デコードメニュー
;; ファイラーに表示する一覧 Ctrl+8
(defvar *get-filer-file-endecode* nil)
(define-key filer-keymap #\C-8
#'(lambda () (interactive)
(unless *get-filer-file-endecode*
(setq *get-filer-file-endecode*
(define-popup-menu
(:item nil "BASE64 エンコード (&E)"
#'(lambda () (interactive) (filer-set-file-endecode 11)))
(:item nil "BASE64 デコード (&D)"
#'(lambda () (interactive) (filer-set-file-endecode 12)))
(:item nil "UU エンコード (&E)"
#'(lambda () (interactive) (filer-set-file-endecode 21)))
(:item nil "UU デコード (&D)"
#'(lambda () (interactive) (filer-set-file-endecode 22)))
(:item nil "MD5 作成 (&M)"
#'(lambda () (interactive) (filer-set-file-endecode 30)))
(:item nil "SHA-1 作成 (&S)"
#'(lambda () (interactive) (filer-set-file-endecode 40)))
)))
(track-popup-menu *get-filer-file-endecode*)))
;;filerでMD5ファイル作成
(defun filer-make-md5-string (name)
(long-operation
(with-open-stream (stream (open name :direction :input :encoding :binary))
(si:md5 stream))))
(defun filer-make-md5-file ()
(let* ((name (ed::filer-get-current-file))
(name5 (concat name ".md5")))
(if (ed::file-directory-p name)
(message "フォルダはできません.")
(when (or (null ed::*filer-query-before-process*)
(if (ed::file-exist-p name5)
(no-or-yes-p "~A~%のMD5は既にあります.~%MD5の生成を続けますか?" name)
(yes-or-no-p "~A~%のMD5を生成しますか?" name)))
(message "MD5 creating...")
(with-open-stream (stream (open name5 :direction :output :encoding :binary))
(princ (filer-make-md5-string name) stream))
(ed::filer-reload) ; 再表示
(message "MD5 done.")))))
;;filerでSHA-1ファイル作成
(defun filer-make-sha1-string (name)
(long-operation
(with-open-stream (stream (open name :direction :input :encoding :binary))
(si:sha-1 stream))))
(defun filer-make-sha1-file ()
(let* ((name (ed::filer-get-current-file))
(namesha1 (concat name ".sha1")))
(if (ed::file-directory-p name)
(message "フォルダはできません.")
(when (or (null ed::*filer-query-before-process*)
(if (ed::file-exist-p namesha1)
(no-or-yes-p "~A~%のSHA-1は既にあります.~%SHA-1の生成を続けますか?" name)
(yes-or-no-p "~A~%のSHA-1を生成しますか?" name)))
(message "SHA-1 creating...")
(with-open-stream (stream (open namesha1 :direction :output :encoding :binary))
(princ (filer-make-sha1-string name) stream))
(ed::filer-reload) ; 再表示
(message "SHA-1 done.")))))
;; BASE64 decode
(defun filer-decode-BASE64-string (name)
(long-operation
(with-open-stream (stream (open name :direction :input :encoding :binary))
(si:base64-decode stream))))
(defun filer-decode-BASE64-file ()
(let* ((name (ed::filer-get-current-file))
(nameDEC (concat name ".dec")))
(if (ed::file-directory-p name)
(message "フォルダはできません.")
(when (or (null ed::*filer-query-before-process*)
(if (ed::file-exist-p nameDEC)
(no-or-yes-p "~A~%と同じファイルがあります。~% BASE64 デコードを続けますか?" name)
(yes-or-no-p "~A~%の BASE64 デコードを行いますか?" name)))
(message "BASE64 decoding...")
(with-open-stream (stream (open nameDEC :direction :output :encoding :binary))
(princ (filer-decode-BASE64-string name) stream))
(ed::filer-reload)
(message "BASE64 decode done.")))))
;; BASE64 encode
(defun filer-encode-BASE64-string (name)
(long-operation
(with-open-stream (stream (open name :direction :input :encoding :binary))
(si:base64-encode stream))))
(defun filer-encode-BASE64-file ()
(let* ((name (ed::filer-get-current-file))
(nameBASE64 (concat name ".base64")))
(if (ed::file-directory-p name)
(message "フォルダはできません.")
(when (or (null ed::*filer-query-before-process*)
(if (ed::file-exist-p nameBASE64)
(no-or-yes-p "~A~% と同じファイルがあります。~%BASE64 エンコードを続けますか?" name)
(yes-or-no-p "~A~%の BASE64 エンコードファイルを作成しますか?" name)))
(message "BASE64 encoding...")
(with-open-stream (stream (open nameBASE64 :direction :output :encoding :binary))
(princ (filer-encode-BASE64-string name) stream))
(ed::filer-reload)
(message "BASE64 encode done.")))))
;; UU decode
(defun filer-decode-UU-string (name)
(long-operation
(with-open-stream (stream (open name :direction :input :encoding :binary))
(si:uudecode stream))))
(defun filer-decode-UU-file ()
(let* ((name (ed::filer-get-current-file))
(nameDEC (concat name ".dec")))
(if (ed::file-directory-p name)
(message "フォルダはできません.")
(when (or (null ed::*filer-query-before-process*)
(if (ed::file-exist-p nameDEC)
(no-or-yes-p "~A~%と同じファイルがあります。~% UU デコードを続けますか?" name)
(yes-or-no-p "~A~%の UU デコードを行いますか?" name)))
(message "UU decoding...")
(with-open-stream (stream (open nameDEC :direction :output :encoding :binary))
(princ (filer-decode-UU-string name) stream))
(ed::filer-reload)
(message "UU decode done.")))))
;; UU encode
(defun filer-encode-UU-string (name)
(long-operation
(with-open-stream (stream (open name :direction :input :encoding :binary))
(si:uuencode stream))))
(defun filer-encode-UU-file ()
(let* ((name (ed::filer-get-current-file))
(nameUU (concat name ".uue")))
(if (ed::file-directory-p name)
(message "フォルダはできません.")
(when (or (null ed::*filer-query-before-process*)
(if (ed::file-exist-p nameUU)
(no-or-yes-p "~A~%と同じファイル名があります。~%UU エンコードを続けますか?" name)
(yes-or-no-p "~A~%の UU エンコードファイルを作成しますか?" name)))
(message "UU encoding...")
(with-open-stream (stream (open nameUU :direction :output :encoding :binary))
(princ (filer-encode-UU-string name) stream))
(ed::filer-reload)
(message "UU encode done.")))))
;;;
;; 分岐
(defun filer-set-file-endecode (type)
(interactive)
(let ((n (filer-get-current-file)) str)
(cond
((= type 11)(filer-encode-BASE64-file))
((= type 12)(filer-decode-BASE64-file))
((= type 21)(filer-encode-UU-file))
((= type 22)(filer-decode-UU-file))
((= type 30)(filer-make-md5-file))
((= type 40)(filer-make-sha1-file))
)))
0 件のコメント:
コメントを投稿