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

[mhc:02161] Re: mhc-goto-date


> C-c.g (mhc-goto-month) だと指定した日付にはとべないのと
> 日付のguessををしてほしかったのでmhc-goto-dateをつくってみました。
> #mhc-goto-dayはmhc-goto-todayのパクリです。


mhc-goto-month の置き換えでもいいかと思いましたが,
今一,guess をして欲しいという意図がよく分かりません.

# C-c.. した直後に M-x mhc-goto-date した場合,guess の結果が
# とても変な気がするのです.こういう風には使わない?

mhc-goto-today そのものを書換えて↓のようにしてみました.
mhc-goto-date も若干いじっています.
guess に失敗したときには,今日の日付の方がよくないでしょうか.

(defun mhc-goto-date (&optional hide-private)
  "*Show schedules of specified date.
If HIDE-PRIVATE, private schedules are suppressed."
    (if mhc-default-hide-private-schedules
	(not current-prefix-arg)
  (let* ((owin (get-buffer-window (current-buffer)))
         (buf (mhc-summary-get-import-buffer))
          (win (if buf (get-buffer-window buf) nil))
          date daten)
      (when win (select-window win))
      (let* ((current-date (mhc-date-now)))
        (setq date (car (mhc-input-day "Date: " current-date (mhc-guess-date))))
        (setq daten (mhc-date-let date
                      (mhc-date-new yy mm dd))))
      (select-window owin)
    (mhc-goto-month daten hide-private)
    (mhc-goto-today nil date))))

(defun mhc-goto-today (&optional no-display xday)
  "*Go to the line of today's schedule or first day of month.
Unless NO-DISPLAY, display it. if xday is set, take xday to be today."
  (interactive "P")
  (let ((now (or xday (mhc-date-now)))
	(buf-date (mhc-current-date-month)))
    (when buf-date
      (goto-char (point-min))
      (mhc-date-let now
	(if (and (= yy (mhc-date-yy buf-date))
		 (= mm (mhc-date-mm buf-date)))
	    (when (mhc-summary-search-date now)
	      (forward-line 0)
	      (or (pos-visible-in-window-p (point))
	      (or no-display
	  (when (and mhc-use-wide-scope
		     (mhc-summary-search-date (mhc-date-mm-first buf-date)))
	    (forward-line 0)
	    (or (pos-visible-in-window-p (point))
	    (or no-display
      ;; Emacs-21.3.50 something wrong