+2016-09-28 HIRAOKA Kazuyuki <khi@users.sourceforge.jp>
+
+ * howm-date.el: extend the option howm-insert-date-future.
+ thx > Albert-san (areiner at tph.tuwien.ac.at)
+ https://osdn.jp/projects/howm/lists/archive/eng/2016/000118.html
+ (howm-action-lock-date-future): new option
+ (howm-action-lock-date): support howm-action-lock-date-future
+ (howm-datestr-expand): new value 'closer for FUTURE-P
+
+ * howm-common.el (howm-time-difference-second):
+ support (HIGH LOW) without milliseconds for howm-datestr-expand
+
2016-04-05 HIRAOKA Kazuyuki <khi@users.sourceforge.jp>
* howm.el: modify header comments for MELPA
<h3><a name="label-18" id="label-18">¹¹¿·µÏ¿</a></h3><!-- RDLabel: "¹¹¿·µÏ¿" -->
<p>thx > patch¡¦²þÎÉ°Æ¡¦»ØŦ¤ò¤¯¤À¤µ¤Ã¤¿³§ÍÍ</p>
<ul>
+<li>¥¹¥Ê¥Ã¥×¥·¥ç¥Ã¥ÈÈÇ
+<ul>
+<li>[2016-09-28]
+<ul>
+<li><p>ÆüÉÕÆþÎÏ»þ¤ÎÆ°ºî¤ò³ÈÄ¥
+ <a href="https://osdn.jp/projects/howm/lists/archive/eng/2016/000118.html">thx</a>
+ > Albert-san (areiner at tph.tuwien.ac.at)</p>
+<pre>;; ¡Ö[2003-12-27]¡×¾å¤Ç RET ¤·¤Æǯ¤ä·î¤òά¤·¤¿¤é¡Ä
+(setq howm-action-lock-date-future t) ;; 2003-12-27 ¤è¤ê̤Íè¤È²ò¼á
+;(setq howm-action-lock-date-future 'closer) ;; 2003-12-27 ¤Ë¶á¤¤Êý¤Ç²ò¼á</pre>
+<ul>
+<li><p>¿·µ¬ÆþÎÏ»þ¤Ë¤À¤±¤½¤¦¤¤¤¦Æ°ºî¤Ë¤·¤¿¤±¤ì¤Ð</p>
+<pre>;; ÆüÉÕÆþÎÏ(C-c , d ¤Þ¤¿¤Ï [Æü¢])¤Çǯ¤ä·î¤òά¤·¤¿¤é¡Ä
+(setq howm-insert-date-future t) ;; ¡Ö̤Íè¡×¤È²ò¼á
+;(setq howm-insert-date-future 'closer) ;; º£Æü¤Ë¶á¤¤Êý¤Ç²ò¼á</pre></li>
+</ul></li>
+</ul></li>
+</ul></li>
<li>¥Æ¥¹¥ÈÈÇ
<ul>
<li>[2016-01-01]
thx > patch¡¦²þÎÉ°Æ¡¦»ØŦ¤ò¤¯¤À¤µ¤Ã¤¿³§ÍÍ
+
+* ¥¹¥Ê¥Ã¥×¥·¥ç¥Ã¥ÈÈÇ
+ * [2016-09-28]
+ * ÆüÉÕÆþÎÏ»þ¤ÎÆ°ºî¤ò³ÈÄ¥
+ ((<thx|URL:https://osdn.jp/projects/howm/lists/archive/eng/2016/000118.html>))
+ > Albert-san (areiner at tph.tuwien.ac.at)
+ ;; ¡Ö[2003-12-27]¡×¾å¤Ç RET ¤·¤Æǯ¤ä·î¤òά¤·¤¿¤é¡Ä
+ (setq howm-action-lock-date-future t) ;; 2003-12-27 ¤è¤ê̤Íè¤È²ò¼á
+ ;(setq howm-action-lock-date-future 'closer) ;; 2003-12-27 ¤Ë¶á¤¤Êý¤Ç²ò¼á
+ * ¿·µ¬ÆþÎÏ»þ¤Ë¤À¤±¤½¤¦¤¤¤¦Æ°ºî¤Ë¤·¤¿¤±¤ì¤Ð
+ ;; ÆüÉÕÆþÎÏ(C-c , d ¤Þ¤¿¤Ï [Æü¢])¤Çǯ¤ä·î¤òά¤·¤¿¤é¡Ä
+ (setq howm-insert-date-future t) ;; ¡Ö̤Íè¡×¤È²ò¼á
+ ;(setq howm-insert-date-future 'closer) ;; º£Æü¤Ë¶á¤¤Êý¤Ç²ò¼á
+
* ¥Æ¥¹¥ÈÈÇ
* [2016-01-01]
* ¥Ð¥¤¥È¥³¥ó¥Ñ¥¤¥ë»þ¤Î·Ù¹ð¤ò²óÈò
(defun howm-time-difference-second (ti1 ti0)
(let ((h (- (car ti1) (car ti0)))
(l (- (cadr ti1) (cadr ti0)))
- (m (- (cl-caddr ti1) (cl-caddr ti0)))
+ (m (- (or (cl-caddr ti1) 0) (or (cl-caddr ti0) 0)))
)
(+ (* h 65536) l
(* m 1e-6)
;; insert & action-lock
(defvar howm-insert-date-pass-through nil)
+(defvar howm-action-lock-date-future nil)
(defun howm-insert-date ()
(interactive)
((string-match "^[-+][0-9]+$" c)
(howm-action-lock-date-shift (string-to-number c) date))
((string-match "^[0-9]+$" c)
- (howm-action-lock-date-set c date future-p))
+ (howm-action-lock-date-set c date
+ (or future-p howm-action-lock-date-future)))
((string-match "^~\\([0-9]+\\)$" c)
(howm-action-lock-date-repeat (match-string-no-properties 1 c) date))
((string-match "^[.]$" c)
(format-time-string "%a" (howm-datestr-to-time date)))
(defun howm-datestr-expand (date base &optional future-p)
- (if future-p
- (howm-datestr-expand-future date base)
- (howm-datestr-expand-general date base future-p)))
-
-(defun howm-datestr-expand-future (date base)
- (let ((raw (howm-datestr-expand-general date base nil))
- (future (howm-datestr-expand-general date base t)))
- (when (not (string= raw future))
- (message "Future date"))
- future))
+ (let* ((raw (howm-datestr-expand-general date base nil))
+ (future (howm-datestr-expand-general date base t))
+ (ret
+ (cond ((eq future-p 'closer)
+ (cl-labels ((to-f (d) (float-time (howm-datestr-to-time d)))
+ (delta (d1 d2) (abs (- (to-f d1) (to-f d2)))))
+ (if (< (delta raw base) (delta future base)) raw future)))
+ (future-p future)
+ (t raw))))
+ (unless (string= raw ret)
+ (message "Assume future date"))
+ ret))
(defun howm-datestr-expand-general (date base &optional future-p)
(let* ((base-ymd (howm-datestr-parse base))