From: "Joe Vornehm Jr." <joe.vornehm@gmail.com>
To: emacs-orgmode@gnu.org
Subject: [PATCH] Fix regexps in org-clock.el
Date: Sat, 31 Dec 2011 02:34:03 -0500 [thread overview]
Message-ID: <4EFEBAEB.2090808@gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 780 bytes --]
I have been seeing persistent errors of "Cannot restart clock because task does not contain unfinished clock" when auto-resuming a saved (persistent) clock. I believe I've tracked the error down to an extraneous space in a regexp ("^[ \t]* " when it should be "^[ \t]*").
This patch fixes the issue for me (in `org-clock-in'), and it makes the same change in `org-clock-find-position'. I've tested this briefly and it works for me; nothing about clocking-in behavior seems to break, and persistent clocks work now.
I've also wrapped `regexp-quote' around instances where org-clock-string is used to build a regexp, in case someone puts funny characters in their org-clock-string.
Hopefully, the patch is attached correctly and Thunderbird didn't mangle it.
Cheers!
Joe V.
[-- Attachment #2: 0001-Fix-regexps-in-org-clock.el.patch --]
[-- Type: text/plain, Size: 2195 bytes --]
From c9d76b191d665e51aa3cea42b86befdc2fe4390c Mon Sep 17 00:00:00 2001
From: Joe Vornehm Jr <vornehm@optics.rochester.edu>
Date: Sat, 31 Dec 2011 02:05:55 -0500
Subject: [PATCH] Fix regexps in org-clock.el
* org-clock.el (org-clock-in): Remove extraneous space from regexp
used to find dangling clock lines when resuming a clock. Also apply
`regexp-quote' where org-clock-string is used in a regexp.
(org-clock-find-position): Remove extraneous space from regexp used to
find dangling clock lines when resuming a clock. Also apply
`regexp-quote' where org-clock-string is used in a regexp.
I have been seeing errors of "Cannot restart clock because task does
not contain unfinished clock" when auto-resuming a saved (persistent)
clock. Deleting the extra space (in `org-clock-in' at least) puts an
end to these errors.
TINYCHANGE
---
lisp/org-clock.el | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index b29f47b..7ad76d5 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -1115,7 +1115,7 @@ the clocking selection, associated with the letter `d'."
(cond
((and org-clock-in-resume
(looking-at
- (concat "^[ \t]* " org-clock-string
+ (concat "^[ \t]*" (regexp-quote org-clock-string)
" \\[\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}"
" *\\sw+\.? +[012][0-9]:[0-5][0-9]\\)\\][ \t]*$")))
(message "Matched %s" (match-string 1))
@@ -1239,7 +1239,7 @@ line and position cursor in that line."
(or (bolp) (newline))
(point)))
(end (progn (outline-next-heading) (point)))
- (re (concat "^[ \t]*" org-clock-string))
+ (re (concat "^[ \t]*" (regexp-quote org-clock-string)))
(cnt 0)
(drawer (if (stringp org-clock-into-drawer)
org-clock-into-drawer "LOGBOOK"))
@@ -1247,7 +1247,7 @@ line and position cursor in that line."
(goto-char beg)
(when (and find-unclosed
(re-search-forward
- (concat "^[ \t]* " org-clock-string
+ (concat "^[ \t]*" (regexp-quote org-clock-string)
" \\[\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}"
" *\\sw+ +[012][0-9]:[0-5][0-9]\\)\\][ \t]*$")
end t))
--
1.7.5.1
next reply other threads:[~2011-12-31 7:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-31 7:34 Joe Vornehm Jr. [this message]
2011-12-31 8:06 ` [PATCH] Fix regexps in org-clock.el Carsten Dominik
2011-12-31 23:21 ` Joe Vornehm Jr.
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4EFEBAEB.2090808@gmail.com \
--to=joe.vornehm@gmail.com \
--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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.