[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[mhc:00538] Re: NO default date with mhc-edit in mhc-summary-buffer

At Tue, 25 Apr 2000 19:05:19 +0900,
Hideyuki SHIRAI wrote:
> 寺西さんの
> From: Yuuichi Teranishi/寺西裕一 <teranisi@xxxxxxxxxx> さん曰く
> Subject: [mhc:00472] Re: TODO
> Message-ID: <fzaek8zr7j.wl@xxxxxxxxxxxxxxxxxxxxx>
> Date: Thu, 9 Mar 2000 13:45:56 +0900
> のパッチをあてたところ、Mew では mhc-summary-buffer 上で
> "C-ce (mhc-edit)" したときに、cursor 上の "年月日" が
> mhc-input-day の default に渡らなくなりました。



(defun mhc-edit (&optional import-buffer)
  "Edit a new schedule.
If optional argument IMPORT-BUFFER is specified, import its content.
Returns t if the importation was succeeded."
  (interactive (if current-prefix-arg
		   (list (get-buffer (read-buffer
				       "Import buffer: ")
  (let ((draft-buffer (generate-new-buffer mhc-draft-buffer-name))
	(current-date (mhc-current-ddate))
	(succeed t)
	sch old)
    (and (interactive-p)
    (set-buffer draft-buffer)
    (if import-buffer
	  (insert-buffer import-buffer)
	  (mhc-misc-hdr-delete-list mhc-draft-unuse-hdr-list)))
    (switch-to-buffer draft-buffer t)
    (setq sch (mhc-sch-new))
    (condition-case ()
	(if import-buffer
	      (if (y-or-n-p "Do you want to import this article? ")
		    (setq old (mhc-sch-new-from-buffer))
		    ;; input date
		    (mhc-sch-set-day sch (mhc-input-day
					  "Date: "
					  (mhc-sch-day old)
		    ;; input time
		    (apply 'mhc-sch-set-time
			    "Time: "
			    (if (mhc-sch-time old)
				(mhc-sch-time-as-string old))
		    ;; input subject
		    (mhc-sch-set-subject sch
					  "Subject: "
					   (or (mhc-sch-subject old)
					       (mhc-misc-hdr-value "Subject:"))
					   "^\\(Re:\\)? *\\(\\[[^\]]+\\]\\)? *"
		    ;; input location
		    (mhc-sch-set-location sch
					   "Location: "
					   (mhc-sch-location old)))
		    ;; input category
		      "Category: "
		      (mhc-sch-category old)))
		    (mhc-misc-hdr-delete-list mhc-sch-header-list))
		;; Answer was no.
		(message "") ; flush minibuffer.
		(and (interactive-p)
		(setq succeed nil)
		(kill-buffer draft-buffer)))
	  ;; No import (it succeeds).
	  (mhc-sch-set-day  sch (mhc-input-day "Date: " current-date))
	  (apply 'mhc-sch-set-time sch (mhc-input-time "Time: "))
	  (mhc-sch-set-subject sch (mhc-input-subject "Subject: "))
	  (mhc-sch-set-location sch (mhc-input-location "Location: "))
	  (mhc-sch-set-category sch (mhc-input-category "Category: ")))
      ;; Quit.
       (and (interactive-p)
       (setq succeed nil)
       (kill-buffer draft-buffer)))
    (if succeed
	  (goto-char (point-min))
	  (insert (mhc-sch-dump-header sch))
	  (if import-buffer
	    (goto-char (point-max))
	    (insert "----\n"))

Yuuichi Teranishi (寺西裕一) <teranisi@xxxxxxxxxx>
PGP 5.0i Public Key: http://www.gohome.org/pgp5/teranisi.key
"Love is needing to be loved..."