Re: [O] [PATCH][babel] add a string input to ob-octave

2011-10-01 Thread Nicolas Goaziou
Hello,

Litvinov Sergey  writes:

> +(cond
> + ((stringp var)
> +  (format "\'%s\'" (or var "nil")))
> + (t
> +  (format "%s" (or var "nil"))

Just nitpicking:

In the first case, var is already identified as a string, so it will
always be non-nil, and your "or" is useless.

In the second case, (or var "nil") is redundant, as (format "%s" nil)
already returns "nil".

In other words, replacing (or var "nil") with var would be enough in
both cases.

Regards,

-- 
Nicolas Goaziou



[O] % (org-agenda-bulk-mark-regexp) in agenda view problems

2011-10-01 Thread netty hacky
Hi Bastien,

I'm having two problems with the % command (org-agenda-bulk-mark-regexp) in
Org-mode agenda view.

1.  If I use "." as the search string, I get "Wrong type argument:
number-or-marker-p, nil".  And my workaround is to change the line "(let
(entries-marked)" in org-agenda.el to "(let ((entries-marked 0))".

2. If I use ".*" as the search string, I get "Wrong type argument: stringp,
nil".  After some edebugging, I found the reason is that in
org-agenda-bulk-mark-regexp, re-search-forward moved the point to the end of
the line (since ".*" matches the whole line), causing (get-text-property
(point) 'txt) to return nil, in turn caused string-match to throw the
error.  I think this may happen to other regexps, as long as the strings
matched include the last character in the line.  I'm new to Emacs Lisp so
I'm not sure how to fix this one.

Wondering why it seems only me having these two problems.

I am using MacPorts' Emacs and Org-mode:
Emacs  : GNU Emacs 23.3.1 (x86_64-apple-darwin10.8.0)
Package: Org-mode version 7.7

Thanks,
Net


Re: [O] TABLES: Remove/add cell

2011-10-01 Thread suvayu ali
2011/9/30 Michael Brand :
> Ehm - it is doable, but not by editing commands from Org table. Only
> with several rectangular edits or an Org table formula with a few
> tricks and a temporary column to be removed afterward.

There are some org-table specific rectangle edit commands that should
make it easier. Cut the cells with org-table-cut-region, and paste by
org-table-paste-rectangle.

Hope this helps.

-- 
Suvayu

Open source is the future. It sets us free.



Re: [O] [PATCH][babel] add a string input to ob-octave

2011-10-01 Thread Litvinov Sergey
> In other words, replacing (or var "nil") with var would be enough

Thanks. Fixed in the patch below. The patch also adds an ert test.
>From b4b679abdc7bec9f3033b50f81d567a0bb48b147 Mon Sep 17 00:00:00 2001
From: Litvinov Sergey 
Date: Sat, 1 Oct 2011 13:37:56 +0200
Subject: [PATCH 2/2] Remove redundant condition check in ob-octave.el. Add a test.

---
 lisp/ob-octave.el   |4 ++--
 testing/examples/ob-octave-test.org |6 --
 testing/lisp/test-ob-octave.el  |6 ++
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/lisp/ob-octave.el b/lisp/ob-octave.el
index cfc1f1d..f840739 100644
--- a/lisp/ob-octave.el
+++ b/lisp/ob-octave.el
@@ -119,9 +119,9 @@ specifying a variable of the same value."
 			 (if (listp (car var)) "; " ",")) "]")
 (cond
  ((stringp var)
-  (format "\'%s\'" (or var "nil")))
+  (format "\'%s\'" var))
  (t
-  (format "%s" (or var "nil"))
+  (format "%s" var)
 
 (defun org-babel-prep-session:octave (session params &optional matlabp)
   "Prepare SESSION according to the header arguments specified in PARAMS."
diff --git a/testing/examples/ob-octave-test.org b/testing/examples/ob-octave-test.org
index 37cf3f9..97d9b00 100644
--- a/testing/examples/ob-octave-test.org
+++ b/testing/examples/ob-octave-test.org
@@ -24,7 +24,6 @@ Input an integer variable
 ans = s
 #+end_src
 
-
 Input an array
 #+begin_src octave :exports results :results silent :var s='(1.0 2.0 3.0)
 ans = s
@@ -40,4 +39,7 @@ Input a string
 ans = s(1:2)
 #+end_src
 
-
+Input elisp nil
+#+begin_src octave :exports results :results silent :var s='nil
+ans = s
+#+end_src
diff --git a/testing/lisp/test-ob-octave.el b/testing/lisp/test-ob-octave.el
index f3972ec..145266d 100644
--- a/testing/lisp/test-ob-octave.el
+++ b/testing/lisp/test-ob-octave.el
@@ -53,3 +53,9 @@
 (org-babel-next-src-block 4)
 (should (equal "te" (org-babel-execute-src-block)
 
+(ert-deftest ob-octave/input-nil ()
+  "Input elisp nil"
+  (org-test-at-id "cc2d82bb-2ac0-45be-a0c8-d1463b86a3ba"
+(org-babel-next-src-block 5)
+(should (equal nil (org-babel-execute-src-block)
+
-- 
1.7.4.1



Re: [O] looking for examples using babel/calc

2011-10-01 Thread Litvinov Sergey
> is there some documentation and are there some examples of using babel
> with calc?

There are examples in
https://github.com/eschulte/babel-dev.git

Search for 'begin_src calc'.
https://raw.github.com/eschulte/babel-dev/master/scraps.org




[O] Bug: Can't check collapsed checkbox from end of line [7.7 (release_7.7.351.gb8b5)]

2011-10-01 Thread Dave Abrahams


Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

 http://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org-mode mailing list.


I have the following item in my todo list

--8<---cut here---start->8---
** TODO [#A] * Org Routine [1/4] **
   SCHEDULED: <2011-10-01 Sat .+1d>
   - [ ] PRIORITIZE
 - A: not completing on scheduled day has consequences
 - C: completely optional but you want to consider it
   - [ ] REFILE Inbox
   - [ ] TAG with required resource
 - Most of all people so you can filter and make sure all issues with that
   person are dealt with
   - [ ] RESCHEDULE/UNSCHEDULE until today is manageable
 - < 15 bite-sized tasks
--8<---cut here---end--->8---

When the line labelled "PRIORITIZE" is collapsed (the A and C are not
visible), if I go to the end of that line, `C-c C-c' has no effect

Emacs  : GNU Emacs 23.3.1 (x86_64-apple-darwin10.8.0, Carbon Version 1.6.0 
AppKit 1038.36)
 of 2011-09-12 on pluto.luannocracy.com
Package: Org-mode version 7.7 (release_7.7.351.gb8b5)

current state:
==
(setq
 org-x-backends '(ox-org ox-redmine)
 org-agenda-deadline-leaders '("D: " "D%d: ")
 org-clock-in-switch-to-state "STARTED"
 org-agenda-skip-scheduled-if-deadline-is-shown t
 org-export-latex-after-initial-vars-hook '(org-beamer-after-initial-vars)
 org-x-redmine-title-prefix-match-function 'org-x-redmine-title-prefix-match
 org-speed-command-hook '(org-speed-command-default-hook 
org-babel-speed-command-hook)
 org-agenda-custom-commands '(("E" "Errands (next 3 days)" tags
   
"Errand&TODO<>\"DONE\"&TODO<>\"CANCELED\"&STYLE<>\"habit\"&SCHEDULED<\"<+3d>\""
   ((org-agenda-overriding-header "Errands (next 3 
days)")

)
   )
  ("A" "Priority #A tasks" agenda ""
   ((org-agenda-ndays 1)
(org-agenda-overriding-header
 "Today's priority #A tasks: ")
(org-agenda-skip-function
 (quote
  (org-agenda-skip-entry-if (quote notregexp)
   "\\=.*\\[#A\\]")
  )
 )
)
   )
  ("b" "Priority #A and #B tasks" agenda ""
   ((org-agenda-ndays 1)
(org-agenda-overriding-header
 "Today's priority #A and #B tasks: ")
(org-agenda-skip-function
 (quote
  (org-agenda-skip-entry-if (quote regexp) 
"\\=.*\\[#C\\]")
  )
 )
)
   )
  ("w" "Waiting/delegated tasks" tags
   "TODO=\"WAITING\"|TODO=\"DELEGATED\""
   ((org-agenda-overriding-header 
"Waiting/delegated tasks:")
(org-agenda-sorting-strategy
 (quote (todo-state-up priority-down 
category-up)))
)
   )
  ("p" "Unprioritized tasks" tags
   
"AREA<>\"Work\"&TODO<>\"\"&TODO<>{DONE\\|CANCELED\\|NOTE\\|PROJECT\\|DEFERRED\\|SOMEDAY}"
   ((org-agenda-files
 

   (quote





 
("~/Documents/Tasks/todo.txt")





 

[O] Hide drawers in indirect buffers?

2011-10-01 Thread Dave Abrahams

When I initially request an indirect buffer for an item (especially from
the agenda) it shows up with all its drawers open.  I'd prefer it if
they were closed by default.  Is there a way to do that?

Thanks,

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




Re: [O] Bug: Can't check collapsed checkbox from end of line [7.7 (release_7.7.351.gb8b5)]

2011-10-01 Thread Nicolas Goaziou
Hello,

Dave Abrahams  writes:

> I have the following item in my todo list
>
>
> ** TODO [#A] * Org Routine [1/4] **
>SCHEDULED: <2011-10-01 Sat .+1d>
>- [ ] PRIORITIZE
>  - A: not completing on scheduled day has consequences
>  - C: completely optional but you want to consider it
>- [ ] REFILE Inbox
>- [ ] TAG with required resource
>  - Most of all people so you can filter and make sure all issues with that
>person are dealt with
>- [ ] RESCHEDULE/UNSCHEDULE until today is manageable
>  - < 15 bite-sized tasks
>
>
> When the line labelled "PRIORITIZE" is collapsed (the A and C are not
> visible), if I go to the end of that line, `C-c C-c' has no effect

I've pushed a fix on master. Could you confirm that it is working now?

Regards,

-- 
Nicolas Goaziou



Re: [O] Bug: Can't check collapsed checkbox from end of line [7.7 (release_7.7.351.gb8b5)]

2011-10-01 Thread Dave Abrahams

on Sat Oct 01 2011, Nicolas Goaziou  wrote:

> Hello,
>
> Dave Abrahams  writes:
>
>> I have the following item in my todo list
>>
>>
>> ** TODO [#A] * Org Routine [1/4] **
>>SCHEDULED: <2011-10-01 Sat .+1d>
>>- [ ] PRIORITIZE
>>  - A: not completing on scheduled day has consequences
>>  - C: completely optional but you want to consider it
>>- [ ] REFILE Inbox
>>- [ ] TAG with required resource
>>  - Most of all people so you can filter and make sure all issues with 
>> that
>>person are dealt with
>>- [ ] RESCHEDULE/UNSCHEDULE until today is manageable
>>  - < 15 bite-sized tasks
>>
>>
>> When the line labelled "PRIORITIZE" is collapsed (the A and C are not
>> visible), if I go to the end of that line, `C-c C-c' has no effect
>
> I've pushed a fix on master. Could you confirm that it is working now?

Not for me.  When I visit the org file above, press `TAB' to reveal the
detail of the TODO, move down two lines with `C-n C-n' and press `TAB'
again to collapse the "PRIORITIZE" bullet, hit `C-e' to go to the end of
line, then hit `C-c C-c', no checkmark appears.

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



[O] [BABEL][PATCH] construct a table from the output of maxima code block

2011-10-01 Thread Litvinov Sergey
Please consider a patch to construct a table from the output of maxima
code block.
>From a0305117f4e793c93d7d10bc7aab04f96bd62e9c Mon Sep 17 00:00:00 2001
From: Litvinov Sergey 
Date: Sat, 1 Oct 2011 22:29:18 +0200
Subject: [PATCH] [ob-maxima] Construct a table from the output of the code block. Add
 ert tests.

---
 lisp/ob-maxima.el   |8 +++-
 testing/README.org  |1 +
 testing/examples/ob-maxima-test.org |   64 +++
 testing/lisp/test-ob-maxima.el  |   82 +++
 4 files changed, 136 insertions(+), 19 deletions(-)
 create mode 100644 testing/lisp/test-ob-maxima.el

diff --git a/lisp/ob-maxima.el b/lisp/ob-maxima.el
index 3b4f6a0..9c39a5f 100644
--- a/lisp/ob-maxima.el
+++ b/lisp/ob-maxima.el
@@ -84,7 +84,13 @@ called by `org-babel-execute-src-block'."
 	(org-babel-eval cmd "") 
 (if (org-babel-maxima-graphical-output-file params) 
 	nil
-  result)))
+  (if (or (member "scalar" result-params)
+	  (member "verbatim" result-params)
+	  (member "output" result-params))
+	  result
+	(let ((tmp-file (org-babel-temp-file "maxima-res-")))
+	  (with-temp-file tmp-file (insert result))
+	  (org-babel-import-elisp-from-file tmp-file))
 
 
 (defun org-babel-prep-session:maxima (session params)
diff --git a/testing/README.org b/testing/README.org
index 2f16a55..eba147f 100644
--- a/testing/README.org
+++ b/testing/README.org
@@ -80,6 +80,7 @@ First tangle this file out to your desktop.
  (concat org-dir "/testing/examples/normal.org")
  (concat org-dir "/testing/examples/ob-awk-test.org")
  (concat org-dir "/testing/examples/ob-fortran-test.org")
+ (concat org-dir "/testing/examples/ob-maxima-test.org")
  (concat org-dir "/testing/examples/link-in-heading.org")
  (concat org-dir "/testing/examples/links.org")))
   
diff --git a/testing/examples/ob-maxima-test.org b/testing/examples/ob-maxima-test.org
index 23c76e7..ad5fc80 100644
--- a/testing/examples/ob-maxima-test.org
+++ b/testing/examples/ob-maxima-test.org
@@ -1,13 +1,20 @@
-* Test org maxima file
+#+Title: a collection of examples for ob-maxima tests
+#+OPTIONS: ^:nil
+
+* Simple tests
+  :PROPERTIES:
+  :ID:   b5842ed4-8e8b-4b18-a1c9-cef006b6a6c8
+  :END:
 #+begin_src maxima :var s=4 :results silent
 print(s);
 #+end_src
 
 Pass a string
 #+begin_src maxima :var fun="sin(x)" :var q=2 :results silent
-print(diff(fun, x, q));
+print(diff(fun, x, q))$
 #+end_src
 
+* Graphic output
 Graphic output
 #+begin_src maxima  :var a=0.5 :results graphics :file maxima-test-sin.png
 plot2d(sin(a*x), [x, 0, 2*%pi])$
@@ -16,21 +23,28 @@ plot2d(sin(a*x), [x, 0, 2*%pi])$
 #+begin_src maxima  :results graphics :file maxima-test-3d.png
 plot3d (2^(-u^2 + v^2), [u, -3, 3], [v, -2, 2])$
 #+end_src
-
+* Output to a file
 Output to a file
 #+begin_src maxima :file maxima-test-ouput.out
 for i:1 thru 10 do print(i)$
 #+end_src
-
-List as input
-#+begin_src maxima :var a=(list 1 2 3)
-print(a+1);
+* List input
+  :PROPERTIES:
+  :ID:   b5561c6a-73cd-453a-ba5e-62ad84844de6
+  :END:
+Simple list as an input
+#+begin_src maxima :var a=(list 1 2 3) :results silent :results verbatim
+print(a)$
 #+end_src
 
-#+begin_src maxima :var a=(list 1 (list 1 2) 3)
+#+begin_src maxima :var a=(list 1 (list 1 2) 3) :results silent :results verbatim
 print(a+1);
 #+end_src
 
+* Table input
+  :PROPERTIES:
+  :ID:   400ee228-6b12-44fd-8097-7986f0f0db43
+  :END:
 #+tblname: test_tbl_col
 | 1.0 |
 | 2.0 |
@@ -38,26 +52,40 @@ print(a+1);
 #+tblname: test_tbl_row
 | 1.0 | 2.0 |
 
-Extra bracket? TODO:
-#+begin_src maxima :var s=test_tbl_col
+#+begin_src maxima :var s=test_tbl_col :results silent :results verbatim
 print(s+1.0);
 #+end_src
 
-#+begin_src maxima :var s=test_tbl_row
+#+begin_src maxima :var s=test_tbl_row :results silent :results verbatim
 print(s+1.0);
 #+end_src
 
 Matrix
-#+tblname: test_tbl_mtr
+#+tblname: test_tbl_mtr 
 | 1.0 | 1.0 |
-| 0.0 | 4.0 |
 
-#+begin_src maxima :var s=test_tbl_mtr
+#+begin_src maxima :var s=test_tbl_mtr :results silent :results verbatim
 ms: apply(matrix, s);
-print(ms^^2);
+print(ms);
 #+end_src
 
-#+begin_src maxima :var s=test_tbl_mtr
-ms: apply(matrix, s);
-print(ms^^2);
+* Construct a table from the output
+  :PROPERTIES:
+  :ID:   cc158527-b867-4b1d-8ae0-b8c713a90fd7
+  :END:
+#+begin_src maxima :var s=test_tbl_mtr :results silent
+m: genmatrix (lambda([i,j], i+j-1), 3, 3)$
+write_data(m, "/dev/stdout")$
 #+end_src
+
+* Latex output
+#+begin_src maxima  :exports both :results latex :results verbatim
+assume(x>0);
+tex(ratsimp(diff(%e^(a*x), x)));
+#+end_src
+
+#+results:
+#+BEGIN_LaTeX
+$$a\,e^{a\,x}$$
+#+END_LaTeX
+
diff --git a/testing/lisp/test-ob-maxima.el b/testing/lisp/test-ob-maxima.el
new file mode 100644
index 000..dff4033
--- /dev/null
+++ b/testing/lisp/test-ob-maxima.el
@@ -0,0 +1,82 @@
+;;; test-ob-maxima.el --- tests for ob-maxima.el
+
+;; Copyright (

Re: [O] Bug: Can't check collapsed checkbox from end of line [7.7 (release_7.7.351.gb8b5)]

2011-10-01 Thread Nicolas Goaziou
Dave Abrahams  writes:

> Not for me.  When I visit the org file above, press `TAB' to reveal the
> detail of the TODO, move down two lines with `C-n C-n' and press `TAB'
> again to collapse the "PRIORITIZE" bullet, hit `C-e' to go to the end of
> line, then hit `C-c C-c', no checkmark appears.

That's because you have `org-special-ctrl-a/e' set to nil.  You should
set it to t first.

Regards,

-- 
Nicolas Goaziou



Re: [O] Bug: Can't check collapsed checkbox from end of line [7.7 (release_7.7.351.gb8b5)]

2011-10-01 Thread Dave Abrahams

on Sat Oct 01 2011, Nicolas Goaziou  wrote:

> Dave Abrahams  writes:
>
>> Not for me.  When I visit the org file above, press `TAB' to reveal the
>> detail of the TODO, move down two lines with `C-n C-n' and press `TAB'
>> again to collapse the "PRIORITIZE" bullet, hit `C-e' to go to the end of
>> line, then hit `C-c C-c', no checkmark appears.
>
> That's because you have `org-special-ctrl-a/e' set to nil.  You should
> set it to t first.

Thanks, you're right; that's definitely a setting I want.

Regards,

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



Re: [O] % (org-agenda-bulk-mark-regexp) in agenda view problems

2011-10-01 Thread netty hacky
Hi Bastien,

I found a third problem of org-agenda-bulk-mark-regexp, it does not work
well on daily/weekly agenda view.  Basically it chokes on lines that is not
a regular headline, like date labels, dairy entries and grid lines.

So to show I am not merely a leech on this list, I come up with my version
here, most of the ugly code are to deal with the way org-agenda-bulk-mark
works now (e.g., returning nil when successful):

(defun org-agenda-bulk-mark-regexp
(regexp)

  "Mark entries match
REGEXP."

  (interactive "sMark entries matching regexp:
")


(save-excursion

  (goto-char
(point-min))

  (let ((entries-marked
0))

(while (not
(eobp))

  (unless
(and

   (not (get-char-property (point)
'invisible))

   (not (org-get-at-bol
'org-agenda-diary-link))

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

   (let
(txt-property)

 (setq txt-property (get-char-property (point)
'txt))

 (string-match regexp
txt-property))

   (not (call-interactively
'org-agenda-bulk-mark))

   (setq entries-marked (+ entries-marked
1)))

(beginning-of-line
2)))

(if (zerop
entries-marked)

(message "No entry matching this
regexp.")

  (message "%d entries marked for bulk action" entries-marked)

Thanks,
Net

On Sat, Oct 1, 2011 at 12:38 AM, netty hacky  wrote:

> Hi Bastien,
>
> I'm having two problems with the % command (org-agenda-bulk-mark-regexp) in
> Org-mode agenda view.
>
> 1.  If I use "." as the search string, I get "Wrong type argument:
> number-or-marker-p, nil".  And my workaround is to change the line "(let
> (entries-marked)" in org-agenda.el to "(let ((entries-marked 0))".
>
> 2. If I use ".*" as the search string, I get "Wrong type argument: stringp,
> nil".  After some edebugging, I found the reason is that in
> org-agenda-bulk-mark-regexp, re-search-forward moved the point to the end of
> the line (since ".*" matches the whole line), causing (get-text-property
> (point) 'txt) to return nil, in turn caused string-match to throw the
> error.  I think this may happen to other regexps, as long as the strings
> matched include the last character in the line.  I'm new to Emacs Lisp so
> I'm not sure how to fix this one.
>
> Wondering why it seems only me having these two problems.
>
> I am using MacPorts' Emacs and Org-mode:
> Emacs  : GNU Emacs 23.3.1 (x86_64-apple-darwin10.8.0)
> Package: Org-mode version 7.7
>
> Thanks,
> Net
>
>


Re: [O] bug#9610: 24.0.90; org-mode: sluggish response and high CPU utilization with large .org files

2011-10-01 Thread Tom Davey
On Tue, Sep 27, 2011 at 3:11 PM, Eric S Fraga  wrote:

> Brilliant!  I have been getting rather annoyed at the jerky movement in
> a number of buffers, mostly org, but I knew the problem wasn't due to
> org having done timings etc.  Setting this to nil does the job.

Yes, a very bothersome issue. Large org files were nearly unusable;
Windows reported that Emacs was using up to 25% of the CPU when I was
simply typing text. I wasted half a day today trying to track this
issue down, until I remembered this thread on the list earlier this
week. Setting this obscure variable to nil in org-mode-hook does the
trick. Thanks so much.

--
Tom Davey
t...@tomdavey.com
New York NY USA



Re: [O] org-mobile-push

2011-10-01 Thread Vikas Rawal
> 
> In trying to call this last function, emacs gets an error: the function
> is not defined.
> 
> Basically what happens is that org-mobile-push calculates the agenda, by
> calling org-agenda-list. This function checks the value of the variable
> org-agenda-include-diary, which in your case must be t, so it tries to
> add agenda entries from the diary.  It calls org-get-entries-from-diary
> to do that, which calls diary-list-entries. This one runs the diary-hook
> and somewhere in your init files you must have done something like
> this:
> 
>   (add-hook 'diary-hook (function appt-make-list))
> 
Thanks very much for explaining it so well. 

Best wishes,

Vikas







Re: [O] Printing in indent mode

2011-10-01 Thread Jarmo Hurri

Giovanni Ridolfi  writes:

>> That would be very nice, but I do not know how to do this for a
>> hierarchical list so that the result would look like a list.
>
> For a subtree:
> * A list
> :PROPERTIES:
> :EXPORT_TITLE: 
> :EXPORT_OPTIONS:  H:0 num:nil toc:nil \n:t @:t ::t |:t ^:t f:nil *:t tags:nil 
> TeX:t LaTeX:nil skip:t p:nil  author:nil  email:nil  creator:nil timestamp:nil
> :END:

Thanks, works like a charm!

It might be useful for me to define this as a function (like
org-export-as-pdf-as-is). I will try to figure out later how I could do
it.

All the best,

Jarmo