emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-time-stamp adds "repeater" where there is none.
@ 2015-02-13 16:01 Nicolas Richard
  2015-02-13 20:56 ` Nicolas Goaziou
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Richard @ 2015-02-13 16:01 UTC (permalink / raw)
  To: emacs-orgmode

Consider the following line:

<2015-02-13 ven.> (10h-13h)

Hiting C-c . RET with point on the timestamp gives
<2015-02-13 ven. -13h> (10h-13h)

which is not expected.

Please consider the patch below


From 688851438f363eaa86dcfe2acfb779d6c22adc16 Mon Sep 17 00:00:00 2001
From: Nicolas Richard <theonewiththeevillook@yahoo.fr>
Date: Fri, 13 Feb 2015 16:57:59 +0100
Subject: [PATCH] * lisp/org.el (org-time-stamp): Restrict to timestamp when
 determining repeater.

---
 lisp/org.el | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 7c2419d..6a0e4c6 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -16149,12 +16149,13 @@ (defun org-time-stamp (arg &optional inactive)
 	       (apply 'encode-time (org-parse-time-string (match-string 1)))
 	     (current-time)))
 	 (default-input (and ts (org-get-compact-tod ts)))
-	 (repeater (save-excursion
-	 	     (save-match-data
-	 	       (beginning-of-line)
-	 	       (when (re-search-forward
+	 (repeater (save-match-data
+		     (with-temp-buffer
+		       (insert ts)
+		       (goto-char (point-min))
+		       (when (re-search-forward
 			      "\\([.+-]+[0-9]+[hdwmy] ?\\)+" ;;\\(?:[/ ][-+]?[0-9]+[hdwmy]\\)?\\) ?"
-			      (save-excursion (progn (end-of-line) (point))) t)
+			      nil t)
 			 (match-string 0)))))
 	 org-time-was-given org-end-time-was-given time)
     (cond
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: org-time-stamp adds "repeater" where there is none.
  2015-02-13 16:01 org-time-stamp adds "repeater" where there is none Nicolas Richard
@ 2015-02-13 20:56 ` Nicolas Goaziou
  2015-02-16 11:00   ` Nicolas Richard
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Goaziou @ 2015-02-13 20:56 UTC (permalink / raw)
  To: Nicolas Richard; +Cc: emacs-orgmode

Hello,

Nicolas Richard <theonewiththeevillook@yahoo.fr> writes:

> Consider the following line:
>
> <2015-02-13 ven.> (10h-13h)
>
> Hiting C-c . RET with point on the timestamp gives
> <2015-02-13 ven. -13h> (10h-13h)
>
> which is not expected.

It should now be fixed.

> Please consider the patch below

Thank you for the patch. However, I applied something different.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: org-time-stamp adds "repeater" where there is none.
  2015-02-13 20:56 ` Nicolas Goaziou
@ 2015-02-16 11:00   ` Nicolas Richard
  0 siblings, 0 replies; 3+ messages in thread
From: Nicolas Richard @ 2015-02-16 11:00 UTC (permalink / raw)
  To: Nicolas Richard; +Cc: emacs-orgmode

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
>> <2015-02-13 ven.> (10h-13h)
>>
>> Hiting C-c . RET with point on the timestamp gives
>> <2015-02-13 ven. -13h> (10h-13h)
>>
>> which is not expected.
>
> It should now be fixed.
>
Thanks, works great so far (unlike my own patch, which would fail in
some situations).

-- 
Nicolas

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-02-16 11:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-13 16:01 org-time-stamp adds "repeater" where there is none Nicolas Richard
2015-02-13 20:56 ` Nicolas Goaziou
2015-02-16 11:00   ` Nicolas Richard

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).