[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
(format
"Import buffer: ")
(current-buffer))))))
(let ((draft-buffer (generate-new-buffer mhc-draft-buffer-name))
(current-date (mhc-current-ddate))
(succeed t)
sch old)
(and (interactive-p)
(mhc-window-push))
(set-buffer draft-buffer)
(if import-buffer
(progn
(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
(progn
(delete-other-windows)
(if (y-or-n-p "Do you want to import this article? ")
(progn
(setq old (mhc-sch-new-from-buffer))
;; input date
(mhc-sch-set-day sch (mhc-input-day
"Date: "
(mhc-sch-day old)
(gdate-guess-date)))
;; input time
(apply 'mhc-sch-set-time
sch
(mhc-input-time
"Time: "
(if (mhc-sch-time old)
(mhc-sch-time-as-string old))
(gdate-guess-time
(mhc-minibuf-candidate-nth-begin)
)))
;; input subject
(mhc-sch-set-subject sch
(mhc-input-subject
"Subject: "
(mhc-misc-sub
(or (mhc-sch-subject old)
(mhc-misc-hdr-value "Subject:"))
"^\\(Re:\\)? *\\(\\[[^\]]+\\]\\)? *"
"")))
;; input location
(mhc-sch-set-location sch
(mhc-input-location
"Location: "
(mhc-sch-location old)))
;; input category
(mhc-sch-set-category
sch
(mhc-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)
(mhc-window-pop))
(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.
(quit
(and (interactive-p)
(mhc-window-pop))
(setq succeed nil)
(kill-buffer draft-buffer)))
(if succeed
(progn
(goto-char (point-min))
(insert (mhc-sch-dump-header sch))
(if import-buffer
()
(goto-char (point-max))
(insert "----\n"))
(mhc-draft-mode)
succeed))))
--
Yuuichi Teranishi (寺西裕一) <teranisi@xxxxxxxxxx>
PGP 5.0i Public Key: http://www.gohome.org/pgp5/teranisi.key
"Love is needing to be loved..."