emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Richard <theonewiththeevillook@yahoo.fr>
To: emacs-orgmode@gnu.org
Subject: org-time-stamp adds "repeater" where there is none.
Date: Fri, 13 Feb 2015 17:01:52 +0100	[thread overview]
Message-ID: <87zj8hol5b.fsf@yahoo.fr> (raw)

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

             reply	other threads:[~2015-02-13 16:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-13 16:01 Nicolas Richard [this message]
2015-02-13 20:56 ` org-time-stamp adds "repeater" where there is none Nicolas Goaziou
2015-02-16 11:00   ` Nicolas Richard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zj8hol5b.fsf@yahoo.fr \
    --to=theonewiththeevillook@yahoo.fr \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).