Re: [O] PATCH Make org-open-at-point only ask once

2011-08-29 Thread Nicolas Goaziou
Hello,

Anders Waldenborg  writes:

> If an org buffer is narrowed, and one tries to do org-open-at-point on
> a link that points to outside of the restriction it asks: "No match -
> create this as a new heading?". When answering no the buffer is
> widened and the reseach is done, and if the link still can't be
> resolved the question is asked again.
>
> For nonexistant links this happens even if the buffer isn't narrowed -
> one needs to answer "n" twice.
>
> I also attached an alternate patch which (IMHO) simplifies the
> implementation by hiding the hard work in a macro, and as a bonus it
> only calls org-link-search once. But it is much more intrusive.

Yes, imposing widening to the user is intrusive. Moreover, I think you
cannot avoid to call org-link-search twice (once it has failed): the
point is to do a local search and then a global one.

Though, the macro idea is interesting, as I can see at least one other
place where it might be useful. So, what about changing the macro to:

1. If current buffer is narrowed, execute body with the current
   restriction. If it fails (silently), re-execute body with a widened
   buffer. Restore default narrowing.

2. If the buffer has no narrowing in effect, just execute body.

Also:

1. Doc-strings must refer to the arguments.

2. Don't forget to add: (def-edebug-spec macro-name (arguments)) just
   after it.

3. You need to add a proper ChangeLog message in your commit.


Thank you for looking at this.


Regards,

-- 
Nicolas Goaziou



Re: [O] Bug: wrong-type-argument when changing TODO state [7.7]

2011-08-29 Thread Stelian Iancu
On Sun, Aug 28, 2011 at 19:09, Nick Dokos  wrote:
> Stelian Iancu  wrote:
>
>>
>> I am trying to switch between TODO and DONE states with Shift-Right
>> Arrow and I get a (wrong-type-argument stringp nil) error.
>>
>> Please find attached the backtrace.
>>
>>
>> Emacs  : GNU Emacs 23.2.1 (i486-pc-linux-gnu, GTK+ Version 2.20.0)
>>  of 2010-12-11 on raven, modified by Debian
>> Package: Org-mode version 7.7
>>
>
>> Debugger entered--Lisp error: (wrong-type-argument stringp nil)
>>   looking-at(nil)
>>   (save-excursion (beginning-of-line 1) (looking-at org-todo-line-regexp))
>>   (and (outline-on-heading-p) (not (bolp)) (save-excursion 
>> (beginning-of-line 1) (looking-at org-todo-line-regexp)) (< (point) (+ 2 
>> ...)))
>>   (if (and (outline-on-heading-p) (not ...) (save-excursion ... ...) (< ... 
>> ...)) (progn (goto-char ...) (and ... ...)))
>>   (let* ...)
>>   (catch (quote exit) ...)
>>   (save-excursion (catch (quote exit)...)
>>   (let ...)
>>   org-todo(right)
>>   call-interactively(org-todo)
>>   (let ((current-prefix-arg arg)) (call-interactively command))
>>   org-call-with-arg(org-todo right)
>>   (let ...)
>>   (cond ...)
>>   org-shiftright(nil)
>>   call-interactively(org-shiftright nil nil)
>
> The problem is that org-todo-line-regexp is nil. This variable is
> made buffer-local and initialized when the buffer's mode is set
> to org-mode.
>
> Are you sure that your buffer's major mode is org-mode?
>
> Nick
>

Yeah, the mode shows as org-mode. But now I get another weird one.
Everytime I open an org file, I see the following message in the
minibuffer:

File mode specification error: (wrong-type-argument keymap nil)

I'm lost ...

S.



Re: [O] Bug: wrong-type-argument when changing TODO state [7.7]

2011-08-29 Thread Nick Dokos
Stelian Iancu  wrote:

> On Sun, Aug 28, 2011 at 19:09, Nick Dokos  wrote:
> > Stelian Iancu  wrote:
> >
> >>
> >> I am trying to switch between TODO and DONE states with Shift-Right
> >> Arrow and I get a (wrong-type-argument stringp nil) error.
> >>
> >> Please find attached the backtrace.
> >>
> >>
> >> Emacs  : GNU Emacs 23.2.1 (i486-pc-linux-gnu, GTK+ Version 2.20.0)
> >>  of 2010-12-11 on raven, modified by Debian
> >> Package: Org-mode version 7.7
> >>
> >
> >> Debugger entered--Lisp error: (wrong-type-argument stringp nil)
> >>   looking-at(nil)
> >>   (save-excursion (beginning-of-line 1) (looking-at org-todo-line-regexp))
> >>   (and (outline-on-heading-p) (not (bolp)) (save-excursion 
> >> (beginning-of-line 1) (looking-at org-todo-line-regexp)) (< (point) (+ 2 
> >> ...)))
> >>   (if (and (outline-on-heading-p) (not ...) (save-excursion ... ...) (< 
> >> ... ...)) (progn (goto-char ...) (and ... ...)))
> >>   (let* ...)
> >>   (catch (quote exit) ...)
> >>   (save-excursion (catch (quote exit)...)
> >>   (let ...)
> >>   org-todo(right)
> >>   call-interactively(org-todo)
> >>   (let ((current-prefix-arg arg)) (call-interactively command))
> >>   org-call-with-arg(org-todo right)
> >>   (let ...)
> >>   (cond ...)
> >>   org-shiftright(nil)
> >>   call-interactively(org-shiftright nil nil)
> >
> > The problem is that org-todo-line-regexp is nil. This variable is
> > made buffer-local and initialized when the buffer's mode is set
> > to org-mode.
> >
> > Are you sure that your buffer's major mode is org-mode?
> >
> > Nick
> >
> 
> Yeah, the mode shows as org-mode.

What happens if while visiting the buffer, you say

C-h v org-todo-line-regexp RET

Is the value reported nil? 

> But now I get another weird one.
> Everytime I open an org file, I see the following message in the
> minibuffer:
> 
> File mode specification error: (wrong-type-argument keymap nil)
> 

That will require another backtrace but...

> I'm lost ...

When you get to the point of feeling lost, it's time to take a step
back. Make yourself a minimal.emacs that contains just the basics to
get org-mode loaded - assuming you get your org sources from git, then
you need something like this (with pathnames changed appropriately):

--8<---cut here---start->8---
;;; -*- mode: emacs-lisp -*-
;;; constant part
(add-to-list 'load-path (expand-file-name "~/src/emacs/org/org-mode/lisp"))
(add-to-list 'auto-mode-alist '("\\.\\(org\\|org_archive\\|txt\\)$" . org-mode))
(require 'org-install)
(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-ca" 'org-agenda)
--8<---cut here---end--->8---

Then start up an emacs without any of your customizations, load the 
minimal.emacs
file and visit an org file and try what you tried before:

   emacs -q -l /path/to/minimal.emacs /path/to/somefile.org

and try changing a TODO as before.  Does that work? If not, try -Q
instead of -q: does *that* work?

Assuming one of these works, then you have localized the problem to
some customization (yours or the systems) and then there are various
ways to proceed.

Nick

> 
> S.
> 



[O] Bug: Babel: asymptote: erroneous conversion of heterogeneous-typed table

2011-08-29 Thread Major A

Hi,

I'd like to use asymptote to plot the values in an Org table.  The table
has cells with numbers but also cells with strings in them.  This table
gets converted to an array of strings in the resulting asymptote file,
with the strings escaped with double-quotes but not the numbers.  In
asymptote, this is an error, so that no plot is produced.

Here's the code:

  #+data: values
  | 0 | 0 | a |
  | 1 | 1 | b |
  | 2 | 3 | c |
  
  #+begin_src asymptote :file asy.png :var v=values
size(100);
draw((0,0)--(1,1));
  #+end_src

The temporary asymptote file created during evaluation or export looks
like this:

  string[][] v={
  {0,0,"a"},
  {1,1,"b"},
  {2,3,"c"}
  };

"asy" complains about this file like this:

  asymptote-12652XAo: 2.2: cannot cast 'int' to 'string'
  asymptote-12652XAo: 2.4: cannot cast 'int' to 'string'
  asymptote-12652XAo: 3.2: cannot cast 'int' to 'string'
  asymptote-12652XAo: 3.4: cannot cast 'int' to 'string'
  asymptote-12652XAo: 4.2: cannot cast 'int' to 'string'
  asymptote-12652XAo: 4.4: cannot cast 'int' to 'string'

Am I doing something wrong here?

I actually need this to work ASAP, so if anyone has any workable
solution, then please let me know.

  András








Emacs  : GNU Emacs 23.3.1 (i486-pc-linux-gnu, GTK+ Version 2.24.3)
 of 2011-04-10 on raven, modified by Debian
Package: Org-mode version 7.7 (release_7.7.205.gce02a)

current state:
==
(setq
 org-export-latex-after-initial-vars-hook '(org-beamer-after-initial-vars)
 org-speed-command-hook '(org-speed-command-default-hook 
org-babel-speed-command-hook)
 org-babel-load-languages '((asymptote . t) (ditaa . t) (dot . t) (gnuplot . t) 
(haskell . t) (latex . t) (octave . t)
   (R . t) (ruby . t) (scheme . t) (sh 
. t))
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 org-babel-tangle-lang-exts '(("ruby" . "rb") ("latex" . "tex") ("haskell" . 
"hs") ("asymptote" . "asy")
("emacs-lisp" . "el"))
 org-export-blocks-postblock-hook '(org-exp-res/src-name-cleanup)
 org-export-latex-format-toc-function 'org-export-latex-format-toc-default
 org-tab-first-hook '(org-hide-block-toggle-maybe 
org-src-native-tab-command-maybe org-babel-hide-result-toggle-maybe)
 org-src-mode-hook '(org-src-babel-configure-edit-buffer 
org-src-mode-configure-edit-buffer)
 org-confirm-shell-link-function 'yes-or-no-p
 org-export-first-hook '(org-beamer-initialize-open-trackers)
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-blank-before-new-entry nil
 org-babel-pre-tangle-hook '(save-buffer)
 org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers 
org-cycle-show-empty-lines
  org-optimize-window-after-visibility-change)
 org-export-preprocess-before-normalizing-links-hook 
'(org-remove-file-link-modifiers)
 org-mode-hook '(#[nil "\300\301\302\303\304$\207" [org-add-hook 
change-major-mode-hook org-show-block-all append local]
  5]
 #[nil "\300\301\302\303\304$\207"
  [org-add-hook change-major-mode-hook 
org-babel-show-result-all append local] 5]
 org-babel-result-hide-spec 
org-babel-hide-all-hashes)
 org-ctrl-c-ctrl-c-hook '(org-babel-hash-at-point 
org-babel-execute-safely-maybe)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-export-interblocks '((lob org-babel-exp-lob-one-liners) (src 
org-babel-exp-inline-src-blocks))
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 org-occur-hook '(org-first-headline-recenter)
 org-from-is-user-regexp nil
 org-export-preprocess-before-selecting-backend-code-hook 
'(org-beamer-select-beamer-code)
 org-confirm-babel-evaluate nil
 org-export-latex-final-hook '(org-beamer-amend-header org-beamer-fix-toc 
org-beamer-auto-fragile-frames
  
org-beamer-place-default-actions-for-lists)
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-export-blocks '((src org-babel-exp-src-block nil) (comment 
org-export-blocks-format-comment t)
(ditaa org-export-blocks-format-ditaa nil) (dot 
org-export-blocks-format-dot nil))
 )



Re: [O] Bug: Babel: asymptote: erroneous conversion of heterogeneous-typed table

2011-08-29 Thread Nicolas Goaziou
Hello,

Major A  writes:

> I'd like to use asymptote to plot the values in an Org table.  The table
> has cells with numbers but also cells with strings in them.  This table
> gets converted to an array of strings in the resulting asymptote file,
> with the strings escaped with double-quotes but not the numbers.  In
> asymptote, this is an error, so that no plot is produced.

I'm not sure to understand. Your array must have all its elements of the
same type. In this case, it detects that common type should be
"string". What else should it do in that case?

That being said, you can have rownames and colnames even in an array of
ints (see :rownames and :colnames headers arguments for your source
block).

In others words, you can plot, for example, the following table without
any problem:

| x | 1 | 2 | 3 |
| y | 1 | 4 | 9 |

Regards,

-- 
Nicolas Goaziou



Re: [O] Bug: Babel: asymptote: erroneous conversion of heterogeneous-typed table

2011-08-29 Thread Nick Dokos
Major A  wrote:

> 
> Hi,
> 
> I'd like to use asymptote to plot the values in an Org table.  The table
> has cells with numbers but also cells with strings in them.  This table
> gets converted to an array of strings in the resulting asymptote file,
> with the strings escaped with double-quotes but not the numbers.  In
> asymptote, this is an error, so that no plot is produced.
> 
> Here's the code:
> 
>   #+data: values
>   | 0 | 0 | a |
>   | 1 | 1 | b |
>   | 2 | 3 | c |
>  =20
>   #+begin_src asymptote :file asy.png :var v=3Dvalues
> size(100);
> draw((0,0)--(1,1));
>   #+end_src
> 
> The temporary asymptote file created during evaluation or export looks
> like this:
> 
>   string[][] v=3D{
>   {0,0,"a"},
>   {1,1,"b"},
>   {2,3,"c"}
>   };
> 
> "asy" complains about this file like this:
> 
>   asymptote-12652XAo: 2.2: cannot cast 'int' to 'string'
>   asymptote-12652XAo: 2.4: cannot cast 'int' to 'string'
>   asymptote-12652XAo: 3.2: cannot cast 'int' to 'string'
>   asymptote-12652XAo: 3.4: cannot cast 'int' to 'string'
>   asymptote-12652XAo: 4.2: cannot cast 'int' to 'string'
>   asymptote-12652XAo: 4.4: cannot cast 'int' to 'string'
> 
> Am I doing something wrong here?
> 

