- (if (and str (string-match "^[ \t]+" str))
- (let ((new (replace-match "" nil nil str)))
- (ad-set-arg 1 new))))))
+ (ad-set-arg 1
+ (cond ((null str) nil)
+ ((and mdw-diary-for-org-mode-p
+ (string-match (concat
+ "^[ \t]*"
+ "\\(" diary-time-regexp
+ "\\(-" diary-time-regexp "\\)?"
+ "\\)[ \t]+")
+ str))
+ (replace-match "\\1 " nil nil str))
+ ((string-match "^[ \t]+" str)
+ (replace-match "" nil nil str))
+ ((and (not mdw-diary-for-org-mode-p)
+ (string-match "\\[\\[[^][]*]\\[\\([^][]*\\)]]"
+ str))
+ (replace-match "\\1" nil nil str))
+ (t str))))))