Re: [O] [babel] Collection of code block snippets

2011-09-09 Thread Rainer M Krug
On Fri 09 Sep 2011 00:03:59 CEST, Martyn Jago wrote:
> Hi Eric
>
> Martyn Jago  writes:
>
>> Hi Eric
>>
>> Eric Schulte  writes:
>>
>>> Hi Martyn,
>>>

 I have written a few more tests for inline source blocks execution with
 org-ctrl-c-ctrl-c (not extensive by any means).
>>>
>>> Thanks for adding these tests, I get 6 failures all with the same error
>>> [1], is that intentional?  If not would you mind taking another look at
>>> this patch?
>
> I reverse-engineered my =test-init.el= script using a call to
> =org-test-run-batch-tests= and from that worked out why your script was
> breaking tests. 
>
> One problem on my system is that emacs was using the wrong org mode
> since the newer org location wasn't known about. Also, the languages,
> emacs-lisp and sh need to be switched on (I thought emacs-lisp was on by
> default)?
>
> Now all tests pass.
>
> My minimised script...
>
> --8<---cut here---start->8---
> (let ((org-dir "~/org-mode/"))
>   (add-to-list 'load-path (concat org-dir "lisp"))
>   (add-to-list 'load-path (concat org-dir "testing"))
>   (require 'org-test)
>   (setq org-confirm-babel-evaluate nil)
>   (org-babel-do-load-languages
>'org-babel-load-languages '((emacs-lisp . t) (sh . t)))
>   (org-test-run-batch-tests))
> --8<---cut here---end--->8---
>
> Called by...
>
> --8<---cut here---start->8---
> emacs -Q -script ~/orgmode/testing/test-init.el
> --8<---cut here---end--->8---
>
> Your modified script...
>
> --8<---cut here---start->8---
> emacs -Q -batch -L ~/org-mode/lisp ~/org-mode/testing -l org-test.el \
> -eval "(progn(setq org-confirm-babel-evaluate nil) \
> (org-babel-do-load-languages 'org-babel-load-languages '((emacs-lisp \
> . t) (sh . t" -f org-test-run-batch-tests
> --8<---cut here---end--->8---
>
> I've fixed my typos in test-ob.el below.
>
> Best, Martyn
>
>
>
>
>
> [...]


I just tried to run the tests, and I got the following error:

>rkrug@ecolmod:~$ emacs -Q -batch -L ~/.emacs.d/org-mode/lisp 
>~/.emacs.d/org-mode/testing -l org-test.el -eval "(progn(setq 
>org-confirm-babel-evaluate nil) \
(org-babel-do-load-languages 'org-babel-load-languages '((emacs-lisp \
. t) (sh . t" -f org-test-run-batch-tests
Cannot open load file: ert
rkrug@ecolmod:~$ 

I read that the ert file should be included in emacs but I installed 
GNU Emacs 23.2.1 from the ubuntu repos - do I have tio install from 
source? Org-mode version 7.7 (release_7.7.267.g1633)

I would very much like to run the tests on my system.
Thanks,

Rainer



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

2011-09-09 Thread Štěpán Němec
On Fri, 09 Sep 2011 06:06:26 +0200
David Maus wrote:

> At Wed, 07 Sep 2011 21:34:41 +0200,
> Štěpán Němec wrote:

>> So your "what stop me to implement a macro" argument is bogus, isn't it?
>> I can't really comment on whether using a macro or not is the right
>> thing here, but it seems to me you shouldn't base the decision on an
>> invalid argument (IOW, from the fact that you even felt the need to
>> explain why you didn't use a macro to begin with, it would appear to be
>> the case that you would have preferred the macro way).
>
> "One of the things Ford Prefect had always found hardest to understand
> about humans was their habit of continually stating and repeating the
> very very obvious, as in /It's a nice day/, or /You're very tall/, or
> /Oh dear you seem to have fallen down a thirty-foot well, are you all
> right?/ At first Ford had formed a theory to account for this strange
> behavior. If human beings don't keep exercising their lips, he
> thought, their mouths probably seize up.
>
> After a few months' consideration and observation he abandoned this
> theory in favor of a new one. If they don't keep on exercising their
> lips, he thought, their brains start working. After a while he
> abandoned this one as well as being obstructively cynical and decided
> he quite liked human beings after all, but he always remained
> desperately worried about the terrible number of things they didn't
> know about."
>
>   Douglas Adams, The Hitchiker's Guide to the Galaxy

In your "enlightened" style, that would be

“曰:‘四境之內不治則如之何?’王顧左右而言他。” 《孟子·梁惠王下》

Still, I'd rather we stuck to the point and expressed ourselves in a way
that doesn't imply the other side is either an idiot or a telepathist
(although I'd argue that in the currrent context, my quotation is much
clearer than yours).

-- 
Štěpán



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

2011-09-09 Thread Bastien
Guys, let's keep using a civil tone in discussions.

I will come back to this issue and see if I can help.

Thanks,

-- 
 Bastien



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

2011-09-09 Thread Štěpán Němec
On Fri, Sep 09, 2011 at 12:41:45PM +0200, Bastien wrote:
> Guys, let's keep using a civil tone in discussions.

I think you're confusing "civil tone" with "political correctness"
(which, in a lot of instances, can be translated as "hypocrisy").

I don't think every sentence containing the word "idiot" is uncivil, if
that's what tripped you up.

In any case, I really appreciate David's contributions focused on
improving Org code quality. I even more appreciate that he sends his
patches to the list so that anyone can review and comment on them. It's
just that I believe it's more helpful to stick to the point being
discussed and address questions raised instead of spamming the list with
one's reading notes.

-- 
Štěpán



Re: [O] [babel] Collection of code block snippets

2011-09-09 Thread Martyn Jago
Hi Rainer

Rainer M Krug  writes:


[...]

>
>
> I just tried to run the tests, and I got the following error:
>
>>rkrug@ecolmod:~$ emacs -Q -batch -L ~/.emacs.d/org-mode/lisp 
>>~/.emacs.d/org-mode/testing -l org-test.el -eval "(progn(setq 
>>org-confirm-babel-evaluate nil) \
> (org-babel-do-load-languages 'org-babel-load-languages '((emacs-lisp \
> . t) (sh . t" -f org-test-run-batch-tests
> Cannot open load file: ert
> rkrug@ecolmod:~$ 
>
> I read that the ert file should be included in emacs but I installed 
> GNU Emacs 23.2.1 from the ubuntu repos - do I have tio install from 
> source? Org-mode version 7.7 (release_7.7.267.g1633)
>
> I would very much like to run the tests on my system.
> Thanks,
>
> Rainer

Unfortunately ERT is not in Emacs 23.3.1. However, you should
have no problem downloading the ERT files from
https://github.com/ohler/ert and saving them in =path/to/org/testing/= 

The script should then work for you (I used ERT like this for some
time).

Best, Martyn




Re: [O] [babel] Collection of code block snippets

2011-09-09 Thread Martyn Jago
Hi Eric

Martyn Jago  writes:

[...]

>
> One problem on my system is that emacs was using the wrong org mode
> since the newer org location wasn't known about. Also, the languages,
> emacs-lisp and sh need to be switched on (I thought emacs-lisp was on by
> default)?

I was quite wrong here, emacs-lisp is available - apologies for the
noise.

My last stab at this is floating a suggestion for something like the
following in org-tests.el...

--8<---cut here---start->8---
(let ((org-test-dir (expand-file-name
  (file-name-directory
   (or load-file-name buffer-file-name)
   (let ((org-lisp-dir (expand-file-name
   (concat org-test-dir "../lisp"
 (unless (member 'features "org")
   (setq load-path (cons org-lisp-dir load-path))
   (org-babel-do-load-languages
'org-babel-load-languages '((sh . t)
   (let* ((load-path (cons
 (expand-file-name "ert" org-test-dir)
 (cons
  (expand-file-name "jump" org-test-dir)
  load-path
(require 'ert)
(require 'ert-x)
(require 'jump)
(require 'which-func)
(require 'org)))
--8<---cut here---end--->8---

In otherwords, if org is not yet a feature, add org mode to the load
path _and_ =do-load-babel-languages= adding sh, but keeping evaluation 
confirmation
on the command line. 

This reduces your script back to...

--8<---cut here---start->8---
Emacs -Q -batch -l org-test.el -eval "(setq org-confirm-babel-evaluate nil)" -f 
org-test-run-batch-tests
--8<---cut here---end--->8---

Regards

Martyn


[...]





[O] disabling mathescape for individual listing?

2011-09-09 Thread Marko Schütz Schmuck
I have looked around, but couldn't find how to set mathescape=false
for one individual #+begin_src sh block and LaTeX export.

Any clarification is very much appreciated.

Best regards,

Marko

pgpEwh48loE8c.pgp
Description: PGP signature


Re: [O] [babel] VC-Log does not run correctly

2011-09-09 Thread Sebastien Vauban
Hi Eric,

Eric Schulte wrote:
> Off the top of my head I would recommend first running the vc-log code
> block interactively to see how it behaves

Had alreayd done it. Same behavior: question asked; whichever the answer, the
results is empty (well, almost: only the first line stating the name of the 
file).

> then possibly expanding the code block with C-c C-v v, copying the results
> to your scratch buffer, evaluating the resulting elisp with edebug (C-M-x
> with a prefix argument), which will then allow you to step through the code
> execution statement by statement. This should help to pinpoint the problem.

#+begin_src emacs-lisp
(let ((buf (quote "ecm-org.txt"))
  (limit (quote -1)))
  ;; Most of this code is copied from vc.el vc-print-log
  (require 'vc)
  (when (vc-find-backend-function
 (vc-backend (buffer-file-name (get-buffer buf))) 'print-log)
(let ((limit -1)
  (vc-fileset nil)
  (backend nil)
  (files nil))
  (with-current-buffer (get-buffer buf)
(setq vc-fileset (vc-deduce-fileset t)) ; FIXME: Why t? --Stef
(setq backend (car vc-fileset))
(setq files (cadr vc-fileset)))
  (with-temp-buffer 
(let ((status (vc-call-backend
   backend 'print-log files (current-buffer
  (when (and (processp status)   ; Make sure status is a process
 (= 0 (process-exit-status status))) ; which has not 
terminated
(while (not (eq 'exit (process-status status)))
  (sit-for 1 t)))
  (buffer-string))
#+end_src

The first 2 lines were added.

Executing that block gives the same results. However, I still need to do your
next piece of advice: going through an edebug. I'll do it, and will let you
know.

Best regards,
  Seb

-- 
Sebastien Vauban




[O] Alignment Regexp Should Recognize Currencies

2011-09-09 Thread Daniel E . Doherty

All,

I noticed that the regular expression for recognizing what columns are
numeric in a table for purposes of right-aligning does not pick up
dollar values with commas.

For example, $23,821,415.18 would be treated as "text" and left-aligned,
which I don't believe is what one would expect.

It can be fixed by customizing the variable org-table-number-regexp,
like so:

^\([<>]?\(\$ *\)?[-+^.,0-9]*[0-9][-+^.0-9eEdDx()%:]*\| ... \)$
  ^
Adding the underlined parts.

My question is should this not be the default, perhaps with the Euro
symbol and other likely currency symbols added in?

Regards,
-- 



Daniel E. Doherty

Up the airy mountain,
Down the rushy glen,
We daren't go a-hunting,
For fear of little men.
  --- William Allingham (Donegal, Ireland)



Re: [O] [babel] VC-Log does not run correctly

2011-09-09 Thread suvayu ali
Hi Seb,

On Thu, Sep 8, 2011 at 4:16 PM, Sebastien Vauban
 wrote:
>  (when (vc-find-backend-function
>         (vc-backend (buffer-file-name (get-buffer buf))) 'print-log)
>

AFAIU from a previous issue (more than a year back I think), you need
to ensure buffer-file-name returns  something reasonable. The problem
is if it is evaluated in a temporary buffer (is that the case during
export?) then it will return nil which confuses vc.

Hope this helps.

-- 
Suvayu

Open source is the future. It sets us free.



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

2011-09-09 Thread David Maus
At Fri, 09 Sep 2011 12:26:31 +0200,
Štěpán Němec wrote:
> 
> Still, I'd rather we stuck to the point and expressed ourselves in a way
> that doesn't imply the other side is either an idiot ...

Your message simply repeated my conclusion: Yes, the problem of
referencing a free variable in the macro expansion does not apply in
this case. Yes, I should base decisions on valid arguments (Who
shouldn't?). Yes, the fact that I refrained from implementing it as a
macro indicates that I wanted to implement it as a macro in the first
place.

Repeating and stating the very, very obvious is one way to call
someone an idiot.
-- 
OpenPGP... 0x99ADB83B5A4478E6
Jabber dmj...@jabber.org
Email. dm...@ictsoc.de


pgpptcO2Ig7jL.pgp
Description: PGP signature


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

2011-09-09 Thread Štěpán Němec
On Fri, 09 Sep 2011 17:10:42 +0200
David Maus wrote:

> At Fri, 09 Sep 2011 12:26:31 +0200,
> Štěpán Němec wrote:
>> 
>> Still, I'd rather we stuck to the point and expressed ourselves in a way
>> that doesn't imply the other side is either an idiot ...
>
> Your message simply repeated my conclusion: Yes, the problem of
> referencing a free variable in the macro expansion does not apply in
> this case. Yes, I should base decisions on valid arguments (Who
> shouldn't?). Yes, the fact that I refrained from implementing it as a
> macro indicates that I wanted to implement it as a macro in the first
> place.
>
> Repeating and stating the very, very obvious is one way to call
> someone an idiot.

It's not. (One way to call someone an idiot is saying "You're an idiot".
If you somehow understood any of my emails as implying you're an idiot,
then I'm sorry. It was definitely not intended.)

The reason I asked (I didn't actually repeat anything, and it's all
apparently still far from obvious, at least to me) is that I'm confused:
You say "I didn't implement is as a macro, because A". Now we both agree
that A is an invalid argument. Given that you now also confirmed you did
want to implement it as a macro in the first place, I would expect that
either you do implement it as a macro, or provide a valid argument for
not doing so. Maybe I really am too dense, but the hitchhiker quotation
didn't help.

-- 
Štěpán



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

2011-09-09 Thread David Maus
At Fri, 09 Sep 2011 17:26:43 +0200,
Štěpán Němec wrote:
> 
> The reason I asked (I didn't actually repeat anything, and it's all
> apparently still far from obvious, at least to me) is that I'm confused:
> You say "I didn't implement is as a macro, because A". Now we both agree
> that A is an invalid argument. Given that you now also confirmed you did
> want to implement it as a macro in the first place, I would expect that
> either you do implement it as a macro, or provide a valid argument for
> not doing so. Maybe I really am too dense, but the hitchhiker quotation
> didn't help.

Okay, now I get it. Do I implement a macro for the operation? I Don't
know.

Please see http://thread.gmane.org/gmane.emacs.orgmode/44422/focus=46184

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


pgpluR4CDEL8P.pgp
Description: PGP signature


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

2011-09-09 Thread Bastien
Hi John,

John Wiegley  writes:

>> John Wiegley  writes:
>
>> In the current Org (updated today), this problem now affects *all*
>> non-drawer text in entries, including code blocks, lists, and log entries!
>> This is makes entry shifting completely useless to me.  What do I need to
>> revert to make it work again?
>
> Actually, it even worse: This affects all refiled blocks as well, resulting in
> the indentation of the refiled entry being the same as the original level it
> was captured in.  I just went through my entire Org file by eye and found a
> huge number of indentation problems resulting from this bug.  Help!

I couldn't fix this correctly, so I simply reverted commit 6b04bef for
now.  I will provide a better fix later.

Thanks,

-- 
 Bastien



[O] Allo org-agenda-text-search-extra-files to be a directory

2011-09-09 Thread Darlan Cavalcante Moreira

I have a directory with several files that are not supposed to be in
org-agenda-files (they don't have TODOs, schedule, etc), but that I want
org to include in text searches.

Is it possible to set org-agenda-text-search-extra-files with a directory
so that all .org files in that directory are considered for text searches
(similarly to how you can set org-agenda-files)?

As I understand this is not possible right now and I need to explicitly set
org-agenda-text-search-extra-files with a list containing all files I want
org to consider in text searches. The problem of that approach is when I
create more files in the same directory and forget to update
org-agenda-text-search-extra-files.


--
Darlan



Re: [O] [babel] Collection of code block snippets

2011-09-09 Thread Eric Schulte
>
> I've fixed my typos in test-ob.el below.
>

I've applied your previous patch along with this fix.

Thanks! -- Eric

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



Re: [O] [babel] Collection of code block snippets

2011-09-09 Thread Eric Schulte
Martyn Jago  writes:

> Hi Eric
>
> Martyn Jago  writes:
>
> [...]
>
>>
>> One problem on my system is that emacs was using the wrong org mode
>> since the newer org location wasn't known about. Also, the languages,
>> emacs-lisp and sh need to be switched on (I thought emacs-lisp was on by
>> default)?
>
> I was quite wrong here, emacs-lisp is available - apologies for the
> noise.
>
> My last stab at this is floating a suggestion for something like the
> following in org-tests.el...
>
> (let ((org-test-dir (expand-file-name
> (file-name-directory
>  (or load-file-name buffer-file-name)
>(let ((org-lisp-dir (expand-file-name
>  (concat org-test-dir "../lisp"
>  (unless (member 'features "org")
>(setq load-path (cons org-lisp-dir load-path))
>(org-babel-do-load-languages
>   'org-babel-load-languages '((sh . t)
>(let* ((load-path (cons
>(expand-file-name "ert" org-test-dir)
>(cons
> (expand-file-name "jump" org-test-dir)
> load-path
> (require 'ert)
> (require 'ert-x)
> (require 'jump)
> (require 'which-func)
> (require 'org)))
>

Looks perfect, I'm adding this to the definition of `org-test-run-batch-tests'.

I still get one failing test when running this in batch mode.
,
| 1 unexpected results:
|FAILED  test-org-babel/inline-src-blocks
`

and 6 failures when run interactively, but these may be local issues so
I'll check them out.
,
| Selector: "\\(org\\|ob\\)"
| Passed: 103
| Failed: 6 (6 unexpected)
| Total:  109/109
| 
| Started at:   2011-09-09 14:38:49-0600
| Finished.
| Finished at:  2011-09-09 14:38:54-0600
| 
| 
..F..F...
| 
| F test-org-babel/inline-src_blk-default-results-replace-line-1
| (error "C-c C-c can do nothing useful at this location")
| 
| F test-org-babel/inline-src_blk-results-file
| (error "C-c C-c can do nothing useful at this location")
| 
| F test-org-babel/inline-src_blk-results-raw
| (error "C-c C-c can do nothing useful at this location")
| 
| F test-org-babel/inline-src_blk-results-scalar
| (error "C-c C-c can do nothing useful at this location")
| 
| F test-org-babel/inline-src_blk-results-silent
| (error "C-c C-c can do nothing useful at this location")
| 
| F test-org-babel/inline-src_blk-results-verbatim
| (error "C-c C-c can do nothing useful at this location")
`

Thanks -- Eric

>
> In otherwords, if org is not yet a feature, add org mode to the load
> path _and_ =do-load-babel-languages= adding sh, but keeping evaluation 
> confirmation
> on the command line. 
>
> This reduces your script back to...
>
> Emacs -Q -batch -l org-test.el -eval "(setq org-confirm-babel-evaluate nil)" 
> -f org-test-run-batch-tests
>
> Regards
>
> Martyn
>
>
> [...]
>
>
>

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



Re: [O] Allo org-agenda-text-search-extra-files to be a directory

2011-09-09 Thread suvayu ali
On Fri, Sep 9, 2011 at 9:09 PM, Darlan Cavalcante Moreira
 wrote:
> Is it possible to set org-agenda-text-search-extra-files with a directory
> so that all .org files in that directory are considered for text searches
> (similarly to how you can set org-agenda-files)?
>

This should work:
(directory-files "~/" t "^[^.#].*\\.\\(org$\\|org_archive$\\)")

-- 
Suvayu

Open source is the future. It sets us free.



Re: [O] Org minor mode in mail-mode

2011-09-09 Thread Rene
René  yahoo.com> writes:

> Here is the the configuration I run
> 
>(defun turn-on-full-org-mailing ()
>  (turn-on-orgstruct++)
>  (turn-on-orgtbl)
>  (load "org-html-mail"))
> 
>(add-hook 'mail-mode-hook 'turn-on-full-org-mailing)
> 
> in order make use of Org minor mode (struct, tbl) within mail-mode.
> 
> Unfortunately with this, calling M-q (fill-paragraph) right after the
> header separator ("--text follows this line--") leads to filling the
> header along with the first paragraph of my mail.

I found the right solution.  I just needed to toggle Filladapt minor mode.
This way `auto-fill-mode' and the `fill-paragraph' command are both smarter
about guessing a proper fill-prefix and finding paragraph boundaries when
indented lines and paragraphs are used.

  (require 'filladapt)
  (setq-default filladapt-mode t)

--
Rene




Re: [O] Org minor mode in mail-mode

2011-09-09 Thread Eric Abrahamsen
On Sat, Sep 10 2011, Rene wrote:

> René  yahoo.com> writes:
>
>> Here is the the configuration I run
>> 
>>(defun turn-on-full-org-mailing ()
>>  (turn-on-orgstruct++)
>>  (turn-on-orgtbl)
>>  (load "org-html-mail"))
>> 
>>(add-hook 'mail-mode-hook 'turn-on-full-org-mailing)
>> 
>> in order make use of Org minor mode (struct, tbl) within mail-mode.
>> 
>> Unfortunately with this, calling M-q (fill-paragraph) right after the
>> header separator ("--text follows this line--") leads to filling the
>> header along with the first paragraph of my mail.
>
> I found the right solution.  I just needed to toggle Filladapt minor mode.
> This way `auto-fill-mode' and the `fill-paragraph' command are both smarter
> about guessing a proper fill-prefix and finding paragraph boundaries when
> indented lines and paragraphs are used.
>
>   (require 'filladapt)
>   (setq-default filladapt-mode t)

Thanks for this hint! I had been advising fill-paragraph, this seems
like a more comprehensive solution.




[O] Adding Timestamps

2011-09-09 Thread Chris Niven
Hi there, 

Is there any way to sum timestamps in org-mode?

Thanks,

-chris




[O] deft - A Notational Velocity mode for emacs

2011-09-09 Thread timetrap
And you can specify your own major mode(perfect for org-mode) ... my
head just exploded, and my weekend schedule is now centered around
rewriting my init.el. :-)

http://jblevins.org/projects/deft/

This is different than org-velocity, as it uses multiple text files
rather than an org-file or a bucket file, you can also add or delete
files from within deft-mode.