top  Index  Search  Changes  RSS  Login

MultiLineToDo

TODOを複数行にわたって書けたらいいな - 2ch3:720

どんなときにそれが欲しくなるのか, あんまり想像がついてないのですが…

;; ToDo の行末が「\」だったら, 次の行もメニューや ToDo 一覧に表示.
;; 味見用に, とりあえず非効率なやっつけ実装.
;; howm-test090502 でテスト.

(defun howm-insert-cont (item-list)
  (mapcan #'howm-expand-cont item-list))

(defvar howm-cont-regexp "\\\\$")
(defun howm-cont-p (item)
  (string-match howm-cont-regexp (howm-item-summary item)))

(defun howm-expand-cont (item)
  (let ((ans (howm-expand-cont-sub item)))
    ;; reset pages of succeeding items so that
    ;; formatters don't try howm-todo-parse to them.
    (mapc (lambda (i) (howm-item-set-page i (howm-make-page:nil)))
          (cdr ans))
    ans))

(defun howm-expand-cont-sub (item)
  (and item
       (cons item (and (howm-cont-p item)
                       (howm-expand-cont-sub (howm-cont-item item))))))

(defun howm-cont-item (item)
  (howm-item-with-temp-buffer
   item
   (lambda (item)
     (and (= (forward-line) 0)
          (howm-make-item (howm-item-page item)
                          (buffer-substring-no-properties
                           (line-beginning-position) (line-end-position))
                          ;; actually (1+ (howm-item-place item))
                          (riffle-get-place))))))

(defadvice riffle-line-number (around widen activate)
  (save-restriction
    (widen)
    ad-do-it))

(defadvice howm-todo-menu (around insert-cont activate)
  ad-do-it
  (setq ad-return-value (howm-insert-cont ad-return-value)))

(defadvice howm-list-reminder-final-setup (around
                                           insert-cont
                                           (&optional name item-list)
                                           activate)
  (setq item-list (howm-insert-cont item-list))
  ad-do-it)

(Please LogIn to post comments.)

Last modified:2009/05/23 22:14:29
Keyword(s):
References:[アイデア]