[O] Old entry remains in appt when the original one in org file is changed

2012-01-13 Thread Takafumi Arakaki
I am using org-agenda-to-appt and I noticed a bug.


1. Add the following in the agenda file

* TODO test
  SCHEDULED: 2012-01-14 Sat 12:00

2. Call org-agenda-to-appt

3. Change the SCHEDULED time-stamp in the entry like this

* TODO test
  SCHEDULED: 2012-01-14 Sat 12:00

4. appt-time-msg-list has the old entry

 ((1380)
  #(12:00 TODO test 6 15
(org-heading t))
  t)
 ((1390)
  #(12:10 TODO test 6 15
(org-heading t))
  t)


I guess a workaround will be removing any entries which has
org-heading as property from appt-time-msg-list before adding the new
entries.

I think this guy had the same problem:
http://article.gmane.org/gmane.emacs.orgmode/8008/

--
Takafumi



Re: [O] Old entry remains in appt when the original one in org file is changed

2012-01-16 Thread Takafumi Arakaki
Hi Bernt,

Thanks for your setup recipe. However, I noticed I failed to explain
what I meant; the old entry remains in appt-time-msg-list even if you
call org-agenda-to-appt.

So, the procedure to reproduce my problem is the following:


1. Add the following in the agenda file

* TODO test
 SCHEDULED: 2012-01-14 Sat 12:00

2. Call org-agenda-to-appt

3. Change the SCHEDULED time-stamp in the entry like this

* TODO test
 SCHEDULED: 2012-01-14 Sat 12:00

4. Call org-agenda-to-appt again  # ADDED THIS

5. appt-time-msg-list has the old entry

 ((1380)
 #(12:00 TODO test 6 15
  (org-heading t))
 t)
 ((1390)
 #(12:10 TODO test 6 15
  (org-heading t))
 t)


I found how to fix this. You can tell org-agenda-to-appt forcefully
clear the old entries by passing non-nil to the first argument of
org-agenda-to-appt.

This is how I use it:


(defun my-org-agenda-to-appt-when-saved ()
 (when (member buffer-file-name (mapcar 'expand-file-name org-agenda-files))
   (org-agenda-to-appt t)))

(add-hook 'after-save-hook 'my-org-agenda-to-appt-when-saved)


Note that this will clear all entries stored in appt, including the
ones unrelated to org-mode. But if you are using appt only from
org-mode, there is no problem.


--
Takafumi



Re: [O] Old entry remains in appt when the original one in org file is changed

2012-01-18 Thread Takafumi Arakaki
Hi Bernt,

 My recipe clears the list each time the agenda is generated.  I only use
 appt for org-mode appointments so clearing the list works great for me.

Sorry I missed (setq appt-time-msg-list nil) in your setup code.  This
is exactly what happens when you pass non-nil for REFRESH argument of
org-agenda-to-appt.



[O] [PATCH] Use font-lock-face property in org-src-font-lock-fontify-block?

2012-09-27 Thread Takafumi Arakaki
Hi,

I am trying to use org-src.el bundled in org-mode to support syntax
highlighgint for multiple languages in my IPython notebook client in
Emacs (EIN) [1].  It works very well but I need to patch (please see the
attached file) it to use. The problem is that fontification is gone when I
edit the buffer.  I found that I can workaround this problem by
putting font-lock-face property instead of face property.

When the fontification vanishes,

(text-properties-at (point))

returns

(font-lock-fontified t fontified t)

Before the fontification vanishes (before inserting a cell),

(text-properties-at (point))

returns this at the same point:

(font-lock-multiline t face font-lock-keyword-face
font-lock-fontified t fontified t)

I couldn't reproduce this problem outside of EIN (in org-mode or
other plain buffers).


I am thinking about including my version of
org-src-font-lock-fontify-block in EIN, but Dan Davison suggested to
ask in this ML because it could be a problem in org-mode too.
Does anyone know what is happening here?  Could this happen in
org-mode too?


See [2] for the original discussion.

[1] https://github.com/tkf/emacs-ipython-notebook/
[2] https://github.com/tkf/emacs-ipython-notebook/issues/2


org-src.patch
Description: Binary data


Re: [O] [PATCH] Use font-lock-face property in org-src-font-lock-fontify-block?

2012-09-28 Thread Takafumi Arakaki
Hi Bastien,

Thanks. I will bundle my version of the function in my module while
watching development of org-src.el.  I will report again if I find
something.

Takafumi


On Fri, Sep 28, 2012 at 8:53 AM, Bastien b...@altern.org wrote:
 Hi Takafumi,

 Takafumi Arakaki aka@gmail.com writes:

 I am thinking about including my version of
 org-src-font-lock-fontify-block in EIN, but Dan Davison suggested to
 ask in this ML because it could be a problem in org-mode too.

 I'm not sure I understand the problem you are trying to fix for your own
 code here but things work fine here in Org.

 Does anyone know what is happening here?

 Not really.   Do you always need this or is it just for some modes?
 Maybe those modes use `font-lock-face' while other modes use `face'
 and highlighting in Src Blocks would need to add `font-lock-face' in
 the first case while just adding `face' in  the second one.

 Perhaps adding both is some extra security...  but I'd rather wait
 for a real bug in Org :)

 Thanks anyway for reporting this,

 --
  Bastien



