大場君が Namazu で検索出来るようにしてくれた。感謝。(といっても検索するほどの内容はない)
generate_regex_str = lambda {|pattern, with_paren| if (pattern == ' ') "[ \t ]*" elsif migemo = Migemo.new(static_dict, pattern) <あとは全角アルファベットの ignore case だ。> def segment (pattern) # pattern.scan(/[A-Z]?[^A-Z]+|[A-Z]+/) pattern.scan(/[^a-zA-Z]+|[A-Z]?[a-z]+|[A-Z]+/) end
(add-hook 'mew-summary-mode-hook (lambda () (define-key mew-summary-mode-map "}" 'mew-summary-review-copy) (define-key mew-summary-mode-map "{" 'mew-summary-review-copy-kill) (define-key mew-summary-mode-map "]" 'mew-summary-review-copy-next) (define-key mew-summary-mode-map "[" 'mew-summary-review-copy-prev))) (add-hook 'mew-message-mode-hook (lambda () (define-key mew-message-mode-map "}" 'mew-message-review-copy) (define-key mew-message-mode-map "{" 'mew-message-review-copy-kill) (define-key mew-message-mode-map "]" 'mew-message-review-copy-next) (define-key mew-message-mode-map "[" 'mew-message-review-copy-prev))) (defvar mew-message-dummy-buffer "*MEW MESSAGE REVIEW*") (defun mew-summary-review-copy-kill () (interactive) (mew-summary-review-copy 'kill)) (defun mew-summary-review-copy (&optional kill) (interactive "P") (let ((owin (selected-window)) (mbuf (mew-buffer-message))) (if kill (mew-message-review-copy 'kill) (when (and (get-buffer mbuf) (get-buffer-window mbuf)) (select-window (get-buffer-window mbuf)) (mew-message-review-copy) (select-window owin))))) (defun mew-summary-review-copy-prev () (interactive) (mew-summary-review-copy-next 'reverse)) (defun mew-summary-review-copy-next (&optional reverse) (interactive "P") (let ((owin (selected-window)) (mbuf (mew-buffer-message))) (when (and (get-buffer mbuf) (get-buffer-window mbuf)) (select-window (get-buffer-window mbuf)) (mew-message-review-copy-next reverse) (select-window owin)))) (defun mew-message-review-copy-kill () (interactive) (mew-message-review-copy 'kill)) (defun mew-message-review-copy (&optional kill) (interactive "P") (if kill (let ((nbuf (get-buffer mew-message-dummy-buffer))) (when nbuf (delete-windows-on nbuf) (kill-buffer nbuf))) (let ((nbuf (get-buffer-create mew-message-dummy-buffer)) (msg (buffer-substring (point-min) (point-max))) (owin (selected-window)) (start (window-start)) (end (window-end)) (w3mp (and (boundp 'mew-use-w3m-minor-mode) (fboundp 'w3m-minor-mode) (get-text-property (point-min) 'w3m) mew-use-w3m-minor-mode)) new) (if (get-buffer-window nbuf) (select-window (get-buffer-window nbuf)) (setq new t) (split-window-vertically) (next-window) (pop-to-buffer nbuf)) (setq rwin (selected-window)) (setq buffer-read-only t) (mew-elet (mew-erase-buffer) (insert msg) (let ((mew-message-mode-map (copy-keymap mew-message-mode-map))) (define-key mew-message-mode-map "q" 'mew-message-review-copy-kill) (mew-message-mode)) (when w3mp (w3m-minor-mode 1)) (set-buffer-modified-p nil) (when (> (window-height) (/ (frame-height) 3)) (shrink-window (- (window-height) (/ (frame-height) 3)))) (set-window-start (selected-window) (progn (goto-char end) (forward-line (- (+ (window-height) (if new 1 -2)))) (point))) (mew-buffers-setup mew-message-dummy-buffer)) (select-window owin)))) (defun mew-message-review-copy-prev () (interactive) (mew-message-review-copy-next 'reverse)) (defun mew-message-review-copy-next (&optional reverse) (interactive "P") (let ((owin (selected-window)) (nbuf (get-buffer-create mew-message-dummy-buffer))) (when (get-buffer-window nbuf) (select-window (get-buffer-window nbuf)) (if reverse (if (eq (window-start) (point-min)) (message "Beginning of buffer") (scroll-up (- 3 (window-height)))) (if (>= (window-end) (point-max)) ;; '>' for XEmacs (message "End of buffer") (scroll-up (- (window-height) 3)))) (select-window owin))))
(defvar minibuf-expand-migemo-original nil) (defvar minibuf-expand-migemo-migemo nil) (defun minibuf-expand-migemo () (interactive) (when (featurep 'migemo) (remove-hook 'minibuffer-exit-hook 'minibuf-expand-migemo-delete-history) (let* ((again (eq last-command this-command)) (beg (if (fboundp 'field-beginning) (field-beginning) (point-min))) (end (if (fboundp 'field-end) (field-end) (point-max))) (string (buffer-substring-no-properties beg end))) (if (and again minibuf-expand-migemo-original) (setq string minibuf-expand-migemo-original minibuf-expand-migemo-original nil) (setq minibuf-expand-migemo-original string) (setq string (migemo-get-pattern string)) (setq minibuf-expand-migemo-migemo string) (add-hook 'minibuffer-exit-hook 'minibuf-expand-migemo-delete-history)) (delete-region beg end) (insert string)))) (defun minibuf-expand-migemo-setup () (when (featurep 'migemo) (setq minibuf-expand-migemo-original nil) (setq minibuf-expand-migemo-migemo nil) (remove-hook 'minibuffer-exit-hook 'minibuf-expand-migemo-delete-history))) (defun minibuf-expand-migemo-delete-history () (when (and minibuf-expand-migemo-migemo (string= minibuf-expand-migemo-migemo (car (symbol-value minibuffer-history-variable)))) (set minibuffer-history-variable (cdr (symbol-value minibuffer-history-variable))) (when minibuf-expand-migemo-original (set minibuffer-history-variable (cons minibuf-expand-migemo-original (symbol-value minibuffer-history-variable))))) (minibuf-expand-migemo-setup)) (unless (featurep 'xemacs) (add-hook 'minibuffer-setup-hook 'minibuf-expand-migemo-setup) (mapcar (lambda (map) (define-key map "\M-\C-m" 'minibuf-expand-migemo)) (delq nil (list (and (boundp 'minibuffer-local-map) minibuffer-local-map) (and (boundp 'minibuffer-local-ns-map) minibuffer-local-ns-map) (and (boundp 'minibuffer-local-completion-map) minibuffer-local-completion-map) (and (boundp 'minibuffer-local-must-match-map) minibuffer-local-must-match-map)))))
本業のリリースは失敗するし、不用意に書いたメールで叱られるし。。。
(defvar gpg-work-directory (expand-file-name "~/.gpg.work") "*Work directory of GPG.") (defalias 'gpg-make-temp-file1 (if (fboundp 'make-temp-file) 'make-temp-file 'make-temp-name)) (defun gpg-make-temp-file (file) (cond ((and (file-exists-p gpg-work-directory) (file-directory-p gpg-work-directory)) (set-file-modes gpg-work-directory ?\700)) ((not (file-exists-p gpg-work-directory)) (make-directory gpg-work-directory) (set-file-modes gpg-work-directory ?\700)) ((and (file-exists-p gpg-work-directory) (file-writable-p gpg-work-directory) (y-or-n-p (format "%s is not directory. Remove it? " gpg-work-directory))) (delete-file gpg-work-directory) (make-directory gpg-work-directory) (set-file-modes gpg-work-directory ?\700)) (t (error (format "%s has something error" gpg-work-directory)))) (gpg-make-temp-file1 (expand-file-name (file-name-nondirectory file) gpg-work-directory)))こんなことをやりつつ、他のリモートファイルもケアして、gpg.el の機能や gpg for Dired が tramp 経由でも動くようにしてみたけど、もうちょっといろいろやらないと公開できないなぁ。
△ なおと [一時ファイルを作るのが切ないので、find-fileしてバッファをgpgに投げつけるようなコードをスクラッチから書こ..]
△ ぱんだ [stdin/out を使うのですよね。そっちの方がおしゃれだからぼくもやってみます。]
△ なおと [簡単な試験コード書いて実験したんですけど、ローカルのファイルだとうまくいく。でも、リモートだとgpgに投げるところで..]
△ ぱんだ [うーむ、最初 default-directory かな?と思ったのですが、違うみたいですね。がんばります。]