[Mew-dist 14297] utashiro special

Kazu Yamamoto ( 山本和彦 ) kazu at example.com
2000年 9月 28日 (木) 12:52:03 JST


歌代さんスペシャル・パッチを送ります。

できること:

(1) 今まで秘密にしていましたが、b63 では単純な pick が復活しています。
    || とか && は使えません。

	"?" -> "to=kazu"

(2) 以下のパッチを当ると、検索コマンドとの API の雛形が利用できるよう
    になります。現在は "grep" を起動しています。

	"C-u ?" -> "keyword"

    API として、mew-prog-grep-* で十分かしら? (不十分でしょうね。)

(3) Summary モードで M-n を押すと、"*" のついているメールを ASIS で表
    示し、keyword をハイライトします。M-n と押し続けると、次々に希望の
    箇所が読めるようになっています。

    keyword には、pick&grep の引数が利用されます。明示的に変えたい場合
    は、C-u M-n して下さい。

(4) mew-coding-system-p のパッチも含まれています。

疑問:

M-p の挙動はどうするか? メール内のキーワードを探すとき、後ろから始め
るべきか?

--かず
-------------- next part --------------
? LOG
? LOGLESS
Index: 00changes
===================================================================
RCS file: /usr/home/kazu/cvsroot/Mew/mew/00changes,v
retrieving revision 1.755
retrieving revision 1.756
diff -c -r1.755 -r1.756
*** 00changes	2000/09/27 03:58:51	1.755
--- 00changes	2000/09/27 12:33:53	1.756
***************
*** 23,28 ****
--- 23,29 ----
  
  	- long field when getting (e.g. To:)
  	- C-u B (like y)
+ 	- no uidl pop server
  
  INFO:
  	- 8bit
Index: mew-blvs.el
===================================================================
RCS file: /usr/home/kazu/cvsroot/Mew/mew/mew-blvs.el,v
retrieving revision 1.22
retrieving revision 1.23
diff -c -r1.22 -r1.23
*** mew-blvs.el	2000/09/21 08:22:06	1.22
--- mew-blvs.el	2000/09/28 03:50:14	1.23
***************
*** 31,36 ****
--- 31,37 ----
  (defvar mew-summary-buffer-disp-msg t)
  (defvar mew-summary-buffer-left-msgs "-")
  (defvar mew-summary-buffer-scan-form nil)
+ (defvar mew-summary-buffer-find-keyword nil)
  (defvar mew-watch-buffer-process nil)
  (defvar mew-syntax-icon-spec nil)
  (defvar mew-syntax-multi-form nil)
***************
*** 88,93 ****
--- 89,95 ----
  	      'mew-summary-buffer-disp-msg
  	      'mew-summary-buffer-left-msgs
  	      'mew-summary-buffer-scan-form
+ 	      'mew-summary-buffer-find-keyword
  	      'mew-watch-buffer-process
  	      'mew-syntax-icon-spec
  	      'mew-syntax-multi-form
Index: mew-const.el
===================================================================
RCS file: /usr/home/kazu/cvsroot/Mew/mew/mew-const.el,v
retrieving revision 1.18
retrieving revision 1.19
diff -c -r1.18 -r1.19
*** mew-const.el	2000/09/27 03:58:51	1.18
--- mew-const.el	2000/09/28 03:50:14	1.19
***************
*** 150,155 ****
--- 150,156 ----
  (defconst mew-buffer-cache      " *mew cache*")
  (defconst mew-buffer-tmp        " *mew tmp*")
  (defconst mew-buffer-burst      " *mew burst*")
+ (defconst mew-buffer-pick       " *mew pick*")
  (defconst mew-buffer-completions "*Mew completions*")
  (defconst mew-buffer-ext        " *mew ext*")
  (defconst mew-buffer-hello      " *mew hello*")
***************
*** 183,188 ****
--- 184,190 ----
  
  (defconst mew-regex-files "^[^.]\\|^.[^.]") ;; xxx "[^.]" is enough?
  (defconst mew-regex-message-files "^[1-9][0-9]*$")