I don't know anything about asymptote and I am not sure whether this
will help: it does produce a temp file with everything quoted and
running asy on the temp file produces an .eps file that contains the
diagonal line, but it produces a png file which seems somewhat peculiar
to me but maybe it'll work for you.

You have to do

(setq org-babel-min-lines-for-block-output 0)

in order to get the example block result.

I just added a python block to produce another table with everything
quoted.  The second table is then give to asymptote:

--8<---cut here---start->8---
#+data: values
| 0 | 0 | a |
| 1 | 1 | b |
| 2 | 3 | c |

#+begin_src python :results output :var table=values
  print "#+data: qvalues"
  for row in table:
  print "|%s|" % ("|".join(map(lambda x: "\"%s\"" % (x), row)))
  
#+end_src

#+results:
#+begin_example
#+data: qvalues
|"0"|"0"|"a"|
|"1"|"1"|"b"|
|"2"|"3"|"c"|
#+end_example

#+begin_src asymptote :file asy.png :var v=qvalues
   size(100);
   draw((0,0)--(1,1));

#+end_src

#+results:
[[file:asy.png]]
--8<---cut here---end--->8---


The temp file looks like this:


--8<---cut here---start->8---
string[][] v={
{"0","0","a"},
{"1","1","b"},
{"2","3","c"}
};
size(100);
draw((0,0)--(1,1));
--8<---cut here---end--->8---

I attach the asy.png file I get.

Nick

<>

Re: [O] disable "org-decrypt: auto-save-mode may cause leakage"

2011-08-29 Thread Sebastien Vauban
Hi Pieter,

Pieter Praet wrote:
> On Tue, 19 Jul 2011 01:12:23 +0200, Bastien  wrote:
>> "Sebastien Vauban"  writes:
>> 
>> > I simply call C-c C-x C-j to jump to the current clocking entry, and the
>> > question "org-decrypt: auto-save-mode may cause leakage. Disable it for
>> > current buffer? (y or n)" pops up -- while the current buffer has nothing
>> > special, as said above.
>>
>> Weird.
>> 
>> Maybe you have some hook in `org-clock-goto-hook' that makes Org visit some
>> buffer containing encrypted entries?
>
> Apparently not config-related.
>
> I don't use org-clock.el (and as such don't have any org-clock related
> config, `org-clock-goto-hook' is nil), but due to a recent freak accident
> involving spastic typing, I've managed to trigger the issue. Apologies for
> dismissing it earlier, Sebastien.

No problem, Pieter. I did not expand the thread further by lack of time, and
-- at this point in time -- I can't prove yet whether you're wrong or right
(saying it could be config-related) in my case.

> `org-clock-goto' erroneously causes `org-decrypt-entry' to be called, though
> it's not immediately obvious how or why this would happen.

Your analysis and patch seems right to me, just from reading it.

However, in my case, I have the question coming up even when
org-clock-goto'ing to/from a buffer that does not contain any :crypt: entry!
But, as stated, by lack of time, I simply can't try to reduce the problem to
an ECM right now. So, I'll first test your patch, when pushed to the repo, and
report any new observation.

Best regards,
  Seb

-- 
Sebastien Vauban




Re: [O] Bug: Babel: asymptote: erroneous conversion of heterogeneous-typed table

2011-08-29 Thread András Major
Hi Nicolas,

> > I'd like to use asymptote to plot the values in an Org table.  The table
> > has cells with numbers but also cells with strings in them.  This table
> > gets converted to an array of strings in the resulting asymptote file,
> > with the strings escaped with double-quotes but not the numbers.  In
> > asymptote, this is an error, so that no plot is produced.
> 
> I'm not sure to understand. Your array must have all its elements of the
> same type. In this case, it detects that common type should be
> "string". What else should it do in that case?
> 
> That being said, you can have rownames and colnames even in an array of
> ints (see :rownames and :colnames headers arguments for your source
> block).
> 
> In others words, you can plot, for example, the following table without
> any problem:
> 
> | x | 1 | 2 | 3 |
> | y | 1 | 4 | 9 |

This isn't what I need.  What I want is to make a graph of certain columns
of a table which contains both ints and strings.  Ideally, there should be
no constraint about which columns contain ints and which contain strings.

Since the table usually comes first (you collect your research in such,
for instance), reformatting afterwards only so that asymptote works is
not an option.

Why isn't it possible to force ob-asymptote to make all cells strings?
Then one could easily convert the strings back to floats or so within
asymptote as needed.

  András





Re: [O] PATCH Make org-open-at-point only ask once

2011-08-29 Thread Anders Waldenborg
On Mon, Aug 29, 2011 at 09:14:13AM +0200, Nicolas Goaziou wrote:
> Yes, imposing widening to the user is intrusive. Moreover, I think you
> cannot avoid to call org-link-search twice (once it has failed): the
> point is to do a local search and then a global one.

Yes, "local then global" search makes sense (I especially like how the
infobrowser pops out to a global search with an extra ^S after failure).

But for org links, I'm not 100% sure - consider this org-file:

* Notes
* Some topic
[[Notes]]
** Notes

If buffer is widen, the link goes to the toplevel header, but if I
narrow to "Some topic" the link suddenly starts going to the subheader.

So the links meaning changes depending on if the buffer is narrowed or
not.

I'm not sure it really is a problem, I just want to make sure it is taken
into consideration.

> 
> Though, the macro idea is interesting, as I can see at least one other
> place where it might be useful. So, what about changing the macro to:
> 
> 1. If current buffer is narrowed, execute body with the current
>restriction. If it fails (silently), re-execute body with a widened
>buffer. Restore default narrowing.

Fails means that it throws error? Or any exception?

> 
> 2. If the buffer has no narrowing in effect, just execute body.
> 
> Also:

Thanks for the review, I'll look into it soon.

 anders



Re: [O] [PATCH 0/5] loop over headlines in active region

2011-08-29 Thread Carsten Dominik

On Aug 28, 2011, at 3:58 PM, David Maus wrote:

> Hi Carsten,
> 
> At Thu, 25 Aug 2011 08:13:21 +0200,
> Carsten Dominik wrote:
>> I am wondering, why did you choose to skip invisible headlines?
>> I would worry that this introduces inconsistent behavior and also
>> makes it hard to use this feature in a programmatic way.
> 
> Good points. I though of skipping invisible headlines as a way to
> control which headlines are 'looped over' but if this is inconsistent
> with already present behaviour of Org mode or Emacs in general we can
> scratch that idea.

Yes, let's do that.

> 
> What brings up the question: What is the current behavior of Org mode
> with regards to operations in a region?

I think almost everything that iterates over a number of
headlines will also do the invisible ones.  Exceptions are
exporting/copying the visible headlines, and probably something else I
am not remembering.

- Carsten





Re: [O] [PATCH 2/5] Immediately return if scope is region but no region is active

2011-08-29 Thread Carsten Dominik

On Aug 28, 2011, at 4:00 PM, David Maus wrote:

