[mew-dist 28372] "&" -- mew-summary-thread-child()

KOIE Hidetaka ( 鯉江英隆 ) hide at example.com
2008年 4月 30日 (水) 12:42:02 JST


^と&でいったりきたりできないのもなんなので
&もsmewをつかえるようにしました。

ただ、mew-summary-thread-child-global()は
smewに渡すオプションとエラーメッセージ以外は
mew-summary-parent-global()とおなじです...

--
KOIE Hidetaka <hide at example.com>
-------------- next part --------------
Index: mew-thread.el
===================================================================
RCS file: /cvsmew/mew/mew-thread.el,v
retrieving revision 1.146
diff -c -F^( -r1.146 mew-thread.el
*** mew-thread.el	19 Mar 2008 09:14:00 -0000	1.146
--- mew-thread.el	30 Apr 2008 03:33:34 -0000
*************** (defun mew-summary-thread-child ()
*** 746,765 ****
    (interactive)
    (mew-summary-goto-message)
    (mew-decode-syntax-delete)
    (let ((pos (point))
! 	(my-id (mew-summary-my-id))
! 	key)
!     (if (or (null my-id) (string= my-id ""))
! 	(message "No child")
!       (setq key (mew-regex-sumsyn-par-id my-id))
!       (if (or (re-search-forward  key nil t)
! 	      (re-search-backward key nil t))
! 	  (progn
! 	    (mew-thread-move-cursor)
! 	    (mew-summary-display)
! 	    (message "Child found"))
! 	(goto-char pos)
! 	(message "Child not found")))))
  
  (defun mew-summary-thread-sibling-up ()
    "Search backward by one sibling message of the current message."
--- 746,799 ----
    (interactive)
    (mew-summary-goto-message)
    (mew-decode-syntax-delete)
+   (let ((my-id (mew-summary-my-id)) result)
+     (cond
+      ((or (null my-id) (string= my-id ""))
+       (message "No child"))
+      ((mew-summary-thread-child-local my-id)
+       (message "Child found"))
+      ((and (y-or-n-p "No child in this folder. Find in others? ")
+            (setq result (mew-summary-thread-child-global my-id)))
+       (if (eq result t)
+ 	  (message "Child found")
+ 	(message "%s" result)))
+      (t
+       (message "Child not found")))))
+ 
+ (defun mew-summary-thread-child-local (my-id)
    (let ((pos (point))
!         (key (mew-regex-sumsyn-par-id my-id)))
!   (if (or (re-search-forward  key nil t)
!           (re-search-backward key nil t))
!       (progn
!         (mew-thread-move-cursor)
!         (mew-summary-display)
!         t)
!     (goto-char pos)
!     nil)))
! 
! (defun mew-summary-thread-child-global (my-id)
!   (mew-msgid-check
!    (let ((db (mew-expand-file "+" mew-id-db-file))
! 	 (regex (format "\\(.*\\)/\\([0-9]+\\)\\(%s\\)?$" (regexp-quote mew-suffix)))
! 	 path msg folder)
!      (with-temp-buffer
!        (mew-piolet mew-cs-text-for-read mew-cs-text-for-write
! 	 (call-process mew-prog-smew nil t nil "-c" db my-id "")
! 	 (goto-char (point-min))
! 	 (when (looking-at regex)
! 	   (setq path (mew-match-string 1))
! 	   (setq msg (mew-match-string 2)))))
!      (if (not msg)
! 	 nil
!        (setq folder (mew-folder-path-to-folder path))
!        (when folder
! 	 (mew-summary-visit-folder folder nil 'no-ls)
! 	 (if (mew-summary-search-msg msg)
! 	     (progn
! 	       (mew-summary-display)
! 	       t)
! 	   "Child not found. Scan 'update would be necessary"))))))
  
  (defun mew-summary-thread-sibling-up ()
    "Search backward by one sibling message of the current message."
Index: bin/smew
===================================================================
RCS file: /cvsmew/mew/bin/smew,v
retrieving revision 1.5
diff -c -F^( -r1.5 smew
*** bin/smew	12 Mar 2008 08:34:36 -0000	1.5
--- bin/smew	30 Apr 2008 03:33:34 -0000
***************
*** 97,102 ****
--- 97,108 ----
    end
  end
  
+ def search_child(hash, db, myid, mydir)
+   parents = select_by_parid(hash, db, [myid], mydir)
+   exit unless parents != []
+   return parents[0]
+ end
+ 
  ################################################################
  ##
  ## Main
***************
*** 108,113 ****
--- 114,120 ----
  OptionParser.new {|opt|
    begin
      opt.on('-p', 'search a parent message only') {|v| opts[:p] = v }
+     opt.on('-c', 'search a child message only') {|v| opts[:c] = v }
      opt.parse!(ARGV)
    rescue OptionParser::ParseError => e
      puts opt
***************
*** 127,132 ****
--- 134,142 ----
    if opts[:p]
      my = search_me(hash, db, myid, mydir)
      puts my['path'];
+   elsif opts[:c]
+     my = search_child(hash, db, myid, mydir)
+     puts my['path'];
    else
      my = search_me(hash, db, myid, mydir)
      search_ancestors(hash, db, my['parid'], mydir)


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