+ (defconst mew-regex-message-files2 "^[1-9][0-9]*")
  (defconst mew-regex-mark "\\([^ 0-9]\\)")
  
  (defconst mew-regex-msg      "^ *\\([0-9]+\\)")
Index: mew-minibuf.el
===================================================================
RCS file: /usr/home/kazu/cvsroot/Mew/mew/mew-minibuf.el,v
retrieving revision 1.65
retrieving revision 1.66
diff -c -r1.65 -r1.66
*** mew-minibuf.el	2000/09/27 02:58:35	1.65
--- mew-minibuf.el	2000/09/28 03:50:14	1.66
***************
*** 133,146 ****
        (setq i (+ (match-beginning 0) 3)))
      string))
  
! (defun mew-input-pick-pattern ()
    (mew-input-clear)
    (setq mew-input-complete-function (function mew-complete-pick-pattern))
    (let ((keymap (copy-keymap mew-input-map)) ret)
      (define-key keymap " " nil)
      (setq ret
  	  (mew-pick-canonicalize-pattern
! 	   (read-from-minibuffer "Pick pattern: "
  				 mew-pick-default-field
  				 keymap
  				 nil
--- 133,146 ----
        (setq i (+ (match-beginning 0) 3)))
      string))
  
! (defun mew-input-pick-pattern (prompt)
    (mew-input-clear)
    (setq mew-input-complete-function (function mew-complete-pick-pattern))
    (let ((keymap (copy-keymap mew-input-map)) ret)
      (define-key keymap " " nil)
      (setq ret
  	  (mew-pick-canonicalize-pattern
! 	   (read-from-minibuffer prompt
  				 mew-pick-default-field
  				 keymap
  				 nil
Index: mew-mule2.el
===================================================================
RCS file: /usr/home/kazu/cvsroot/Mew/mew/mew-mule2.el,v
retrieving revision 1.56
retrieving revision 1.57
diff -c -r1.56 -r1.57
*** mew-mule2.el	2000/09/26 12:23:40	1.56
--- mew-mule2.el	2000/09/28 03:52:16	1.57
***************
*** 10,17 ****
  
  ;; must be here
  (if (fboundp 'find-coding-system)
!     (fset 'mew-coding-system-p (symbol-function 'find-coding-system))
!   (fset 'mew-coding-system-p (symbol-function 'coding-system-p)))
  
  ;; In the context of Mew, 'charset' means MIME charset.
  ;; 'cs' means the internal representation of Emacs (was known as Mule).
--- 10,19 ----
  
  ;; must be here
  (if (fboundp 'find-coding-system)
!     (defun mew-coding-system-p (cs)
!       (if (null cs) t (find-coding-system cs)))
!   (defun mew-coding-system-p (cs)
!     (if (null cs) t (coding-system-p cs))))
  
  ;; In the context of Mew, 'charset' means MIME charset.
  ;; 'cs' means the internal representation of Emacs (was known as Mule).
Index: mew-mule3.el
===================================================================
RCS file: /usr/home/kazu/cvsroot/Mew/mew/mew-mule3.el,v
retrieving revision 1.58
retrieving revision 1.59
diff -c -r1.58 -r1.59
*** mew-mule3.el	2000/09/26 12:23:40	1.58
--- mew-mule3.el	2000/09/28 03:52:16	1.59
***************
*** 10,17 ****
  
  ;; must be here
  (if (fboundp 'find-coding-system)
!     (fset 'mew-coding-system-p (symbol-function 'find-coding-system))
!   (fset 'mew-coding-system-p (symbol-function 'coding-system-p)))
  
  ;; In the context of Mew, 'charset' means MIME charset.
  ;; 'cs' means the internal representation of Emacs (was known as Mule).
--- 10,19 ----
  
  ;; must be here
  (if (fboundp 'find-coding-system)
!     (defun mew-coding-system-p (cs)
!       (if (null cs) t (find-coding-system cs)))
!   (defun mew-coding-system-p (cs)
!     (if (null cs) t (coding-system-p cs))))
  
  ;; In the context of Mew, 'charset' means MIME charset.
  ;; 'cs' means the internal representation of Emacs (was known as Mule).
Index: mew-pick.el
===================================================================
RCS file: /usr/home/kazu/cvsroot/Mew/mew/mew-pick.el,v
retrieving revision 1.36
retrieving revision 1.39
diff -c -r1.36 -r1.39
*** mew-pick.el	2000/09/27 02:58:35	1.36
--- mew-pick.el	2000/09/28 03:50:14	1.39
***************
*** 18,27 ****
    (interactive "P")
    (mew-summary-only
     (let ((folder (mew-summary-folder-name 'ext))
! 	 (pattern (mew-input-pick-pattern))
  	 msgs)
       (message "Picking messages in %s ..." folder)
!      (setq msgs (mew-summary-pick-with-imls folder pattern))
       (message "Picking messages in %s ... done" folder)
       (if (null msgs)
  	 (message "No message to be marked.")
--- 18,30 ----
    (interactive "P")
    (mew-summary-only
     (let ((folder (mew-summary-folder-name 'ext))
! 	 (pattern (mew-input-pick-pattern
! 		   (if arg "Grep pattern: " "Pick pattern: ")))
  	 msgs)
       (message "Picking messages in %s ..." folder)
!      (if arg
! 	 (setq msgs (mew-summary-pick-with-grep folder pattern))
!        (setq msgs (mew-summary-pick-with-imls folder pattern)))
       (message "Picking messages in %s ... done" folder)
       (if (null msgs)
  	 (message "No message to be marked.")
***************
*** 39,45 ****
  (defun mew-summary-pick-with-imls (folder pattern)
    (let (msgs)
      (save-excursion
!       (mew-set-buffer-tmp)
        (mew-piolet
         mew-cs-text-for-read mew-cs-text-for-write
         (call-process mew-prog-mewls nil t nil "--pick" pattern folder))
--- 42,50 ----
  (defun mew-summary-pick-with-imls (folder pattern)
    (let (msgs)
      (save-excursion
!       (set-buffer (get-buffer-create mew-buffer-pick))
!       (mew-erase-buffer)
!       ;; xxx multibyte
        (mew-piolet
         mew-cs-text-for-read mew-cs-text-for-write
         (call-process mew-prog-mewls nil t nil "--pick" pattern folder))
***************
*** 49,54 ****
--- 54,132 ----
  	    (setq msgs (cons (mew-match 0) msgs)))
  	(forward-line))
        (nreverse msgs))))
+ 
+ (defun mew-summary-pick-with-grep (folder pattern)
+   (let* ((dir (mew-expand-folder folder))
+ 	 (default-directory dir) ;; buffer local
+ 	 (msgs (directory-files "." nil mew-regex-message-files 'no-sort)))
+     ;; no sort here
+     (if (null msgs)
+ 	()
+       (save-excursion
+ 	(set-buffer (get-buffer-create mew-buffer-pick))
+ 	(mew-erase-buffer)
+ 	(if (= (length msgs) 1) (setq msgs (cons "/dev/null" msgs)))
+ 	(cd dir)
+ 	(mew-piolet
+ 	 mew-cs-text-for-read mew-cs-text-for-write
+ 	 (apply (function call-process)
+ 		mew-prog-grep nil t nil
+ 		mew-prog-grep-key-opt pattern
+ 		(if mew-prog-grep-opts (append mew-prog-grep-opts msgs) msgs)))
+ 	(goto-char (point-min))
+ 	(setq msgs nil)
+ 	(while (not (eobp))
+ 	  (if (looking-at mew-regex-message-files2)
+ 	      (setq msgs (cons (mew-match 0) msgs)))
+ 	  (forward-line))
+ 	(setq msgs (mew-uniq-list msgs))
+ 	(setq msgs (mapcar (function string-to-int) msgs))
+ 	(setq msgs (sort msgs (function <)))
+ 	(mapcar (function int-to-string) msgs)))))
+ 
+ (defun mew-summary-find-keyword-down (&optional arg)
+   (interactive "P")
+   (let* ((fld (mew-summary-folder-name))
+ 	 (msg (mew-summary-message-number))
+ 	 (ofld (mew-current-get 'fld))
+ 	 (omsg (mew-current-get 'msg))
+ 	 (cwin (get-buffer-window (current-buffer)))
+ 	 (mbuf (mew-buffer-message))
+ 	 (mwin (get-buffer-window mbuf))
+ 	 (key mew-summary-buffer-find-keyword)
+ 	 (mark (mew-summary-get-mark))
+ 	 (search t) end top )
+     (if (or arg (not (stringp key)))
+ 	(progn
+ 	  (setq key (read-string
+ 		     "Keyword: " (or key (car mew-input-pick-pattern-hist))))
+ 	  (setq mew-summary-buffer-find-keyword key)))
+     (cond
+      ((and (equal mew-mark-review mark)
+ 	   (or (not (string= fld ofld)) (not (string= msg omsg))))
+       (mew-summary-display-asis 'nolimit)
+       (setq top t))
+      ((or (null mwin)
+ 	  (not (equal mew-mark-review mark))
+ 	  (or (not (string= fld ofld)) (not (string= msg omsg)))
+ 	  (save-excursion (set-buffer mbuf) (eobp)))
+       (if (not (mew-summary-down-mark mew-mark-review))
+ 	  (setq search nil)
+ 	(mew-summary-display-asis 'nolimit)
+ 	(setq top t))))
+     (setq mwin (get-buffer-window mbuf))
+     (if (not search)
+ 	(message "No more marked message.")
+       (select-window mwin)
+       (unwind-protect
+ 	  (progn
+ 	    (if top (goto-char (point-min)))
+ 	    (if (setq end (re-search-forward key nil t))
+ 		(isearch-highlight (- end (length key)) end)
+ 	      (goto-char (point-max))
+ 	      (message "Keyword '%s' is not found." key))
+ 	    (recenter 2))
+ 	(select-window cwin)))))
  
  (provide 'mew-pick)
  
Index: mew-summary.el
===================================================================
RCS file: /usr/home/kazu/cvsroot/Mew/mew/mew-summary.el,v
retrieving revision 1.345
retrieving revision 1.346
diff -c -r1.345 -r1.346
*** mew-summary.el	2000/09/26 12:23:40	1.345
--- mew-summary.el	2000/09/27 12:33:53	1.346
***************
*** 122,127 ****
--- 122,128 ----
    (define-key mew-summary-mode-map "p"    'mew-summary-display-up)
    (define-key mew-summary-mode-map "N"    'mew-summary-display-review-down)
    (define-key mew-summary-mode-map "P"    'mew-summary-display-review-up)
+   (define-key mew-summary-mode-map "\en"  'mew-summary-find-keyword-down)
    (define-key mew-summary-mode-map "w"    'mew-summary-send)
    (define-key mew-summary-mode-map "W"    'mew-summary-send-to-others)
    (define-key mew-summary-mode-map "B"    'mew-summary-burst)
Index: mew-vars.el
===================================================================
RCS file: /usr/home/kazu/cvsroot/Mew/mew/mew-vars.el,v
retrieving revision 1.310
retrieving revision 1.311
diff -c -r1.310 -r1.311
*** mew-vars.el	2000/09/27 02:58:35	1.310
--- mew-vars.el	2000/09/28 03:50:14	1.311
***************
*** 1676,1681 ****
--- 1676,1685 ----
  
  (defvar mew-prog-shell-arg   "-c")
  
+ (defvar mew-prog-grep "grep")
+ (defvar mew-prog-grep-key-opt "-e")
+ (defvar mew-prog-grep-opts nil)
+ 
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  ;;;
  ;;; Text/Html


Mew-dist メーリングリストの案内