> Hi Carsten,
> 
> At Thu, 25 Aug 2011 07:43:48 +0200,
> Carsten Dominik wrote:
>> 
>> 
>> On 25.8.2011, at 06:25, David Maus wrote:
>> 
>>> * org.el (org-map-entries): Immediately return if scope is region but
>>> no region is active.
>>> ---
>>> lisp/org.el |  116 
>>> ++-
>>> 1 files changed, 59 insertions(+), 57 deletions(-)
>>> 
>>> diff --git a/lisp/org.el b/lisp/org.el
>>> index b69b77c..27bad52 100644
>>> --- a/lisp/org.el
>>> +++ b/lisp/org.el
>>> @@ -13608,65 +13608,67 @@ with `org-get-tags-at'.  If your function gets 
>>> properties with
>>> to t around the call to `org-entry-properties' to get the same speedup.
>>> Note that if your function moves around to retrieve tags and properties at
>>> a *different* entry, you cannot use these techniques."
>>> -  (let* ((org-agenda-archives-mode nil) ; just to make sure
>>> -(org-agenda-skip-archived-trees (memq 'archive skip))
>>> -(org-agenda-skip-comment-trees (memq 'comment skip))
>>> -(org-agenda-skip-function
>>> - (car (org-delete-all '(comment archive) skip)))
>>> -(org-tags-match-list-sublevels t)
>>> -matcher file res
>>> -org-todo-keywords-for-agenda
>>> -org-done-keywords-for-agenda
>>> -org-todo-keyword-alist-for-agenda
>>> -org-drawers-for-agenda
>>> -org-tag-alist-for-agenda)
>>> +  (unless (and (eq scope 'region)
>>> +  (not (org-region-active-p)))
>> 
>> Would it be good to throw an error here?
>> 
>> (if (and (eq scope 'region) (not (org-region-active-p)))
>>(error "No active region")
> 
> Not necessarily. I look at map-entries as a function that applies FUNC
> to a subset of all headlines. SCOPE, MATCH, and SKIP are selectors
> that narrow down the set of headlines.  First SCOPE is applied to the
> set containing all headlines, than MATCH is applied to the set of
> headlines selected by SCOPE, finally FUNC is applied to all headlines
> in the final subset if not SKIP.
> 
> If you look at `org-map-entries' this way then calling it with SCOPE
> 'region but no active region is not an error. How many headlines are
> in the active region if there is no active region? Exactly zero. Its
> the same with a SCOPE 'file but no headline in current file.
> 
> Applying SCOPE to the set of all headings produces the empty set
> and `org-map-entries' can simply leave because MATCH and SKIP wouldn't
> match anything.

Yes, I agree, I think you are right.  Thanks!

- Carsten


Re: [O] PATCH Make org-open-at-point only ask once

2011-08-29 Thread Nicolas Goaziou
Anders Waldenborg  writes:

> But for org links, I'm not 100% sure - consider this org-file:
>
> * Notes
> * Some topic
> [[Notes]]
> ** Notes
>
> If buffer is widen, the link goes to the toplevel header, but if I
> narrow to "Some topic" the link suddenly starts going to the
> subheader.

And I think that totally makes sense. If the user bothered narrowing
buffer to a sub-tree, he probably wants to focus on the Notes relative to
that sub-tree.

Now, you're right, that search behaviour won't be consistent as long as
it will rely on narrowing.

Maybe we should define a consistent link search: ignore the narrowing
but first search in current sub-tree, if that fails (any error, I guess)
search in current tree and if that one fails too, search in the whole
buffer.

> Thanks for the review, I'll look into it soon.

Np.

Regards,

-- 
Nicolas Goaziou



Re: [O] Bug: Babel: asymptote: erroneous conversion of heterogeneous-typed table

2011-08-29 Thread András Major
Hi Nick,

> I don't know anything about asymptote and I am not sure whether this
> will help: it does produce a temp file with everything quoted and
> running asy on the temp file produces an .eps file that contains the
> diagonal line, but it produces a png file which seems somewhat peculiar
> to me but maybe it'll work for you.

Thanks for the example, good idea.  Yes, the diagonal line is OK,
that's what my asymptote example creates, as the code I posted doesn't
actually make use of the array (its mere presence is enough to trigger
the error).

> You have to do
> 
> (setq org-babel-min-lines-for-block-output 0)
> 
> in order to get the example block result.

#+begin_rant

Is it just me, or are there other people who think that this kind of
approach is wrong?  In my view, per-user configuration can affect
the look-and-feel of org-mode, the paths, etc., but I think having
options that affect the result in any way (most babel options, in
fact) should be configurable from within the Org file itself.

After all, most work I do (now in Org) is supposed to be passed
to other people who can then continue doing this work.  I can't
expect them to change "global" settings just so they can reproduce
my output.

I love most software I use exactly because it doesn't rely too
much on global (per-user) configuration.  I think Org should also
reduce the set of global options to the absolute minimum.

#+end_rant

  András





Re: [O] Bug: Babel: asymptote: erroneous conversion of heterogeneous-typed table

2011-08-29 Thread Nicolas Goaziou
András Major  writes:

> This isn't what I need.  What I want is to make a graph of certain
> columns of a table which contains both ints and strings.  Ideally,
> there should be no constraint about which columns contain ints and
> which contain strings.

Again, this is a limitation of Asymptote. An array _must_ contain
elements of a single type. That beast you want doesn't exist (unless you
typedef it, but then you cannot pass arguments anymore).

> Since the table usually comes first (you collect your research in
> such, for instance), reformatting afterwards only so that asymptote
> works is not an option.

Why? You can always write an intermediary step to "stringify" every
cell. Choose your language. Nick Dokos showed you one way.

> Why isn't it possible to force ob-asymptote to make all cells strings?

It is possible to force ob-asymptote to make all cells strings. But
I don't think ob-asymptote should try that hard to compensate users'
misuses of data types.

Now, I may be totally wrong.

Regards,

-- 
Nicolas Goaziou



[O] Footnote changes creates [REGRESSION] in xhtml/odt exporters

2011-08-29 Thread Jambunathan K

Footnote changes creates [REGRESSION] in xhtml/odt exporters. The
required details are in the attached org file.

Caught by my test.org file :-).

-- 
#+TITLE: footnote-regression.org
#+AUTHOR:
#+EMAIL: kjambunathan@JAMBU-NETBOOK
#+DATE:  2011-08-29 Mon
#+DESCRIPTION:
#+KEYWORDS:
#+LANGUAGE:  en
#+OPTIONS:   H:3 num:t toc:t \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t
#+OPTIONS:   TeX:t LaTeX:t skip:nil d:nil todo:t pri:nil tags:not-in-toc
#+INFOJS_OPT: view:nil toc:nil ltoc:t mouse:underline buttons:0 path:http://orgmode.org/org-info.js
#+EXPORT_SELECT_TAGS: export
#+EXPORT_EXCLUDE_TAGS: noexport
#+LINK_UP:   
#+LINK_HOME: 
#+XSLT:



* COMMENT Bug Description 

  With very minimal emacs, do
  1. M-x load-library RET org-html.el RET
  1. M-x load-library RET org-xhtml.el RET
  2. C-x C-f footnote-regression.org RET
  3. M-x org-export-as-xhtml-and-open RET
  4. Note that the title of this document ends up in the footnote
 definitions.

  Hint: I am seeing that the value returned by
  `org-export-preprocess-string' in the before and after commits are
  different.

* Second headline

  Duis aute irure dolor in reprehenderit in voluptate velit esse
  cillum dolore eu fugiat nulla pariatur[fn:inlabel:an inline
  footnote][fn:inlabel2:[[http://www.google.com][google]] this].

* COMMENT How Emacs is invoked

"C:\Program Files\emacs-24.0.50\bin\runemacs.exe" --debug-init -Q -L ~/src/org-mode/lisp -L ~/src/org-mode/contrib/lisp --visit footnote-regression.org"

* COMMENT  Commit that causes regression
git bisect bad
Bisecting: 0 revisions left to test after this (roughly 0 steps)
[baf7dde28ef8730c558a6cf3c789d7400dbc51c6] org-footnote: allow non Org mode files to have no footnote tag

* COMMENT The good one

commit baf7dde28ef8730c558a6cf3c789d7400dbc51c6
Author: Nicolas Goaziou 
Date:   Tue Aug 16 20:02:30 2011 +0200

org-footnote: allow non Org mode files to have no footnote tag

* lisp/org-footnote.el (org-footnote-tag-for-non-org-mode-files):
  notify the opportunity to set the variable to the empty string.
(org-footnote-normalize, org-footnote-create-definition): carefully
  check for inserted newlines and presence of the footnote
  tag.

commit cb906e440661f102fd004cb7c8792c2498018858
Author: Nicolas Goaziou 
Date:   Tue Aug 16 18:10:15 2011 +0200

org-footnote: re-use global regexps when possible

* lisp/org-footnote.el (org-footnote-at-definition-p): re-use
  org-footnote-definition-re.



Re: [O] Bug: Babel: asymptote: erroneous conversion of heterogeneous-typed table

2011-08-29 Thread András Major
> Why? You can always write an intermediary step to "stringify" every
> cell. Choose your language. Nick Dokos showed you one way.

Apparently, only if you set a global/per-user option in .emacs or suchlike,
which I think is a bad way of doing it.

> > Why isn't it possible to force ob-asymptote to make all cells strings?
> 
> It is possible to force ob-asymptote to make all cells strings. But
> I don't think ob-asymptote should try that hard to compensate users'
> misuses of data types.

I don't think this is misuse in any way.  Consider a table which is a
result of your research:  the columns are the maker (e.g., "Mazda"), the
type (e.g., "MX-5"), engine displacement (a number), the mileage/fuel
consumption (a number), etc., and I want to create some asymptote plot
from this data.

If there is no way of doing this without requiring global/per-user
settings, then I think that something must be changed.

  András





[O] [babel][R] no return values in R code blocks

2011-08-29 Thread Max Flöttmann
Hi,
When i run a code block like this using C-c C-c:

#+BEGIN_SRC R
c(1,23,54,5)
#+END_SRC

I do not get any results.

In older versions of orgmode the result used be a table or vector returned
by R. Is this a bug, or do I need a new keyword that is not in the
documentation yet to get the same result?
I'm using version 7.7 and R2.13.1

Thanks,

Max


Re: [O] PATCH Make org-open-at-point only ask once

2011-08-29 Thread Anders Waldenborg
On Mon, Aug 29, 2011 at 11:36:19AM +0200, Nicolas Goaziou wrote:
> Maybe we should define a consistent link search: ignore the narrowing
> but first search in current sub-tree, if that fails (any error, I guess)
> search in current tree and if that one fails too, search in the whole
> buffer.

So something with the same semantics as this:

(defun find-nearest-heading-named (l)
  (unless (find-heading-in-current-subtree l)
(up-one-level)
(find-nearest-heading-named l)))

i.e find the target with its parent headings list sharing the longest
prefix with current point's.

* A
** B
* C
** B
** D
*** B
*** E

A link to B inside E would go to C/D/B because (C D B) shares longer
prefix with (C D E) than (C B) and (A B) does.

 anders



Re: [O] Footnote changes creates [REGRESSION] in xhtml/odt exporters

2011-08-29 Thread Nicolas Goaziou
Hello,

Jambunathan K  writes:

> Footnote changes creates [REGRESSION] in xhtml/odt exporters. The
> required details are in the attached org file.
>
> Caught by my test.org file :-).

I've pushed a fix to master. Thanks for reporting it.

I have to admit I don't do xhtml/odt regression tests yet.

Regards,

-- 
Nicolas Goaziou



Re: [O] PATCH Make org-open-at-point only ask once

2011-08-29 Thread Nicolas Goaziou
Anders Waldenborg  writes:

> On Mon, Aug 29, 2011 at 11:36:19AM +0200, Nicolas Goaziou wrote:
>> Maybe we should define a consistent link search: ignore the narrowing
>> but first search in current sub-tree, if that fails (any error, I guess)
>> search in current tree and if that one fails too, search in the whole
>> buffer.
>
> So something with the same semantics as this:
>
> (defun find-nearest-heading-named (l)
>   (unless (find-heading-in-current-subtree l)
> (up-one-level)
> (find-nearest-heading-named l)))

Recursively, yes. And enclosing this with (org-with-wide-buffer ...)
macro.

> i.e find the target with its parent headings list sharing the longest
> prefix with current point's.
>
> * A
> ** B
> * C
> ** B
> ** D
> *** B
> *** E
>
> A link to B inside E would go to C/D/B because (C D B) shares longer
> prefix with (C D E) than (C B) and (A B) does.

To be sure we understand it the same way:

1. Go to E and search from there: failure.
2. Go to D and search from there: success.

And if there's a link to D in A/B:

1. Search from B: failure.
2. Search from A: failure.
3. Search from (point-min): success.

Also, I would use "hierarchically" (or the like) instead of "nearest",
which can be confusing, as in this example:

* A
** F
* B
** C
*** D
 F

Linking F from B should point to  F instead of ** F while the latter
is nearer if considered distance is positive difference between buffer
positions.

What do you (or anyone reading this) think?

Regards,

-- 
Nicolas Goaziou



[O] deadline :: schedualed :: or-later

2011-08-29 Thread Michael Hintz
Hello,

IMHO it needs a 3nd date-mode. I use deadline for all thinks 
that have to be done until the deadline-date. I use scheduled
for a fix date ...

and what about thinks that could start at a date "or later".

I tried to fix it by using a time for fix and no time for
non-fixed or has-to-be-start dates, but this is no solution,
because there are todos that have to be done on a fix-time and
others only on a fix day.

But never the less I use a lot of planning tools but org-mode
fits best for all my needs - 
   thanks - Michael



Re: [O] deadline :: schedualed :: or-later

2011-08-29 Thread Juan Pechiar
Hi Michael,

Please check the purpose of SCHEDULED in org-mode:

   http://orgmode.org/manual/Deadlines-and-scheduling.html

It is exactly what you mean by starting at a day or later.

For a fixed date, just drop a timestamp inside a heading.

Regards,
.j.

On Mon, Aug 29, 2011 at 01:38:26PM +0200, Michael Hintz wrote:
> IMHO it needs a 3nd date-mode. I use deadline for all thinks
> that have to be done until the deadline-date. I use scheduled
> for a fix date ...
>
> and what about thinks that could start at a date "or later".
>
> I tried to fix it by using a time for fix and no time for
> non-fixed or has-to-be-start dates, but this is no solution,
> because there are todos that have to be done on a fix-time and
> others only on a fix day.



Re: [O] Footnote changes creates [REGRESSION] in xhtml/odt exporters

2011-08-29 Thread Jambunathan K
Nicolas Goaziou  writes:

> Hello,
>
> Jambunathan K  writes:
>
>> Footnote changes creates [REGRESSION] in xhtml/odt exporters. The
>> required details are in the attached org file.
>>
>> Caught by my test.org file :-).
>
> I've pushed a fix to master. Thanks for reporting it.

Confirming that this is fixed.

> I have to admit I don't do xhtml/odt regression tests yet.

I didn't mean it that way.

In this context, I would like to re-surface Martyn Jago's offer of help
here.
http://lists.gnu.org/archive/html/emacs-orgmode/2011-07/msg00154.html

Jambunathan K.

>
> Regards,

-- 



Re: [O] Attachments and refiling

2011-08-29 Thread Gustav Wikström
Thanks for this. Added it to my settings for now =)

/Gustav

2011/8/2 Matt Lundin 

> Gustav Wikström  writes:
>
> > However I think it also is nice to also be able to use custom names to
> > attachment folders. And it would be nice be able to use some logic with
> > this, like automatically setting the folder name to the same as the
> > heading it's attached to. And to allow properties on a file/heading/
> > sub-tree basis which defines the base-path to where attachments to that
> > particular file/heading/sub-tree should reside on the system, relative
> > or non-relative. This would allow for more atomic solutions if i'm
> > writing a document on the side of my main setup and want to add some
> > attachments in the same path.
> >
> > But still, it is a really nice feature to have control over the
> > attachments. So from my point of view it seems sound to try to reason
> > about different solutions to this or at least keep it in mind for
> > future functionality.
>
> One possibility is to advise the function org-attach-dir to call
> org-attach-set-directory (and, optionally, org-attach-set-inherit) if
> the entry does not already have an ATTACH_DIR property:
>
> --8<---cut here---start->8---
> (defadvice org-attach-dir (before my-org-attach-set-dir-before-attach
> activate)
>  "Prompt for attachment directory (thus preempting org-get-id)."
>  (unless (org-entry-get nil "ATTACH_DIR" 'inherit)
>(org-attach-set-directory)))
> --8<---cut here---end--->8---
>
> This allows one to enter the name of the directory *before* org attaches
> the file. This is the way I use org-attach, as I prefer human-readable
> directories to UUIDs.
>
> Best,
> Matt
>


Re: [O] Bug: Babel: asymptote: erroneous conversion of heterogeneous-typed table

2011-08-29 Thread Nicolas Goaziou
András Major  writes:

>> Why? You can always write an intermediary step to "stringify" every
>> cell. Choose your language. Nick Dokos showed you one way.
>
> Apparently, only if you set a global/per-user option in .emacs or suchlike,
> which I think is a bad way of doing it.
-
#+tblname: mixed-types
|1|x|5|
|3|y|4|

#+source: stringify(table=mixed-types)
#+begin_src emacs-lisp
(concat "string[][] myvar={{"
(mapconcat
 (lambda (row)
   (when (listp row)
 (concat (mapconcat (lambda (el) (format "\"%s\"" el)) row ",") 
"}")))
 table
 ",{")
"};")
#+end_src

#+source: myplot
#+begin_src asymptote :noweb yes :file myplot.png
<>
unitsize(3cm);
draw((0,0)--(1,1));
#+end_src

#+results: myplot
[[file:myplot.png]]


It may be ugly, but it works.

> I don't think this is misuse in any way.  Consider a table which is a
> result of your research:  the columns are the maker (e.g., "Mazda"), the
> type (e.g., "MX-5"), engine displacement (a number), the mileage/fuel
> consumption (a number), etc., and I want to create some asymptote plot
> from this data.

How would you would you specify it to Asymptote? You can't.

You would probably use:

string[][] cars={{"Mazda","MX-5","1.5"}};

And that's exactly my point: engine displacement may be a number, but
you would have to enter it as a string.

Though, you insist on being able to enter it as a number anyway, hoping
ob-asymptote will do the magic behind. How could it, since the language
can't itself?

Perhaps there should be a way in Babel (not specifically in Asymptote)
to output a table with raw strings. Because want you really want to use
is:

|"1"|"x"|"5"|
|"3"|"y"|"4"|


Regards,

-- 
Nicolas Goaziou



Re: [O] The Orgfather

2011-08-29 Thread Manish
On Sat, Aug 27, 2011 at 9:16 PM, suvayu ali wrote:
> On Sat, Aug 27, 2011 at 5:05 PM, Bastien wrote:
>> Hi folks,
>>
>> http://lumiere.ens.fr/~guerry/theorgfather.html
>>
>> Enjoy!
>
> Ignoring the Hindi audio was a bit difficult for me. :D :D
>

Ditto. But loved it nonetheless.  :)

-- 
Manish



Re: [O] Bug: wrong-type-argument when changing TODO state [7.7]

2011-08-29 Thread Stelian Iancu
Many thanks Nick for all of these suggestions. I will do this in the
evening when I'm back home and let you know.

S.

On Mon, Aug 29, 2011 at 09:59, Nick Dokos  wrote:
> Stelian Iancu  wrote:
>
>> On Sun, Aug 28, 2011 at 19:09, Nick Dokos  wrote:
>> > Stelian Iancu  wrote:
>> >
>> >>
>> >> I am trying to switch between TODO and DONE states with Shift-Right
>> >> Arrow and I get a (wrong-type-argument stringp nil) error.
>> >>
>> >> Please find attached the backtrace.
>> >>
>> >>
>> >> Emacs  : GNU Emacs 23.2.1 (i486-pc-linux-gnu, GTK+ Version 2.20.0)
>> >>  of 2010-12-11 on raven, modified by Debian
>> >> Package: Org-mode version 7.7
>> >>
>> >
>> >> Debugger entered--Lisp error: (wrong-type-argument stringp nil)
>> >>   looking-at(nil)
>> >>   (save-excursion (beginning-of-line 1) (looking-at org-todo-line-regexp))
>> >>   (and (outline-on-heading-p) (not (bolp)) (save-excursion 
>> >> (beginning-of-line 1) (looking-at org-todo-line-regexp)) (< (point) (+ 2 
>> >> ...)))
>> >>   (if (and (outline-on-heading-p) (not ...) (save-excursion ... ...) (< 
>> >> ... ...)) (progn (goto-char ...) (and ... ...)))
>> >>   (let* ...)
>> >>   (catch (quote exit) ...)
>> >>   (save-excursion (catch (quote exit)...)
>> >>   (let ...)
>> >>   org-todo(right)
>> >>   call-interactively(org-todo)
>> >>   (let ((current-prefix-arg arg)) (call-interactively command))
>> >>   org-call-with-arg(org-todo right)
>> >>   (let ...)
>> >>   (cond ...)
>> >>   org-shiftright(nil)
>> >>   call-interactively(org-shiftright nil nil)
>> >
>> > The problem is that org-todo-line-regexp is nil. This variable is
>> > made buffer-local and initialized when the buffer's mode is set
>> > to org-mode.
>> >
>> > Are you sure that your buffer's major mode is org-mode?
>> >
>> > Nick
>> >
>>
>> Yeah, the mode shows as org-mode.
>
> What happens if while visiting the buffer, you say
>
> C-h v org-todo-line-regexp RET
>
> Is the value reported nil?
>
>> But now I get another weird one.
>> Everytime I open an org file, I see the following message in the
>> minibuffer:
>>
>> File mode specification error: (wrong-type-argument keymap nil)
>>
>
> That will require another backtrace but...
>
>> I'm lost ...
>
> When you get to the point of feeling lost, it's time to take a step
> back. Make yourself a minimal.emacs that contains just the basics to
> get org-mode loaded - assuming you get your org sources from git, then
> you need something like this (with pathnames changed appropriately):
>
> --8<---cut here---start->8---
> ;;; -*- mode: emacs-lisp -*-
> ;;; constant part
> (add-to-list 'load-path (expand-file-name "~/src/emacs/org/org-mode/lisp"))
> (add-to-list 'auto-mode-alist '("\\.\\(org\\|org_archive\\|txt\\)$" . 
> org-mode))
> (require 'org-install)
> (global-set-key "\C-cl" 'org-store-link)
> (global-set-key "\C-ca" 'org-agenda)
> --8<---cut here---end--->8---
>
> Then start up an emacs without any of your customizations, load the 
> minimal.emacs
> file and visit an org file and try what you tried before:
>
>   emacs -q -l /path/to/minimal.emacs /path/to/somefile.org
>
> and try changing a TODO as before.  Does that work? If not, try -Q
> instead of -q: does *that* work?
>
> Assuming one of these works, then you have localized the problem to
> some customization (yours or the systems) and then there are various
> ways to proceed.
>
> Nick
>
>>
>> S.
>>
>



Re: [O] [babel][R] no return values in R code blocks

2011-08-29 Thread Eric Schulte
Max Flöttmann  writes:

> Hi,
> When i run a code block like this using C-c C-c:
>
> #+BEGIN_SRC R
> c(1,23,54,5)
> #+END_SRC
>
> I do not get any results.
>
> In older versions of orgmode the result used be a table or vector returned
> by R. Is this a bug, or do I need a new keyword that is not in the
> documentation yet to get the same result?
> I'm using version 7.7 and R2.13.1
>

When I run your example I do get results.

#+BEGIN_SRC R
c(1,23,54,5)
#+END_SRC

#+results:
|  1 |
| 23 |
| 54 |
|  5 |

So maybe the problem is located somewhere in your configuration.  I
would suggest trying with a minimal configuration by launching emacs
with the -Q option, and then only evaluating the bare minimum of a
config sufficient to add R to the list of languages that Babel attempts
to evaluate.

Best -- Eric

>
> Thanks,
>
> Max

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



[O] setting up org-remember

2011-08-29 Thread Renato
Hello, I'm trying to set up org-remember, however I'm having some
problems. I seem to miss the function org-remember-insinuate (No
Match). However that function seems to be defined in org-remember.el.gz
which is in /usr/share/emacs/23.3/lisp/org (and this path is in
load-path). 

should I post somewhere my .emacs?

I'm on archlinux, emacs version 23.3.1 and the org-mode shipped with it
(6.33)

renato



Re: [O] setting up org-remember

2011-08-29 Thread Sebastien Vauban
Hi Renato,

Renato wrote:
> Hello, I'm trying to set up org-remember, however I'm having some
> problems. I seem to miss the function org-remember-insinuate (No
> Match). However that function seems to be defined in org-remember.el.gz
> which is in /usr/share/emacs/23.3/lisp/org (and this path is in
> load-path). 
>
> should I post somewhere my .emacs?
>
> I'm on archlinux, emacs version 23.3.1 and the org-mode shipped with it
> (6.33)

If you can, try updating to Org 7.7 or something approaching. Org-remember has
been replaced by a very similar, but still different set of
variales/templates/etc., package called Org-capture.

So better upgrade first.

Best regards,
  Seb

-- 
Sebastien Vauban




[O] exporting customized timestamps

2011-08-29 Thread Matt Price
Hi everyone,

I'm trying to understand timestamps a bit better.  I'm exporting my
syllabus to html, using org2blog for my wordpress course site. The
syllabus includes a timestamp at the beginning of each week of the
description.  org-time-stamp-custom-formats is set to:

("<%m/%d/%Y>" . "<%m/%d/%y %a %H:%M>")

which is sort of the American standard (sidenote: how do I toggle
between these custom values? I only seem to be able to toggle between
overlaid and not overlaid).

In Emacs, when I look at my org file, thetimestamp displays just as I
want it to.  But on export to HTML, the timestamp returns to the ISO
format ("2011-10-06 Thu").  Is this an inevitable behaviour?  if not,
how do I get around it?  I can more or less live with this output, but
it's a bit awkward for my students to read.

Thanks very much!
matt



Re: [O] Bug: Babel: asymptote: erroneous conversion of heterogeneous-typed table

2011-08-29 Thread Nicolas Goaziou
Completing myself.

> Though, you insist on being able to enter it as a number anyway,
> hoping ob-asymptote will do the magic behind. How could it, since the
> language can't itself?

Actually, the attached patch does that magic: if there's any string in
the table, every cell will be turned into a string and the array will be
of type string.

I still think a more general way would be better. I'll let Eric Schulte
decide what to do about it.

Regards,

-- 
Nicolas Goaziou
>From 72dfd3c98c535ea595be053fe321e195cd08c070 Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou 
Date: Mon, 29 Aug 2011 17:24:07 +0200
Subject: [PATCH] ob-asymptote: mixed-types tables default to string arrays

* lisp/ob-asymptote.el (org-babel-asymptote-table-to-array): Require a
new argument TYPE specifying the detected type of array.  If it's a
string array, make sure every element is returned as a string. Also
improve doc-string.
(org-babel-asymptote-var-to-asymptote): Fill new argument.  Small
refactoring.
(org-babel-asymptote-define-type): Rewrite to avoid stopping search at
first float found, as strings have precedence over floats.
---
 lisp/ob-asymptote.el |   50 --
 1 files changed, 28 insertions(+), 22 deletions(-)

diff --git a/lisp/ob-asymptote.el b/lisp/ob-asymptote.el
index 1cf6db4..0e9b449 100644
--- a/lisp/ob-asymptote.el
+++ b/lisp/ob-asymptote.el
@@ -108,23 +108,29 @@ a variable of the same value."
  ((stringp val)
   (format "string %S=\"%s\";" var val))
  ((listp val)
-  (let* ((dimension-2-p (not (null (cdr val
+  (let* ((dimension-2-p (cdr val))
  (dim (if dimension-2-p "[][]" "[]"))
  (type (org-babel-asymptote-define-type val))
  (array (org-babel-asymptote-table-to-array
- val
+ val type
  (if dimension-2-p '(:lstart "{" :lend "}," :llend "}")
 (format "%S%s %S=%s;" type dim var array))
 
-(defun org-babel-asymptote-table-to-array (table params)
-  "Convert values of an elisp table into a string of an asymptote array.
+(defun org-babel-asymptote-table-to-array (table type params)
+  "Convert values of TABLE into a string of an asymptote array.
+
+TABLE is a list whose atoms are assumed to be of type
+TYPE. PARAMS is a plist of parameters that can influence the
+conversion.
+
 Empty cells are ignored."
   (labels ((atom-to-string (table)
(cond
 ((null table) '())
 ((not (listp (car table)))
- (cons (if (and (stringp (car table))
-(not (string= (car table) "")))
+ (cons (if (or (eq type 'string)
+   (and (stringp (car table))
+(not (string= (car table) ""
(format "\"%s\"" (car table))
  (format "%s" (car table)))
(atom-to-string (cdr table
@@ -140,22 +146,22 @@ Empty cells are ignored."
 
 (defun org-babel-asymptote-define-type (data)
   "Determine type of DATA.
-DATA is a list. Type symbol is returned as 'symbol. The type is
-usually the type of the first atom encountered, except for arrays
-of int, where every cell must be of int type."
-  (labels ((anything-but-int (el)
- (cond
-  ((null el) nil)
-  ((not (listp (car el)))
-   (cond
-((floatp (car el)) 'real)
-((stringp (car el)) 'string)
-(t
- (anything-but-int (cdr el)
-  (t
-   (or (anything-but-int (car el))
-   (anything-but-int (cdr el)))
-(or (anything-but-int data) 'int)))
+
+DATA is a list.  Return type as a symbol.
+
+The type is `string' if any element in DATA is
+a string. Otherwise, it is either `float', if some elements are
+floats, or `int'."
+  (let* ((type 'int)
+	 (find-type
+	  (lambda (row)
+	(catch 'exit
+	  (mapc (lambda (el)
+		  (cond ((listp el) (funcall find-type el))
+			((stringp el) (throw 'exit (setq type 'string)))
+			((floatp el) (setq type 'float
+		row)
+(funcall find-type data) type))
 
 (provide 'ob-asymptote)
 
-- 
1.7.6.1



Re: [O] org-agenda-custom-commands clarification on filters needed

2011-08-29 Thread Thomas Wallrafen
Hi

On Mon, Aug 29, 2011 at 09:53:01AM +0800, Eric Abrahamsen wrote:
> On Sun, Aug 28 2011, Thomas Wallrafen wrote:
> 
> > Hi org'ers,
> >
> > I am currently trying to figure out a way to build a composite view for
> > an agenda containing agenda and todos, which works well but when it
> > comes to setting filters...
> >
> > In the first example (agenda and todo list below) the filter "+home" for
> > the agenda does not take effect. When reordering that the todo list is
> > on top and the agenda below, it works as expected. That is, both items
> > of the composite view are correctly filtered with tag "+home".
> >
> > #+begin_src elisp
> > (setq org-agenda-custom-commands
> >   '(("h" "Agenda and home related todos" (
> >   (agenda "" ((org-agenda-filter-preset '("+home")) 
> > (org-agenda-span 4)))
> >   (tags-todo "+home")
> >   
> 
> I've been fooling with this recently, as well. The docstring for
> `org-agenda-filter-preset' says that it "will not work reliably" to
> filter just a single block of a multi-block custom agenda. You need to
> put the filter in the tail end of the whole definition, and that way it
> will apply to all the blocks (apparently there's no reliable way to
> apply different filters to different blocks, but that's probably a rare
> use-case). So I think you want:
> 
> (setq org-agenda-custom-commands
> '(("h" "Agenda and home related todos"
>  ((agenda)
>   (tags-todo))
>  ((org-agenda-filter-preset '("+home"))
>   (org-agenda-span 4)
> 
> This or something very close to it should work. It only works with tags
> though, not more complex matches.

Thank you for the answer. I'll experiment with that tonight.

bye,

thomas



Re: [O] Bug: Babel: asymptote: erroneous conversion of heterogeneous-typed table

2011-08-29 Thread Eric Schulte
Nicolas Goaziou  writes:

> Completing myself.
>
>> Though, you insist on being able to enter it as a number anyway,
>> hoping ob-asymptote will do the magic behind. How could it, since the
>> language can't itself?
>
> Actually, the attached patch does that magic: if there's any string in
> the table, every cell will be turned into a string and the array will be
> of type string.
>
> I still think a more general way would be better. I'll let Eric Schulte
> decide what to do about it.
>

I don't know asymptote well enough to know if you would /always/ want a
heterogeneous table to be converted to all strings, or if there would
ever be a case where you would want mixed types in a table.  If a later
then perhaps this behavior should be tucked behind a header argument,
e.g., :mixed-table-all-strings (or somesuch) which could default to
either true or false depending on which use cases is more common.

Let me know which would be most useful and least surprising and I'll
gladly apply the patch.

Thanks -- Eric

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



Re: [O] Bug: Babel: asymptote: erroneous conversion of heterogeneous-typed table

2011-08-29 Thread Nicolas Goaziou
Hello,

Eric Schulte  writes:

> I don't know asymptote well enough to know if you would /always/ want a
> heterogeneous table to be converted to all strings, or if there would
> ever be a case where you would want mixed types in a table.

There are no mixed types arrays in Asymptote, hence the problem of the
OP. You can choose between int[][], real[][] or string[][] (and other
types specific to Asymptote and, as such, irrelevant here), but you
never want an heterogeneous table.

So, the real question is: what should Org do when an user tries to fit
a mixed array into an Asymptote var? Until now, it was throwing an
error. With this patch, _one_ string in the table will trigger the
string type for every other cell.

But this kind of an hidden feature. The user has to be aware that, under
some circumstances, ints in his table will become strings.

On the other hand, an user knowing he can't mix types in Asymptote (as
he should) can't do much about it, as far as I know.

As I said in this thread, an elegant solution would be to have a way to
specify Babel to output tables of strings easily:

| x | "1" | "2" | "3" |
| y | "1" | "4" | "9" |

That would be the less surprising, as the user would get the type he
sees in his table.


Regards,

-- 
Nicolas Goaziou



Re: [O] Bug: Babel: asymptote: erroneous conversion of heterogeneous-typed table

2011-08-29 Thread Eric Schulte
Nicolas Goaziou  writes:

> Hello,
>
> Eric Schulte  writes:
>
>> I don't know asymptote well enough to know if you would /always/ want a
>> heterogeneous table to be converted to all strings, or if there would
>> ever be a case where you would want mixed types in a table.
>
> There are no mixed types arrays in Asymptote, hence the problem of the
> OP. You can choose between int[][], real[][] or string[][] (and other
> types specific to Asymptote and, as such, irrelevant here), but you
> never want an heterogeneous table.
>
> So, the real question is: what should Org do when an user tries to fit
> a mixed array into an Asymptote var? Until now, it was throwing an
> error. With this patch, _one_ string in the table will trigger the
> string type for every other cell.
>
> But this kind of an hidden feature. The user has to be aware that, under
> some circumstances, ints in his table will become strings.
>
> On the other hand, an user knowing he can't mix types in Asymptote (as
> he should) can't do much about it, as far as I know.
>
> As I said in this thread, an elegant solution would be to have a way to
> specify Babel to output tables of strings easily:
>
> | x | "1" | "2" | "3" |
> | y | "1" | "4" | "9" |
>
> That would be the less surprising, as the user would get the type he
> sees in his table.
>

Given that asymptote can not make use of heterogeneous tables, it seems
that it would be easiest to simply silently converted any table
containing a single string element to a table of all strings.  I've just
applied your previous patch (thanks for the patch!).  If this proves
confounding in the future we can always revisit the decision.

Additionally, I've just added a new function to the library of babel
which can be used to convert all elements of a table to strings.  It is
not needed here, but it could be useful in the future.

** Convert every element of a table to a string

#+tblname: hetero-table
| 1 | 2 | 3 |
| a | b | c |

#+source: all-to-string
#+begin_src emacs-lisp :var tbl='()
  (defun all-to-string (tbl)
(if (listp tbl)
(mapcar #'all-to-string tbl)
  (if (stringp tbl)
  tbl
(format "%s" tbl
  (all-to-string tbl)
#+end_src

#+begin_src emacs-lisp :var tbl=hetero-table
  (mapcar (lambda (row) (mapcar (lambda (cell) (stringp cell)) row)) tbl)
#+end_src

#+results:
| nil | nil | nil |
| t   | t   | t   |

#+begin_src emacs-lisp :var tbl=all-to-string(hetero-table)
  (mapcar (lambda (row) (mapcar (lambda (cell) (stringp cell)) row)) tbl)
#+end_src

#+results:
| t | t | t |
| t | t | t |

Cheers -- Eric

>
>
> Regards,

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


[O] orgmode and org-drill

2011-08-29 Thread Alfred Neumann
I'd like to learn vocabulary with org-drill in orgmode, which both I
find very cleverly programmed and useful.

After pressing Enter after the question in org-drill mode the
properties will get fully expanded and fill the screen ahead of the
answer.

- Can I configure org-drill mode to avoid this behaviour? (Maybe I've
overseen something).

I don't want to get distracted by the properties and, for me more
important, I don't want to scroll when I use org-drill on a Nokia N810
tablet with its tiny screen.

Thank you in advance for your support!

Alfred.



Re: [O] setting up org-remember

2011-08-29 Thread Renato
On Mon, 29 Aug 2011 16:13:22 +0200
"Sebastien Vauban"  wrote:

> Hi Renato,
> 
> Renato wrote:
> > Hello, I'm trying to set up org-remember, however I'm having some
> > problems. I seem to miss the function org-remember-insinuate (No
> > Match). However that function seems to be defined in
> > org-remember.el.gz which is in /usr/share/emacs/23.3/lisp/org (and
> > this path is in load-path). 
> >
> > should I post somewhere my .emacs?
> >
> > I'm on archlinux, emacs version 23.3.1 and the org-mode shipped
> > with it (6.33)
> 
> If you can, try updating to Org 7.7 or something approaching.
> Org-remember has been replaced by a very similar, but still different
> set of variales/templates/etc., package called Org-capture.

yeah, I've seen it (going through the compact guide for 7.7 which
treats org-capture). But since I saw -on the org manual I think- that
upgrading from org-remember to org-capture is rather painless, I was
hoping to be able to stick to the org shipped with emacs. Archlinux
doesn't provide binaries for "standalone" org and compiling it myself
would make future updates more cumbersome - though I'll indeed go that
route if I can't solve this issue in the next few days.

so, no idea on why I can't call org-remember-insinuate?

cheers,
renato




Re: [O] Bug: Babel: asymptote: erroneous conversion of heterogeneous-typed table

2011-08-29 Thread András Major
Hi Eric,

> Given that asymptote can not make use of heterogeneous tables, it seems
> that it would be easiest to simply silently converted any table
> containing a single string element to a table of all strings.  I've just
> applied your previous patch (thanks for the patch!).  If this proves
> confounding in the future we can always revisit the decision.

I've been away since my last post and now you've already applied a patch
-- wow!  Here's another thought though: change the behaviour of the :var
header argument such that you can specify a range of rows, columns, or
a rectangle just like in table references.  I agree that wildly mixing
cell types in a table should be a felony, but "mixing" them the way I'd
like to makes perfect sense.  You would then simply make more than one
:var to specify multiple subtables, each with its own type.  I think
this might be better than brute-forcing everything to string just so
that the asymptote program has to parse the values back to numbers.

What do you think?

  András





[O] indent fixup error on refile

2011-08-29 Thread Michael Gilbert
Hi —

I'm afraid I don't know exactly where this error was introduced (I do nightly 
updates) and I have been on travels and haven't been monitoring the list 
closely. So I apologize in advance is this is a lousy error message. But I 
wanted to put it out there in case it was already something that had someone's 
attention

When I refile from the agenda, I will frequently get this error:

org-fixup-indentation: Invalid search bound (wrong side of point)

The item is copied to the new location (as the new topmost item in the 
location), but the indentation, as you might expect, is incorrect. Also as you 
might expect, the  item is not deleted from its original location. Bulk refiles 
stop after just messing up the first one, of course.

Anyone else experiencing this? Has it been discussed and I just didn't managed 
to search for it properly?

— Michael

http://nonprofitnews.org
http://gilbert.org




Re: [O] Bug: Babel: asymptote: erroneous conversion of heterogeneous-typed table

2011-08-29 Thread Eric Schulte
András Major  writes:

> Hi Eric,
>
>> Given that asymptote can not make use of heterogeneous tables, it seems
>> that it would be easiest to simply silently converted any table
>> containing a single string element to a table of all strings.  I've just
>> applied your previous patch (thanks for the patch!).  If this proves
>> confounding in the future we can always revisit the decision.
>
> I've been away since my last post and now you've already applied a patch
> -- wow!  Here's another thought though: change the behaviour of the :var
> header argument such that you can specify a range of rows, columns, or
> a rectangle just like in table references.

This is already possible, see "Indexable variable values" [1].

> I agree that wildly mixing cell types in a table should be a felony,
> but "mixing" them the way I'd like to makes perfect sense.  You would
> then simply make more than one :var to specify multiple subtables,
> each with its own type.  I think this might be better than
> brute-forcing everything to string just so that the asymptote program
> has to parse the values back to numbers.
>
> What do you think?
>

I must admit by the time I got to this thread is was already many
messages deep, and I haven't read the initial messages, so I don't know
what your way of mixing was, but from my current understanding of
asymptote the behavior implemented by Nick's patch seems to make the
most sense, in that it allows tables of ints and floats, but when a
single string is present it converts the table to all strings.

Best -- Eric

>
>   András
>
>
>


Footnotes: 
[1]  http://orgmode.org/manual/var.html

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



Re: [O] Bug: babel: results switch (output vs. value) has no or wrong effect for sh source block [7.7 (release_7.7.107.g7a82)]

2011-08-29 Thread Michael Brand
Hi Eric

On Tue, Aug 23, 2011 at 19:13, Eric Schulte  wrote:
> Note that during interactive evaluation if the exit status is non-0 then
> STDERR will be dumped into a babel error buffer which will be poped up,
> so this information will not be silently discarded.

Thanks for emphasizing this. I didn't use code block evaluation much
for ob-sh and haven't yet noticed this rule with the last exit status
that seems very important to know.

Two things I would like to comment referring to the examples 1) to 5)
below:
a) _completeness_ of the process output:
   - When the last exit status is 0, babel silently discards possible
 important information from stderr, see mainly 1), also 2) to 3).
   - When the last exit status is >0, babel pops up the "Org-Babel
 Error Output" and silently discards possible important
 information from stdout, see 4).
b) _decision_ whether the process succeeded or failed:
   - This is made by discriminating the last exit status 0 or not. But
 there are even standard processes with an exit status and stderr
 not simple, see 4) to 5) ("simple": 0 => success and output only
 on stdout, >0 => failure and output only on stderr).

My suggestions for changes (I have understood that this would not be
easy to do, babel grew differently):
a) _completeness_ of the process output:
   - When the last exit status is 0: Include stderr in "#+results:" by
 default. In the minority of use cases where the behavior changes
 I think this is most of the time an improvement.
   - When the last exit status is >0 and babel pops up the "Org-Babel
 Error Output": Include stdout there by default. In the minority
 of use cases where the behavior changes I think this is always an
 improvement.
b) _decision_ whether the process succeeded or failed:
   - My point of view is that babel code block evaluation is not
 always able to make such a decision for two reasons, at least in
 the case of the languages awk, sh and shell: Firstly not
 universally because it would require to consider which process it
 runs, e. g. the exit status 1 means success for diff or grep but
 >0 means failure for most other processes. Secondly not reliably
 because it would require to consider for which purpose this
 process is used during this evaluation. When one wants to
 document the output of a failure then "Org-Babel Error Output"
 does not come in handy.
   - An option to move this decision to the user would help. For this
 I wish to have an additional and somehow more manual operation
 mode that bypasses the interpretation of the last exit status and
 omits "Org-Babel Error Output". Achim already phrased it in this
 thread as:
 - "I think that it would be generally useful (not just for shell
   blocks) to be able to capture stderr, either together with
   stdout or separately into a result target block and have the
   return status available as a variable."
 - I would only add: It would be nice to have both variants of
   "either or" available to choose from. The first for better
   human readability and the second to read stdout without stderr
   into the next chained code block again.



Comments and questions for the examples and workarounds:

Examples 4) to 5) end up with an empty "Org-Babel Error Output" and
"#+results:" is emptied.
- Since they are both empty it is not necessarily clear what happened.
- The Messages buffer says "Babel evaluation exited with code 1" and
  "Code block produced no output.". The second statement is not
  necessarily clear:
  - Is this an _info_ or was output expected and this is an _error_
that even stopped babel from doing more work?
- Is the message "Code block evaluation complete." from other
  cases an indication whether babel finished all its work? If this
  is an indication, isn't this message missing in the following
  case?
#+begin_src sh :results output
  true
#+end_src

#+results:

  - Which "output" was meant to be missing?
- Output missing on stdout (example 5) or was stdout not
  considered due to last exit status >0 (example 4)?
- Output missing on stderr?

At the end are the workarounds I will use for now for the examples 1)
to 5). Shown is the complete variant when I need to know the last exit
status.
- 2>&1 :: collect stderr
- $?   :: last exit status
- true :: omit any "Org-Babel Error Output"



Examples:

1) command(s) before the last command have error
   - non-existent file myfile, output mixed on stdout and stderr
 - in a terminal (not babel code block evaluation):
   - shell command:
 #+begin_example
   ls myfile
   echo b
 #+end_example

   - output (stderr: ls, stdout: echo, exit status ls: 2, exit
 status ech

Re: [O] setting up org-remember

2011-08-29 Thread Sebastien Vauban
Hi Renato,

Renato wrote:
> On Mon, 29 Aug 2011 16:13:22 +0200
> "Sebastien Vauban"  wrote:
>> Renato wrote:
>> > Hello, I'm trying to set up org-remember, however I'm having some
>> > problems. I seem to miss the function org-remember-insinuate (No
>> > Match). However that function seems to be defined in
>> > org-remember.el.gz which is in /usr/share/emacs/23.3/lisp/org (and
>> > this path is in load-path). 
>> >
>> > should I post somewhere my .emacs?
>> >
>> > I'm on archlinux, emacs version 23.3.1 and the org-mode shipped
>> > with it (6.33)
>> 
>> If you can, try updating to Org 7.7 or something approaching.
>> Org-remember has been replaced by a very similar, but still different
>> set of variales/templates/etc., package called Org-capture.
>
> yeah, I've seen it (going through the compact guide for 7.7 which
> treats org-capture). But since I saw -on the org manual I think- that
> upgrading from org-remember to org-capture is rather painless, I was
> hoping to be able to stick to the org shipped with emacs. Archlinux
> doesn't provide binaries for "standalone" org and compiling it myself
> would make future updates more cumbersome - though I'll indeed go that
> route if I can't solve this issue in the next few days.
>
> so, no idea on why I can't call org-remember-insinuate?

I still would advice you to try and use Org 7+. There are huge, really huge,
differences with Org 6.33. Not just on the capture side.

Though, from your description, it seems to me you'd just miss the following
line in your .emacs:

(require 'org-remember)

Just put it there, restart Emacs and tell us whether that was it or not.

Best regards,
  Seb

-- 
Sebastien Vauban




[O] Fwd: setting up org-remember

2011-08-29 Thread Jonathan Leech-Pepin
Forwarding to list (forgot to include in reply)

-- Forwarded message --
From: Jonathan Leech-Pepin 
Date: Mon, Aug 29, 2011 at 4:05 PM
Subject: Re: [O] setting up org-remember
To: Renato 


Hi Renato,

Emacs-bzr (emacs24) in the AUR will provide a much more up-to-date Org so
you can always just proceed that way (although once again you will need to
compile the bzr checkout for it to work).

There is actually also a couple AUR packages for Org-Mode:
- emacs-org-mode 7.7-1 :: http://aur.archlinux.org/packages.php?ID=18206
  which simply downloads the 7.7 release .tar.gz
- emacs-org-mode-git 20110328-1 ::
http://aur.archlinux.org/packages.php?ID=25234
  which clones the latest git.

The first of the two is probably as close as you get to a standalone binary
in Arch (I simply compile it from the latest git manually which runs quickly
enough on my machine when I need it) and should stay up to date with the
current release.

Regards,
Jonathan

On Mon, Aug 29, 2011 at 2:47 PM, Renato  wrote:

> On Mon, 29 Aug 2011 16:13:22 +0200
> "Sebastien Vauban"  wrote:
>
> > Hi Renato,
> >
> > Renato wrote:
> > > Hello, I'm trying to set up org-remember, however I'm having some
> > > problems. I seem to miss the function org-remember-insinuate (No
> > > Match). However that function seems to be defined in
> > > org-remember.el.gz which is in /usr/share/emacs/23.3/lisp/org (and
> > > this path is in load-path).
> > >
> > > should I post somewhere my .emacs?
> > >
> > > I'm on archlinux, emacs version 23.3.1 and the org-mode shipped
> > > with it (6.33)
> >
> > If you can, try updating to Org 7.7 or something approaching.
> > Org-remember has been replaced by a very similar, but still different
> > set of variales/templates/etc., package called Org-capture.
>
> yeah, I've seen it (going through the compact guide for 7.7 which
> treats org-capture). But since I saw -on the org manual I think- that
> upgrading from org-remember to org-capture is rather painless, I was
> hoping to be able to stick to the org shipped with emacs. Archlinux
> doesn't provide binaries for "standalone" org and compiling it myself
> would make future updates more cumbersome - though I'll indeed go that
> route if I can't solve this issue in the next few days.
>
> so, no idea on why I can't call org-remember-insinuate?
>
> cheers,
> renato
>
>
>


Re: [O] setting up org-remember

2011-08-29 Thread Pieter Praet
On Mon, 29 Aug 2011 20:47:48 +0200, Renato  wrote:
> On Mon, 29 Aug 2011 16:13:22 +0200
> "Sebastien Vauban"  wrote:
> 
> > Hi Renato,
> > 
> > Renato wrote:
> > > Hello, I'm trying to set up org-remember, however I'm having some
> > > problems. I seem to miss the function org-remember-insinuate (No
> > > Match). However that function seems to be defined in
> > > org-remember.el.gz which is in /usr/share/emacs/23.3/lisp/org (and
> > > this path is in load-path). 
> > >
> > > should I post somewhere my .emacs?
> > >
> > > I'm on archlinux, emacs version 23.3.1 and the org-mode shipped
> > > with it (6.33)
> > 
> > If you can, try updating to Org 7.7 or something approaching.
> > Org-remember has been replaced by a very similar, but still different
> > set of variales/templates/etc., package called Org-capture.
> 
> yeah, I've seen it (going through the compact guide for 7.7 which
> treats org-capture). But since I saw -on the org manual I think- that
> upgrading from org-remember to org-capture is rather painless, I was
> hoping to be able to stick to the org shipped with emacs. Archlinux
> doesn't provide binaries for "standalone" org and compiling it myself
> would make future updates more cumbersome - though I'll indeed go that
> route if I can't solve this issue in the next few days.

Seriously?  Not being bolted down to stale software is one of the main
reasons why people run Arch in the first place :D.

There's PKGBUILDs for both the stable [1] as well as the dev [2] version
in the AUR.  Using one of the "AUR Helpers" [3] (Clyde [4] is my personal
favourite) makes keeping up to date only slightly more "cumbersome"
than running `pacman -Syu'.


Even better, while Org *can* be compiled (or rather byte-compiled),
you don't *have* to:

  #+begin_src sh
mdir -p ~/src
git clone git://orgmode.org/org-mode.git ~/src/org-mode
  #+end_src

and stuff this in your `.emacs':

   #+begin_src emacs-lisp
(add-to-list 'load-path "~/src/org-mode/lisp")
(add-to-list 'load-path "~/src/org-mode/contrib/lisp")
(require 'org-install)
  #+end_src

... and an occasional `cd ~/src/org-mode ; git pull' will be all you
need to stay on the cutting edge.


At the pace Org is evolving, running old code will surely cause you more
grief in the long run, so there's really no reason not to keep up to date.

> so, no idea on why I can't call org-remember-insinuate?

Sebastien covered this, but just in case, put this at the top of your `.emacs':

  #+begin_src emacs-lisp
(setq debug-on-error t)
  #+end_src

... which will provide you with a much more informative error message.

> cheers,
> renato
> 
> 


Peace

-- 
Pieter

[1] https://aur.archlinux.org/packages.php?ID=18206
[2] https://aur.archlinux.org/packages.php?ID=25234
[3] https://wiki.archlinux.org/index.php/AUR_Helpers
[4] https://wiki.archlinux.org/index.php/Clyde



Re: [O] Bug: Babel: asymptote: erroneous conversion of heterogeneous-typed table

2011-08-29 Thread Nick Dokos
Eric Schulte  wrote:

> András Major  writes:
> 
> > Hi Eric,
> >
> >> Given that asymptote can not make use of heterogeneous tables, it seems
> >> that it would be easiest to simply silently converted any table
> >> containing a single string element to a table of all strings.  I've just
> >> applied your previous patch (thanks for the patch!).  If this proves
> >> confounding in the future we can always revisit the decision.
> >
> > I've been away since my last post and now you've already applied a patch
> > -- wow!  Here's another thought though: change the behaviour of the :var
> > header argument such that you can specify a range of rows, columns, or
> > a rectangle just like in table references.
> 
> This is already possible, see "Indexable variable values" [1].
> 
> > I agree that wildly mixing cell types in a table should be a felony,
> > but "mixing" them the way I'd like to makes perfect sense.  You would
> > then simply make more than one :var to specify multiple subtables,
> > each with its own type.  I think this might be better than
> > brute-forcing everything to string just so that the asymptote program
> > has to parse the values back to numbers.
> >
> > What do you think?
> >
> 
> I must admit by the time I got to this thread is was already many
> messages deep, and I haven't read the initial messages, so I don't know
> what your way of mixing was, but from my current understanding of
> asymptote the behavior implemented by Nick's patch seems to make the
 ^^^Nicolas Goaziou's patch^^^

Nick

> most sense, in that it allows tables of ints and floats, but when a
> single string is present it converts the table to all strings.
> 
> Best -- Eric
> 
> >
> >   András
> >
> >
> >
> 
> 
> Footnotes: 
> [1]  http://orgmode.org/manual/var.html
> 
> -- 
> Eric Schulte
> http://cs.unm.edu/~eschulte/
> 



[O] [babel] small patch (inline src blocks cannot start at bol)

2011-08-29 Thread Nicolas Goaziou
Hello,

For now inline src blocks cannot start at bol. In the following example,
only the first inline block is recognized.

This src_emacs-lisp{(1+ 1)} is ok.

src_emacs-lisp{"This"} isn't.

The small following patch should fix that.

Regards,

-- 
Nicolas Goaziou
>From 98ec0a9d86f1b4f35be0530e2d8afb97861a91c0 Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou 
Date: Mon, 29 Aug 2011 23:13:40 +0200
Subject: [PATCH] ob: allow inline src blocks to start at bol

* lisp/ob.el (org-babel-inline-src-block-regexp): Allow regexp to
  start at bol.
---
 lisp/ob.el |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lisp/ob.el b/lisp/ob.el
index 5d91ac3..9d80056 100644
--- a/lisp/ob.el
+++ b/lisp/ob.el
@@ -143,7 +143,7 @@ remove code block execution from the C-c C-c keybinding."
 (defvar org-babel-inline-src-block-regexp
   (concat
;; (1) replacement target (2) lang
-   "[^-[:alnum:]]\\(src_\\([^ \f\t\n\r\v]+\\)"
+   "\\(?:^\\|[^-[:alnum:]]\\)\\(src_\\([^ \f\t\n\r\v]+\\)"
;; (3,4) (unused, headers)
"\\(\\|\\[\\(.*?\\)\\]\\)"
;; (5) body
-- 
1.7.6.1



Re: [O] Bug: wrong-type-argument when changing TODO state [7.7]

2011-08-29 Thread Stelian Iancu
On Mon, Aug 29, 2011 at 09:59, Nick Dokos  wrote:
> Stelian Iancu  wrote:
>
>> On Sun, Aug 28, 2011 at 19:09, Nick Dokos  wrote:
>> > Stelian Iancu  wrote:
>> >
>> >>
>> >> I am trying to switch between TODO and DONE states with Shift-Right
>> >> Arrow and I get a (wrong-type-argument stringp nil) error.
>> >>
>> >> Please find attached the backtrace.
>> >>
>> >>
>> >> Emacs  : GNU Emacs 23.2.1 (i486-pc-linux-gnu, GTK+ Version 2.20.0)
>> >>  of 2010-12-11 on raven, modified by Debian
>> >> Package: Org-mode version 7.7
>> >>
>> >
>> >> Debugger entered--Lisp error: (wrong-type-argument stringp nil)
>> >>   looking-at(nil)
>> >>   (save-excursion (beginning-of-line 1) (looking-at org-todo-line-regexp))
>> >>   (and (outline-on-heading-p) (not (bolp)) (save-excursion 
>> >> (beginning-of-line 1) (looking-at org-todo-line-regexp)) (< (point) (+ 2 
>> >> ...)))
>> >>   (if (and (outline-on-heading-p) (not ...) (save-excursion ... ...) (< 
>> >> ... ...)) (progn (goto-char ...) (and ... ...)))
>> >>   (let* ...)
>> >>   (catch (quote exit) ...)
>> >>   (save-excursion (catch (quote exit)...)
>> >>   (let ...)
>> >>   org-todo(right)
>> >>   call-interactively(org-todo)
>> >>   (let ((current-prefix-arg arg)) (call-interactively command))
>> >>   org-call-with-arg(org-todo right)
>> >>   (let ...)
>> >>   (cond ...)
>> >>   org-shiftright(nil)
>> >>   call-interactively(org-shiftright nil nil)
>> >
>> > The problem is that org-todo-line-regexp is nil. This variable is
>> > made buffer-local and initialized when the buffer's mode is set
>> > to org-mode.
>> >
>> > Are you sure that your buffer's major mode is org-mode?
>> >
>> > Nick
>> >
>>
>> Yeah, the mode shows as org-mode.
>
> What happens if while visiting the buffer, you say
>
> C-h v org-todo-line-regexp RET
>
> Is the value reported nil?

Yes, the value is nil.

>
>> But now I get another weird one.
>> Everytime I open an org file, I see the following message in the
>> minibuffer:
>>
>> File mode specification error: (wrong-type-argument keymap nil)
>>
>
> That will require another backtrace but...
>
>> I'm lost ...
>
> When you get to the point of feeling lost, it's time to take a step
> back. Make yourself a minimal.emacs that contains just the basics to
> get org-mode loaded - assuming you get your org sources from git, then
> you need something like this (with pathnames changed appropriately):
>
> --8<---cut here---start->8---
> ;;; -*- mode: emacs-lisp -*-
> ;;; constant part
> (add-to-list 'load-path (expand-file-name "~/src/emacs/org/org-mode/lisp"))
> (add-to-list 'auto-mode-alist '("\\.\\(org\\|org_archive\\|txt\\)$" . 
> org-mode))
> (require 'org-install)
> (global-set-key "\C-cl" 'org-store-link)
> (global-set-key "\C-ca" 'org-agenda)
> --8<---cut here---end--->8---
>
> Then start up an emacs without any of your customizations, load the 
> minimal.emacs
> file and visit an org file and try what you tried before:
>
>   emacs -q -l /path/to/minimal.emacs /path/to/somefile.org
>
> and try changing a TODO as before.  Does that work?

Tried this one and indeed, it works now. Looking at the
org-todo-line-regexp variable I can see it's no longer reported nil.

> If not, try -Q
> instead of -q: does *that* work?
>
> Assuming one of these works, then you have localized the problem to
> some customization (yours or the systems) and then there are various
> ways to proceed.
>

So it is a customization issue. Now the question is what :-). I should
mention that I am using both dev versions for Emacs and org-mode
(Emacs from bzr from a few days ago and org-mode from git from a few
days ago) on Mac OS X 10.7. Emacs is installed using homebrew.

> Nick
>
>>
>> S.
>>
>



Re: [O] Bug: wrong-type-argument when changing TODO state [7.7]

2011-08-29 Thread Stelian Iancu
On Mon, Aug 29, 2011 at 23:42, Stelian Iancu  wrote:
> On Mon, Aug 29, 2011 at 09:59, Nick Dokos  wrote:
>> Stelian Iancu  wrote:
>>
>>> On Sun, Aug 28, 2011 at 19:09, Nick Dokos  wrote:
>>> > Stelian Iancu  wrote:
>>> >
>>> >>
>>> >> I am trying to switch between TODO and DONE states with Shift-Right
>>> >> Arrow and I get a (wrong-type-argument stringp nil) error.
>>> >>
>>> >> Please find attached the backtrace.
>>> >>
>>> >>
>>> >> Emacs  : GNU Emacs 23.2.1 (i486-pc-linux-gnu, GTK+ Version 2.20.0)
>>> >>  of 2010-12-11 on raven, modified by Debian
>>> >> Package: Org-mode version 7.7
>>> >>
>>> >
>>> >> Debugger entered--Lisp error: (wrong-type-argument stringp nil)
>>> >>   looking-at(nil)
>>> >>   (save-excursion (beginning-of-line 1) (looking-at 
>>> >> org-todo-line-regexp))
>>> >>   (and (outline-on-heading-p) (not (bolp)) (save-excursion 
>>> >> (beginning-of-line 1) (looking-at org-todo-line-regexp)) (< (point) (+ 2 
>>> >> ...)))
>>> >>   (if (and (outline-on-heading-p) (not ...) (save-excursion ... ...) (< 
>>> >> ... ...)) (progn (goto-char ...) (and ... ...)))
>>> >>   (let* ...)
>>> >>   (catch (quote exit) ...)
>>> >>   (save-excursion (catch (quote exit)...)
>>> >>   (let ...)
>>> >>   org-todo(right)
>>> >>   call-interactively(org-todo)
>>> >>   (let ((current-prefix-arg arg)) (call-interactively command))
>>> >>   org-call-with-arg(org-todo right)
>>> >>   (let ...)
>>> >>   (cond ...)
>>> >>   org-shiftright(nil)
>>> >>   call-interactively(org-shiftright nil nil)
>>> >
>>> > The problem is that org-todo-line-regexp is nil. This variable is
>>> > made buffer-local and initialized when the buffer's mode is set
>>> > to org-mode.
>>> >
>>> > Are you sure that your buffer's major mode is org-mode?
>>> >
>>> > Nick
>>> >
>>>
>>> Yeah, the mode shows as org-mode.
>>
>> What happens if while visiting the buffer, you say
>>
>> C-h v org-todo-line-regexp RET
>>
>> Is the value reported nil?
>
> Yes, the value is nil.
>
>>
>>> But now I get another weird one.
>>> Everytime I open an org file, I see the following message in the
>>> minibuffer:
>>>
>>> File mode specification error: (wrong-type-argument keymap nil)
>>>
>>
>> That will require another backtrace but...
>>
>>> I'm lost ...
>>
>> When you get to the point of feeling lost, it's time to take a step
>> back. Make yourself a minimal.emacs that contains just the basics to
>> get org-mode loaded - assuming you get your org sources from git, then
>> you need something like this (with pathnames changed appropriately):
>>
>> --8<---cut here---start->8---
>> ;;; -*- mode: emacs-lisp -*-
>> ;;; constant part
>> (add-to-list 'load-path (expand-file-name "~/src/emacs/org/org-mode/lisp"))
>> (add-to-list 'auto-mode-alist '("\\.\\(org\\|org_archive\\|txt\\)$" . 
>> org-mode))
>> (require 'org-install)
>> (global-set-key "\C-cl" 'org-store-link)
>> (global-set-key "\C-ca" 'org-agenda)
>> --8<---cut here---end--->8---
>>
>> Then start up an emacs without any of your customizations, load the 
>> minimal.emacs
>> file and visit an org file and try what you tried before:
>>
>>   emacs -q -l /path/to/minimal.emacs /path/to/somefile.org
>>
>> and try changing a TODO as before.  Does that work?
>
> Tried this one and indeed, it works now. Looking at the
> org-todo-line-regexp variable I can see it's no longer reported nil.
>
>> If not, try -Q
>> instead of -q: does *that* work?
>>
>> Assuming one of these works, then you have localized the problem to
>> some customization (yours or the systems) and then there are various
>> ways to proceed.
>>
>
> So it is a customization issue. Now the question is what :-). I should
> mention that I am using both dev versions for Emacs and org-mode
> (Emacs from bzr from a few days ago and org-mode from git from a few
> days ago) on Mac OS X 10.7. Emacs is installed using homebrew.
>

Ok, it seems like I've found the culprit. It's this line:

;; Make org-mode default for all the new files
(setq major-mode 'org-mode)

If I comment it out, it all works beautifully. I thought it was
because I was executing it before loading org-mode, but I've made sure
org-mode is loaded before executing that line and I still get the same
error.

Any ideas why it happens?

Thanks,
S.



Re: [O] [babel] small patch (inline src blocks cannot start at bol)

2011-08-29 Thread Eric Schulte
Nicolas Goaziou  writes:

> Hello,
>
> For now inline src blocks cannot start at bol. In the following example,
> only the first inline block is recognized.
>
> This src_emacs-lisp{(1+ 1)} is ok.
>
> src_emacs-lisp{"This"} isn't.
>
> The small following patch should fix that.
>

I've just applied this along with a test case which should ensure that
this functionality is maintained.

Thanks! -- Eric

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



Re: [O] Bug: wrong-type-argument when changing TODO state [7.7]

2011-08-29 Thread Nick Dokos
Stelian Iancu  wrote:

> >
> > Then start up an emacs without any of your customizations, load the 
> > minimal.emacs
> > file and visit an org file and try what you tried before:
> >
> >   emacs -q -l /path/to/minimal.emacs /path/to/somefile.org
> >
> > and try changing a TODO as before.  Does that work?
> 
> Tried this one and indeed, it works now. Looking at the
> org-todo-line-regexp variable I can see it's no longer reported nil.
> 
> > If not, try -Q
> > instead of -q: does *that* work?
> >
> > Assuming one of these works, then you have localized the problem to
> > some customization (yours or the systems) and then there are various
> > ways to proceed.
> >
> 
> So it is a customization issue. Now the question is what :-). I should
> mention that I am using both dev versions for Emacs and org-mode
> (Emacs from bzr from a few days ago and org-mode from git from a few
> days ago) on Mac OS X 10.7. Emacs is installed using homebrew.
> 

Probably. The next step is to modify your .emacs (or whatever you use)
to do all the other stuff, except for the orgmode customizations and try
again. If it works, you keep introducing more and more stuff until it breaks.

My .emacs does things like this:

...
(require 'my-org-config)
...

and all the org config stuff is in a separate file, my-org-config.el which
ends with

(provide 'my-org-config)

That way I can whack large swaths of code in one swell foop (sic) by
just commenting out the (require ...) form in .emacs and replacing it
with a

(load-file "minimal.org.emacs")

but even if you don't have it organized like this, you can still follow
the steps.

Always keep the minimal stuff that is necessary to get org-mode loaded.
Then bisect your way through your org config: throw away the bottom half
temporarily and try with just the top half. If that works, add some
(roughly half) of the stuff you threw away and try again. If it doesn't,
try with the bottom half only. And keep doing it until you find the
culprit.

The most important thing is to be systematic, but also aware of what you
are doing. You have to choose your bisection points with some care. But
bisection is a very effective way to find such problems.

There have been many discussions of such bisections on this list in the
past. You might want to search the list for more suggestions.

Nick





Re: [O] Bug: wrong-type-argument when changing TODO state [7.7]

2011-08-29 Thread Nick Dokos
Stelian Iancu  wrote:


> > So it is a customization issue. Now the question is what :-). I should
> > mention that I am using both dev versions for Emacs and org-mode
> > (Emacs from bzr from a few days ago and org-mode from git from a few
> > days ago) on Mac OS X 10.7. Emacs is installed using homebrew.
> >
> 
> Ok, it seems like I've found the culprit. It's this line:
> 
> ;; Make org-mode default for all the new files
> (setq major-mode 'org-mode)
> 
> If I comment it out, it all works beautifully. I thought it was
> because I was executing it before loading org-mode, but I've made sure
> org-mode is loaded before executing that line and I still get the same
> error.
> 
> Any ideas why it happens?
> 

Yes - don't ever do that. The major mode of a buffer is set by calling a
function (e.g. the org-mode function for buffers that should be in org
mode).  That function does a million things to make sure that everything
works properly: your setting a single variable does none of that and all
you end up doing is confusing emacs.

In most cases, you don't even call the mode function explicitly: it is
called for you automatically, e.g. through the setting of auto-mode-alist.
I have the following in my basic customizations:

(add-to-list 'auto-mode-alist '("\\.org$" . org-mode))

That says to emacs: when find-file is called to open a file whose name
ends in `.org' arrange to call the function org-mode on it. The function
takes care of the setting of major-mode.

Be sure to read Ch.23 of the emacs manual on major modes.

Nick



[O] Custom latex environments using properties

2011-08-29 Thread suvayu ali
Hi everyone,

I am trying to implement a way to wrap a custom latex environment
around a sub-tree where I specify the environment and its options as a
PROPERTY. I am expecting it to work as BEAMER_env or BEAMER_envargs
works for org-beamer export.

To give you an example:


* Bs decay (Bs->Dsh)
  Bs->DsK or Dsπ

** Decay model
   :PROPERTIES:
   :LATEX_env:  todonotes
   :LATEX_envargs:  green
   :END:

1. Justify neglecting CP violation
2. Verify master equations

** Detector effects
   :PROPERTIES:
   :LATEX_env:  todonotes
   :LATEX_envargs:  blue
   :END:

1. How is the Gaussian used for smearing of proper time resolution
   derived?
2. Why is the per event proper time error PDF needed? Why is smearing
   of time resolution not enough?


I am hoping to get blocks with colour codes (using the todonotes
package) based on the org properties. I tried using the preprocess hook
to convert the org source to latex using the defined properties but the
conversion to latex escapes everything and the process to pdf part
breaks. I used the following code to modify the preprocess hook.

#+begin_src emacs-lisp
  (defun my-org-export-latex-wrap-env ()
"Wrap heading with arbitrary latex environment."
(interactive)
(setq env (org-entry-get (point) "LATEX_env"))
(setq envargs (org-entry-get (point) "LATEX_envargs"))
(let ((heading (org-get-heading t))
  (text (org-get-entry)))
  (org-mark-subtree)
  (delete-region (region-beginning) (region-end))
  (insert (concat env "[inline, color=" envargs "]{%\n"
  "\\textbf{" heading "}\\protect\\linebreak{}%\n"
  text "\n}%\n"

  ;; the following snippet is from my hook
  (dolist (match spltags)
(org-map-entries (lambda () (my-org-export-latex-wrap-env))
 match))
#+end_src

Any one has ideas about what else I can try?

-- 
Suvayu

Open source is the future. It sets us free.



Re: [O] Bug: wrong-type-argument when changing TODO state [7.7]

2011-08-29 Thread Nick Dokos
I'm pretty tired and I might have misunderstood what is happening here,
so don't put too much weight on the following. I'll need some sleep
before I can take a whack at it again however.

Nick

Nick Dokos  wrote:

> Stelian Iancu  wrote:
> 
> 
> > > So it is a customization issue. Now the question is what :-). I should
> > > mention that I am using both dev versions for Emacs and org-mode
> > > (Emacs from bzr from a few days ago and org-mode from git from a few
> > > days ago) on Mac OS X 10.7. Emacs is installed using homebrew.
> > >
> > 
> > Ok, it seems like I've found the culprit. It's this line:
> > 
> > ;; Make org-mode default for all the new files
> > (setq major-mode 'org-mode)
> > 
> > If I comment it out, it all works beautifully. I thought it was
> > because I was executing it before loading org-mode, but I've made sure
> > org-mode is loaded before executing that line and I still get the same
> > error.
> > 
> > Any ideas why it happens?
> > 
> 
> Yes - don't ever do that. The major mode of a buffer is set by calling a
> function (e.g. the org-mode function for buffers that should be in org
> mode).  That function does a million things to make sure that everything
> works properly: your setting a single variable does none of that and all
> you end up doing is confusing emacs.
> 
> In most cases, you don't even call the mode function explicitly: it is
> called for you automatically, e.g. through the setting of auto-mode-alist.
> I have the following in my basic customizations:
> 
> (add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
> 
> That says to emacs: when find-file is called to open a file whose name
> ends in `.org' arrange to call the function org-mode on it. The function
> takes care of the setting of major-mode.
> 
> Be sure to read Ch.23 of the emacs manual on major modes.
> 
> Nick
> 



[O] Change in org-babel with indenting code blocks?

2011-08-29 Thread John Wiegley
I don't have any org-babel variables customized.  I have a code block like
this:

*** NOTE Assets:Receivable:CEG
#+begin_src sh :results value :exports results
ledger reg --inject=Expected '^income:ceg'
ledger reg --sort date -b 2007 receivable:CEG
#+end_src
:PROPERTIES:
:ID:   8BEF6C42-8B23-495B-9421-3810B58907A1
:VISIBILITY: folded
:CREATED:  [2010-06-18 Fri 07:37]
:END:

When I put my cursor on the '*' in the heading and hit 'r', I was used to the
whole entry, including the code block, getting indented by one space.  Now
everything *but* the code block gets indented.

Is this new behavior?  How do I get back to the old behavior?  I don't want my
code blocks sticking to a fixed column.

Thanks,
  John




Re: [O] [PATCH 1/5] Extend scope 'region to include body of last headline in active region

2011-08-29 Thread David Maus
Hi Carsten,

At Thu, 25 Aug 2011 07:40:52 +0200,
Carsten Dominik wrote:
>
>
> On 25.8.2011, at 06:25, David Maus wrote:
>
> > * org.el (org-map-entries): Extend scope 'region to include entire
> > body of last headline in active region.
> > ---
> > lisp/org.el |8 ++--
> > 1 files changed, 6 insertions(+), 2 deletions(-)
> >
> > diff --git a/lisp/org.el b/lisp/org.el
> > index de8c72b..b69b77c 100644
> > --- a/lisp/org.el
> > +++ b/lisp/org.el
> > @@ -13633,8 +13633,12 @@ a *different* entry, you cannot use these 
> > techniques."
> >(org-narrow-to-subtree)
> >(setq scope nil))
> >   ((and (eq scope 'region) (org-region-active-p))
> > -  (narrow-to-region (region-beginning) (region-end))
> > -  (setq scope nil)))
> > +  (let ((end (save-excursion
> > +   (goto-char (region-end))
> > +   (outline-next-heading)
> > +   (point
> > +(narrow-to-region (region-beginning) end)
> > +(setq scope nil
>
>
> Hi David,
>
> I think the better algorithm here would be this:
> If region-end is at the beginning of a line and that line is a headline,
> use region-end as it is.  If not, jump to the next headline.

Thanks, yes. This makes sense. Attached patch supersedes the previous.

Best,
  -- David
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber dmj...@jabber.org
Email. dm...@ictsoc.de
From 957dcbe6ae40fa332e48455a260782ba3e61e68d Mon Sep 17 00:00:00 2001
From: David Maus 
Date: Tue, 30 Aug 2011 06:22:12 +0200
Subject: [PATCH 1/4] Extend scope 'region to include entire body of last 
headline in active region

* org.el (org-map-entries): Extend scope 'region to include
entire body of last headline in active region.
---
 lisp/org.el |7 ++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index d63b854..b770fa6 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -13629,7 +13629,12 @@ a *different* entry, you cannot use these techniques."
   (org-narrow-to-subtree)
   (setq scope nil))
  ((and (eq scope 'region) (org-region-active-p))
-  (narrow-to-region (region-beginning) (region-end))
+  (narrow-to-region (region-beginning)
+(save-excursion
+  (goto-char (region-end))
+  (unless (and (bolp) (org-at-heading-p))
+(outline-next-heading))
+  (point)))
   (setq scope nil)))
 
(if (not scope)
-- 
1.7.2.5



pgpqnT8KK8oE5.pgp
Description: PGP signature


Re: [O] [PATCH 0/5] loop over headlines in active region

2011-08-29 Thread David Maus
Hi Carsten,

At Mon, 29 Aug 2011 11:29:04 +0200,
Carsten Dominik wrote:
>
>
> On Aug 28, 2011, at 3:58 PM, David Maus wrote:
>
> > Hi Carsten,
> >
> > At Thu, 25 Aug 2011 08:13:21 +0200,
> > Carsten Dominik wrote:
> >> I am wondering, why did you choose to skip invisible headlines?
> >> I would worry that this introduces inconsistent behavior and also
> >> makes it hard to use this feature in a programmatic way.
> >
> > Good points. I though of skipping invisible headlines as a way to
> > control which headlines are 'looped over' but if this is inconsistent
> > with already present behaviour of Org mode or Emacs in general we can
> > scratch that idea.
>
> Yes, let's do that.
>
> >
> > What brings up the question: What is the current behavior of Org mode
> > with regards to operations in a region?
>
> I think almost everything that iterates over a number of
> headlines will also do the invisible ones.  Exceptions are
> exporting/copying the visible headlines, and probably something else I
> am not remembering.

I'll investigate this. Maybe the customization variable could control
all operations on headlines in active region. Current proposal does
not feel good because it only controls some.

Best,
  -- David
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber dmj...@jabber.org
Email. dm...@ictsoc.de


pgpa2hFgS1kzx.pgp
Description: PGP signature


Re: [O] [PATCH 2/5] Immediately return if scope is region but no region is active

2011-08-29 Thread David Maus
Attached patch superseeds the old one, required to be applied after
"Extend scope 'region...".
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber dmj...@jabber.org
Email. dm...@ictsoc.de
From 8a0e1630629693a85a824713b1357faa49a372f0 Mon Sep 17 00:00:00 2001
From: David Maus 
Date: Tue, 30 Aug 2011 06:29:29 +0200
Subject: [PATCH 2/4] Immediately return if scope is 'region but no region is 
active

* org.el (org-map-entries): Immediately return if scope is 'region but
no region is active.
---
 lisp/org.el |  117 ++-
 1 files changed, 59 insertions(+), 58 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index b770fa6..d1f9898 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -13604,66 +13604,67 @@ with `org-get-tags-at'.  If your function gets 
properties with
 to t around the call to `org-entry-properties' to get the same speedup.
 Note that if your function moves around to retrieve tags and properties at
 a *different* entry, you cannot use these techniques."
-  (let* ((org-agenda-archives-mode nil) ; just to make sure
-(org-agenda-skip-archived-trees (memq 'archive skip))
-(org-agenda-skip-comment-trees (memq 'comment skip))
-(org-agenda-skip-function
- (car (org-delete-all '(comment archive) skip)))
-(org-tags-match-list-sublevels t)
-matcher file res
-org-todo-keywords-for-agenda
-org-done-keywords-for-agenda
-org-todo-keyword-alist-for-agenda
-org-drawers-for-agenda
-org-tag-alist-for-agenda)
+  (unless (and (eq scope 'region) (not (org-region-active-p)))
+(let* ((org-agenda-archives-mode nil) ; just to make sure
+  (org-agenda-skip-archived-trees (memq 'archive skip))
+  (org-agenda-skip-comment-trees (memq 'comment skip))
+  (org-agenda-skip-function
+   (car (org-delete-all '(comment archive) skip)))
+  (org-tags-match-list-sublevels t)
+  matcher file res
+  org-todo-keywords-for-agenda
+  org-done-keywords-for-agenda
+  org-todo-keyword-alist-for-agenda
+  org-drawers-for-agenda
+  org-tag-alist-for-agenda)
 
-(cond
- ((eq match t)   (setq matcher t))
- ((eq match nil) (setq matcher t))
- (t (setq matcher (if match (cdr (org-make-tags-matcher match)) t
+  (cond
+   ((eq match t)   (setq matcher t))
+   ((eq match nil) (setq matcher t))
+   (t (setq matcher (if match (cdr (org-make-tags-matcher match)) t
 
-(save-excursion
-  (save-restriction
-   (cond ((eq scope 'tree)
-  (org-back-to-heading t)
-  (org-narrow-to-subtree)
-  (setq scope nil))
- ((and (eq scope 'region) (org-region-active-p))
-  (narrow-to-region (region-beginning)
-(save-excursion
-  (goto-char (region-end))
-  (unless (and (bolp) (org-at-heading-p))
-(outline-next-heading))
-  (point)))
-  (setq scope nil)))
-
-   (if (not scope)
-   (progn
- (org-prepare-agenda-buffers
-  (list (buffer-file-name (current-buffer
- (setq res (org-scan-tags func matcher)))
- ;; Get the right scope
- (cond
-  ((and scope (listp scope) (symbolp (car scope)))
-   (setq scope (eval scope)))
-  ((eq scope 'agenda)
-   (setq scope (org-agenda-files t)))
-  ((eq scope 'agenda-with-archives)
-   (setq scope (org-agenda-files t))
-   (setq scope (org-add-archive-files scope)))
-  ((eq scope 'file)
-   (setq scope (list (buffer-file-name
-  ((eq scope 'file-with-archives)
-   (setq scope (org-add-archive-files (list (buffer-file-name))
- (org-prepare-agenda-buffers scope)
- (while (setq file (pop scope))
-   (with-current-buffer (org-find-base-buffer-visiting file)
- (save-excursion
-   (save-restriction
- (widen)
- (goto-char (point-min))
- (setq res (append res (org-scan-tags func matcher))
-res))
+  (save-excursion
+   (save-restriction
+ (cond ((eq scope 'tree)
+(org-back-to-heading t)
+(org-narrow-to-subtree)
+(setq scope nil))
+   ((and (eq scope 'region) (org-region-active-p))
+(narrow-to-region (region-beginning)
+  (save-excursion
+(goto-char (region-end))
+(unless (and (bolp) (org-at-heading-p))
+  (outline-next-heading))
+(point)))
+(setq scope nil)))
+
+ (if (not scope)
+   

Re: [O] Custom latex environments using properties

2011-08-29 Thread Jambunathan K
suvayu ali  writes:


Suvayu

> Hi everyone,
>
> I am trying to implement a way to wrap a custom latex environment
> around a sub-tree where I specify the environment and its options as a
> PROPERTY. I am expecting it to work as BEAMER_env or BEAMER_envargs
> works for org-beamer export.

Not strictly answering your question. But is tangentially related ...

The excerpt pasted below is from org-special-blocks.el. I am not much
familiar with LaTeX. I hope these special blocks could be used for
achieving the desired resutls.

Also there is a way to wrap a block of text in custom divs in case of
HTML exporter.

,
| ;; This package generalizes the #+begin_foo and #+end_foo tokens.
| 
| ;; To use, put the following in your init file:
| ;;
| ;; (require 'org-special-blocks)
| 
| ;; The tokens #+begin_center, #+begin_verse, etc. existed previously.
| ;; This package generalizes them (at least for the LaTeX and html
| ;; exporters).  When a #+begin_foo token is encountered by the LaTeX
| ;; exporter, it is expanded into \begin{foo}.  The text inside the
| ;; environment is not protected, as text inside environments generally
| ;; is.  When #+begin_foo is encountered by the html exporter, a div
| ;; with class foo is inserted into the HTML file.  It is up to the
| ;; user to add this class to his or her stylesheet if this div is to
| ;; mean anything.
`



Re: [O] [babel][R] no return values in R code blocks

2011-08-29 Thread Max Flöttmann
Hi Eric,
Thanks for the response.
I pulled the newest org version from the repository, mine was a few weeks
old. Now it's returning results correctly.
Cheers,

Max

2011/8/29 Eric Schulte 

> Max Flöttmann  writes:
>
> > Hi,
> > When i run a code block like this using C-c C-c:
> >
> > #+BEGIN_SRC R
> > c(1,23,54,5)
> > #+END_SRC
> >
> > I do not get any results.
> >
> > In older versions of orgmode the result used be a table or vector
> returned
> > by R. Is this a bug, or do I need a new keyword that is not in the
> > documentation yet to get the same result?
> > I'm using version 7.7 and R2.13.1
> >
>
> When I run your example I do get results.
>
> #+BEGIN_SRC R
> c(1,23,54,5)
> #+END_SRC
>
> #+results:
> |  1 |
> | 23 |
> | 54 |
> |  5 |
>
> So maybe the problem is located somewhere in your configuration.  I
> would suggest trying with a minimal configuration by launching emacs
> with the -Q option, and then only evaluating the bare minimum of a
> config sufficient to add R to the list of languages that Babel attempts
> to evaluate.
>
> Best -- Eric
>
> >
> > Thanks,
> >
> > Max
>
> --
> Eric Schulte
> http://cs.unm.edu/~eschulte/
>


Re: [O] Change in org-babel with indenting code blocks?

2011-08-29 Thread Sebastien Vauban
Hi John,

John Wiegley wrote:
> I don't have any org-babel variables customized.  I have a code block like
> this:
>
> *** NOTE Assets:Receivable:CEG
> #+begin_src sh :results value :exports results
> ledger reg --inject=Expected '^income:ceg'
> ledger reg --sort date -b 2007 receivable:CEG
> #+end_src
> :PROPERTIES:
> :ID:   8BEF6C42-8B23-495B-9421-3810B58907A1
> :VISIBILITY: folded
> :CREATED:  [2010-06-18 Fri 07:37]
> :END:
>
> When I put my cursor on the '*' in the heading and hit 'r', I was used to
> the whole entry, including the code block, getting indented by one space.
> Now everything *but* the code block gets indented.
>
> Is this new behavior? How do I get back to the old behavior? I don't want my
> code blocks sticking to a fixed column.

Could it be due to the patch around "Extra space inserted in repeated tasks'
date line"?

See http://lists.gnu.org/archive/html/emacs-orgmode/2011-08/msg00634.html

Best regards,
  Seb

-- 
Sebastien Vauban




Re: [O] Custom latex environments using properties

2011-08-29 Thread Sebastien Vauban
Hi Jambunathan and Suvayu,

Jambunathan K wrote:
> suvayu ali  writes:
>> I am trying to implement a way to wrap a custom latex environment around a
>> sub-tree where I specify the environment and its options as a PROPERTY. I
>> am expecting it to work as BEAMER_env or BEAMER_envargs works for
>> org-beamer export.

I have no particular experience with using such at the subtree level.

> Not strictly answering your question. But is tangentially related ...
>
> The excerpt pasted below is from org-special-blocks.el. I am not much
> familiar with LaTeX. I hope these special blocks could be used for
> achieving the desired resutls.
>
> Also there is a way to wrap a block of text in custom divs in case of
> HTML exporter.
>
> ,
> | ;; This package generalizes the #+begin_foo and #+end_foo tokens.
> | 
> | ;; To use, put the following in your init file:
> | ;;
> | ;; (require 'org-special-blocks)
> | 
> | ;; The tokens #+begin_center, #+begin_verse, etc. existed previously.
> | ;; This package generalizes them (at least for the LaTeX and html
> | ;; exporters).  When a #+begin_foo token is encountered by the LaTeX
> | ;; exporter, it is expanded into \begin{foo}.  The text inside the
> | ;; environment is not protected, as text inside environments generally
> | ;; is.  When #+begin_foo is encountered by the html exporter, a div
> | ;; with class foo is inserted into the HTML file.  It is up to the
> | ;; user to add this class to his or her stylesheet if this div is to
> | ;; mean anything.
> `

The answer of Jambunathan makes much sense, for such cases:

  #+BEGIN_shaded
  This will get a color background.
  #+END_shaded

or

  #+BEGIN_mcchangemargin {-1cm}{0cm}
  This paragraph must be moved regarding the normal margins.
  #+END_mcchangemargin {-1cm}{0cm}

  Note -- The above does not work yet correctly, though, because of the
  parameters to be passed onto the LaTeX environment.

But, the problem asked by Suvayu is different because the "todo" here is a
macro, not an environment. Hence the expected output:

  \todo[inline]{\textbf{\textsf{\textsc{TODO} Provide your last offer.}}\\ }

Except from working in such a fashion:

  #+LaTeX: \todo{
  ... your Org text
  is here
  inside ...
  #+LaTeX: }

I don't see (currently) any other way to achieve what you'd like to get.

Best regards,
  Seb

-- 
Sebastien Vauban