[O] Patch: Customize failure for org-agenda-custom-commands

2012-03-19 Thread Joe Vornehm Jr.

The Customize interface for org-agenda-custom-commands fails for agenda 
commands with an org-agenda-entry-types command option.  The reason it fails is 
that the org-agenda-entry-types option should be a quoted list, but the 
defcustom expression doesn't add the quote properly.  A patch is below.

To reproduce the error:
1. M-x customize-variable RET org-agenda-custom-commands
2. Click the first INS button
3. Choose a convenient access key and description (or leave them as defaults -- I used 
access key x)
4. Click the second Value Menu button (currently set to Tags/Property match (all agenda 
files)) and choose Agenda
5. Under Local settings for this command. Remember to quote values:, click INS
6. Click the new Value Menu button and choose Set daily/weekly entry types
7. C-c C-c   (sets Customize variable for the current session)
8. M-x org-agenda RET x (or just C-c a x) -- you'll get an empty agenda buffer and the 
error message Symbol's function definition is void: :deadline.

I haven't checked whether there are other quoting issues in the customization 
definition for org-agenda-custom-commands but thought I would submit the patch 
anyway.

Joe V.


Patch:

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 1b033e8..2e74d5d 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -306,11 +306,13 @@ you can \misuse\ it to also add other text to the 
header.  However,
 (string :tag +tag or -tag
 (list :tag Set daily/weekly entry types
   (const org-agenda-entry-types)
-  (set :greedy t :value (:deadline :scheduled :timestamp :sexp)
-   (const :deadline)
-   (const :scheduled)
-   (const :timestamp)
-   (const :sexp)))
+  (list
+   (const :format  quote)
+   (set :greedy t :value (:deadline :scheduled :timestamp :sexp)
+(const :deadline)
+(const :scheduled)
+(const :timestamp)
+(const :sexp
 (list :tag Standard skipping condition
   :value (org-agenda-skip-function '(org-agenda-skip-entry-if))
   (const org-agenda-skip-function)




Re: [O] [PATCH] Fix regexps in org-clock.el

2011-12-31 Thread Joe Vornehm Jr.
Thanks -- understood.  I checked org-clock.el for uses of org-clock-string
in regexps but failed to check other files.

Joe V.

On Sat, Dec 31, 2011 at 3:06 AM, Carsten Dominik
carsten.domi...@gmail.comwrote:

 Applied, thanks.

 But I have removed the regexp-quote again, because org-clock-string
 is used in many more regexps, and a more complete patch would be
 needed to make this change meaningful.

 - Carsten

 On 31.12.2011, at 08:34, Joe Vornehm Jr. wrote:

  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.
 
 
  0001-Fix-regexps-in-org-clock.el.patch




[O] [PATCH] Fix regexps in org-clock.el

2011-12-30 Thread Joe Vornehm Jr.

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.


From c9d76b191d665e51aa3cea42b86befdc2fe4390c Mon Sep 17 00:00:00 2001
From: Joe Vornehm Jr vorn...@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