[O] [PATCH] Escape slashes in ARCHIVE_OLPATH

2012-11-05 Thread Takafumi Arakaki
Currently information about tree structure is lost if you have a slash
in node headings.  This patch fixes the problem by escaping slashes in
headings before concatenating them.

Takafumi


archive_olpath.patch
Description: Binary data


[O] [PATCH] Fix org-entry-put (trouble with org-columns-edit-value)

2012-11-06 Thread Takafumi Arakaki
I have a trouble with org-columns-edit-value; updating property using
this command breaks property formatting.

If I update MyProp_B in,

   :PROPERTIES:
   :MyProp_A: a
   :MyProp_B: b
   :END:

I end up with:

   :PROPERTIES:
   :MyProp_A: :MyProp_B: x a

   :END:


I found that (match-beginning 0) returns different value after
(delete-region (match-beginning 0) (match-end 0)).  The strange thing
is that I could not reproduce it in plain Emacs without loading my
init.el.

I am using a few week older version from Emacs trunk.
emacs-version: 24.2.50.1
emacs-bzr-version: 110740 r...@gnu.org-20121030101856-aimepc487hfjuqqs


I will try to reproduce the bug after updating Emacs (probably to the
24.3 release branch) and org-mode later.  But I thought I'd share the
patch first.


org-entry-put.patch
Description: Binary data


Re: [O] [PATCH] Fix org-entry-put (trouble with org-columns-edit-value)

2012-11-09 Thread Takafumi Arakaki
Hi,
Thanks for the reply.
Do you know if it is fixed in both master and maint, or only in master?

---
Takafumi


On Fri, Nov 9, 2012 at 9:58 AM, Nicolas Goaziou n.goaz...@gmail.com wrote:
 Hello,

 Takafumi Arakaki aka@gmail.com writes:

 I have a trouble with org-columns-edit-value; updating property using
 this command breaks property formatting.

 If I update MyProp_B in,

:PROPERTIES:
:MyProp_A: a
:MyProp_B: b
:END:

 I end up with:

:PROPERTIES:
:MyProp_A: :MyProp_B: x a

:END:


 I found that (match-beginning 0) returns different value after
 (delete-region (match-beginning 0) (match-end 0)).  The strange thing
 is that I could not reproduce it in plain Emacs without loading my
 init.el.

 I am using a few week older version from Emacs trunk.
 emacs-version: 24.2.50.1
 emacs-bzr-version: 110740 r...@gnu.org-20121030101856-aimepc487hfjuqqs


 I will try to reproduce the bug after updating Emacs (probably to the
 24.3 release branch) and org-mode later.  But I thought I'd share the
 patch first.

 I think this was fixed a while ago. I'll wait for your feedback after
 you update Org.


 Regards,

 --
 Nicolas Goaziou



Re: [O] [PATCH] Escape slashes in ARCHIVE_OLPATH

2012-11-09 Thread Takafumi Arakaki
I am not familiar with org-mode test suite but I can try.  Could you
tell me where I can find similar test cases which creates archive
entries?

---
Takafumi

On Fri, Nov 9, 2012 at 9:57 AM, Nicolas Goaziou n.goaz...@gmail.com wrote:
 Hello,

 Takafumi Arakaki aka@gmail.com writes:

 Currently information about tree structure is lost if you have a slash
 in node headings.  This patch fixes the problem by escaping slashes in
 headings before concatenating them.

 Thanks for your patch.

 Would you mind providing a test-case to illustrate the problem? Also,
 could you provide a change log entry for the patch (and use git
 format-patch if possible)?

 + (olpath (mapconcat
 +  (lambda (s)
 +(setq s (replace-regexp-in-string   s))
 +(setq s (replace-regexp-in-string / / s))
 +s)

 I'd rather nest the `replace-regexp-in-string' instead of setq'ing twice
 in a row the same variable. I.e:

   (replace-regexp-in-string
/ / (replace-regexp-in-string   s))


 Regards,

 --
 Nicolas Goaziou



Re: [O] [PATCH] Fix org-entry-put (trouble with org-columns-edit-value)

2012-11-09 Thread Takafumi Arakaki
Thanks, I will check maint first then.

Takafumi

On Fri, Nov 9, 2012 at 2:25 PM, Nicolas Goaziou n.goaz...@gmail.com wrote:
 Hello,

 Takafumi Arakaki aka@gmail.com writes:

 Do you know if it is fixed in both master and maint, or only in
 master?

 I don't know. If it's fixed already, I guess the patch was applied to
 maint.


 Regards,

 --
 Nicolas Goaziou



Re: [O] [PATCH] Escape slashes in ARCHIVE_OLPATH

2012-11-09 Thread Takafumi Arakaki
I thought it would be convenient if there was a macro or something to
setup temporal main org file and temporal archive file.  If there is
nothing like that, then I will just create by my self or use
unwind-protect or something directly.

I remember there is a way to archive in the same file by specifying a
root tree.  This will make test easier, but I guess it is better to
test with a plain configuration first.

Takafumi


On Fri, Nov 9, 2012 at 2:28 PM, Nicolas Goaziou n.goaz...@gmail.com wrote:
 Takafumi Arakaki aka@gmail.com writes:

 I am not familiar with org-mode test suite but I can try.  Could you
 tell me where I can find similar test cases which creates archive
 entries?

 We use ERT.

 There is no test case related to archive entries yet. Though, if you
 write a recipe to reproduce a problem, I can make a test out of it. You
 can also try to implement the test directly. It should go to
 testing/lisp/test-org-archive.el (to be created). Your call.


 Regards,



Re: [O] [PATCH] Fix org-entry-put (trouble with org-columns-edit-value)

2012-12-01 Thread Takafumi Arakaki
I can confirm that the behavior I described still exists.
I checked with the latest version (8d22b119786206bbae98183b0fb61e3ab1b22a43)
in maint branch of org-mode and the latest version (110979) in emacs-24 branch
of Emacs bzr repository.  I also checked with the master branch
(6642177dee3ec04404ebd99391748f373ada3d2a) result was the same.

Takafumi


On Fri, Nov 9, 2012 at 3:34 PM, Takafumi Arakaki aka@gmail.com wrote:
 Thanks, I will check maint first then.

 Takafumi

 On Fri, Nov 9, 2012 at 2:25 PM, Nicolas Goaziou n.goaz...@gmail.com wrote:
 Hello,

 Takafumi Arakaki aka@gmail.com writes:

 Do you know if it is fixed in both master and maint, or only in
 master?

 I don't know. If it's fixed already, I guess the patch was applied to
 maint.


 Regards,

 --
 Nicolas Goaziou



Re: [O] [PATCH] Fix org-entry-put (trouble with org-columns-edit-value)

2012-12-07 Thread Takafumi Arakaki
It turned out that the bug I encountered was due to
after-change-function in flyspell-lazy.  It alters the
match data that's why org-entry-put worked unexpectedly.

https://github.com/rolandwalker/flyspell-lazy/pull/4


On Sun, Dec 2, 2012 at 9:39 AM, Nicolas Goaziou n.goaz...@gmail.com wrote:
 Takafumi Arakaki aka@gmail.com writes:

 I can confirm that the behavior I described still exists.
 I checked with the latest version (8d22b119786206bbae98183b0fb61e3ab1b22a43)
 in maint branch of org-mode and the latest version (110979) in emacs-24 
 branch
 of Emacs bzr repository.  I also checked with the master branch
 (6642177dee3ec04404ebd99391748f373ada3d2a) result was the same.

 OK thanks for the confirmation. Could you provide an ECM (or better:
 write an ERT test) for it?


 Regards,

 --
 Nicolas Goaziou



Re: [O] Inserting a comma as prefix of headlines (in Org code blocks)

2013-03-01 Thread Takafumi Arakaki
Hi,

Indeed, orgparse can parse only subset of org syntax.  It is primary
developed for OrgViz [1] which is an app to view your org files in
various formats including calendar, graph and table.  That's why it
doesn't understand babel stuff.  I thought I'd advertise it in org
ML at some point but I was too lazy to do that.

As orgparse supports `:PROPERTIES:', I think it is not hard to support
babel syntax.  If somebody can write a patch I am happy to review and
pull it.

[1] https://github.com/tkf/orgviz


On Thu, Feb 28, 2013 at 9:06 PM, Yagnesh Raghava Yakkala h...@yagnesh.org 
wrote:

 [CC'ed to Takafumi Arakaki, author of orgparse]

 Hello François,

 Do you know happen to know how conforming it is?

 I can't comment on that, since I haven't really used it for anything.

 I wrote many ad hoc parsers for Org already, but what I would like
 is something really close to the parser which comes with the new
 exporter, both in syntax and concept nomenclature,

 AFAIU it is pretty cleanly written and even includes tests., though its just a
 reader and can't be used for exporting right now. By glancing through It seems
 it doesn't entirely know Org's syntax, especially babel related.

 tkf may tell us more.

 Thanks.,
 --
 ఎందరో మహానుభావులు అందరికి వందనములు.
 YYR



[O] [PATCH] Support hour in repeated task cookie

2012-03-27 Thread Takafumi Arakaki
Hi,

Basically, this patch changes all occurrence of [dwmy] with
[hdwmy] and adds (h . hour) to whata of org-auto-repeat-maybe.

I think it is better to have some constant to indicate dwmy.  So,
this pull request is rather a proof-of-concept and a feature request.
I didn't try to do it by myself because I thought org developers might
have some preference to how to add this constant.  If somebody who can
commit the change can add a constant and introduce h for repeated
cookie, please do it.  If you think I should create another patch to
add the constant, please give me a name of the constant.   How should
we call dwmy?  Time unit chars or something like that?  If the
current patch is acceptable, it is fine for me.  Maybe you want to introduce
some constants afterward.

Best,
Takafumi
From bd1a22fe245c5e2e33979b4b351bfb4564e83825 Mon Sep 17 00:00:00 2001
From: Takafumi Arakaki aka@gmail.com
Date: Tue, 27 Mar 2012 22:55:39 +0200
Subject: [PATCH 1/2] Support hour in repeated task cookie

Basically, this patch changes all occurrence of [dwmy] with
[hdwmy] and adds (h . hour) to whata of org-auto-repeat-maybe.
---
 lisp/org.el |   38 +++---
 1 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 04c5c62..2981b0f 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -683,7 +683,7 @@ An entry can be toggled between QUOTE and normal with
   :type 'string)
 
 (defconst org-repeat-re
-  [0-9]\\{4\\}-[0-9][0-9]-[0-9][0-9] [^\n]*?\\([.+]?\\+[0-9]+[dwmy]\\(/[0-9]+[dwmy]\\)?\\)
+  [0-9]\\{4\\}-[0-9][0-9]-[0-9][0-9] [^\n]*?\\([.+]?\\+[0-9]+[hdwmy]\\(/[0-9]+[hdwmy]\\)?\\)
   Regular expression for specifying repeated events.
 After a match, group 1 contains the repeat expression.)
 
@@ -7919,7 +7919,7 @@ and still retain the repeater to cover future instances of the task.
 (if (not (and (integerp n) ( n 0)))
 	(error Invalid number of replications %s n))
 (if (and (setq doshift (and (stringp shift) (string-match \\S- shift)))
-	 (not (string-match \\`[ \t]*\\+?\\([0-9]+\\)\\([dwmy]\\)[ \t]*\\'
+	 (not (string-match \\`[ \t]*\\+?\\([0-9]+\\)\\([hdwmy]\\)[ \t]*\\'
 shift)))
 	(error Invalid shift specification %s shift))
 (when doshift
@@ -7937,7 +7937,7 @@ and still retain the repeater to cover future instances of the task.
 (setq end (point))
 (setq template (buffer-substring beg end))
 (when (and doshift
-	   (string-match [^\n]+ [.+]?\\+[0-9]+[dwmy][^\n]* template))
+	   (string-match [^\n]+ [.+]?\\+[0-9]+[hdwmy][^\n]* template))
   (delete-region beg end)
   (setq end beg)
   (setq nmin 0 nmax (1+ nmax) n-no-remove nmax))
@@ -7968,7 +7968,7 @@ and still retain the repeater to cover future instances of the task.
 		(while (re-search-forward org-ts-regexp nil t)
 		  (save-excursion
 		(goto-char (match-beginning 0))
-		(if (looking-at [^\n]+\\( +[.+]?\\+[0-9]+[dwmy]\\))
+		(if (looking-at [^\n]+\\( +[.+]?\\+[0-9]+[hdwmy]\\))
 			(delete-region (match-beginning 1) (match-end 1)))
 	(setq task (buffer-string)))
 	  (insert task))
@@ -11870,7 +11870,7 @@ This function is run automatically after each state change to a DONE state.
 	 (aa (assoc last-state org-todo-kwd-alist))
 	 (interpret (nth 1 aa))
 	 (head (nth 2 aa))
-	 (whata '((d . day) (m . month) (y . year)))
+	 (whata '((h . hour) (d . day) (m . month) (y . year)))
 	 (msg Entry repeats: )
 	 (org-log-done nil)
 	 (org-todo-log-states nil)
@@ -11906,7 +11906,7 @@ This function is run automatically after each state change to a DONE state.
 	(setq type (if (match-end 1) org-scheduled-string
 		 (if (match-end 3) org-deadline-string Plain:))
 	  ts (match-string (if (match-end 2) 2 (if (match-end 4) 4 0
-	(when (string-match \\([.+]\\)?\\(\\+[0-9]+\\)\\([dwmy]\\) ts)
+	(when (string-match \\([.+]\\)?\\(\\+[0-9]+\\)\\([hdwmy]\\) ts)
 	  (setq	n (string-to-number (match-string 2 ts))
 		what (match-string 3 ts))
 	  (if (equal what w) (setq n (* n 7) what d))
@@ -11935,7 +11935,7 @@ This function is run automatically after each state change to a DONE state.
 	  ;; rematch, so that we have everything in place for the real shift
 	  (org-at-timestamp-p t)
 	  (setq ts (match-string 1))
-	  (string-match \\([.+]\\)?\\(\\+[0-9]+\\)\\([dwmy]\\) ts
+	  (string-match \\([.+]\\)?\\(\\+[0-9]+\\)\\([hdwmy]\\) ts
 	  (org-timestamp-change n (cdr (assoc what whata)))
 	  (setq msg (concat msg type   org-last-changed-timestamp  
   (setq org-log-post-message msg)
@@ -11982,7 +11982,7 @@ can either be an Org date like \2011-07-24\ or a delta like \+2d\.
 (let* ((old-date (org-entry-get nil DEADLINE))
 	   (repeater (and old-date
 			  (string-match
-			   \\([.+-]+[0-9]+[dwmy]\\(?:[/ ][-+]?[0-9]+[dwmy]\\)?\\) ?
+			   \\([.+-]+[0-9]+[hdwmy]\\(?:[/ ][-+]?[0-9]+[hdwmy]\\)?\\) ?
 			   old-date)
 			  (match-string 1 old-date
   (if remove
@@ -12030,7 +12030,7 @@ either be an Org date

Re: [O] [PATCH] Support hour in repeated task cookie

2012-03-31 Thread Takafumi Arakaki
No comments? No one wants to have +3h in SCHEDULED?

--
Takafumi



Re: [O] [PATCH] Support hour in repeated task cookie

2012-04-26 Thread Takafumi Arakaki
Hi, Bastien

Thanks for the patch and I am sorry for this late reply (especially
because I pushed maintainers to review my patch before...).

Anyway, I tried the head of master
(580add2f4148fea949a4db5550577911ee6d756e) and it works fine for me.
But I couldn't reproduce this behavior:

 Note that timestamps need to be well formatted.  If there is
 a +3d repeat cookie and the original timestamp doesn have any
 indication for the hour, it will produce an error.

(BTW, you mean +3h, right?)  There is no change in the SCHEDULE time
stamp, but I've got state change log and LAST_REPEAT in PROPERTIES.
Note that I have `(setq org-log-into-drawer t)' in my configuration.
Resulting tree was something like this (I changed the state to DONE
three times):

* TODO Test
  SCHEDULED: 2012-04-26 Thu +3h
  :LOGBOOK:
  - State DONE   from TODO[2012-04-26 Thu 16:16]
  - State DONE   from TODO[2012-04-26 Thu 16:16]
  - State DONE   from TODO[2012-04-26 Thu 16:16]
  :END:
  :PROPERTIES:
  :LAST_REPEAT: [2012-04-26 Thu 16:16]
  :END:


Regarding not using constant for dwmy.

 I didn't replace dwmy by a constant though, this is not expected
 to change anymore.

I think somebody may want to have minute cookie.  And in that case,
repeating the same task is tiresome.  I didn't put minute in my patch
simply because I didn't know what letter I should use.  I guess no one
wants second or century though.  So maybe we should decide what letter
to use for minute and change dwmy again, if you don't like the
constant solution?

--
Takafumi