Re: Help speeding up Org iCal export

2022-01-20 Thread Josh Moller-Mara
I'm running into this issue now.

One thing I noticed is that if you have broken links (and
org-export-with-broken-links is t), org-id-update-id-locations will be
run for every broken link it finds.  This turns out to be quite slow and
unnecessary since no files will have changed in between
org-id-update-id-locations runs during export.

One hacky workaround is to temporarily disable
org-id-update-id-locations, like so:

(cl-letf (((symbol-function 'org-id-update-id-locations)
 (lambda ( files silent) (message "Not updating 
locations"
(let ((org-export-with-broken-links t)
  (gc-cons-threshold 8000))
  (org-icalendar-combine-agenda-files)))

The right solution would probably be to not have broken links in the
first place. :P
Or maybe org-id-update-id-locations could be debounced or cached in some way.

Best,
Josh



Re: Inserting org-mode heading links the org-refile way

2020-05-06 Thread Josh Moller-Mara
Hi,

Here's an example of how to create an ivy prompt that inserts links.

It isn't exactly what you're looking for, as it doesn't hijack
`org-insert-link` functionality, nor does it specifically use
`org-refile-target-verify-function` to do filtering.

Instead, this uses org-ql to select TODO headers with a level of at
least 3. org-ql will cache queries in a manner similar to the initial
collecting of org-refile targets. You can add other filter criteria
using org-ql's sexp query syntax. You can also replace the
`(org-agenda-files)` to be some expression that returns the specific
list of files you're interested in.

(defun jmm/org-ql-ivy-prompt-for-link ()
  "Select a todo header with ivy and insert its link"
  (interactive)
  (ivy-read "Link:"
(->> (org-ql-select (org-agenda-files)
   '(and (todo)
 (level >= 3)
 (not (tags "ARCHIVE")))
   :action 'element-with-markers)
 (-map #'org-ql-view--format-element))
:action (lambda (x)
  (let ((org-id-link-to-org-use-id t)) ; Add an ID if it 
doesn't exist
(insert
 (org-with-point-at (get-text-property 0 'org-hd-marker 
x)
   (org-store-link nil)))

Note: This also uses dash.el functions/macros. You can replace that as
needed.

Best,
Josh

Daryl Manning  writes:

> This looks impressive, and is *similar* to the effect I am going for, but
> what I am looking at is intercepting the `org-insert-link` functionality
> (or replacing it) with the ability to insert a link from the global
> filter-and-select interface via ivy for `org-refile`. So, in other words,
> global access to the (say 3 levels down) headings and files available
> through the ivy interface (which further allows me to filter that down).
>
> This would give me the ability to arbitrarily add links across all files
> (and particularly handy with org-contact for adding in links in cal entries
> for meetings).  Since the viy interface seems to work fine for refiling
> tasks (except for initial load of refile targets), it seems it'd be
> sufficiently performant.
>
> Daryl.



Shift select

2020-03-06 Thread Josh

One more question,

I turned on shift-select with the following line in my .emacs. It works, 
but of course, on headings, it doesn't work because it changes the TODO 
status of the heading (shift left-right) or the priority of the heading 
(shift up-down). How would I make shift select still work on headings, and 
assign those other functions to other bindings?


(setq org-support-shift-select t)

Thanks!

Josh



Binding literal tab to C-Tab

2020-03-06 Thread Josh

Hi all,

I have a need to insert literal tab characters into my org-mode files 
frequently. I would like to bind a key to insert literal tabs (ASCII 9). I 
thought Control-TAB would be a good option. So I inserted the following 
lines into my .emacs file. It works when in normal emacs, but not in 
org-mode. Is there a way to get this to work in org-mode? If this is a bad 
key combination for org-mode, I'm ok switching to another key combo.


(defun my-insert-tab-char ()
  "Insert a tab char. (ASCII 9, \t)"
  (interactive)
  (insert "\t"))

(global-set-key (kbd "C-") 'my-insert-tab-char)

Thanks!

Josh



Re: [O] Macro that calls external program

2019-03-11 Thread Josh

Thanks Ken.

Yes, at first I was trying to accomplish my task with Macros, but after 
finding out that I could run the whole Org file through a pre-filter, I 
realized that this would be a much cleaner and easier way rather than 
having multiple types of macros or code blocks. So now I'm trying to 
figure out how to attach an external program to 
`org-export-before-parsing-hook' or `org-export-before-processing-hook' to 
pipe the entire Org file through...


Josh

On Mon, 11 Mar 2019, Ken Mankoff wrote:


Hi Josh,

On 2019-03-10 at 23:37 +0100, Josh  wrote...

I am new to emacs and orgmode. I spent the last couple days reading
most of the docs before diving in,


Welcome!


but I didn't see anywhere how I could have a macro that instead of
replacing the macro with lisp code, calls an external program instead.

Something like:
#+MACRO: func   call /home/josh/mybinary $1

{{{func(Text Argument)}}}

and this would be setup to call an external program and the output of
the program would replace the macro on export.

/home/josh/mybinary "Text Argument"


I do wonder if you're asking an XY problem, especially after reading your 
follow-up question about running an entire Org file through a pre-filter.

Why does it have to be a macro that you call? Why not #+NAME:'d Babel code 
block, which can (presumably) run any program you want.

 -k.





Re: [O] Macro that calls external program

2019-03-11 Thread Josh

Thanks! This is very helpful.

I have a related question. How can I run an external program right before 
Export that takes as input the current buffer and prints out to stdout an 
updated version of the org file that then is exported? Basically I want to 
pipe the org file through a filter that is an external program before it 
is exported.


Thanks in advance!

Josh


On Sunday, 10 Mar 2019 at 15:37, Josh wrote:

Hi,

I am new to emacs and orgmode. I spent the last couple days reading most
of the docs before diving in, but I didn't see anywhere how I could have a
macro that instead of replacing the macro with lisp code, calls an
external program instead.

Something like:

#+MACRO: func   call /home/josh/mybinary $1


You could maybe do something along the lines of

#+macro: func (eval (shell-command (concat "/home/josh/mybinary " "$1")))

(untested).

--
Eric S Fraga via Emacs 27.0.50, Org release_9.2.2-249-g51444a





[O] Macro that calls external program

2019-03-10 Thread Josh

Hi,

I am new to emacs and orgmode. I spent the last couple days reading most 
of the docs before diving in, but I didn't see anywhere how I could have a 
macro that instead of replacing the macro with lisp code, calls an 
external program instead.


Something like:
#+MACRO: func   call /home/josh/mybinary $1

{{{func(Text Argument)}}}

and this would be setup to call an external program and the output of the 
program would replace the macro on export.


/home/josh/mybinary "Text Argument"

Thanks!

Josh



Re: [O] Bug: Marking repeated tasks with two tags as DONE causes problems

2017-08-11 Thread Josh Moller-Mara
Nicolas Goaziou <m...@nicolasgoaziou.fr> writes:

>
> I still cannot reproduce it.
>
> Does the very recent 10b1cfb0317274a91500562a2872f2626160f079 fix this?
>

Yup. That commit seems to fix it.

Thanks!

Best,
Josh



[O] Bug: Marking repeated tasks with two tags as DONE causes problems

2017-08-11 Thread Josh Moller-Mara

Hello,

I'm starting to encounter a strange, silent problem when switching the
state of a task with multiple tags. With the following minimal example:

#+STARTUP: logdone
#+STARTUP: logdrawer
* TODO Hello :hi:there:
  SCHEDULED: <2017-08-11 Fri .+1d>

Switching The "hello" task from "TODO" to "DONE" should keep the task as
"TODO", but schedule it in the future. Instead, the file ends up looking
like:

#STARTUP: logdone :hi:there:
#+STARTUP: logdrawer
* DONE Hello :hi:there:
  CLOSED: [2017-08-11 Fri 14:57] SCHEDULED: <2017-08-12 Sat .+1d>

Where the task is marked as "DONE", and weirdly tags are added in some
of the startup config at the beginning of the file.

I'm using

Emacs  : GNU Emacs 26.0.50.2 (x86_64-pc-linux-gnu, GTK+ Version 3.22.5)
 of 2017-01-18
Package: Org mode version 9.0.9 (release_9.0.9-746-g8fa6c0 @ 
/usr/local/share/emacs/site-lisp/org/)

There still seems to be a problem with org-toggle-tag, which is causing
this. I think it has to do with the "replace-match"
again. "org-split-string" doesn't save match data, so "replace-match"
replaces the wrong thing.

Best,
Josh



Re: [O] Change in appearance of org-todo-keywords

2017-08-07 Thread Josh Moller-Mara


Nicolas Goaziou <m...@nicolasgoaziou.fr> writes:
> Hello,
>
> Colin Baxter <m43...@yandex.com> writes:
>
>> Yes, you are correct. I can confirm that switching off
>> org-todo-state-tags-triggers removes the insertion of colons for me
>> too.
>
> Fixed. Thank you.
>

Hello,

~org-toggle-tag~ now seems to delete currently set tags for a heading. It
seems that calling ~(match-string 1)~ after ~(replace-match "")~ makes
the former return an empty string, so the ~current~ tags get set as an
empty string. It also still seems to set a blank tag ("::") if there was
a tag set previously.

Best,

Josh



Re: [O] Change in appearance of org-todo-keywords

2017-08-06 Thread Josh Moller-Mara
Colin Baxter <m43...@yandex.com> writes:

> As of today, TODO now appears with three sets of un-requested double
> colons after it, as in TODO :: :: ::
>
> The behaviour doesn't occur with emacs -q, so the cause is presumably in
> my ~/.emacs. I can't work out what's wrong with my org-todo-sequence,
> which is:
>
> (setq org-todo-keywords (quote((sequence "TODO(t)" "STARTED(s)"
>   "NEXT(n@/!)" "WAITING(w@/!)"
>   "HOLD(h@/!)" "CANCELLED(c@/!)"
>   "PHONE(p)"  "BREAK(b)" "MEETING(m)" "DONE(d@/!)"
>   

This is happening with me too. But I suspect it has more to do with
org-todo-state-tags-triggers being set. I don't get the double colons if
I don't set org-todo-state-tags-triggers.

>From what I can tell, doing something like (org-toggle-tag "sometag"
'off) produces these double colons. It seems to have to do with the way
that org-split-string no longer returns nil, but returns ("").

Best,
Josh



[O] Bug: org-clock-sum-current-item/org-clock-get-sum-start not respecting LAST_REPEAT [9.0.9 (release_9.0.9-697-gb0776e @ /usr/local/share/emacs/site-lisp/org/)]

2017-08-05 Thread Josh Moller-Mara

Hey there,

Recently I've found that clocking in to a repeating task is giving me an
incorrect "task time since last repeat". Normally, when I clock into a task,
mark it as done, and clock in again, I expect the starting clock time to
be 0. In this example:

* TODO Stuff
  SCHEDULED: <2017-08-04 Fri +1d>
  :PROPERTIES:
  :LAST_REPEAT: [2017-07-12 Wed 20:02]
  :END:
  :LOGBOOK:
  - State "DONE"   from "TODO"   [2017-07-12 Wed 20:02]
  CLOCK: [2017-07-12 Wed 19:54]--[2017-07-12 Wed 20:02] =>  0:08
  - State "DONE"   from "TODO"   [2017-07-08 Sat 19:14]
  CLOCK: [2017-07-08 Sat 18:49]--[2017-07-08 Sat 19:14] =>  0:25
  - State "DONE"   from "TODO"   [2017-06-05 Mon 15:14]
  CLOCK: [2017-06-05 Mon 14:48]--[2017-06-05 Mon 15:14] =>  0:26
  :END:

clocking in reports that I've spent 8 minutes on the item already, even
though that happened before the LAST_REPEAT. When looking at
(org-clock-sum-current-item (org-clock-get-sum-start))
I'm getting "8" when I should get "0".

This change seems to have started happening after commit 112c5ba47,
which changed org-clock-sum to do something different with daylights
savings.

I'm currently using
Emacs  : GNU Emacs 26.0.50.2 (x86_64-pc-linux-gnu, GTK+ Version 3.22.5)
 of 2017-01-18
Package: Org mode version 9.0.9 (release_9.0.9-697-gb0776e @ 
/usr/local/share/emacs/site-lisp/org/)

Best,
Josh



Re: [O] Problem with org-agenda-clockreport-mode and tag-filtered view in agenda

2015-05-04 Thread Josh Berdine
Resurrecting an old thread that reported a problem that I am also
having: the prefix argument to org-agenda-clockreport-mode seems to be
ignored instead of applying the current filter.

I investigated, and commit 2e9c2d7128e0491491d00b585be83ac688587d00
http://orgmode.org/w/?p=org-mode.git;a=commit;h=2e9c2d7128e0491491d00b585be83ac688587d00
appears to be first one where C-u R does not apply the current filter.
For me, commit 30220ffcdcef45c0237f80a2347d4da19877f64a works as
expected.  I also just checked master and maint, and they both still
ignore the prefix argument.

The commit message contains:

 (org-agenda-clockreport-mode, org-agenda-set-mode-name): Don't
 consider tag filters.

So it seems that this behavior is intended, although the documentation
at http://orgmode.org/manual/Agenda-commands.html still refers to the
old behavior.

Is this assumption correct, and if so is there a different way to filter
the clockreport by tag?

Cheers, Josh



[O] Running Node.js and exporting css.

2014-08-22 Thread Josh Berry
Couple of weeks ago, I accidentally spammed the message board with several
attempts to send up a couple of patches for some problems I was seeing.
 So, firstly, apologies for the spam.

The two problems I was seeing were related to executing js using node.js,
and exporting css with vendor properties.

The node.js problem is that it will start putting in newlines if a
structure is past some size.  I think this may be fixable by changing
some settings in node.js, but it was also easy enough to change the regex
to look past newlines in org.  An example of the problem can be seen by
running the following

  #+BEGIN_SRC js
return [[1, 2],[1, 2],[1, 2],[1, 2],[1, 2],[1, 2],[1,2]]
  #+END_SRC

If you remove just one of the inner arrays, it will work as desired.

The other problem is just as short.  Simply export the following when you
have org-src-fontify-natively set.

  #+BEGIN_SRC css
foo {
  -webkit-appearance: none;
}
  #+END_SRC

I cobbled a small change that seemed to fix that.

At any rate, again apologies for the previous spam.  I didn't want to just
respam immediately with an apology.

Thanks!

--
josh


[O] [PATCH] Couple of small fixes in exporting node.js and css content.

2014-08-05 Thread Josh Berry
I've got a toy paper I'm writing where I ran into a couple of issues
exporting to html.  The first issue is related to exporting the source of a
css block that contains proprietary properties.  In short, it looks like a
list is generated for the font face, where a single value was expected.

The second issue may be my fault, so if there is a setting I should change
on my end, apologies and I'll set said setting.  Basically, there is a
cutoff value whereby node.js will insert newlines into the results.  This
was incredibly frustrating as what was turning into a decent looking table
would suddenly become garbage.

In both cases, I did not add a test file.  If it is enough to just copy an
existing test file and trim it down to just these two items, I can
certainly do that.

Finally, apologies if I am doing this incorrectly.  I tried following the
directions on how to contribute as well as I could.

Thanks!

-josh

p.s.  The toy paper is here: http://taeric.github.io/DancingLinks.html
From 0441982a9457f9bbd953a06ab4fa830c6ffc967b Mon Sep 17 00:00:00 2001
From: Josh Berry tae...@gmail.com
Date: Mon, 4 Aug 2014 22:45:43 -0400
Subject: [PATCH 1/2] Fix css export when proprietary properties are used

* htmlize.el (htmlize-face-size): Check for a list instead of a single
  font face.

`face-attribute' does not act kindly to being given a list of faces.

TINYCHANGE
---
 contrib/lisp/htmlize.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/lisp/htmlize.el b/contrib/lisp/htmlize.el
index 3bf5949..6654f40 100644
--- a/contrib/lisp/htmlize.el
+++ b/contrib/lisp/htmlize.el
@@ -1079,7 +1079,7 @@ If no rgb.txt file is found, return nil.
   (let ((size-list
 	 (loop
 	  for f = face then (face-attribute f :inherit)
-	  until (or (not f) (eq f 'unspecified))
+	  until (or (not f) (eq f 'unspecified) (listp f))
 	  for h = (face-attribute f :height)
 	  collect (if (eq h 'unspecified) nil h
 (reduce 'htmlize-merge-size (cons nil size-list
-- 
1.9.1

From 792b89a0922ee21bd0155f68adb0ce07c2558a51 Mon Sep 17 00:00:00 2001
From: Josh Berry tae...@gmail.com
Date: Mon, 4 Aug 2014 22:46:46 -0400
Subject: [PATCH 2/2] Fix javascript exporting of results from node.js

* ob-js.el (org-babel-js-read): Expand regexps to account for newlines
  in output from node.js

It may be possible to instruct node.js to not insert line breaks
automatically.  Was not difficult to fix the regular expressions to
account for newlines, though.

I did *not* add a test file that goes over this, as I did not see one
already for ob-js.el.  I can certainly add one, if desired.

TINYCHANGE
---
 lisp/ob-js.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/ob-js.el b/lisp/ob-js.el
index 7789449..9d956cc 100644
--- a/lisp/ob-js.el
+++ b/lisp/ob-js.el
@@ -97,13 +97,13 @@ This function is called by `org-babel-execute-src-block'
 If RESULTS look like a table, then convert them into an
 Emacs-lisp table, otherwise return the results as a string.
   (org-babel-read
-   (if (and (stringp results) (string-match ^\\[.+\\]$ results))
+   (if (and (stringp results) (string-match ^\\[[\0-\377[:nonascii:]]*\\]$ results))
(org-babel-read
 (concat '
 (replace-regexp-in-string
  \\[ ( (replace-regexp-in-string
 \\] ) (replace-regexp-in-string
-   ,(replace-regexp-in-string
+   ,\\W   (replace-regexp-in-string
 		 ' \ results))
  results)))
 
-- 
1.9.1



[O] [PATCH] Couple of small fixes in exporting node.js and css content.

2014-08-05 Thread Josh Berry
I've got a toy paper I'm writing where I ran into a couple of issues
exporting to html.  The first issue is related to exporting the source of a
css block that contains proprietary properties.  In short, it looks like a
list is generated for the font face, where a single value was expected.

The second issue may be my fault, so if there is a setting I should change
on my end, apologies and I'll set said setting.  Basically, there is a
cutoff value whereby node.js will insert newlines into the results.  This
was incredibly frustrating as what was turning into a decent looking table
would suddenly become garbage.

In both cases, I did not add a test file.  If it is enough to just copy an
existing test file and trim it down to just these two items, I can
certainly do that.

Finally, apologies if I am doing this incorrectly.  I tried following the
directions on how to contribute as well as I could.

Thanks!

-josh

p.s.  The toy paper is here: http://taeric.github.io/DancingLinks.html
Feedback welcome!


[O] [PATCH] Couple of small fixes in exporting node.js and css content.

2014-08-04 Thread Josh Berry
I've got a toy paper I'm writing where I ran into a couple of issues
exporting to html.  The first issue is related to exporting the source of a
css block that contains proprietary properties.  In short, it looks like a
list is generated for the font face, where a single value was expected.

The second issue may be my fault, so if there is a setting I should change
on my end, apologies and I'll set said setting.  Basically, there is a
cutoff value whereby node.js will insert newlines into the results.  This
was incredibly frustrating as what was turning into a decent looking table
would suddenly become garbage.

In both cases, I did not add a test file.  If it is enough to just copy an
existing test file and trim it down to just these two items, I can
certainly do that.

Finally, apologies if I am doing this incorrectly.  I tried following the
directions on how to contribute as well as I could.

Thanks!

-josh
From 0441982a9457f9bbd953a06ab4fa830c6ffc967b Mon Sep 17 00:00:00 2001
From: Josh Berry tae...@gmail.com
Date: Mon, 4 Aug 2014 22:45:43 -0400
Subject: [PATCH 1/2] Fix css export when proprietary properties are used

* htmlize.el (htmlize-face-size): Check for a list instead of a single
  font face.

`face-attribute' does not act kindly to being given a list of faces.

TINYCHANGE
---
 contrib/lisp/htmlize.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/lisp/htmlize.el b/contrib/lisp/htmlize.el
index 3bf5949..6654f40 100644
--- a/contrib/lisp/htmlize.el
+++ b/contrib/lisp/htmlize.el
@@ -1079,7 +1079,7 @@ If no rgb.txt file is found, return nil.
   (let ((size-list
 	 (loop
 	  for f = face then (face-attribute f :inherit)
-	  until (or (not f) (eq f 'unspecified))
+	  until (or (not f) (eq f 'unspecified) (listp f))
 	  for h = (face-attribute f :height)
 	  collect (if (eq h 'unspecified) nil h
 (reduce 'htmlize-merge-size (cons nil size-list
-- 
1.9.1

From 792b89a0922ee21bd0155f68adb0ce07c2558a51 Mon Sep 17 00:00:00 2001
From: Josh Berry tae...@gmail.com
Date: Mon, 4 Aug 2014 22:46:46 -0400
Subject: [PATCH 2/2] Fix javascript exporting of results from node.js

* ob-js.el (org-babel-js-read): Expand regexps to account for newlines
  in output from node.js

It may be possible to instruct node.js to not insert line breaks
automatically.  Was not difficult to fix the regular expressions to
account for newlines, though.

I did *not* add a test file that goes over this, as I did not see one
already for ob-js.el.  I can certainly add one, if desired.

TINYCHANGE
---
 lisp/ob-js.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/ob-js.el b/lisp/ob-js.el
index 7789449..9d956cc 100644
--- a/lisp/ob-js.el
+++ b/lisp/ob-js.el
@@ -97,13 +97,13 @@ This function is called by `org-babel-execute-src-block'
 If RESULTS look like a table, then convert them into an
 Emacs-lisp table, otherwise return the results as a string.
   (org-babel-read
-   (if (and (stringp results) (string-match ^\\[.+\\]$ results))
+   (if (and (stringp results) (string-match ^\\[[\0-\377[:nonascii:]]*\\]$ results))
(org-babel-read
 (concat '
 (replace-regexp-in-string
  \\[ ( (replace-regexp-in-string
 \\] ) (replace-regexp-in-string
-   ,(replace-regexp-in-string
+   ,\\W   (replace-regexp-in-string
 		 ' \ results))
  results)))
 
-- 
1.9.1



Re: [O] Advice needed: Cant find a decent way to autosync my work TODO org file between laptop and work pc

2014-05-25 Thread Josh Berry
On Sat, May 24, 2014 at 1:11 AM, Xebar Saram zelt...@gmail.com wrote:

  need to sync my main work TODO org file between my work PC and laptop i
 carry around on work related trips and when im at home. i have tried
 several methods buy really none of them work.

 i mainly used git over the last 6 months but that forces me to
 pull/commit/push manually each time i add something to either machine and
 that is really annoying. plus i get merge conflicts all the time


I can't really help for the other items too easily, but have you tried
*not* syncing edits between a single files?  This would at least stop the
merge conflicts.

That is, if you had two sets of all of your .org files, one under
desktop/ and the other under laptop/, then you could setup a basic hook
in git that pushes/pulls on every change.  I believe org is good with the
refile commands that moving between the flies shouldn't be that much of a
burden, if you do that often.  Otherwise, things definitely work well for
agenda mode and such.

-josh


Re: [O] Writing .el files for org in org?

2014-05-22 Thread Josh Berry
On Thu, May 22, 2014 at 5:54 AM, Rainer M Krug rai...@krugs.de wrote:

 4) and if it is working, detangled into ob-org


Apologies for jumping in as a lurker.  When you say detangled, is there a
process for doing this?  I know that working with cweb files the tangled
output included some markers to indicate where the sections came from.
Having something like that here would be great.  I have not extensively
used this workflow for writing code, but I know I have had times where I
found it easy to try out a few small (or sometimes largish) changes in the
tangled output directly.  Having a procedure to detangle would be very
nice.

Thanks!

-josh


[O] bug#15888: 24.3.50; Eval-after-load eval'ed twice

2013-11-16 Thread Josh
On Wed, Nov 13, 2013 at 1:27 PM, Sebastien Vauban
sva-n...@mygooglest.com wrote:
 (with-eval-after-load org
   (message Eval this when Org is loaded)
   (sit-for 3)
   (message ))

 the code block in the `with-eval-after-load' is eval'ed twice whenever an Org
 file is loaded.

Have you checked to see what happens if you specify 'org (a symbol
designating a feature) rather than org (a string representing a
file name) above?





[O] Bug [w/patch]: TODO blocking doesn't work across files with different TODO keyword sets

2013-08-31 Thread Josh Berry
Hi list,

Some of my agenda files use custom TODO keywords (set through a
#+SETUPFILE), and some use the standard TODO | DONE keywords.  I recently
discovered that TODO blocking is broken in the files which use custom
keywords.

It turns out the org-not-done-heading-regexps variable was global instead
of buffer-local like the other *-regexp variables; this appears to be due
to a typo in org.el.

I think the blocker hook
(org-block-todo-from-children-or-siblings-or-parent) was picking up the
global value (set by one of the factory-default buffers, which got opened
last) and applying it to buffers with my custom TODO keywords, so it was
not correctly identifying some headlines as TODO headlines.

The patch below corrects the typo and fixes TODO blocking in my
custom-keyword files.  I hope you find it useful.  (BTW, I quickly ran
through the other make-variable-buffer-local invocations in org.el, and
didn't see any more typos of this nature.)

Thanks,
Josh

diff --git a/lisp/org.el b/lisp/org.el
index 97b5365..985dd74 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -4602,7 +4602,7 @@ Otherwise, these types are allowed:
 (make-variable-buffer-local 'org-not-done-regexp)
 (defvar org-not-done-heading-regexp nil
   Matches a TODO headline that is not done.)
-(make-variable-buffer-local 'org-not-done-regexp)
+(make-variable-buffer-local 'org-not-done-heading-regexp)
 (defvar org-todo-line-regexp nil
   Matches a headline and puts TODO state into group 2 if present.)
 (make-variable-buffer-local 'org-todo-line-regexp)


Re: [O] Custom Agenda View for Projects

2011-03-18 Thread Josh Berry
On Fri, Mar 18, 2011 at 10:57, Jason McBrayer jmcb...@carcosa.net wrote:
 On Thu, Mar 17, 2011 at 6:55 PM, Josh Berry d...@condordes.net wrote:

 I think org considers child tasks to be dependencies of the parent
 task -- so if a parent task (such as your PROJ) has children, it won't
 be displayed in a tags-todo agenda view, because that takes
 dependencies into account.

 That's a logical explanation, but shouldn't this only be the case if
 the parent has the :ORDERED: property set?

No, if :ORDERED: is set, then each child is a dependency of the next
child.  So if you have:

* TODO top
   ... :ORDERED: t ...
** TODO a
** TODO b
** TODO c

Only a will appear in your agenda view.  But if you have:

* TODO top
** TODO a
** TODO b
** TODO c

All children of top--that is, a, b and c--will appear.
However, in neither case will top appear, because it has children
that are not yet completed.

 Have you tried just a tags view with a match of TODO=\PROJ\?
 IIRC this will do what you want.

 I gave this a test, and apparently it does not. What's shown is still
 dependent on the value of org-enforce-todo-dependencies.

I see, it does not, my bad.  I tried experimenting a bit on my own,
and didn't find an easy way using just agendas.

You might consider experimenting with Stuck Projects though.  If you
consider all projects to be stuck, you could probably build an
agenda view that shows you all projects regardless of what's in them.
(I don't use stuck projects myself, so YMMV.)

-- Josh



Re: [O] Custom Agenda View for Projects

2011-03-17 Thread Josh Berry
On Tue, Mar 15, 2011 at 14:35, Christian Zang
christian.z...@googlemail.com wrote:
 2011/3/15 Christian Zang christian.z...@googlemail.com:
 2011/3/15 Manish mailtomanish.sha...@gmail.com:
 On Tue, Mar 15, 2011 at 11:54 AM, Christian Zang wrote:
 2011/3/15 Manish:
 On Tue, Mar 15, 2011 at 12:54 AM, Christian Zang wrote:
 Dear all,

 I might be overlooking something very obvious, but I cannot find the
 solution: I have various org files, in which projects (anything
 requiring more than one action step...) are first level headings
 marked using the TODO kwd PROJ. If I tell my agenda to list all items
 with kwd PROJ (either via C-a T PROJ or as a custom agenda view via
 tags-todo LEVEL=1), only the ones without siblings are returned.
 I've looked into org-tags-match-list-sublevels but this is not quite
 the right thing to calibrate...
...
 Update: I found the culprit in org-enforce-todo-dependencies, set to
 nil and all projects labeled as PROJ are displayed again. Have to
 think about why this affects the agenda views in that way...

Someone correct me if I'm wrong, but:

I think org considers child tasks to be dependencies of the parent
task -- so if a parent task (such as your PROJ) has children, it won't
be displayed in a tags-todo agenda view, because that takes
dependencies into account.

Have you tried just a tags view with a match of TODO=\PROJ\?
IIRC this will do what you want.

So it would be:

   (P Projects tags TODO=\PROJ\
((org-agenda-overriding-header List of Projects)))

-- Josh



[O] Version 7.5: C-c C-t anything fails with args out of range

2011-03-08 Thread Josh Berry
Hi list,

I just upgraded from org-mode 7.4 to 7.5, and I can't set or change
TODO states at all with C-c C-t now; an args-out-of-range error gets
raised.  I've tried doing a make clean in my org-mode checkout, to
no avail.

I'm running GNU emacs 23.2.1 on Mac OSX (in Aqua), installed via
Homebrew.  Debugger backtrace is pasted below.

[[BTW, please forgive me if this isn't a well-formed bug report; I'm
relatively new to Emacs and don't know Elisp.  Just let me know if you
need anything else.]]

--
Debugger entered--Lisp error: (args-out-of-range 1 4913)
  narrow-to-region(1 4913)
  (prog2 (widen) (run-hook-with-args-until-failure (quote
org-blocker-hook) change-plist) (narrow-to-region beg end) (goto-char
pos))
  (let ((beg ...) (end ...) (pos ...)) (prog2 (widen)
(run-hook-with-args-until-failure ... change-plist) (narrow-to-region
beg end) (goto-char pos)))
  (org-with-wide-buffer (run-hook-with-args-until-failure (quote
org-blocker-hook) change-plist))
  (progn (org-with-wide-buffer (run-hook-with-args-until-failure ...
change-plist)))
  (unwind-protect (progn (org-with-wide-buffer ...)) (set-match-data
save-match-data-internal (quote evaporate)))
  (let ((save-match-data-internal ...)) (unwind-protect (progn ...)
(set-match-data save-match-data-internal ...)))
  (save-match-data (org-with-wide-buffer
(run-hook-with-args-until-failure ... change-plist)))
  (save-excursion (save-match-data (org-with-wide-buffer ...)))
  (if (save-excursion (save-match-data ...)) nil (if (interactive-p)
(error TODO state change from %s to %s blocked this state) (message
TODO state change from %s to %s blocked this state) (throw ...
nil)))
  (unless (save-excursion (save-match-data ...)) (if (interactive-p)
(error TODO state change from %s to %s blocked this state) (message
TODO state change from %s to %s blocked this state) (throw ...
nil)))
  (progn (setq org-last-todo-state-is-todo (not ...)) (unless
(save-excursion ...) (if ... ... ... ...)))
  (if org-blocker-hook (progn (setq org-last-todo-state-is-todo ...)
(unless ... ...)))
  (when org-blocker-hook (setq org-last-todo-state-is-todo (not ...))
(unless (save-excursion ...) (if ... ... ... ...)))
  (let* ((match-data ...) (startpos ...) (logging ...) (org-log-done
org-log-done) (org-log-repeat org-log-repeat) (org-todo-log-states
org-todo-log-states) (this ...) (hl-pos ...) (head ...) (ass ...)
(interpret ...) (done-word ...) (final-done-word ...) (last-state ...)
(completion-ignore-case t) (member ...) (tail ...) (state ...) (state
...) (next ...) (change-plist ...) dolog now-done-p) (when
org-blocker-hook (setq org-last-todo-state-is-todo ...) (unless ...
...)) (store-match-data match-data) (replace-match next t t) (unless
(pos-visible-in-window-p hl-pos) (message TODO state changed to %s
...)) (unless head (setq head ... ass ... interpret ... done-word ...
final-done-word ...)) (when (memq arg ...) (message Keyword-Set
%d/%d: %s ... ... ...)) (setq org-last-todo-state-is-todo (not ...))
(setq now-done-p (and ... ...)) (and logging (org-local-logging
logging)) (when (and ... ... ...) (setq dolog ...) (if ... ...) (when
... ...) (when ... ... ...) (when ... ...))
(org-todo-trigger-tag-changes state) (and org-auto-align-tags (not
org-setting-tags) (org-set-tags nil t)) (when
org-provide-todo-statistics (org-update-parent-todo-statistics))
(run-hooks (quote org-after-todo-state-change-hook)) (if (and arg ...)
(setq head ...)) (put-text-property (point-at-bol) (point-at-eol)
(quote org-todo-head) head) (when now-done-p (when ... ...)
(org-auto-repeat-maybe state)) (if (and ... ... ... ...) (progn ...
...)) (when org-trigger-hook (save-excursion ...)))
  (catch (quote exit) (org-back-to-heading t) (if (looking-at
outline-regexp) (goto-char ...)) (or (looking-at ...) (looking-at 
*)) (let* (... ... ... ... ... ... ... ... ... ... ... ... ... ...
... ... ... ... ... ... ... dolog now-done-p) (when org-blocker-hook
... ...) (store-match-data match-data) (replace-match next t t)
(unless ... ...) (unless head ...) (when ... ...) (setq
org-last-todo-state-is-todo ...) (setq now-done-p ...) (and logging
...) (when ... ... ... ... ... ...) (org-todo-trigger-tag-changes
state) (and org-auto-align-tags ... ...) (when
org-provide-todo-statistics ...) (run-hooks ...) (if ... ...)
(put-text-property ... ... ... head) (when now-done-p ... ...) (if ...
...) (when org-trigger-hook ...)))
  (save-excursion (catch (quote exit) (org-back-to-heading t) (if ...
...) (or ... ...) (let* ... ... ... ... ... ... ... ... ... ... ...
... ... ... ... ... ... ... ... ...)))
  (let ((org-blocker-hook org-blocker-hook) (case-fold-search nil))
(when (equal arg ...) (setq arg nil org-blocker-hook nil)) (when (and
org-blocker-hook ...) (setq org-blocker-hook nil)) (save-excursion
(catch ... ... ... ... ...)))
  org-todo(nil)
  call-interactively(org-todo nil nil)
--

Can you please advise me on what (if anything) I should do next?
Thanks in advance for your help!

-- Josh



Re: [O] Version 7.5: C-c C-t anything fails with args out of range

2011-03-08 Thread Josh Berry
On Tue, Mar 8, 2011 at 15:25, Nick Dokos nicholas.do...@hp.com wrote:
 Josh Berry d...@condordes.net wrote:

 I just upgraded from org-mode 7.4 to 7.5, and I can't set or change
 TODO states at all with C-c C-t now; an args-out-of-range error gets
 raised.  I've tried doing a make clean in my org-mode checkout, to
 no avail.
...
 Can you please advise me on what (if anything) I should do next?
 Thanks in advance for your help!

 See the thread

    http://thread.gmane.org/gmane.emacs.orgmode/38966

 It seems all you have to do is git pull; make clean; make
 and restart your emacs.

Unfortunately this doesn't help.  I did as you suggested -- switched
back to master, then did git pull; make clean; make all, and I can
still reproduce the problem.

I'm on commit 4090006ab124dd10698f21f1ee44c913b5faf990.

Thanks,
Josh



Re: [O] Version 7.5: C-c C-t anything fails with args out of range

2011-03-08 Thread Josh Berry
On Tue, Mar 8, 2011 at 18:14, Nick Dokos nicholas.do...@hp.com wrote:
 Josh Berry d...@condordes.net wrote:

 On Tue, Mar 8, 2011 at 15:25, Nick Dokos nicholas.do...@hp.com wrote:
  Josh Berry d...@condordes.net wrote:
 
  I just upgraded from org-mode 7.4 to 7.5, and I can't set or change
  TODO states at all with C-c C-t now; an args-out-of-range error gets
  raised. =C2=A0I've tried doing a make clean in my org-mode checkout, t=
 o
  no avail.
 ...
  Can you please advise me on what (if anything) I should do next?
  Thanks in advance for your help!
 
  See the thread
 
  =C2=A0 =C2=A0http://thread.gmane.org/gmane.emacs.orgmode/38966
 
  It seems all you have to do is git pull; make clean; make
  and restart your emacs.

 Unfortunately this doesn't help.  I did as you suggested -- switched
 back to master, then did git pull; make clean; make all, and I can
 still reproduce the problem.


 ... and did you restart your emacs?

Yes. :P

:)

-- Josh



Re: [O] Version 7.5: C-c C-t anything fails with args out of range

2011-03-08 Thread Josh Berry
On Tue, Mar 8, 2011 at 22:55, Carsten Dominik carsten.domi...@gmail.com wrote:

 On 9.3.2011, at 06:49, David Maus wrote:

 At Tue, 8 Mar 2011 15:08:57 -0800,
 Josh Berry wrote:

 Hi list,

 I just upgraded from org-mode 7.4 to 7.5, and I can't set or change
 TODO states at all with C-c C-t now; an args-out-of-range error gets
 raised.  I've tried doing a make clean in my org-mode checkout, to
 no avail.

 I'm running GNU emacs 23.2.1 on Mac OSX (in Aqua), installed via
 Homebrew.  Debugger backtrace is pasted below.

 [[BTW, please forgive me if this isn't a well-formed bug report; I'm
 relatively new to Emacs and don't know Elisp.  Just let me know if you
 need anything else.]]

 Just a fast comment: Couldn't this be a problem with the macro
 `org-with-wide-buffer'?

 #+begin_src emacs-lisp
 (defmacro org-with-wide-buffer (rest body)
  Execute body while temporarily widening the buffer.
  `(let ((beg (point-min)) (end (point-max)) (pos (point)))
     (prog2
        (widen)
        ,@body
       (narrow-to-region beg end)
       (goto-char pos
 #+end_src

 This macro is indeed not written in a stable way and will
 fail of the buffer gets modified with @body.
 But Emacs already has save-restriction, so there is no
 need to re-invent the wheel:

 (defmacro org-with-wide-buffer (rest body)
  Execute body while temporarily widening the buffer.
  `(save-excursion
    (save-restriction
       (widen)
       ,@body)))

I just hacked your version of org-with-wide-buffer into my org-macs.el
file, and it appears to fix the problem.

Thanks!

-- Josh



[Orgmode] dates in a spreadsheet

2010-03-17 Thread Josh Mattoon
I'm using the spreadsheet capabilities of org for the first time (very
cool!) to plan an upcoming trip.  I'd like to create a column formula to
automatically calculate the dates/day of week but I'm a bit stumped.  I
don't see a way for the formula to know which row it is currently
processing.  I'm also coming up short trying to find any elisp to go from
day of year - formatted date string.  Any suggestions?
___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] dates in a spreadsheet

2010-03-17 Thread Josh Mattoon
Sure thing.  Basically I'd like the date column to be automatically
calculated so that I can move things around, add extra days here and there,
and not have to edit that column by hand.

| date  | location | activities| notes  |
|---+--+---+|
| 03-16 Tue | moon | collect rocks ||
| 03-17 Wed | mars | terraform | this might take a few days |
| 03-18 Thu | earth| breath air||

If I wanted to add an extra day on mars I could just enter a new row,
recalculate the forumula, and the dates would be automagically updated.
It's not such a big deal in a small example like this but I'm planning out a
3 week vacation with a fair number of destinations.  I'd like the day of
week to display because some sites are closed on certain days.

It goes without saying that I've spent more time trying to figure this out
than it would actually save so it's more about education at this point :)


On Wed, Mar 17, 2010 at 8:26 AM, Dan Davison davi...@stats.ox.ac.uk wrote:

 Josh Mattoon joshmatt...@gmail.com writes:

  I'm using the spreadsheet capabilities of org for the first time (very
 cool!)
  to plan an upcoming trip.  I'd like to create a column formula to
 automatically
  calculate the dates/day of week but I'm a bit stumped.  I don't see a way
 for
  the formula to know which row it is currently processing.  I'm also
 coming up
  short trying to find any elisp to go from day of year - formatted date
 string.
   Any suggestions?

 Hi Josh,

 Could you provide a small example table that shows the challenge you are
 describing?

 Dan


  ___
  Emacs-orgmode mailing list
  Please use `Reply All' to send replies to the list.
  Emacs-orgmode@gnu.org
  http://lists.gnu.org/mailman/listinfo/emacs-orgmode

___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] dates in a spreadsheet

2010-03-17 Thread Josh Mattoon
Hey Nick, the first one came through just fine. This is pretty cool but
still not quite what I'm looking for.  It totally helped me get what I
wanted though!  I wanted to have a separate row for each day so I could fill
in activities.  Modifying your example I get:

| date | place   | activity  | notes
 |
|--+-+---+--|
| 2010-03-19 Fri | |   | dummy
 |
| 2010-03-20 Sat | |   |
 |
| 2010-03-21 Sun | moon| collect rocks |
 |
| 2010-03-22 Mon | jupiter | thrash around the red dot |
 |
| 2010-03-23 Tue | mars| see the little green men  |
 |
| 2010-03-24 Wed | earth   |   | home, sweet home
|
#+TBLFM: @2$1 = 03-19-2010::$1 = @-1$1 + 1

Exactly what I wanted!  I can insert days, move them around, and just hit
C-u C-c C-c to have it update.  I'd like to understand how it works though,
if you don't mind.  What does the ::$1 synax mean?  And how did it know that
we were dealing with a date?

On Wed, Mar 17, 2010 at 12:58 PM, Nick Dokos nicholas.do...@hp.com wrote:

 Josh Mattoon joshmatt...@gmail.com wrote:

  If I wanted to add an extra day on mars I could just enter a new row,
 recalculate the forumula, and
  the dates would be automagically updated. It's not such a big deal in a
 small example like this but
  I'm planning out a 3 week vacation with a fair number of destinations.
 I'd like the day of week to
  display because some sites are closed on certain days.

 [Not sure what mailer mangled my previous reply to the point of
 unrecognizability, but here is another attempt - I hope it's
 cleaner. Let me know if there is a problem.]


 | date | duration | place   | activity  | notes
|

 |--+--+-+---+--|
 | 2010-03-17 Wed |0 | |   | dummy
|
 | 2010-03-17 Wed |3 | moon| collect rocks |
|
 | 2010-03-20 Sat |5 | mars| see the little green men  |
|
 | 2010-03-25 Thu |5 | jupiter | thrash around the red dot |
|
 | 2010-03-30 Tue |  | earth   |   | home,
 sweet home |
 #+TBLFM: @2$1 = 03-17-2010::$1 = @-1$1 + @-1$2

___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode