[O] org-refile-use-outline-path question

2011-10-11 Thread Arun Persaud
Hi

I use the following settings to refile tasks

(setq org-refile-use-outline-path 'file)
(setq org-refile-targets '((org-agenda-files . (:maxlevel . 5

this has the nice effect that I can refile across different files, which
I do use every now and then.
For this I use:

/level1/level2/...

However mostly I refile to the same file and therefore I wish I could
just use something like:

level1/level2/...

and it would refile using the current file, which at the moment doesn't
work for me (at least the level1s of the current file are not part of
the autocomplete, only files are).

Is there a way that this can be done or can this be added?

Thanks

Arun




Re: [O] [patch] Add source subtree which will be refiled

2011-10-11 Thread Sebastien Vauban
Hi Carsten,

"Sebastien Vauban" wrote:
> Carsten Dominik wrote:
>>> I found it difficult, sometimes, to remember which subtree we're gonna
>>> refile. When TAB'ing for multiple targets, you loose your source buffer,
>>> and can easily forget which exact subtree you had selected.
>>>
>>> Here a patch to add the name of the subtree we're operating on.
>>
>> can you please resubmit a modified patch using either (org-get-heading t t)
>> or (nth 4 (org-heading-components))
>
> Thanks for looking at it.
>
> I'll do!

Here it is: a modified version which only uses the text of the entry when
asking where to refile some headline.

Best regards,
  Seb

-- 
Sebastien Vauban
>From 02c57d0f8d60d18be664eff0657e813ac297250f Mon Sep 17 00:00:00 2001
From: Sebastien Vauban 
Date: Wed, 12 Oct 2011 07:08:22 +0200
Subject: [PATCH] Use the text of the heading when asking where to refile an
 entry.

---
 lisp/org.el |   21 +
 1 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index b26e1a3..c033b9e 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -10481,14 +10481,19 @@ prefix argument (`C-u C-u C-u C-c C-w')."
    (marker-position org-clock-hd-marker)))
 		  (setq goto nil)))
 	   (setq it (or rfloc
-			(save-excursion
-			  (unless goto (org-back-to-heading t))
-			  (org-refile-get-location
-			   (cond (goto "Goto")
- (regionp "Refile region to")
- (t "Refile subtree to")) default-buffer
-			   org-refile-allow-creating-parent-nodes
-			   goto)
+			(let (heading-text)
+			  (save-excursion
+(unless goto
+  (org-back-to-heading t)
+  (setq heading-text
+	(nth 4 (org-heading-components
+(org-refile-get-location
+ (cond (goto "Goto")
+   (regionp "refill-mode region to")
+   (t (concat "Refile subtree \""
+		  heading-text "\" to")))
+ default-buffer
+ org-refile-allow-creating-parent-nodes))
 	  (setq file (nth 1 it)
 		re (nth 2 it)
 		pos (nth 3 it))
-- 
1.7.5.1



Re: [O] Put result output in different type of code block than original

2011-10-11 Thread Niels Giesen
To all people in this thread,

Thank you for all the responses.

The echoing of #+begin_src and #end_src is indeed a workaround that I
had not thought of myself, though it is not that general, and puts stuff
in the source that really oughtn't be there.

In the mean time I came up with a piece of advise to
`org-babel-insert-result' that does the trick in a general way.

#+begin_src emacs-lisp
  (defadvice org-babel-insert-result (around pft/output-type)
(let* ((all-params (caddr info))
   (lang (or (cdr (assoc :out all-params)) lang)))
  ad-do-it))

(ad-activate 'org-babel-insert-result)
#+end_src

Use it with :out your-choice-of-lang

And while I was at it, I added indentation:

#+begin_src elisp
(defadvice org-babel-insert-result (around pft/output-indent)
  (let* ((all-params (caddr info))
 (indent-after (assoc :indent-after all-params)))
ad-do-it
(when indent-after
 (save-excursion
   (when (re-search-forward
  "#\\+begin_src " nil t)
 (beginning-of-line)
 (org-edit-special)
 (indent-region (point-min) (point-max))
 (org-edit-src-exit))
#+end_src

so... this it what it does:

#+begin_src sh :results output code :out json :indent-after
  echo "{\"peul\":\"erwt\",\n\"graan\":\"rijst\"}"
#+end_src

#+results:
#+BEGIN_SRC json
  {"peul":"erwt",
   "graan":"rijst"}
#+END_SRC

I do not know whether it plays nice with all other input forms and
:result parameters, as there seem to be some special handlers for e.g.
LaTeX and emacs-lisp, but I guess this would help the AWK->SQL case too.

If this works well enough, these pieces of advise may serve as a basis
for a patch to `org-babel-insert-result'. What do you think?

-- 
http://pft.github.com/



Re: [O] org-agenda-switch-to switches to weird place

2011-10-11 Thread Antoine Levitt
11/10/11 21:35, Sebastien Vauban
>> If I understand correctly, org-agenda-switch-to goes to the org-marker
>> marker that is set by capture.
>
> No, I absolutely don't think so. Org files are plain text files: what you
> don't see in there, is simply not there. So, how could such markers be stored
> in the Org file, when capturing something, and not be visible?

Via markers, see
http://www.chemie.fu-berlin.de/chemnet/use/info/elisp/elisp_29.html. I
don't know much about it either, I just know it exists :-)

> IIUC, the markers are simply some sort of regexp search to find
> certain typical positions:
>
> - org-marker matches the timestamp which is at the origin of the presence of
>   the entry in the agenda
>
> - org-hd-marker is the beginning of the heading.

That doesn't seem likely. See this (simplified) code from
org-agenda-switch-to:

(let* ((marker (org-get-at-bol 'org-marker))
   (pos (marker-position marker)))

So apparently there is a marker.

> Do you really modify the title more often than the date? You have luck!
> Because of procrastination, I'd say I much, much more often change the date, 
> to
> reprogram the entry at a later date, and so on, and so on.

I change the date directly from the agenda with C-c C-s or S-right. So
when I press RET, it's that I want to edit the title.

>
> Anyway, would you jump onto the beginning of the heading, just where the `***'
> start, I think you can change the line:
>
> (org-get-at-bol 'org-marker))
>
> with:
>
> (org-get-at-bol 'org-hd-marker))
>
> to get another behavior. Now, from that, adding a constant number, or --
> better -- moving forward a couple of times, or -- certainly there are still
> better options -- ... would allow you to land on whichever component of the
> heading.

Right. I can hack something up that'll be specific to my case, I just
wanted to know if there was a proper way to do it that'd benefit everybody.




Re: [O] Idea: insert "current sort order" property

2011-10-11 Thread Christian Moe

Hi, Gez,

On 10/7/11 5:02 PM, Gez wrote:

What I'm imagining is a command executed on a headline to insert a
property into each of its children "fixing" the current order;
something like ":sorted:01", ":sorted:02"  etc.


I think this is a neat idea, and can see some uses for it for my own 
stuff. I've made a first pass below. Please test it and let me know 
how it works for you (and please *don't* test it on anything valuable 
without backing up first!).



Ideally there would
be a prompt for the property key (or part of it) so that there could
be more than one such property for a particular headline, but with the
option to simplify the usage and consistency by having just one
property key as a default and no prompt.


More or less done. There'll be a prompt anyway, but just hit RET to 
select the default ("OutlineIndex").



If a sorted headline got moved to a new parent its sort-order might be
a duplicate one of its siblings, but I don't really see that as a
problem - the user knows it's "only text" after all.


The below will just do sequential numbering, as you suggested (01, 02, 
03...) Then, as long as you've only changed the order of siblings at 
each level, the order can be restored by sorting on the outline-index 
property (C-c ^ r) for each parent.


Irretrievable chaos may and probably will result if headlines are 
demoted, promoted, or moved to new parents. As long as the user's fine 
with that, everything's fine.


An obvious refinement would be to do true outline numbering (e.g. 01, 
01-01, 01-01-01, 01-01-02, 01-02-01, 01-02-02 ...). Then you could 
restore the original outline entirely no matter how headings have been 
moved around. But you couldn't do that by sorting; making that useful 
would take additional code, so I haven't implemented it (yet).



I don't know
whether it might be desired to similarly fix the sort-order of 1st
level headlines; perhaps the command could act per current file, with
a < to narrow down to the current tree.


The below will not number the entry at point, because that could break 
a numbering already set at that level. It will number its direct 
children. With prefix, it will number all its descendants. See how it 
works for you. I made it the default behavior to number only the 
direct children of the entry at point, since littering the whole tree 
with property drawers is not necessarily what you want to do.



I'm also not sure how to deal
with larger numbers - 01-99 seems like a good default but could one
have an option for 001-999?  I also wonder about adding the property
to more than one level at a time, but might that be a bit much in
terms of affecting performance?


Solved; the below counts the total number of headings first, then 
adjusts the zero padding accordingly. Code follows.


Yours,
Christian

#+begin_src emacs-lisp
  (defun cm/org-store-outline-order (arg prop)
"Store the outline of the subtree of the entry at point by
  setting the property PROP of each direct child entry to its
  current position in the tree. With prefix ARG, store the position
  of the whole subtree. The tree can be restored to the stored
  outline by sorting on the property with `C-c ^ r'. Note that this
  will only work properly on the order of each subtree; if headings
  are demoted, promoted, or moved into different subtrees, the
  result may or may not be nonsense, but it will be impossible to
  restore the original order by sorting."
(interactive "P\nsProperty key (default OutlineIndex): ")
(if (string= prop "") (setq prop "OutlineIndex"))
(if (or (not (org-map-entries t (concat prop "={.}") 'tree))
(y-or-n-p "Property exists; overwrite? "))
(let* ((match (format "LEVEL%s%s"
  (if arg ">=" "=")
  (1+ (org-current-level
   (counter 1)
   (width (1+ (floor (log10 (length (org-map-entries t 
match 'tree))

   (fstr (concat "%0" (number-to-string width) "d")))
  (org-map-entries
   '(progn
  (org-set-property prop
(format fstr counter))
  (setq counter (1+ counter)))
   match 'tree)
  (message ""
#+end_src



Re: [O] org-agenda-switch-to switches to weird place

2011-10-11 Thread Sebastien Vauban
Hi Antoine,

Antoine Levitt wrote:
> 11/10/11 18:45, Sebastien Vauban
>> Antoine Levitt wrote:
>>> I use org-capture to store information (such as appointments), then view
>>> them in the agenda. I use RET (org-agenda-switch-to) in the agenda view to
>>> modify them. For instance, for an entry like
>>>
>>> * TODO Some task
>>> SCHEDULED: !<2011-10-11 Tue>
>>>
>>> , point is at "!", which is inconvenient, because most of the time I want to
>>> modify the heading of the entry ("Some task"). A nice place to put the point
>>> would be at the %? specifier of org-capture-templates, if specified.
>>> Apparently, org-capture does the job of inserting a marker for
>>> org-agenda-switch-to to come back to, so it should be able to figure out if
>>> %? was specified, and if yes, where. I couldn't manage to do it, though.
>>> Could someone take a look at this?
>>
>> [...] I don't see how org-capture templates would come into play: your
>> different capture templates can have very different positions for %?, and
>> once captured, a note or TODO is no different than free text that the user
>> would have written manually.

Please consider what follows as doubtful, as I absolutely don't have enough
experience on this subject... but let's try...

> If I understand correctly, org-agenda-switch-to goes to the org-marker
> marker that is set by capture.

No, I absolutely don't think so. Org files are plain text files: what you
don't see in there, is simply not there. So, how could such markers be stored
in the Org file, when capturing something, and not be visible?

IIUC, the markers are simply some sort of regexp search to find certain
typical positions:

- org-marker matches the timestamp which is at the origin of the presence of
  the entry in the agenda

- org-hd-marker is the beginning of the heading.

> If capture inserts this marker right after the template insertion,
> org-agenda can then switch back to it. In theory at least. I can't make
> sense of org-capture's code.

So, no, capture does not insert any biscuit for later. It simply is the agenda
functions which scan all the agenda buffers, and remember where the important
elements are, to be used when jumping.

> Anyway, pretty much anything is better than the current behavior, which is
> not very user friendly when SCHEDULED info is present.

You say:

>>> , point is at "!", which is inconvenient, because most of the time I want to
>>> modify the heading of the entry ("Some task").

Do you really modify the title more often than the date? You have luck!
Because of procrastination, I'd say I much, much more often change the date, to
reprogram the entry at a later date, and so on, and so on.

Anyway, would you jump onto the beginning of the heading, just where the `***'
start, I think you can change the line:

(org-get-at-bol 'org-marker))

with:

(org-get-at-bol 'org-hd-marker))

to get another behavior. Now, from that, adding a constant number, or --
better -- moving forward a couple of times, or -- certainly there are still
better options -- ... would allow you to land on whichever component of the
heading.

Best regards,
  Seb

-- 
Sebastien Vauban




[O] "C-M" showing up everywhere in the INFO file

2011-10-11 Thread York Zhao
Hi,

I'm using the lasted org-mode from git, I used make install info to generate the
INFO file and I have verified that the file "org" has been copied to the "info"
directory of my emacs directory. I'm using Windows, and the problem is that
"C-M" is appearing everywhere in this INFO file which is extremely painful. What
can I do about these carriage return (0x0d)?

Thanks,

York



Re: [O] Include does not work when doing org-export-as-org

2011-10-11 Thread Carsten Dominik

On 11.10.2011, at 16:34, Henry Hirsch wrote:

> On Tue, Oct 11, 2011 at 10:27:56AM -0400, Nick Dokos wrote:
> 
>> In particular, I assume it does not process includes, because they need
>> to be preserved in examples.
>> 
>> Nick
> 
> So do you think it is reasonable that org-export-as-org is the only mode
> of export which is exhibiting a different behaviour?
> 
> For my part I think it is not. 
> I used to love org-mode above everything.
> But this just leaves me not amused.

What made you get out of bed today in a bad mood?

Maybe I can help to improve the communication
by explaining where the problem lies.
Both functionalities, the one that is implemented, and the
one that you want make a lot of sense.  The problem
is merely a misnaming of the function.

The reason why `org-export-to-org' was introduced was
solely to provide a way for a website to publish
the source file that was used to create a particular
website, along with the website itself.  An example can
be found on Bernt's site.

http://doc.norang.ca/org-mode.html#sec-18

What the function does is (Nick already collected this info)

- remove archived trees and commented trees
- remove trees that are excluded by special tags
- output the resulting file with -source.org extension
  and optionally produce an htmlized version of this
  file so that the web visitor can look at the file.

Processing of #include files was left out on purpose, because
that often contains stuff which you want to have out of the way
because it is tedious or complicated.  In fact, a website can choose
to also publish the source of the #include files as separate files.

What you are looking for a mechanism to expand more directives,
in order to produce another org file.  You want (IIUC) a preprocessor
much like a C compiler preprocessor.  However, it is not
automatic what this should do and what it should not do.
For example

 - do you think it should expand macros?
 - oo you think it should process babel blocks and insert the
   evaluation results, as the other exporters do?
 - do you think it should process links into a standard format
   and pre-expand link searches?

I suspect (but that is a guess, based on the description
of your use-case) that your answer would be No to all
these questions.  Yet someone else could come in and
take issue with the absence of this processing, with all
the same right as you have to wonder about the absence
of #include processing.  It all depends and what you
actually want to achieve, and the answer is *not*
obvious.

So while I am guilty of maybe misnaming this function, you will
have noticed that this "exporter" actually does not show up in
the export menu as an independent exporter - it is mainly used
by publishing projects.

We could use a new function which does a configurable amount
of processing, maybe it could get a number of arguments which
define what exactly should be done - and it should definitely
write to a different file, without clobbering the current file.
Maybe file_expanded.org or so?

The way to write this function is to start at `org-export-as-org',
keep what you like and add more stuff from org-export-preprocess,
for example a call `org-export-handle-include-files-recurse' as
one of the first things.  Really, `org-export-preprocess-string'
can be the guide of what can and should be done.

I could write such a function, Nick could, but first there needs to
be clarity of what this should achieve, and how to address this issue
in a general way.

- Carsten



Re: [O] org-agenda-switch-to switches to weird place

2011-10-11 Thread Antoine Levitt
11/10/11 18:45, Sebastien Vauban
> Hi Antoine,
>
> Antoine Levitt wrote:
>> I use org-capture to store information (such as appointments), then view
>> them in the agenda. I use RET (org-agenda-switch-to) in the agenda view to
>> modify them. For instance, for an entry like
>>
>> * TODO Some task
>> SCHEDULED: !<2011-10-11 Tue>
>>
>> , point is at "!", which is inconvenient, because most of the time I want to
>> modify the heading of the entry ("Some task"). A nice place to put the point
>> would be at the %? specifier of org-capture-templates, if specified.
>> Apparently, org-capture does the job of inserting a marker for
>> org-agenda-switch-to to come back to, so it should be able to figure out if
>> %? was specified, and if yes, where. I couldn't manage to do it, though.
>> Could someone take a look at this?
>
> I guess one could imagine that it should be possible to customize a point to
> land on when switching from the agenda to the source buffer.

That seems a bit overkill. But then again, this is org. :-)

> But I don't see how org-capture templates would come into play: your different
> capture templates can have very different positions for %?, and once captured,
> a note or TODO is no different than free text that the user would have written
> manually.

If I understand correctly, org-agenda-switch-to goes to the org-marker
marker that is set by capture. If capture inserts this marker right
after the template insertion, org-agenda can then switch back to it. In
theory at least. I can't make sense of org-capture's code.

Anyway, pretty much anything is better than the current behavior, which
is not very user friendly when SCHEDULED info is present.




Re: [O] Put result output in different type of code block than original

2011-10-11 Thread Sebastien Vauban
Hi Burton,

Burton Samograd wrote:
> "Sebastien Vauban"  writes:
>> Hi Rainer and Niels,
>>
>> Rainer M Krug wrote:
>>> On Mon, Oct 10, 2011 at 5:44 PM, Niels Giesen wrote:
 Say I've got a sh code block invoking curl to some json api, is it possible
 some way to specify that the format of the output when :results output code
 is in a json code block and *not* a sh code block?
>>
>> FYI, this is a need I also have, for example AWK outputting SQL code. There
>> has been some threads about this, but nothing is implemented so far in this
>> direction.
>>
 #+begin_src sh :results output code :exports both
 curl
 https://our-service.org/getstuff?username=dirk\&password=catsbrithday\&fmt=json
 #+end_src
>>>
>>> Does
>>>
>>> #+begin_src sh :results output :exports both
>>> echo #+BEGIN_SRC json
>>> curl
>>> https://our-service.org/getstuff?username=dirk\&password=catsbrithday\&fmt=json
>>> echo #+END_SRC
>>> #+end_src
>>>
>>> help?
>>
>> I like very much the idea of your workaround. Great thought!
>>
>> Though, nope, it does not help the OP, because the echo lines don't output
>> anything here, as # is the symbol to begin a comment (in shell scripts). So,
>> the first line simply outputs a blank line...
>
> Could you escape the comment character by using \#?

Yes, that does work as well (alternative to Eric's quoting method):

#+begin_src sh :results output raw :exports both
echo \#+BEGIN_SRC json
echo curl
echo 
https://our-service.org/getstuff?username=dirk\&password=catsbrithday\&fmt=json
echo \#+END_SRC
#+end_src

but my point was intended to be more general: this workaround may be difficult
to use for differnet languages to marry (my own need, in the past, was for AWK
outputting SQL + another I've forgotten about right now).

Anyway, this currently can be made to work, as shown.

Best regards,
  Seb

PS- I was expecting that multiple evaluations of the code block would lead to
multiple results blocks, because of the raw specifier. It's not the case.
Is is perfectly normal and explainable, or a corner case which favors --
in this case -- this workaround?

-- 
Sebastien Vauban




Re: [O] Include does not work when doing org-export-as-org

2011-10-11 Thread Nick Dokos
Henry Hirsch  wrote:

> On Tue, Oct 11, 2011 at 11:37:54AM -0400, Nick Dokos wrote:
> > What is *your* use case? That is not at all clear, so far at least.
> > 
> > Nick
> 
> I want to apply the don't repeat yourself (dry) principle to my org files.
> For the documentation of software quality I have huge org documents
> with a lot of tables which tend to repeat themselves since I 
> have to document the same parameters in different environments.
> 
> To prevent having to go through a lot of lines and files every time I
> add a parameter to be documented or change anything else on the table
> for that matter. 
> 
> I would like to export it to an org file and have it put the included
> files in that file. And while I realy don't get why org-export-as-org
> does not do this. I am sure implementing this does not need to break
> established api. It could very well be added as a seperate function.
> 
> If this needs any more clarification I will contribute every
> information I can. Also I understand that there is not much motivation
> to implement this since nobody besides me seems to mind the
> absence of the functionality.
> 

The following should do basically what you want, but there are several
assumptions built into it: it assumes that

1) you are visiting the buffer of the top file (a.org in your example).

2) there is a file associated with the buffer (i.e. (buffer-file-name)
   returns a path, not nil).

3) the file is named something like "/path/to/my/file.org" and the
   output file is named "/path/to/my/file.I.org"

4) the output file is sacrificial: it is *clobbered* by the function.

5) if there is narrowing in effect, only the narrowed portion is processed.

There may be other limitations as well.

Nick

--8<---cut here---start->8---
(defun org-to-org-handle-includes ()
  "Copy the contents of the current buffer to OUTFILE,
recursively processing #+INCLUDEs."
  (let* ((s (buffer-string))
 (fname (buffer-file-name))
 (ofname (format "%s.I.org" (file-name-sans-extension fname
(setq result
  (with-temp-buffer
(insert s)
(org-export-handle-include-files-recurse)
(buffer-string)))
(find-file ofname)
(delete-region (point-min) (point-max))
(insert result)
(save-buffer)))
--8<---cut here---end--->8---




Re: [O] org-agenda-switch-to switches to weird place

2011-10-11 Thread Sebastien Vauban
Hi Antoine,

Antoine Levitt wrote:
> I use org-capture to store information (such as appointments), then view
> them in the agenda. I use RET (org-agenda-switch-to) in the agenda view to
> modify them. For instance, for an entry like
>
> * TODO Some task
> SCHEDULED: !<2011-10-11 Tue>
>
> , point is at "!", which is inconvenient, because most of the time I want to
> modify the heading of the entry ("Some task"). A nice place to put the point
> would be at the %? specifier of org-capture-templates, if specified.
> Apparently, org-capture does the job of inserting a marker for
> org-agenda-switch-to to come back to, so it should be able to figure out if
> %? was specified, and if yes, where. I couldn't manage to do it, though.
> Could someone take a look at this?

I guess one could imagine that it should be possible to customize a point to
land on when switching from the agenda to the source buffer.

But I don't see how org-capture templates would come into play: your different
capture templates can have very different positions for %?, and once captured,
a note or TODO is no different than free text that the user would have written
manually.

So, you can't get a behavior depending on any template, IIUC.

Best regards,
  Seb

-- 
Sebastien Vauban




Re: [O] Put result output in different type of code block than original

2011-10-11 Thread Burton Samograd
"Sebastien Vauban"
 writes:

> Hi Rainer and Niels,
>
> Rainer M Krug wrote:
>> On Mon, Oct 10, 2011 at 5:44 PM, Niels Giesen wrote:
>>> Say I've got a sh code block invoking curl to some json api, is it possible
>>> some way to specify that the format of the output when :results output code
>>> is in a json code block and *not* a sh code block?
>
> FYI, this is a need I also have, for example AWK outputting SQL code. There
> has been some threads about this, but nothing is implemented so far in this
> direction.
>
>>> #+begin_src sh :results output code :exports both
>>> curl
>>> https://our-service.org/getstuff?username=dirk\&password=catsbrithday\&fmt=json
>>> #+end_src
>>
>> Does
>>
>> #+begin_src sh :results output :exports both
>> echo #+BEGIN_SRC json
>> curl
>> https://our-service.org/getstuff?username=dirk\&password=catsbrithday\&fmt=json
>> echo #+END_SRC
>> #+end_src
>>
>> help?
>
> I like very much the idea of your workaround. Great thought!
>
> Though, nope, it does not help the OP, because the echo lines don't output
> anything here, as # is the symbol to begin a comment (in shell scripts). So,
> the first line simply outputs a blank line...

Could you escape the comment character by using \#?

--
Burton Samograd




Re: [O] Include does not work when doing org-export-as-org

2011-10-11 Thread Henry Hirsch
On Tue, Oct 11, 2011 at 11:37:54AM -0400, Nick Dokos wrote:
> What is *your* use case? That is not at all clear, so far at least.
> 
> Nick

I want to apply the don't repeat yourself (dry) principle to my org files.
For the documentation of software quality I have huge org documents
with a lot of tables which tend to repeat themselves since I 
have to document the same parameters in different environments.

To prevent having to go through a lot of lines and files every time I
add a parameter to be documented or change anything else on the table
for that matter. 

I would like to export it to an org file and have it put the included
files in that file. And while I realy don't get why org-export-as-org
does not do this. I am sure implementing this does not need to break
established api. It could very well be added as a seperate function.

If this needs any more clarification I will contribute every
information I can. Also I understand that there is not much motivation
to implement this since nobody besides me seems to mind the
absence of the functionality.

Thank you,
Henry




[O] org-agenda-switch-to switches to weird place

2011-10-11 Thread Antoine Levitt
Hi,

I use org-capture to store information (such as appointments), then view
them in the agenda. I use RET (org-agenda-switch-to) in the agenda
view to modify them. For instance, for an entry like

* TODO Some task
SCHEDULED: !<2011-10-11 Tue>

, point is at "!", which is inconvenient, because most of the time I
want to modify the heading of the entry ("Some task"). A nice place to
put the point would be at the %? specifier of org-capture-templates, if
specified. Apparently, org-capture does the job of inserting a marker
for org-agenda-switch-to to come back to, so it should be able to figure
out if %? was specified, and if yes, where. I couldn't manage to do it,
though. Could someone take a look at this?




Re: [O] Include does not work when doing org-export-as-org

2011-10-11 Thread Nick Dokos
Henry Hirsch  wrote:

> On Tue, Oct 11, 2011 at 10:57:58AM -0400, Nick Dokos wrote:
> >   o org is very much a scratch-your-itch project - so you can
> >   certainly go ahead and implement what you want.
> 
> I get it. If I want something fixed I gotta do it myself.
> 
> Have a nice day, and thank you for sobering me up.
> 

I'm sorry I offended you: that was not my intention at all.
But the above is certainly a misrepresentation of what I said.
Let me repeat:


... there are a couple of options:

  o org is very much a scratch-your-itch project - so you can
  certainly go ahead and implement what you want.

  o explain your use case: if it is compelling enough, somebody
  might be motivated to implement what you ask for (but you need
  to specify it exactly - and if somebody else implements it, be
  prepared to compromise...)



A lot of people do follow the first way - many follow the second.
You are certainly free to propose some other way to proceed.

So far what you have done is identified it a behavior that does not
meet your expectations. It may be considered a bug or it may be not.
If the "bug" is fixed, it would break an existing use case (exporting
org example to web pages), which was in fact the primary reason for
providing the interface (somebody scratched that itch). So why should
it be changed (or more likely: why should another interface be added)
to meet your expectations? What is *your* use case? That is not at
all clear, so far at least.

Nick

















Re: [O] Include does not work when doing org-export-as-org

2011-10-11 Thread Henry Hirsch
On Tue, Oct 11, 2011 at 10:57:58AM -0400, Nick Dokos wrote:
>   o org is very much a scratch-your-itch project - so you can
>   certainly go ahead and implement what you want.

I get it. If I want something fixed I gotta do it myself.

Have a nice day, and thank you for sobering me up.



Re: [O] Include does not work when doing org-export-as-org

2011-10-11 Thread Nick Dokos
Henry Hirsch  wrote:

> On Tue, Oct 11, 2011 at 10:27:56AM -0400, Nick Dokos wrote:
>  
> > In particular, I assume it does not process includes, because they need
> > to be preserved in examples.
> > 
> > Nick
>  
> So do you think it is reasonable that org-export-as-org is the only mode
> of export which is exhibiting a different behaviour?
> 
It's certainly reasonable: it does not pretend to be a general-purpose
exporter. It may be misnamed though: if org-export-as-org is only used
in batch processing of e.g. Worg, then it can be renamed to something more
obscure and made non-interactive, so that it would not confuse the unwary.

One could imagine a general-purpose org-export-as-org that processes
includes, but I'm not sure what else it would do: just copy it's input
to its output mostly - other than processing includes, is there anything
else that it should do?

> For my part I think it is not.  I used to love org-mode above
> everything.  But this just leaves me not amused.
> 

Well, there are a couple of options:

  o org is very much a scratch-your-itch project - so you can
  certainly go ahead and implement what you want.

  o explain your use case: if it is compelling enough, somebody
  might be motivated to implement what you ask for (but you need
  to specify it exactly - and if somebody else implements it, be
  prepared to compromise...)


But it is certainly *not* the case that org is some ivory tower project
that exists for theoretical purity only: there are hacks, work-arounds,
inconsistencies and bugs.

Nick



  



Re: [O] Include does not work when doing org-export-as-org

2011-10-11 Thread Henry Hirsch
On Tue, Oct 11, 2011 at 10:27:56AM -0400, Nick Dokos wrote:
 
> In particular, I assume it does not process includes, because they need
> to be preserved in examples.
> 
> Nick
 
So do you think it is reasonable that org-export-as-org is the only mode
of export which is exhibiting a different behaviour?

For my part I think it is not. 
I used to love org-mode above everything.
But this just leaves me not amused.

Henry



Re: [O] Put result output in different type of code block than original

2011-10-11 Thread Eric Schulte
Niels Giesen  writes:

> Hi,
>
> Say I've got a sh code block invoking curl to some json api, is it possible
> some way to specify that the format of the output when :results output code
> is in a json code block and *not* a sh code block?
>

Hi Niels,

Currently there is no way to specify the type of returned source code
block.  Hopefully one of Rainer or Rasmus' suggestions to this thread
should serve as a sufficient work around.

I would augment Rainer's solution changing it to the following...

#+begin_src sh :results scalar raw
  echo "#+begin_src json"
curl 
https://our-service.org/getstuff?username=dirk\&password=catsbrithday\&fmt=json
  echo "#+end_src json"
#+end_src

which works for me -- or presumably would work for me if our-service
could getstfff for dirk with password catsbirthday.

Cheers -- Eric

>
> #+begin_src sh :results output code :exports both
> curl
> https://our-service.org/getstuff?username=dirk\&password=catsbrithday\&fmt=json
> #+end_src
>
> #+results:
> #+BEGIN_SRC sh
> {"userinfo" : {"id" : "QNCNFQUKKBCTTMAOIUFNOQVLDUFAJV", "fullname" : "Gekke
> Dirk", "role" : "user"}}
> #+END_SRC
>
> whereas I'd like it to be
>
> #+results:
> #+BEGIN_SRC json
> {"userinfo" : {"id" : "QNCNFQUKKBCTTMAOIUFNOQVLDUFAJV", "fullname" : "Gekke
> Dirk", "role" : "user"}}
> #+END_SRC
>
> Any thoughts on how to go about this? Do other people have this same issue
> and should there come an option in babel that handles this (one language
> outputting source code for another?), or is there a way to specify ones own
> outputter?

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/



Re: [O] Include does not work when doing org-export-as-org

2011-10-11 Thread Nick Dokos
Nick Dokos  wrote:

> Nick Dokos  wrote:
> 
> > Henry Hirsch  wrote:
> > 
> > > Hello everyone,
> > > 
> > > I am trying to export an org-file with includes.
> > > When I export as PDF all includes work but when
> > > I export as org-file the includes are getting ignored.
> > > 
> > 
> > What does "export as org-file" mean? What do you do exactly?
> > 
> 
> Never mind: I didn't read the subject line.
> 

C-h f org-export-as-org says:

,
| org-export-as-org is an interactive Lisp function in `org-exp.el'.
| 
| (org-export-as-org ARG &optional HIDDEN EXT-PLIST TO-BUFFER BODY-ONLY
| PUB-DIR)
| 
| Make a copy with not-exporting stuff removed.
| The purpose of this function is to provide a way to export the source
| Org file of a webpage in Org format, but with sensitive and/or irrelevant
| stuff removed.  This command will remove the following:
| 
| - archived trees (if the variable `org-export-with-archived-trees' is nil)
| - comment blocks and trees starting with the COMMENT keyword
| - only trees that are consistent with `org-export-select-tags'
|   and `org-export-exclude-tags'.
`

It is not a general purpose exporter. It is supposed to allow you to post
org examples on web pages. I presume it is used when exporting to Worg.

In particular, I assume it does not process includes, because they need
to be preserved in examples.

Nick





Re: [O] Include does not work when doing org-export-as-org

2011-10-11 Thread Henry Hirsch
On Tue, Oct 11, 2011 at 10:09:49AM -0400, Nick Dokos wrote:
> Henry Hirsch  wrote:
> 
> > Hello everyone,
> > 
> > I am trying to export an org-file with includes.
> > When I export as PDF all includes work but when
> > I export as org-file the includes are getting ignored.
> > 
> 
> What does "export as org-file" mean? What do you do exactly?
> 
> FWIW, I tried with your minimal example (thanks!), and I can export to
> ascii/latex/PDF/HTML with

Yes. As I mentioned none of the above is producing any problem for me.

As I explicitly stated only org-export-as-org produces the unwanted output.

So when I say export as org I mean I hit M-x and then type "org-export-as-org"
without the quotes and then enter. Then I get a new file in the same directory
with the name of a-source.org, which you can open by hitting C-x C-f then typing
"a-source.org" without the quotes and then enter. 

Now if both our systems react the same, you should see the Line #+INCLUDE 
"b.org".
Though I expected it to say "Hello World".

Sincerly yours,
Henry

-- 
Mit freundlichem Gruß,

Henry Hirsch 

--
Entwickler

-

ADITION technologies AG
Basler Landstraße 8
79111 Freiburg

http://www.adition.com

T +49 / (0)761 / 88147 - 30
F +49 / (0)761 / 88147 - 77
Support +49 /(0)1805 - ADITION

(Festnetzpreis 14 ct/min; Mobilfunkpreise maximal 42 ct/min)

Eingetragen beim Amtsgericht Düsseldorf unter HRB 54076
Vorstände: Andreas Kleiser, Jörg Klekamp, Tihomir Perkovic, Marcus Schlüter
Aufsichtsratsvorsitzender: Rechtsanwalt Daniel Raimer
UStIDNr.: DE 218 858 434




Re: [O] Include does not work when doing org-export-as-org

2011-10-11 Thread Nick Dokos
Nick Dokos  wrote:

> Henry Hirsch  wrote:
> 
> > Hello everyone,
> > 
> > I am trying to export an org-file with includes.
> > When I export as PDF all includes work but when
> > I export as org-file the includes are getting ignored.
> > 
> 
> What does "export as org-file" mean? What do you do exactly?
> 

Never mind: I didn't read the subject line.

Sorry,
Nick




Re: [O] Include does not work when doing org-export-as-org

2011-10-11 Thread Nick Dokos
Nick Dokos  wrote:

> FWIW, I tried with your minimal example (thanks!), and I can export to
> ascii/latex/PDF/HTML with
> 
>   C-c C-e A (or D or L or H)
> 

I meant:

C-c C-e A (or L or d or H)

Nick




[O] [PATCH] Improve documentation + fix typos

2011-10-11 Thread Rafael Laboissiere
Dear Org-mode developpers,

You will find here attached three patches for org-mode.  Two of them
improve the "External links" node of the info documentation.  The other
one just fixes minor typos.

Best regards,

Rafael Laboissière
>From b6aac367829af8b6507d04c3f820e3cdbd33853a Mon Sep 17 00:00:00 2001
From: Rafael Laboissiere 
Date: Tue, 11 Oct 2011 00:22:09 +0200
Subject: [PATCH 1/3] Fix typos in variable description

* lisp/org.el (org-link-search-must-match-exact-headline): fix typos
---
 lisp/org.el |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index b26e1a3..3446ce2 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -1493,9 +1493,9 @@ When nil, the link search tries to match a phrase with all words
 in the search text."
   :group 'org-link-follow
   :type '(choice
-	  (const :tag "Use fuzy text search" nil)
+	  (const :tag "Use fuzzy text search" nil)
 	  (const :tag "Match only exact headline" t)
-	  (const :tag "Match extact headline or query to create it"
+	  (const :tag "Match exact headline or query to create it"
 		 query-to-create)))
 
 (defcustom org-link-frame-setup
-- 
1.7.6.3

>From f9b109a147cc5dac6016e46773da11f7dee4dbe3 Mon Sep 17 00:00:00 2001
From: Rafael Laboissiere 
Date: Tue, 11 Oct 2011 00:58:36 +0200
Subject: [PATCH 2/3] Add footnote on how the hyperlink text is searched in
 Org files

* org.texi (External links): Add footnote on how the behavior of the
text search in Org files are controled by the variable
org-link-search-must-match-exact-headline.

This change is necessary in order to avoid misleading the user as
regards of the behavior of the search, in particular because the
default value of org-link-search-must-match-exact-headline is
'query-to-create.
---
 doc/org.texi |8 +++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/doc/org.texi b/doc/org.texi
index 957b393..eb6941f 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -3172,7 +3172,13 @@ file:/myself@@some.where:papers/last.pdf   @r{file, path on remote machine}
 /myself@@some.where:papers/last.pdf@r{same as above}
 file:sometextfile::NNN@r{file with line number to jump to}
 file:projects.org @r{another Org file}
-file:projects.org::some words @r{text search in Org file}
+file:projects.org::some words @r{text search in Org file}@footnote{
+The actual behavior of the search will depend on the value of
+the variable @code{org-link-search-must-match-exact-headline}.  If its value
+is nil, then a fuzzy text search will be done.  If it is t, then only the
+exact headline will be matched.  If the value is @code{'query-to-create},
+then an exact headline will be searched; if it is not found, then the user
+will be queried to create it.}
 file:projects.org::*task title@r{heading search in Org file}
 docview:papers/last.pdf::NNN  @r{open file in doc-view mode at page NNN}
 id:B7423F4D-2E8A-471B-8810-C40F074717E9   @r{Link to heading by ID}
-- 
1.7.6.3

>From 2cac1d22741efe90cdafa43f9f918647ee19a979 Mon Sep 17 00:00:00 2001
From: Rafael Laboissiere 
Date: Tue, 11 Oct 2011 01:15:37 +0200
Subject: [PATCH 3/3] Accurate description of info hyperlink format

Hyperlinks in the form "info:file#node" work with plain spaces in the
"node" part and do not need to have spaces encoded as %20.  This is
the case for me, who is using the Debian emacs-snapshot package,
version 20110926-1.
---
 doc/org.texi |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/doc/org.texi b/doc/org.texi
index eb6941f..573cbc9 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -3197,7 +3197,7 @@ gnus:group@r{Gnus group link}
 gnus:group#id @r{Gnus article link}
 bbdb:R.*Stallman  @r{BBDB link (with regexp)}
 irc:/irc.com/#emacs/bob   @r{IRC link}
-info:org#External%20links @r{Info node link (with encoded space)}
+info:org#External links   @r{Info node link}
 shell:ls *.org@r{A shell command}
 elisp:org-agenda  @r{Interactive Elisp command}
 elisp:(find-file-other-frame "Elisp.org") @r{Elisp form to evaluate}
-- 
1.7.6.3



[O] Patch: Mark org-diary-class as obsolete and skip entries on holidays in org-class

2011-10-11 Thread Rüdiger Sonderfeld
Hello,
I wrote two small patches. The first one marks org-diary-class as obsolete
(according to its documentation it is deprecated). The second one is a
patch for org-class. It changes org-class to skip entries that are on
holidays.

Maybe the second change should be made optional.

Regards,
Rüdiger

P.S. I have signed the FSF papers.
From 3774298aeb959b36bf39ac0988999b94198c1984 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=BCdiger=20Sonderfeld?= 
Date: Mon, 10 Oct 2011 20:59:28 +0200
Subject: [PATCH 1/2] Mark org-diary-class as obsolete (use org-class).

---
 lisp/org-agenda.el |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index b208d1e..faca285 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -4913,6 +4913,7 @@ please use `org-class' instead."
  (nth 2 date1) (car date1) (nth 1 date1)
  (nth 2 date2) (car date2) (nth 1 date2)
  dayname skip-weeks)))
+(make-obsolete 'org-diary-class 'org-class "")
 
 (defalias 'org-get-closed 'org-agenda-get-progress)
 (defun org-agenda-get-progress ()
-- 
1.7.7

From 66fdd7995556002c4b5061641dbac5c1a7788d02 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=BCdiger=20Sonderfeld?= 
Date: Mon, 10 Oct 2011 21:07:02 +0200
Subject: [PATCH 2/2] org-class: Skip entries on holidays.

---
 lisp/org-agenda.el |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index faca285..8fe9cc7 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -4881,7 +4881,7 @@ This function is invoked if 
`org-agenda-todo-ignore-deadlines',
   "Entry applies if date is between dates on DAYNAME, but skips SKIP-WEEKS.
 DAYNAME is a number between 0 (Sunday) and 6 (Saturday).  SKIP-WEEKS
 is any number of ISO weeks in the block period for which the item should
-be skipped."
+be skipped. Entries are also skipped if they happen on a holiday."
   (let* ((date1 (calendar-absolute-from-gregorian (list m1 d1 y1)))
 (date2 (calendar-absolute-from-gregorian (list m2 d2 y2)))
 (d (calendar-absolute-from-gregorian date)))
@@ -4893,6 +4893,7 @@ be skipped."
 (progn
   (require 'cal-iso)
   (not (member (car (calendar-iso-from-absolute d)) skip-weeks
+ (not (calendar-check-holidays date))
  entry)))
 
 (defun org-diary-class (m1 d1 y1 m2 d2 y2 dayname &rest skip-weeks)
-- 
1.7.7



Re: [O] Include does not work when doing org-export-as-org

2011-10-11 Thread Nick Dokos
Henry Hirsch  wrote:

> Hello everyone,
> 
> I am trying to export an org-file with includes.
> When I export as PDF all includes work but when
> I export as org-file the includes are getting ignored.
> 

What does "export as org-file" mean? What do you do exactly?

FWIW, I tried with your minimal example (thanks!), and I can export to
ascii/latex/PDF/HTML with

C-c C-e A (or D or L or H)

They all include "Hello world" in the output.

I downgraded to org 7.6 as well: same result.

Nick

> I am on org-mode 7.6.
> 
> Hope somebody knows how to fix this.
> 
> Sincerly yours,
> Henry
>  
> 



Re: [O] Checkbox difficulties

2011-10-11 Thread Dave Abrahams

on Thu Oct 06 2011, Dave Abrahams  wrote:

> Here's a version that deals with at least one of your caveats:
>
> (defun ndk/checkbox-list-complete ()
>   (save-excursion
> (org-back-to-heading t)
> (when looking-at (concat 
>   "^\\*+[ \t]+" 
>   org-todo-regexp ;; first match group here
>   "[ \t].*\\[" "\\(100%\\)\\|[0-9]+%" 
>   "\\|" "\\([0-9]+\\)" "/" "\\([0-9]+\\)" "\\]")
>   (if (or (match-string 2)
>   (and (match-string 3)
>(equal (match-string 3) (match-string 4
>   (org-todo 'done)
> (org-todo 'todo)

Whoops!  Looks like I made some edits to that after my last test.
Please try this one instead:

--8<---cut here---start->8---
(defun dwa/checkbox-list-complete ()
  (save-excursion
(org-back-to-heading t)
(when (looking-at (concat 
  "^\\*+[ \t]+" 
  org-todo-regexp ;; first match group here
  "[ \t].*\\[" "\\(?:" "\\(?2:100%\\)\\|[0-9]+%" 
  "\\|" "\\(?3:[0-9]+\\)" "/" "\\(?4:[0-9]+\\)" "\\)" 
"\\]"))
  (if (or (match-string 2)
  (and (match-string 3)
   (equal (match-string 3) (match-string 4
  (org-todo 'done)
(org-todo 'todo)
--8<---cut here---end--->8---

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com



Re: [O] Put result output in different type of code block than original

2011-10-11 Thread Sebastien Vauban
Hi Rainer and Niels,

Rainer M Krug wrote:
> On Mon, Oct 10, 2011 at 5:44 PM, Niels Giesen wrote:
>> Say I've got a sh code block invoking curl to some json api, is it possible
>> some way to specify that the format of the output when :results output code
>> is in a json code block and *not* a sh code block?

FYI, this is a need I also have, for example AWK outputting SQL code. There
has been some threads about this, but nothing is implemented so far in this
direction.

>> #+begin_src sh :results output code :exports both
>> curl
>> https://our-service.org/getstuff?username=dirk\&password=catsbrithday\&fmt=json
>> #+end_src
>
> Does
>
> #+begin_src sh :results output :exports both
> echo #+BEGIN_SRC json
> curl
> https://our-service.org/getstuff?username=dirk\&password=catsbrithday\&fmt=json
> echo #+END_SRC
> #+end_src
>
> help?

I like very much the idea of your workaround. Great thought!

Though, nope, it does not help the OP, because the echo lines don't output
anything here, as # is the symbol to begin a comment (in shell scripts). So,
the first line simply outputs a blank line...

Best regards,
  Seb

-- 
Sebastien Vauban




Re: [O] Include does not work when doing org-export-as-org

2011-10-11 Thread Henry Hirsch
On Tue, Oct 11, 2011 at 03:53:00PM +0200, Henry Hirsch wrote:
I forgot something:

> Content of a_source.org after export:

is actually:
#+INCLUDE "b.org"

Where I expected it to be "Hello World".
 
Thanks,
Henry





Re: [O] Include does not work when doing org-export-as-org

2011-10-11 Thread Henry Hirsch
On Tue, Oct 11, 2011 at 09:41:43AM -0400, Nick Dokos wrote:
> Sorry to be a grouch, but can you *please* provide an example?  
Content of a.org:
#+INCLUDE: "b.org" 

Content of b.org:
Hello World

Content of a_source.org after export:

Thanks,
Henry



Re: [O] Include does not work when doing org-export-as-org

2011-10-11 Thread Nick Dokos
Henry Hirsch  wrote:

> Hello everyone,
> 
> I am trying to export an org-file with includes.
> When I export as PDF all includes work but when
> I export as org-file the includes are getting ignored.
> 
> I am on org-mode 7.6.
> 
> Hope somebody knows how to fix this.
> 

Sorry to be a grouch, but can you *please* provide an example?  If you
have a small toy example, provide that. Otherwise, cut down your example
to a minimal case that exhibits the problem (what Seb calls an ECM).

You see, if you provide an example that I can cut-n-past and test in a
few seconds, I probably will do it. If not, I have to *create* an
example based on your instructions: that not only takes longer (which
cuts down the number of people who might be willing to help), but it is
also error-prone - if I misunderstand your instructions, then I end up
wasting my time testing something that is not the problem, or providing
wrong information and wasting the time of every *other* person who might
be looking at the problem.

And please don't take it personally - this is a plea to *everybody*
who reports a problem:

o if you report odd behavior, please provide an ECM.
o if you report an error, please provide a backtrace.

Thanks,
Nick



[O] Include does not work when doing org-export-as-org

2011-10-11 Thread Henry Hirsch
Hello everyone,

I am trying to export an org-file with includes.
When I export as PDF all includes work but when
I export as org-file the includes are getting ignored.

I am on org-mode 7.6.

Hope somebody knows how to fix this.

Sincerly yours,
Henry
 



Re: [O] Put result output in different type of code block than original

2011-10-11 Thread Rainer M Krug
On Mon, Oct 10, 2011 at 5:44 PM, Niels Giesen wrote:

> Hi,
>
> Say I've got a sh code block invoking curl to some json api, is it possible
> some way to specify that the format of the output when :results output code
> is in a json code block and *not* a sh code block?
>
> #+begin_src sh :results output code :exports both
> curl
> https://our-service.org/getstuff?username=dirk\&password=catsbrithday\&fmt=json
> #+end_src
>
>
Does

#+begin_src sh :results output :exports both
echo #+BEGIN_SRC json
curl
https://our-service.org/getstuff?username=dirk\&password=catsbrithday\&fmt=json
echo #+END_SRC
#+end_src

help?

Rainer


> #+results:
> #+BEGIN_SRC sh
> {"userinfo" : {"id" : "QNCNFQUKKBCTTMAOIUFNOQVLDUFAJV", "fullname" : "Gekke
> Dirk", "role" : "user"}}
> #+END_SRC
>
> whereas I'd like it to be
>
> #+results:
> #+BEGIN_SRC json
> {"userinfo" : {"id" : "QNCNFQUKKBCTTMAOIUFNOQVLDUFAJV", "fullname" : "Gekke
> Dirk", "role" : "user"}}
> #+END_SRC
>
> Any thoughts on how to go about this? Do other people have this same issue
> and should there come an option in babel that handles this (one language
> outputting source code for another?), or is there a way to specify ones own
> outputter?
>
> --
> http://pft.github.com
>



-- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology,
UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :   +33 - (0)9 53 10 27 44
Cell:   +33 - (0)6 85 62 59 98
Fax (F):   +33 - (0)9 58 10 27 44

Fax (D):+49 - (0)3 21 21 25 22 44

email:  rai...@krugs.de

Skype:  RMkrug


Re: [O] Put result output in different type of code block than original

2011-10-11 Thread Rasmus Pank Roulund
Niels Giesen  writes:

> Hi,
>
> Say I've got a sh code block invoking curl to some json api, is it possible
> some way to specify that the format of the output when :results output code
> is in a json code block and *not* a sh code block?

Does this help you?  (Lacking a relevant example)

#+begin_src R :results output latex
1+1
#+end_src

#+results:
#+BEGIN_LaTeX
[1] 2
#+END_LaTeX

–Rasmus

-- 
Sent from my Emacs



Re: [O] What do you use to identify projects (in the GTD sense)

2011-10-11 Thread Sven Bretfeld
Hi Bernt

Bernt Hansen  writes:

> http://doc.norang.ca/org-mode.html#Projects

Wow, that is a WONDERFUL page you shared with us. Thank you very much!
It will cost me hours go through it and see what I can implement for my
setup. Can't you think about others' time before posting such great
stuff?

Here is my setup and workflow:

I'm quite an orthodox GTD user with one exception: I blended two
concepts of ZTD (Zen to Done
http://zenhabits.net/zen-to-done-ztd-the-ultimate-simple-productivity-system/)
which is a mix of GTD and other systems. What I took from it is the two
tags :MIT: (Most important thing of the day) and :BIGROCK: (Most
important project of the week). Usually MITs are Next Steps which I do
as early as possible during the day, normally there are two or three of
them each day. Bigrocks are privileged projects which I return to most
often, I usually have one or two of them per week.

I use one main org-file. Spheres of responsibility are top level
headings containing neither tags nor todo-keywords:

,
| * Termine (contains only appointments)
| * Teaching
| * Institute
| * Research Department
| * Research Consortium
| * Personal Research
| * Readings
| * Home Projects
| * Friends
| * Someday/Maybe
| * Stuff to remember (here for example birthdays are defined)
`

The second level contains projects which are tagged with :PROJECT:. The
third level are associated next steps containing a resource tag.

,
| * Institute
| ** Major Book Order :PROJECT:
| *** DONE Advertise a position for a coordinator :OFFICE:
| *** WAITING Wait for applications   :OFFICE:
| *** Choose an appropriate person:OFFICE:
| *** Call a meeting  :OFFICE:
| *** Set up delegation project for supervision   :OFFICE:
`

As you see, only the first two steps contain a todo-keyword. This is
because the second step is running at the moment and cannot choose a
person before the position was actually advertised and the application
deadline has come. I use triggers to set the next step to the
appropriate state when the previous step is marked DONE:

,
| *** WAITING Wait for applications   :OFFICE:
| :PROPERTIES:
| :TRIGGER:  chain-siblings(NEXT)
| :END:
| *** Choose an appropriate person:OFFICE:
`

So, after the application deadline has come, I mark the WAITING entry
DONE and the next entry is automatically set to NEXT. After this is
DONE, "Call a meeting" will be set to NEXT. 

,
| *** DONE Wait for applications  :OFFICE:
| *** NEXT Choose an appropriate person   :OFFICE:
| :PROPERTIES:
| :TRIGGER:  chain-siblings(NEXT)
| :END:
| *** Call a meeting  :OFFICE:
`

In this way my agenda view for "NEXT actions at OFFICE" contains only
actions which can actually be done immediately.

I use to revise my project lists on a daily base. This is the first
thing I do in the morning. It takes about 15 minutes. This is not
orthodox GTD behavior but only this way a can make my mind free and be
sure that I don't forget deadlines and don't neglect projects. I have a
special entry for this revision that appears on top of my
day-agenda-view:

,
| Dienstag   11 Oktober 2011
|8:00.. 
|9:23.. now - - - - - - - - - - - - 
|10:00.. 
|12:00.. 
| diary: 14:00-15:00 Meeting with Mrs. Smith
|14:00.. 
|16:00.. 
| Termine:18:00-20:00 Central Asia group meeting  :MEETING:
|20:00.. 
| DailyTasks:  Scheduled:  REGULAR Daily Review [0/7]
| HomeProjects:Scheduled:  REGULAR Water flowers  :HOME:
`

I have a special keyword for regular tasks because I don't like them to
appear in NEXT lists. These regular tasks always have a schedule and
therefore appear only in the day-agenda:

,
| ** REGULAR Daily Review [0/7]
|SCHEDULED: <2011-10-10 Mo .+1d>
|:PROPERTIES:
|:REPEAT_TO_STATE: REGULAR
|:END:
|- [ ] review daily agenda
|- [ ] review Waiting
|- [ ] review Delegated
|- [ ] review Projects
|- [ ] review Stuck Projects
|- [ ] review Bigrocks
|- [ ] make new MITs from
|  - [ ] OFFICE
|  - [ ] HOME
|  - [ ] SCHRIESHEIM
|  - [ ] PHONE
|  - [ ] READING
`

For distant projects I have the Someday/Maybe category:

,
| ** Send documents to tax adviser
| NOT_STARTED
| *** Start Project
| SCHEDULED: <2012-01-02 Mo>
| *** Gather documents :HOME:
| :PROPERTIES:
| :TRIGGER:  chain-siblings(NEXT)
| :END:
| *** Copy documents :OFFICE:
| *** Prepare letter   :HOME:
| *** Send letter:SHOPPING:
`

These future projects contain the keywor

Re: [O] [agenda] Case-insensitive tag search

2011-10-11 Thread Christian Moe

On 10/11/11 8:22 AM, Carsten Dominik wrote:

(...) To be on the safe side, my suggestion
would be to apply a function to your files which would
downcase all the tags present in the buffer.

Marcelo, maybe this is a nice task to try your elisp on?
With perl, it would be a one-liner


I have one... but I won't spoil Marcelo's fun if he wants to write his 
own; it was indeed a nice task!


:)

Christian



Re: [O] [PATCH]: New Add defun org-mode-or-derived-mode-p

2011-10-11 Thread Tassilo Horn
Carsten Dominik  writes:

Hi Carsten,

>> BTW: I'm not sure if there is any reasonable benefit for
>> `org-mode-p', anyway.  Checking the rest of the emacs source tree,
>> then the convention is to either use
>> 
>>  (eq major-mode 'foo-mode)
>> 
>> or
>> 
>>  (derived-mode-p 'foo-mode)
>> 
>> depending on what's needed.  I don't see why (org-mode-p) or even
>> (org-mode-p 'derived) is clearer...
>
> I agree, it is not clearer, only a bit more compact.  I don't think we
> should have a new function here.  Just make a patch that used
> derived-mode-p in places where this is needed.  I would accept such a
> patch.

Ups, I've slightly misread your suggestion.  Currently, there is only
one place in org-src.el that check for being a mode derived from
org-mode or org-mode itself.  The second is useless, because
(derived-mode-p 'org-mode) is true for org-mode, too.

But as I've said, I've misread your suggestion and made a patch that
completely erases org-mode-p and all its calls.  Feel free to apply or
discard it. :-)

Bye,
Tassilo
>From 92e83b95aead15a4346e671de6ba211c6ca95a43 Mon Sep 17 00:00:00 2001
From: Tassilo Horn 
Date: Tue, 11 Oct 2011 09:07:27 +0200
Subject: [PATCH] Replace org-mode-p with usual (eq major-mode 'org-mode)
 check

Additionally, replace one

  (or (org-mode-p) (derived-mode-p 'org-mode))

with

  (derived-mode-p 'org-mode)

cause that is reflexive anyway (returns true, if the current mode is
org-mode).

Delete one check testing for org-mode or org derived mode
---
 BUGFIXING/org-log.el  |4 +-
 contrib/lisp/org-annotate-file.el |2 +-
 contrib/lisp/org-contacts.el  |4 +-
 contrib/lisp/org-expiry.el|4 +-
 contrib/lisp/org-lparse.el|2 +-
 contrib/lisp/org-registry.el  |2 +-
 contrib/lisp/org-toc.el   |2 +-
 lisp/org-agenda.el|   26 +++---
 lisp/org-archive.el   |2 +-
 lisp/org-ascii.el |2 +-
 lisp/org-capture.el   |   16 
 lisp/org-colview-xemacs.el|6 ++--
 lisp/org-colview.el   |6 ++--
 lisp/org-ctags.el |2 +-
 lisp/org-docbook.el   |2 +-
 lisp/org-footnote.el  |   14 
 lisp/org-html.el  |2 +-
 lisp/org-id.el|4 +-
 lisp/org-indent.el|2 +-
 lisp/org-latex.el |2 +-
 lisp/org-macs.el  |6 +---
 lisp/org-mouse.el |4 +-
 lisp/org-remember.el  |4 +-
 lisp/org-src.el   |8 ++--
 lisp/org-table.el |4 +-
 lisp/org-timer.el |2 +-
 lisp/org.el   |   68 ++--
 testing/org-test.el   |2 +-
 28 files changed, 100 insertions(+), 104 deletions(-)

diff --git a/BUGFIXING/org-log.el b/BUGFIXING/org-log.el
index 8ebedfe..1fb82e6 100644
--- a/BUGFIXING/org-log.el
+++ b/BUGFIXING/org-log.el
@@ -21,7 +21,7 @@
 (and delete-other-windows (delete-other-windows))
 (widen)
 (goto-char pos)
-(when (org-mode-p)
+(when (eq major-mode 'org-mode)
   (org-show-context 'agenda)
   (save-excursion
 	(and (outline-next-heading)
@@ -54,7 +54,7 @@
 (switch-to-buffer-other-window buffer)
 (widen)
 (goto-char pos)
-(when (org-mode-p)
+(when (eq major-mode 'org-mode)
   (org-show-context 'agenda)
   (save-excursion
 	(and (outline-next-heading)
diff --git a/contrib/lisp/org-annotate-file.el b/contrib/lisp/org-annotate-file.el
index 265b55f..eb53ab1 100644
--- a/contrib/lisp/org-annotate-file.el
+++ b/contrib/lisp/org-annotate-file.el
@@ -99,7 +99,7 @@ show the relevant section"
(concat "file:" filename "::" line)
(org-annotate-file-elipsify-desc line
 (with-current-buffer (find-file org-annotate-file-storage-file)
-  (unless (org-mode-p)
+  (unless (eq major-mode 'org-mode)
 (org-mode))
   (goto-char (point-min))
   (widen)
diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el
index f4d9cd7..167caa0 100644
--- a/contrib/lisp/org-contacts.el
+++ b/contrib/lisp/org-contacts.el
@@ -157,7 +157,7 @@ If both match values are nil, return all contacts."
 (dolist (file (org-contacts-files))
   (org-check-agenda-file file)
   (with-current-buffer (org-get-agenda-file-buffer file)
-(unless (org-mode-p)
+(unless (eq major-mode 'org-mode)
   (error "File %s is no in `org-mode'" file))
 (org-scan-tags
  '(add-to-list 'markers (set-marker (make-marker) (point)))
@@ -263,7 +263,7 @@ If both match values are nil, return all contacts."
 (when marker
   (switch-to-buffer-other-window (marker-buffer marker))
   (goto-char marker)
-  (when (org-mode-p)
+  (when (eq major-mode 'org-mode)
 (org-show-context 'agenda)