[O] Bug: Latex export fails when src block contains [X] [7.7]

2011-11-13 Thread Daniel Mescheder

Hi,

I'm running the following system:

Emacs  : GNU Emacs 23.2.1 (i686-pc-linux-gnu, GTK+ Version 2.24.4)
 of 2011-04-04 on rothera, modified by Debian
Package: Org-mode version 7.7

I've run into a problem with #+begin_src #+end_src blocks:
Whenever I trying to have a one-element python list inside of such a block the 
pdf-export will fail with 

(wrong-type-argument stringp nil)

Here comes a minimal example:


* Some section

This works fine:

#+begin_src python
print [0,1,2]
#+end_src

This does not work:

#+begin_src python
print [1]
#+end_src


(For some reason I needed to include the src-block in some section. 
That is probably an unrelated problem.)

The trace of this example is

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  string-match(ORG-LIST-END-MARKER\\' nil)
  org-export-latex-preprocess((:emph-multiline t :for-backend latex :comments 
nil :tags not-in-toc :priority nil :footnotes t :drawers nil :timestamps t 
:todo-keywords t :tasks t :add-text nil :skip-before-1st-heading nil 
:select-tags (export) :exclude-tags (noexport) :LaTeX-fragments nil))
  org-export-preprocess-string(#(* Some section\n\nThis works 
fine:\n\n#+begin_src python\nprint [0,1,2]\n#+end_src\n\nThis does not 
work:\n\n#+begin_src python\nprint [1]\n#+end_src\n\n 0 18 
(font-lock-fontified t fontified nil) 18 19 (font-lock-fontified t fontified 
nil) 19 20 (fontified nil) 20 22 (fontified nil) 22 34 (fontified nil) 34 35 
(fontified nil) 35 36 (fontified nil) 36 53 (fontified nil) 53 54 (fontified 
nil) 54 72 (fontified nil font-lock-fontified t) 72 73 (fontified nil 
font-lock-fontified t) 73 77 (fontified nil font-lock-fontified t) 77 90 
(fontified nil font-lock-fontified t) 90 91 (fontified nil font-lock-fontified 
t) 91 100 (fontified nil font-lock-fontified t) 100 101 (fontified nil 
font-lock-fontified t) 101 102 (fontified nil font-lock-fontified t) 102 121 
(fontified nil font-lock-fontified t) 121 122 (fontified nil 
font-lock-fontified t) 122 123 (fontified nil font-lock-fontified t) 123 141 
(font-lock-fontified t fontified nil) 141 142 (font-lock-fontified t fontified 
nil) 142 146 (font-lock-fontified t fontified nil) 146 155 (font-lock-fontified 
t fontified nil) 155 156 (font-lock-fontified t fontified nil) 156 164 
(font-lock-fontified t fontified nil) 164 165 (font-lock-fontified t fontified 
nil rear-nonsticky t) 165 166 (fontified nil font-lock-fontified t) 166 167 
(fontified nil)) :emph-multiline t :for-backend latex :comments nil :tags 
not-in-toc :priority nil :footnotes t :drawers nil :timestamps t :todo-keywords 
t :tasks t :add-text nil :skip-before-1st-heading nil :select-tags (export) 
:exclude-tags (noexport) :LaTeX-fragments nil)
  org-export-as-latex(nil nil nil nil nil nil)
  org-export-as-pdf(nil)
  call-interactively(org-export-as-pdf)
  org-export(nil)
  call-interactively(org-export nil nil)


I don't want to exclude the possibility that this has to do with my particular 
setup.
If you cannot reproduce this problem, I'll have a look whether there's anything 
relevant in my config files.

Regards,
Daniel



Re: [O] Bug: Latex export fails when src block contains [X] [7.7]

2011-11-13 Thread Nicolas Goaziou
Hello,

Daniel Mescheder m...@danielmescheder.de writes:

 I'm running the following system:

 Emacs  : GNU Emacs 23.2.1 (i686-pc-linux-gnu, GTK+ Version 2.24.4)
  of 2011-04-04 on rothera, modified by Debian
 Package: Org-mode version 7.7

 I've run into a problem with #+begin_src #+end_src blocks:
 Whenever I trying to have a one-element python list inside of such a block 
 the pdf-export will fail with 

This should be fixed in recent development versions. You may upgrade or
wait for 7.8 release.


Regards,

-- 
Nicolas Goaziou



Re: [O] [bug] Org link dialog escapes URL spaces incorrectly

2011-11-13 Thread David Maus
First sorry for the late response, some pressing family matters kept
me busy last week.

At Sun, 06 Nov 2011 17:29:06 -0500,
Nick Dokos wrote:
 No, I mean the handling in org-insert-link itself:

 line 9048 says

   (setq link (org-extract-attributes
   (org-link-unescape (org-match-string-no-properties 1

This is step 4: Org reads a bracket link from the buffer and these
links are expected to be escaped (step 2). The unescape restores the
original link.

 but further down, on line 9114 the link is not unescaped:

   (setq link
 (let ((org-completion-use-ido nil)
   (org-completion-use-iswitchb nil))
   (org-completing-read
Link: 
(append
 (mapcar (lambda (x) (list (concat x :)))
 all-prefixes)
 (mapcar 'car org-stored-links))
nil nil nil
'tmphist
(car (car org-stored-links)
Here we read the user's input and provide completion for stored links
and registered link types. There's no need to unescape the link, we
assume that whatever the user enters here is the link in its normal
form.

In both cases the minibuffer contains a link in its normal form. In
the first case obtaining the normal form requires unescaping because
whatever the user enters in the minibuffer is escaped once before
written to buffer.

To make things a little bit clearer lets look into the specs
(RFC3986):

#+begin_quote
2.4.  When to Encode or Decode

   Under normal circumstances, the only time when octets within a URI
   are percent-encoded is during the process of producing the URI from
   its component parts.  This is when an implementation determines which
   of the reserved characters are to be used as subcomponent delimiters
   and which can be safely used as data.  Once produced, a URI is always
   in its percent-encoded form.
#+end_quote

In other words: Steps 2 and 4, escaping and unescaping when a link is
written to or read from the buffer has nothing to do with
percent-escaping of URIs. Org just happens to use the percent-escaping
algorithm to store a link in the buffer and encode special chars
(i.e. brackets).

After reading the specs I'm quite confident that dropping the
percent-escaping of HTTP links in `org-open-at-point' is the right
thing to do: If you paste a URI from the browser or enter it manually
Org does not *produce* the URI and therefor is not responsible for
proper escaping or unescaping.

I think we should remove the percent-escaping in `org-open-at-point'
after 7.8 was released and see if this works out without breaking to
many links.

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


pgpEF8T3yHqSi.pgp
Description: PGP signature


Re: [O] Bug: cdlatex-tab in math-env isn't considered when inside of a list item. [7.7 (release_7.7.513.g2a5877)]

2011-11-13 Thread Nicolas Goaziou
Maik Beckmann beckmann.m...@googlemail.com writes:

 I've slightly modified your patch to repair that. Could you test it and
 report back the result?

 From what i can tell it works flawlessly.

I've pushed a close patch into master (I had forgotten to take care of
headlines case).

Thank you for your work.


Regards,

-- 
Nicolas Goaziou



Re: [O] Bug: cdlatex-tab in math-env isn't considered when inside of a list item. [7.7 (release_7.7.513.g2a5877)]

2011-11-13 Thread Maik Beckmann
2011/11/13 Nicolas Goaziou n.goaz...@gmail.com:

 I've slightly modified your patch to repair that. Could you test it and
 report back the result?

 From what i can tell it works flawlessly.

I'm sorry, but I just caught a flaw.  I actually remember it being the reason
why I chose to test if the point is inside a latex fragment, which then broke
cdlatex' environment completion outside of fragments. If the point is at the
beginning of a headline cdlatex-tab advances to the next word rather than
leaving it alone.


[TAB]* foo bar bazz
Some test

* [CURSOR]foo bar bazz
Some test

* [TAB]foo bar bazz
Some test

* foo bar bazz...


Regards,
Maik



[O] Regression: Empty TODO lines

2011-11-13 Thread Carsten Dominik
Hi Nicolas,

commit dfcb6faef11a2439b56b18a6289803361d402130 (Provide more consistent 
regexps for headlines)
makes the global TODO list fail on headlines with a TODO keyword but no text 
following:

* TODO This one works
* TODO
  This one fails (note, there is not even a space after TODO.

While I agree that a TODO line with not text is not good, I think
it should not break the TODO list view.  I am attaching the backtrace.

Cheers

- Carsten


Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p nil)
  goto-char(nil)
  (if org-agenda-todo-list-sublevels (goto-char (match-end 2)) 
(org-end-of-subtree (quote invisible)))
  (catch :skip (save-match-data (beginning-of-line) (org-agenda-skip) (setq beg 
... end ...) (when ... ... ... ...)) (goto-char (match-beginning 2)) (setq 
marker (org-agenda-new-marker ...) category (org-get-category) org-category-pos 
(get-text-property ... ...) txt (match-string 2) tags (org-get-tags-at ...) txt 
(org-agenda-format-item  txt category tags) priority (1+ ...) todo-state 
(org-get-todo-state)) (org-add-props txt props (quote org-marker) marker (quote 
org-hd-marker) marker (quote priority) priority (quote org-category) category 
(quote org-category-position) org-category-pos (quote type) todo (quote 
todo-state) todo-state) (push txt ee) (if org-agenda-todo-list-sublevels 
(goto-char ...) (org-end-of-subtree ...)))
  (while (re-search-forward regexp nil t) (catch :skip (save-match-data ... ... 
... ...) (goto-char ...) (setq marker ... category ... org-category-pos ... txt 
... tags ... txt ... priority ... todo-state ...) (org-add-props txt props ... 
marker ... marker ... priority ... category ... org-category-pos ... todo ... 
todo-state) (push txt ee) (if org-agenda-todo-list-sublevels ... ...)))
  (let* ((props ...) (regexp ...) marker priority category org-category-pos 
tags todo-state ee txt beg end) (goto-char (point-min)) (while 
(re-search-forward regexp nil t) (catch :skip ... ... ... ... ... ...)) 
(nreverse ee))
  org-agenda-get-todos()
  (setq rtn (org-agenda-get-todos))
  (cond ((and ... ...) (setq rtn ...) (setq results ...)) ((eq arg :timestamp) 
(setq rtn ...) (setq results ...) (setq rtn ...) (setq results ...)) ((eq arg 
:sexp) (setq rtn ...) (setq results ...)) ((eq arg :scheduled) (setq rtn ...) 
(setq results ...)) ((eq arg :closed) (setq rtn ...) (setq results ...)) ((eq 
arg :deadline) (setq rtn ...) (setq deadline-results ...) (setq results ...)))
  (while (setq arg (pop args)) (cond (... ... ...) (... ... ... ... ...) (... 
... ...) (... ... ...) (... ... ...) (... ... ... ...)))
  (save-restriction (if org-agenda-restrict (narrow-to-region 
org-agenda-restrict-begin org-agenda-restrict-end) (widen)) (while (setq arg 
...) (cond ... ... ... ... ... ...)))
  (save-excursion (save-restriction (if org-agenda-restrict ... ...) (while ... 
...)))
  (let ((case-fold-search nil)) (save-excursion (save-restriction ... ...)))
  (save-current-buffer (set-buffer buffer) (unless (eq major-mode ...) (error 
Agenda file %s is not in `org-mode' file)) (let (...) (save-excursion ...)) 
results)
  (with-current-buffer buffer (unless (eq major-mode ...) (error Agenda file 
%s is not in `org-mode' file)) (let (...) (save-excursion ...)) results)
  (if (not buffer) (list (format ORG-AGENDA-ERROR: No such org-file %s file)) 
(with-current-buffer buffer (unless ... ...) (let ... ...) results))
  (let* ((org-startup-folded nil) (org-startup-align-all-tables nil) (buffer 
...) arg results rtn deadline-results) (if (not buffer) (list ...) 
(with-current-buffer buffer ... ... results)))
  org-agenda-get-day-entries(~/org/orgmode.org (11 13 2011) :todo)
  (setq rtn (org-agenda-get-day-entries file date :todo))
  (catch (quote nextfile) (org-check-agenda-file file) (setq rtn 
(org-agenda-get-day-entries file date :todo)) (setq rtnall (append rtnall rtn)))
  (while (setq file (pop files)) (catch (quote nextfile) (org-check-agenda-file 
file) (setq rtn ...) (setq rtnall ...)))
  (let* ((today ...) (date ...) (kwds org-todo-keywords-for-agenda) 
(completion-ignore-case t) (org-select-this-todo-keyword ...) rtn rtnall files 
file pos) (when (equal arg ...) (setq org-select-this-todo-keyword ...)) (and 
(equal 0 arg) (setq org-select-this-todo-keyword nil)) (org-set-local (quote 
org-last-arg) arg) (setq org-agenda-redo-command (quote ...)) (setq files 
(org-agenda-files nil ...) rtnall nil) (while (setq file ...) (catch ... ... 
... ...)) (if org-agenda-overriding-header (insert ... \n) (insert Global 
list of TODO items of type: ) (add-text-properties ... ... ...) 
(org-agenda-mark-header-line ...) (setq pos ...) (insert ... \n) 
(add-text-properties pos ... ...) (setq pos ...) (unless org-agenda-multi ... 
... ...) (add-text-properties pos ... ...)) (org-agenda-mark-header-line 
(point-min)) (when rtnall (insert ... \n)) (goto-char (point-min)) (or 
org-agenda-multi 

Re: [O] Bug: cdlatex-tab in math-env isn't considered when inside of a list item. [7.7 (release_7.7.513.g2a5877)]

2011-11-13 Thread Maik Beckmann
My bad,  I wrote:

 if the point is at the beginning of a headline cdlatex-tab advances to the 
 next word rather than leaving it alone.

because I evidently didn't read your email closely enough

2011/11/13 Nicolas Goaziou n.goaz...@gmail.com:
 ... (I had forgotten to take care of headlines case).


Sorry for the noise and thanks again.

Best,
Maik



Re: [O] Makefile restructuring

2011-11-13 Thread Achim Gratz
Achim Gratz strom...@nexgo.de writes:
 If byte-compile-directory is available in all versions of Emacs, then I
 could certainly use it in the Makefile.  Not sure if I can get to it
 before the weekend, but I will try it out soon-ish.

I've pushed a change to my Makefile fork that uses
batch-byte-recompile-directory, which in turn calls the equivalent of
what package manager uses.  As a bonus it now compiles much faster since
it only starts up Emacs once.

 I may be missing what the org-macs.el issue is, precisely.

There shouldn't be any differences between Makefiles and package
managers results now, aside from the fact that one of these runs in
batch-mode and the other not (I think).


Regards,
Achim.
-- 
+[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]+

Factory and User Sound Singles for Waldorf Q+, Q and microQ:
http://Synth.Stromeko.net/Downloads.html#WaldorfSounds




Re: [O] [bug] regression tests broken

2011-11-13 Thread Martyn Jago
Martyn Jago martyn.j...@btinternet.com writes:
Hi Eric 

[...]

Further to the problem of tests failing under sandboxed conditions
unexpectedly, I've made a few observations which I want to pass on.

* ID

Currently the ID searching command `org-id-find' has global scope to
find ID's all over the host system. Since developers frequently have  1
Orgs on their system, this can lead to confusion.

For instance, the test `ob-C/table' in in test-ob-C.el appears to
contain an orphan ID, which fails, but may well pass on the devs system,
since the ID probably exists somewhere (does this test also require to
be called test-ob-C/table)?.

Unfortunately `org-id-find' seems to be heavily dependent on org-mode.el
forms, and I suspect it would require a lot of time for me to attempt to
restrict it's scope to `the current Org system in use, so I will leave
it to someone with more experience.

Another by-product is that sandboxed test systems are not guaranteed to
pick up the _correct_ file containing the search ID (this plagued me
this-morning).

* `org-test-load' attempts to load symlinks (Emacs interlocking files).

Currently `org-test-load' will happily attempt to load an interlocking
symbolic link (such as .#test-ob-exp.el -
martyn@88-96-171-138.59787). This results in a failure to run any tests,
and is particularly annoying during test development. Below is a patch
that fixes this problem for me.

From 04dd7358295caef0d42a3fe93f4979ccd3b5c630 Mon Sep 17 00:00:00 2001
From: Martyn Jago martyn.j...@btinternet.com
Date: Sun, 13 Nov 2011 14:43:34 +
Subject: [PATCH] Avoid loading (and failing) symbolic links (interlocking files)
 * testing/org-test.el: During test development various interlocking
 files may be present in testing/lisp directory (since they are being
 edited by emacs). Currently org-test-load will attempt to load these
 and fail.

---
 testing/org-test.el |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/testing/org-test.el b/testing/org-test.el
index 57b7252..ea8cae4 100644
--- a/testing/org-test.el
+++ b/testing/org-test.el
@@ -274,9 +274,10 @@ otherwise place the point at the beginning of the inserted text.
 	  (mapc
 	   (lambda (path)
 		 (if (file-directory-p path)
-		   (rld path)
+		 (rld path)
 		   (catch 'missing-test-dependency
-		 (load-file path
+		 (when (string-match ^[A-Za-z].*\\.el$ path)
+		   load-file path
 	   (directory-files base 'full
 ^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*\\.el$
 (rld (expand-file-name lisp org-test-dir))
-- 
1.7.3.4


I'm still looking at a potential variable passing problem during html
export by inline calls, and will submit something as soon as I can.

Best, Martyn



Re: [O] [bug] regression tests broken

2011-11-13 Thread Martyn Jago
Hi Eric

Oops, the patch was broken - this one fixes the problem...

[...]

 Currently `org-test-load' will happily attempt to load an interlocking
 symbolic link (such as .#test-ob-exp.el -
 martyn@88-96-171-138.59787). This results in a failure to run any tests,
 and is particularly annoying during test development. Below is a patch
 that fixes this problem for me.


From b868e208dd3ece7c10818ed73f2cf0dc86dac94b Mon Sep 17 00:00:00 2001
From: Martyn Jago martyn.j...@btinternet.com
Date: Sun, 13 Nov 2011 16:03:51 +
Subject: [PATCH] Fix don't load symlinks (Emacs interlocking files)
 * testing/org-test.el: During test development various interlocking
  files may be present in testing/lisp directory (since they are being
  edited by emacs). Currently org-test-load will attempt to load these

---
 testing/org-test.el |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/testing/org-test.el b/testing/org-test.el
index ea8cae4..7d2f7e7 100644
--- a/testing/org-test.el
+++ b/testing/org-test.el
@@ -276,8 +276,9 @@ otherwise place the point at the beginning of the inserted text.
 		 (if (file-directory-p path)
 		 (rld path)
 		   (catch 'missing-test-dependency
-		 (when (string-match ^[A-Za-z].*\\.el$ path)
-		   load-file path
+		 (when (string-match ^[A-Za-z].*\\.el$
+	 (file-name-nondirectory path))
+		   (load-file path)
 	   (directory-files base 'full
 ^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*\\.el$
 (rld (expand-file-name lisp org-test-dir))
-- 
1.7.3.4


Best, Martyn

[...]



Re: [O] [bug] regression tests broken

2011-11-13 Thread Eric Schulte
Martyn Jago martyn.j...@btinternet.com writes:

 Hi Eric

 Eric Schulte schulte.e...@gmail.com writes:

 Hi Martyn,

 I have all tests passing in a branch in the Org-mode git repo (which I
 plan to merge into master soon).  Could you try a run of this on the
 standard-code-block-syntax branch?

 I've added the standard-code-block-syntax branch to my test server, and
 have configured notification so that you will be informed via email on
 failure. Unfortunately, the branch is currently failing, as are all
 other builds including my test-branch. I will try to take a look
 tomorrow on why three tests are failing.


I had to take special care that previous versions of Org-mode weren't
loaded when running tests on this branch.  The problem being that if
some defvar forms are defined by a previous instillation of Org-mode
their new values may not be overwritten with the latest versions in this
branch.

From looking at your test output it seems the only two tests which are
failing are the most recent two related to nested code blocks.  Again
these are passing on my system so I'm not sure what the cause could be.


 As a side note, how automated is your crusecontrol.rb setup?  Would you
 recommend this as a way to run automated tests on the Org-mode server
 after every git commit?

 It is completely autonomous, git-pulling, cleaning, building, building
 docs, and running tests within 10 minutes or so of a fresh commit to the
 Org repository. Builds are serialized.

 I would certainly recommend it as an easy way of setting up a test
 server, since everything you need is built-in, such as email
 notification (notifying the list is of course a possibility), RSS, and
 rapid backtrace investigation etc. 

 I have come across other gnu projects that use cruisecontrolrb.

 Your server would need Ruby installed (I use v1.9.2), but installation
 should be straight-forward since I have already written the scripts,
 which is fairly simple anyway.

 Hope that helps


This sounds like a very nice setup.  It would be great if you can work
with me and Jason to see if we can set this up on the Org-mode server.

Thanks -- Eric


 Best Martyn

 Thanks -- Eric

 Martyn Jago martyn.j...@btinternet.com writes:

 Hi 

 All automated regression tests broken since 7720786 commit

 http://martynjago.com:

 Best, Martyn





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



Re: [O] [bug] regression tests broken

2011-11-13 Thread Eric Schulte
Martyn Jago martyn.j...@btinternet.com writes:

 Martyn Jago martyn.j...@btinternet.com writes:
 Hi Eric 

 [...]

 Further to the problem of tests failing under sandboxed conditions
 unexpectedly, I've made a few observations which I want to pass on.

 * ID

 Currently the ID searching command `org-id-find' has global scope to
 find ID's all over the host system. Since developers frequently have  1
 Orgs on their system, this can lead to confusion.


Customizing the `org-id-locations-file' can be used to isolate ID lists
between different instances of Emacs.  Only the files in the
`org-id-files' list should be scanned for IDs, so it shouldn't be too
difficult to limit the scope of those files used in testing to only the
example files in the testing directory.


 For instance, the test `ob-C/table' in in test-ob-C.el appears to
 contain an orphan ID, which fails,

Confirmed, I don't have this ID located on my system either.  Perhaps
the author of this test file can help here.  Note that this test is
marked as expected to fail, so it should not affect the test suite as a
whole.

 but may well pass on the devs system, since the ID probably exists
 somewhere (does this test also require to be called test-ob-C/table)?.


No, the existing name is fine, see the ERT test match string in
`org-test-run-all-tests' to see which tests will be picked up by the
Org-mode test suite..


 Unfortunately `org-id-find' seems to be heavily dependent on org-mode.el
 forms, and I suspect it would require a lot of time for me to attempt to
 restrict it's scope to `the current Org system in use, so I will leave
 it to someone with more experience.

 Another by-product is that sandboxed test systems are not guaranteed to
 pick up the _correct_ file containing the search ID (this plagued me
 this-morning).


Given that all of these IDs are long hash tags I doubt there is any risk
of ID duplication unless there are multiple checkouts of Org-mode being
included in the files Org-mode scans for IDs.


 * `org-test-load' attempts to load symlinks (Emacs interlocking
files).

 Currently `org-test-load' will happily attempt to load an interlocking
 symbolic link (such as .#test-ob-exp.el -
 martyn@88-96-171-138.59787). This results in a failure to run any tests,
 and is particularly annoying during test development. Below is a patch
 that fixes this problem for me.


Great, I've just applied this patch.

Thanks -- Eric


 From 04dd7358295caef0d42a3fe93f4979ccd3b5c630 Mon Sep 17 00:00:00 2001
 From: Martyn Jago martyn.j...@btinternet.com
 Date: Sun, 13 Nov 2011 14:43:34 +
 Subject: [PATCH] Avoid loading (and failing) symbolic links (interlocking 
 files)
  * testing/org-test.el: During test development various interlocking
  files may be present in testing/lisp directory (since they are being
  edited by emacs). Currently org-test-load will attempt to load these
  and fail.

 ---
  testing/org-test.el |5 +++--
  1 files changed, 3 insertions(+), 2 deletions(-)

 diff --git a/testing/org-test.el b/testing/org-test.el
 index 57b7252..ea8cae4 100644
 --- a/testing/org-test.el
 +++ b/testing/org-test.el
 @@ -274,9 +274,10 @@ otherwise place the point at the beginning of the 
 inserted text.
 (mapc
  (lambda (path)
(if (file-directory-p path)
 -(rld path)
 +  (rld path)
  (catch 'missing-test-dependency
 -  (load-file path
 +  (when (string-match ^[A-Za-z].*\\.el$ path)
 +load-file path
  (directory-files base 'full
   ^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*\\.el$
  (rld (expand-file-name lisp org-test-dir))

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



Re: [O] [test] Mark tests with missing dependencies as expected to fail

2011-11-13 Thread David Maus
Hi Eric,

At Tue, 18 Oct 2011 10:22:34 -0600,
Eric Schulte wrote:
 Hi David,

 I agree it would be preferable to note that not all tests are run when
 dependencies are missing, although I don't think it is extremely
 important.  I think some version of the above would be worthwhile if it
 could be done in a file-wide manner (as are the current dependency
 checks) and wouldn't require duplicating the dependency check or
 changing every test form individually.  Perhaps a file-local-variable
 could be used to expect failures for every form defined in the file?

I tried the approach with a file-local variable but it didn't work
out: A macro can be expanded at any time, i.e. looks like there is no
way to obtain a reference to the buffer where the macro is defined at
expansion time.

But finally came up with this one:

#+begin_src emacs-lisp
(defmacro org-test-with-dependencies (dependencies rest body)
  Mark `ert-deftest' forms in BODY with a expected result
depending on DEPENDENCIES.  DEPENDENCIES is an alist with a
human-readable name of the dependency as key. The second element
of each member should be a form that evaluates to a non-nil value
if the dependency is met.

All `ert-deftest' forms in BODY are marked as expected to pass if
all dependencies are met. Otherwise the expected result is set to
`:failed' and the test's bodies modified to signal an error with
an error message indicating the first failing dependency.
  (macrolet ((define-dependencies ()
   `(cond
 ,@(mapcar (lambda (dependency)
 `((not ,(second dependency)) ,(first 
dependency))) dependencies
(let ((missing-dependency (define-dependencies)))
  `(progn
 ,@(mapcar (lambda (sexp)
 (if (and (consp sexp)
  (eq (first sexp) 'ert-deftest))
 (let* ((docstring (if (stringp (fourth sexp)) 
(list (fourth sexp
(deftest-body (nthcdr (if docstring 4 3) 
sexp)))
   `(,@(append (list (first sexp) (second sexp) 
(third sexp)) docstring)
 :expected-result ,@(if missing-dependency
`(:failed (error 
Missing dependency: %s ,missing-dependency))
  '(:passed))
 ,@deftest-body))
   sexp)) body)
#+end_src

You wrap it around ert-deftest forms, e.g.

#+begin_src emacs-lisp
(org-test-with-dependencies ((ESS (featurep 'ess)))
  (ert-deftest test-ob-R/simple-session ()
   (org-test-with-temp-text
   #+begin_src R :session R\n  paste(\Yep!\)\n#+end_src\n
 (should (string= Yep! (org-babel-execute-src-block))
#+end_src

#+begin_quote
ELISP (macroexpand '(org-test-with-dependencies ((ESS (featurep 'ess))) 
(ert-deftest foo () t)))
(progn
  (ert-deftest foo nil :expected-result :failed
   (error Missing dependency: %s ESS)
   t))

ELISP
#end_quote

If this is acceptable I'd push it and start to adjust the test
definitions.

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


pgpOluycBrzcq.pgp
Description: PGP signature


Re: [O] Getting rid of split frame with org-capture

2011-11-13 Thread Tom Prince
On Sat, 12 Nov 2011 23:13:11 -0500, Nick Dokos nicholas.do...@hp.com wrote:
 Not worth the bother IMO[fn:1], but if you wish to implement it and submit
 a patch, I'd be happy to review it.
 
 Nick
 
 Footnotes:
 
 [fn:1] Remember, capture is supposed to be as unobtrusive as possible:
you just want to squirrel away something for future
reference. Bells and whistles (which, IMO, this change would be)
are not the point: you want to get in, record the data and get
out and back to work as fast as possible. Popping up frames slows
things down but more importantly jolts you away from what you
were doing. At least, it would me (I think): that's why I don't
think it's worth it, but you may very well disagree.

It isn't worth *if* capture is invoked from emacs. If capture is invoked
from org-protocol in firefox, then there might not even be a emacs frame
visible.

1) If I don't pass -c to emacsclient, then I need to search all my
   workspaces to find where emacs decided to put the capture frame
2) If I pass do pass -c to emacsclient, then I need to close the frame
   afterwards. And more significantly, I need to close the empty frame
   when I use store-link instead. (I could work around this by using
   seperate protocols for for each)

 Tom



Re: [O] [bug] Org link dialog escapes URL spaces incorrectly

2011-11-13 Thread Nick Dokos
David Maus dm...@ictsoc.de wrote:

 First sorry for the late response, some pressing family matters kept
 me busy last week.
 
 At Sun, 06 Nov 2011 17:29:06 -0500,
 Nick Dokos wrote:
  No, I mean the handling in org-insert-link itself:
 
  line 9048 says
 
  (setq link (org-extract-attributes
  (org-link-unescape (org-match-string-no-properties 1
 
 This is step 4: Org reads a bracket link from the buffer and these
 links are expected to be escaped (step 2). The unescape restores the
 original link.
 
  but further down, on line 9114 the link is not unescaped:
 
  (setq link
(let ((org-completion-use-ido nil)
  (org-completion-use-iswitchb nil))
  (org-completing-read
   Link: 
   (append
(mapcar (lambda (x) (list (concat x :)))
all-prefixes)
(mapcar 'car org-stored-links))
   nil nil nil
   'tmphist
   (car (car org-stored-links)
 Here we read the user's input and provide completion for stored links
 and registered link types. There's no need to unescape the link, we
 assume that whatever the user enters here is the link in its normal
 form.
 
 In both cases the minibuffer contains a link in its normal form. In
 the first case obtaining the normal form requires unescaping because
 whatever the user enters in the minibuffer is escaped once before
 written to buffer.
 
 To make things a little bit clearer lets look into the specs
 (RFC3986):
 
 #+begin_quote
 2.4.  When to Encode or Decode
 
Under normal circumstances, the only time when octets within a URI
are percent-encoded is during the process of producing the URI from
its component parts.  This is when an implementation determines which
of the reserved characters are to be used as subcomponent delimiters
and which can be safely used as data.  Once produced, a URI is always
in its percent-encoded form.
 #+end_quote
 
 In other words: Steps 2 and 4, escaping and unescaping when a link is
 written to or read from the buffer has nothing to do with
 percent-escaping of URIs. Org just happens to use the percent-escaping
 algorithm to store a link in the buffer and encode special chars
 (i.e. brackets).
 

OK - thanks for the checking and the info.

 After reading the specs I'm quite confident that dropping the
 percent-escaping of HTTP links in `org-open-at-point' is the right
 thing to do: If you paste a URI from the browser or enter it manually
 Org does not *produce* the URI and therefor is not responsible for
 proper escaping or unescaping.
 
 I think we should remove the percent-escaping in `org-open-at-point'
 after 7.8 was released and see if this works out without breaking to
 many links.
 

Good enough for me. I don't remember whether you supplied a patch for this
(sorry, no time to check atm) but if you did, maybe the OP can test it and
make sure that it does what he expected (or maybe he's done that already -
I can't remember and I'm completely discombobulated right now, even more than
usual).

Thanks,
Nick



Re: [O] Getting rid of split frame with org-capture

2011-11-13 Thread Nick Dokos
Tom Prince tom.pri...@ualberta.net wrote:

 On Sat, 12 Nov 2011 23:13:11 -0500, Nick Dokos nicholas.do...@hp.com wrote:
  Not worth the bother IMO[fn:1], but if you wish to implement it and submit
  a patch, I'd be happy to review it.
  
  Nick
  
  Footnotes:
  
  [fn:1] Remember, capture is supposed to be as unobtrusive as possible:
 you just want to squirrel away something for future
 reference. Bells and whistles (which, IMO, this change would be)
 are not the point: you want to get in, record the data and get
 out and back to work as fast as possible. Popping up frames slows
 things down but more importantly jolts you away from what you
 were doing. At least, it would me (I think): that's why I don't
 think it's worth it, but you may very well disagree.
 
 It isn't worth *if* capture is invoked from emacs. If capture is invoked
 from org-protocol in firefox, then there might not even be a emacs frame
 visible.
 

OT rant

org-protocol is below my horizon :-) I had gotten it working a long time
ago, then something happened in ff and broke it, I fixed it, they broke
it again and at some point I gave up: every time I had to fix it, I had
to go back and relearn everything (it's not as if I live and breathe ff
arcana) and do a few hours' worth of research and then try a few dozen
times, tweaking this and that because all the instructions were either
outdated or inconsistent - if they are not respectful enough of the
thousands of people that used the feature that they broke and not
cognizant of the pain they produce, I will not use their damn
feature. Similar remarks apply to the improvements of Unity and Gnome
3: a plague a' both their houses. All I need the damn desktop to do is
open emacs when I click on the icon and give me enough workspaces for my
needs (which vary). I'd rather do cut-n-paste than waste another second
on org-protocol (mind you, it's not org-protocol's problem: it's the
other side that breaks - but without the other side, org-protocol is
almost useless).

Ah, I feel better now...

/OT rant

 1) If I don't pass -c to emacsclient, then I need to search all my
workspaces to find where emacs decided to put the capture frame
 2) If I pass do pass -c to emacsclient, then I need to close the frame
afterwards. And more significantly, I need to close the empty frame
when I use store-link instead. (I could work around this by using
seperate protocols for for each)
 

Sounds like a worthwhile thing to fix - patches would probably be welcome.

Nick




Re: [O] [bug] regression tests broken

2011-11-13 Thread Martyn Jago
Hi Eric

Eric Schulte schulte.e...@gmail.com writes:


[...]

 This sounds like a very nice setup.  It would be great if you can work
 with me and Jason to see if we can set this up on the Org-mode server.

No problem. If it is a Linux server, I can work on setting up a fresh
instance on Linux prior the actual deployment (currently on OSX).

Best, Martyn

 Thanks -- Eric


 Best Martyn

 Thanks -- Eric

 Martyn Jago martyn.j...@btinternet.com writes:

 Hi 

 All automated regression tests broken since 7720786 commit

 http://martynjago.com:

 Best, Martyn








Re: [O] Regression: Empty TODO lines

2011-11-13 Thread Mikhail Titov
On 11/13/2011 05:30 AM, Carsten Dominik wrote:
 Hi Nicolas,

 commit dfcb6faef11a2439b56b18a6289803361d402130 (Provide more consistent 
 regexps for headlines)
 makes the global TODO list fail on headlines with a TODO keyword but no text 
 following:

 * TODO This one works
 * TODO
   This one fails (note, there is not even a space after TODO.

 While I agree that a TODO line with not text is not good, I think
 it should not break the TODO list view.  I am attaching the backtrace.

I have a related question. How do I escape TODO? I mean if I want to
have a beamer frame named this way, how can I do that? Last time I ended
up writing

** ToDo

Mikhail



Re: [O] [test] Mark tests with missing dependencies as expected to fail

2011-11-13 Thread Eric Schulte
David Maus dm...@ictsoc.de writes:

 Hi Eric,

 At Tue, 18 Oct 2011 10:22:34 -0600,
 Eric Schulte wrote:
 Hi David,

 I agree it would be preferable to note that not all tests are run when
 dependencies are missing, although I don't think it is extremely
 important.  I think some version of the above would be worthwhile if it
 could be done in a file-wide manner (as are the current dependency
 checks) and wouldn't require duplicating the dependency check or
 changing every test form individually.  Perhaps a file-local-variable
 could be used to expect failures for every form defined in the file?

 I tried the approach with a file-local variable but it didn't work
 out: A macro can be expanded at any time, i.e. looks like there is no
 way to obtain a reference to the buffer where the macro is defined at
 expansion time.

 But finally came up with this one:


Nice macro,

The only downside I see is the requirement to wrap every single deftest
form which (to me) is too much overhead for too little payoff.  How
about the following which will register a failing test for each file of
tests not loaded due to missing dependencies.

Best -- Eric

From a84259bba32a69ae0b54dc577f1ba19b23625714 Mon Sep 17 00:00:00 2001
From: Eric Schulte schulte.e...@gmail.com
Date: Sun, 13 Nov 2011 12:30:25 -0700
Subject: [PATCH] Indicate tests with missing dependencies by adding a expected failing test

* testing/lisp/test-ob-R.el (featurep): Signal missing dependencies
  with an error rather than a throw.
* testing/org-test.el (missing-test-dependency): Define the error
  signal for missing dependencies.
  (org-test-for-executable): Signal missing dependencies with an error
  rather than a throw.
  (org-test-load): Define an expected failing test for each file with
  missing dependencies.
---
 testing/lisp/test-ob-R.el |2 +-
 testing/org-test.el   |   19 +++
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/testing/lisp/test-ob-R.el b/testing/lisp/test-ob-R.el
index bc637ff..bb9783f 100644
--- a/testing/lisp/test-ob-R.el
+++ b/testing/lisp/test-ob-R.el
@@ -8,7 +8,7 @@
 
 (org-test-for-executable R)
 (unless (featurep 'ess)
-  (throw 'missing-test-dependency ESS))
+  (signal 'missing-test-dependency ESS))
 
 (let ((load-path (cons (expand-file-name
 			.. (file-name-directory
diff --git a/testing/org-test.el b/testing/org-test.el
index 7d2f7e7..0f9cf1a 100644
--- a/testing/org-test.el
+++ b/testing/org-test.el
@@ -102,6 +102,10 @@ org-test searches this directory up the directory tree.)
 
 
 ;;; Functions for writing tests
+(put 'missing-test-dependency
+ 'error-conditions
+ '(error missing-test-dependency))
+
 (defun org-test-for-executable (exe)
   Throw an error if EXE is not available.
 This can be used at the top of code-block-language specific test
@@ -111,7 +115,7 @@ executable.
 	   (lambda (acc dir)
 	 (or acc (file-exists-p (expand-file-name exe dir
 	   exec-path :initial-value nil)
-(throw 'missing-test-dependency exe)))
+(signal 'missing-test-dependency (list exe
 
 (defun org-test-buffer (optional file)
   TODO:  Setup and return a buffer to work with.
@@ -275,10 +279,17 @@ otherwise place the point at the beginning of the inserted text.
 	   (lambda (path)
 		 (if (file-directory-p path)
 		 (rld path)
-		   (catch 'missing-test-dependency
-		 (when (string-match ^[A-Za-z].*\\.el$
+		   (condition-case err
+		   (when (string-match ^[A-Za-z].*\\.el$
 	 (file-name-nondirectory path))
-		   (load-file path)
+			 (load-file path))
+		 (missing-test-dependency
+		  (let ((name (intern
+   (concat org-missing-dependency/
+	   (file-name-nondirectory
+	(file-name-sans-extension path))
+			(eval `(ert-deftest ,name ()
+ :expected-result :failed (should nil
 	   (directory-files base 'full
 ^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*\\.el$
 (rld (expand-file-name lisp org-test-dir))
-- 
1.7.4.1



 #+begin_src emacs-lisp
 (defmacro org-test-with-dependencies (dependencies rest body)
   Mark `ert-deftest' forms in BODY with a expected result
 depending on DEPENDENCIES.  DEPENDENCIES is an alist with a
 human-readable name of the dependency as key. The second element
 of each member should be a form that evaluates to a non-nil value
 if the dependency is met.

 All `ert-deftest' forms in BODY are marked as expected to pass if
 all dependencies are met. Otherwise the expected result is set to
 `:failed' and the test's bodies modified to signal an error with
 an error message indicating the first failing dependency.
   (macrolet ((define-dependencies ()
`(cond
  ,@(mapcar (lambda (dependency)
  `((not ,(second dependency)) ,(first 
 dependency))) dependencies
 (let ((missing-dependency (define-dependencies)))
   `(progn
  ,@(mapcar (lambda 

Re: [O] Getting rid of split frame with org-capture

2011-11-13 Thread Nick Dokos
Thomas Lockney tho...@lockney.net wrote:

 I'm attempting to get some code working that should create a new frame
 with *just* org-capture, but when I run it, I keep getting a split
 despite various attempts at running delete-other-windows. I'm running
 on GNU Emacs 24.0.90.1 (i386-apple-darwin10.8.0, NS
 apple-appkit-1038.36) so perhaps this is a 24 specific issue. Here's
 the code I've currently got:
 
 (defadvice org-capture-finalize (after delete-capture-frame activate)
   Advise capture-finalize to close the frame if it is the capture frame
   (if (equal capture (frame-parameter nil 'name))
   (delete-frame)))
 
 (defadvice org-capture-destroy (after delete-capture-frame activate)
   Advise capture-destroy to close the frame if it is the capture frame
   (if (equal capture (frame-parameter nil 'name))
   (delete-frame)))
 
 (defun make-capture-frame ()
   Create a new frame and run org-capture.
   (interactive)
   (make-frame '((name . Capture)
 (width . 100)
 (height . 15)))
   (select-frame-by-name Capture)
   (delete-other-windows)
   (org-capture))
 
 I've also tried this using the org-capture-mode-hook to call
 delete-other-windows and I've tried placing delete-other-windows after
 the call to org-capture (both of those based on solutions I've seen
 posted to this list at various times). Anyone have any clues on this?
 I'm stumped, but I'm also fairly inexperienced at programming emacs.
 

As I pointed out in my reply to Gregor, org-capture will split the frame,
no matter whether you have a new one or not: you need to modify its innards
to change that behavior.

Aside from that, there is a problem here: you name the frame
Capture, yet you test (equal capture ...) - I presume that's a typo?

Nick



[O] slow agenda view and scrolling through headlines

2011-11-13 Thread Susan Addy
I am an avid user of org mode for all of my notes (usually kept under
headlines with dates) and TODOs. I now have 5 agenda files with a total of
about 25,000 lines, about 25% of which are headlines.

Sometimes, when I run agenda, it is very slow to compile - about 10-15
seconds. During these times, it is also slow to scroll through the high
level headings (about 5-6 seconds each to get to the next heading).
However, others times, the same commands are much faster - 2 seconds to
compile the agenda and an immediate response when scrolling. I can't find a
pattern to when it is slow versus fast. It is usually fast the first time I
open emacs, even if I just restarted the computer and opened emacs. It
doesn't seem to matter what else is running on the computer. Sometimes it
stays fast for several hours, and then all of sudden will be slow - even if
nothing has been added to the file in the meantime.

I've considered some major changes to try and fix this, like converting all
of my headlines that don't have todo items (i.e. notes that start with a
date) to a list instead of a headline. I've also considered trying to use
the logbook for notes instead of headlines. However, if it is just having
trouble scanning through so many headlines, I don't understand why it can
compile the agenda fast some times and not others. I also don't know if
scroll would be any faster, because the same number of lines would still be
there.  If scroll was always slow at first and then fast later, that might
make sense too (maybe it is remembering some of the structure after the
first scroll?).

Below is a list of my agenda command - maybe it is too long? When it is
slow, it is slow no matter what TODO I am trying to compile.

Any thoughts?
Thank you!

(setq org-agenda-custom-commands
  '((d Daily Action List (work)
 ((agenda  ((org-agenda-ndays 5)
  (org-deadline-warning-days 0)
  (org-agenda-repeating-timestamp-show-all t)
  (org-agenda-skip-scheduled-if-done nil)
(n NextActions List (work)
 ((agenda  ((org-agenda-ndays 1)
  (org-use-tag-inheritance nil)
  (org-agenda-repeating-timestamp-show-all t)))
  (tags-todo work+TODO=\NEXTACTION\
 ((org-agenda-skip-function
  '(org-agenda-skip-entry-if 'scheduled))
(p Active Projects List (work)
 ((tags-todo work/PRJ
 ((org-agenda-skip-function '(org-agenda-skip-entry-if
  'scheduled))
  
(o Ongoing Projects List (work)
 ((tags-todo work/ONGOING
 ((org-agenda-skip-function '(org-agenda-skip-entry-if
  'scheduled))  
(w Waiting For List (work)
 ((tags-todo work/WAITING)))
(s Someday/Maybe List (work)
 ((tags-todo work/SOMEDAY )))
(y Delegated Projects (work)
 ((tags-todo work/YOUDO)))
(H How To List
 ((tags HowTo)))
(g Things to google
 ((tags google)))
 (a agendas (work)
 ((tags-todo work/AGENDA
 ((org-agenda-skip-function '(org-agenda-skip-entry-if
  'scheduled))
  
(N NextActions List (home)
 ((agenda  ((org-agenda-ndays 1)
  (org-agenda-repeating-timestamp-show-all t)))
  (tags-todo
   home+TODO=\NEXTACTION\
   ((org-agenda-skip-function '(org-agenda-skip-entry-if
'scheduled))  
 (P Active Projects List (home)
 ((tags-todo home/PRJ
 ((org-agenda-skip-function '(org-agenda-skip-entry-if
  'scheduled))
  
(O Ongoing Projects List (home)
 ((tags-todo home/ONGOING
 ((org-agenda-skip-function '(org-agenda-skip-entry-if
  'scheduled))  
 (W Waiting For List (home)
 ((tags-todo home/WAITING)))
 (S Someday/Maybe List (home)
 ((tags-todo home/SOMEDAY )))
 (Y Delegated Projects (home)
 ((tags-todo home/YOUDO)))
 (A agendas (home)
 ((tags-todo home/AGENDA
 ((org-agenda-skip-function '(org-agenda-skip-entry-if
  'scheduled))
  
))


Re: [O] slow agenda view and scrolling through headlines

2011-11-13 Thread Bernt Hansen
Susan Addy susan.e.a...@gmail.com writes:

 Below is a list of my agenda command - maybe it is too long? When it
 is slow, it is slow no matter what TODO I am trying to compile.

 Any thoughts? 
 Thank you!

If you have linum-mode enabled you should turn that off.  Others have
reported slow navigation when that is enabled.

HTH,
Bernt



Re: [O] slow agenda view and scrolling through headlines

2011-11-13 Thread Susan Addy
Thanks Bernt. I checked and Linum-mode is not enabled.

Also, I using emacs 22.3.1 and org-mode 7.7 (if it helps).


On Sun, Nov 13, 2011 at 2:16 PM, Bernt Hansen be...@norang.ca wrote:

 Susan Addy susan.e.a...@gmail.com writes:

  Below is a list of my agenda command - maybe it is too long? When it
  is slow, it is slow no matter what TODO I am trying to compile.
 
  Any thoughts?
  Thank you!

 If you have linum-mode enabled you should turn that off.  Others have
 reported slow navigation when that is enabled.

 HTH,
 Bernt



Re: [O] zotero plain, org-odt, and citations in general

2011-11-13 Thread Christian Moe

* Towards a solution for Zotero - Org - ODT


I think I have a way to get Zotero references from Org links into ODT 
as working reference marks. Interested parties, please

test if this works for you at all.

1. Create Zotero links such as e.g.:

   : [[zotero:0_RADJMJ8Q][{Bolin, 1958}]]

   Below, I include code for a simple Zotero export translator
   (OrgMode.js) that will create such links at a keystroke/mouse drag,
   since some of us are currently experiencing difficulties with
   zotero-plain.

2. Define a custom link export function to fake a Zotero field code
   for ODT. Code below.

3. Export to ODT and do the things you normally do with Zotero, like
   generating a bibliography. (Note that Zotero won't let you insert a
   bibliography until you've inserted at least one Zotero reference
   from within LibreOffice. You can always delete it afterwards.)

If this works for you, the code (which is a quickly thrown-together 
mess) can probably be improved on.


Yours,
Christian Moe

** OrgMode.js translator

Installation:

1. Tangle or copy the below to a file called OrgMode.js.
2. Place it in the Zotero translators folder (on Mac, that's

   ~/Library/Application 
Support/Firefox/Profiles/[PROFILENAME]/zotero/translators/


3. Restart Firefox.
4. Open Zotero  Actions (the cogwheel icon)  Preferences. From the
   drop-down menu, select Org-mode as the Quick Copy default format.

Use: you can

- drag and drop references from the Zotero panel to the Emacs buffer,
  or
- Quick Copy to clipboard with Shift-Cmd-C (Mac) and yank in the
  Emacs buffer

#+name: OrgMode.js
#+begin_src javascript
{
translatorID: b0006c6f-b743-4508-beaf-490bbd68a403,
label: Org-mode,
creator: Christian Moe,
target: org,
minVersion: 2.1.9,
maxVersion: ,
priority: 200,
displayOptions: {
exportCharset: UTF-8,
exportNotes: true,
exportFileData: false
},
inRepository: false,
translatorType: 2,
browserSupport: gcs,
lastUpdated: 2011-11-12 17:05:00
}

// Loosely based on Scott Campbell's ZotSelect.js
// posted at 
http://forums.zotero.org/discussion/8306/testing-zoteroselect/


function doExport() {
// Zotero.write(zotero://select//);
// Zotero.write(\n);

var item;
var notfirst = false;
while(item = Zotero.nextItem()) {

// Separate multiple links
if (notfirst) {
Zotero.write(; )
}

// Org link path
Zotero.write([[zotero:);
var library_id = item.LibraryID ? item.LibraryID : 0;
Zotero.write(library_id+_+item.key);

// Org link descr
Zotero.write(][{);
// create a unique citation key
//var descr = buildCiteKey(item, citekeys);

// write citation key
//Zotero.write(/+citekey);

// Authorname
if(item.creators  item.creators[0]  item.creators[0].lastName) {
Zotero.write(item.creators[0].lastName);
} else {
Zotero.write(n.a.)
}
// Separator
Zotero.write(, )
// Year
var numberRe = /^[0-9]+/;
if(item.date) {
var date = Zotero.Utilities.strToDate(item.date);
if(date.year  numberRe.test(date.year)) {
Zotero.write(date.year);
}
} else {
Zotero.write(n.d.);
}

// Close Org link
Zotero.write(}]])

notfirst = true;
}
}
#+end_src

** Zotero link type

Evaluate the following (or place it in your .emacs for repeated use).

Note that clicking the links does not work on Mac and probably won't 
work on Linux/Windows, either (but please let me know if it does!). 
Consider org-zotero-open a placeholder for now.


#+begin_src elisp
  (org-add-link-type zotero
 'org-zotero-open
 'org-zotero-export)

  (defun org-zotero-open (path)
(browse-url (format zotero://select//%s path)))

  (defun org-zotero-export (path desc format)
(cond
 ((eq format 'odt)
  (let
  ((refmark text:reference-mark-start 
text:name=\%s\/%stext:reference-mark-end text:name=\%s\/)
   (zitem ZOTERO_ITEM 
{quot;citationIDquot;:quot;%squot;,quot;citationItemsquot;:[{quot;uriquot;:[quot;http://zotero.org/users/local/%s/items/%squot;]}]} 
%s)
   (citation-id (substring (org-id-new) -10)) ; Is this a 
good way to make a unique ID?

   (library-id (car (split-string path _)))
   (item-key (car (cdr (split-string path _
   (rnd (concat RND (substring (org-id-new) -10
(setq zitem
  (format zitem
  citation-id
  library-id
  item-key
  rnd))
(setq desc (format (%s) desc))
(format refmark zitem desc zitem)))
 (t desc)))
#+end_src




Re: [O] slow agenda view and scrolling through headlines

2011-11-13 Thread Nick Dokos
Susan Addy susan.e.a...@gmail.com wrote:

 Thanks Bernt. I checked and Linum-mode is not enabled. 
   
 Also, I using emacs 22.3.1 and org-mode 7.7 (if it helps). 
  
 
 On Sun, Nov 13, 2011 at 2:16 PM, Bernt Hansen be...@norang.ca wrote:
 
 Susan Addy susan.e.a...@gmail.com writes:

  Below is a list of my agenda command - maybe it is too long? When it
  is slow, it is slow no matter what TODO I am trying to compile.
 
  Any thoughts? 
  Thank you!

 If you have linum-mode enabled you should turn that off.  Others have
 reported slow navigation when that is enabled.

 HTH,
 Bernt
 
 

There have been various discussions on agenda slowness in the past -
check the mailing list for some guesses (linum-mode, font-lock, property
inheritance, code compilation and perhaps others have been suggested as
possible causes). Sometimes the guesses pan out, sometimes not.

The most important thing you can do, imo, is to profile the code, first
when it's behaving well and then when it's behaving badly.

All you have to do is

M-x elp-instrument-package RET org RET

run your agenda command and then

M-x elp-results RET

to get the results. 

Nick



Re: [O] slow agenda view and scrolling through headlines

2011-11-13 Thread Samuel Wales
Does it slow down depending on the number of times you run agenda?



Re: [O] slow agenda view and scrolling through headlines

2011-11-13 Thread Susan Addy
Hi Nick,
I have looked through the archives and tried what I found, including
the linum-mode and property-inheritance, which didn't affect the problem. I
also tried to change to the latest version of org mode and (I think) emacs,
which didn't help. I don't recall seeing the font-lock problem, though I
may have tried it earlier. I'll look for that one again. Most of the
archive questions had a slow agenda all the time, and not only sometimes.

   I tried your commands below (thank you!) and have some interesting
results, but I don't know enough to interpret them. If I am interpreting
right, org-scan-tags  sometimes takes much longer, but I have no idea why
it would be fast sometimes and slow others.

Here are the top 10 listings when operation is fast (about 3 seconds)

Function Name Call Count
Elapsed Time  Average Time

  ==

org-agenda1
1.943013  1.943013

org-agenda-run-series 1
1.590022  1.590022

org-let2  2
1.161017  0.580508

org-tags-view 1
0.826727  0.826727

org-scan-tags 5
0.760431  0.1520862

org-let   2
0.426281  0.2131405

org-agenda-get-restriction-and-command1
0.35290.3529

org-agenda-list   1
0.334261  0.334261

org-prepare-agenda-buffers2
0.326487  0.163243

org-prepare-agenda3
0.311333  0.103777

org-get-entries-from-diary1
0.266385  0.26638


When agenda is slow:

Function Name Call
Count  Elapsed Time  Average Time

  ==

org-agenda1
12.133429 12.133429

org-agenda-run-series 1
11.768025 11.768025

org-let2  2
10.856247999  5.428123

org-tags-view 1
10.427989 10.427989

org-scan-tags 5
10.402578000  2.0805156000

org-let   2
0.908944  0.454472

org-finalize-agenda   3
0.817623  0.272541

org-agenda-get-day-entries10
0.684588  0.0684588999

org-agenda-get-scheduled  10
0.444710  0.0444711

org-agenda-list   1
0.428234  0.428234

On Sun, Nov 13, 2011 at 2:58 PM, Nick Dokos nicholas.do...@hp.com wrote:

 Susan Addy susan.e.a...@gmail.com wrote:

  Thanks Bernt. I checked and Linum-mode is not enabled.
 
  Also, I using emacs 22.3.1 and org-mode 7.7 (if it helps).
 
 
  On Sun, Nov 13, 2011 at 2:16 PM, Bernt Hansen be...@norang.ca wrote:
 
  Susan Addy susan.e.a...@gmail.com writes:
 
   Below is a list of my agenda command - maybe it is too long? When
 it
   is slow, it is slow no matter what TODO I am trying to compile.
  
   Any thoughts?
   Thank you!
 
  If you have linum-mode enabled you should turn that off.  Others have
  reported slow navigation when that is enabled.
 
  HTH,
  Bernt
 
 

 There have been various discussions on agenda slowness in the past -
 check the mailing list for some guesses (linum-mode, font-lock, property
 inheritance, code compilation and perhaps others have been suggested as
 possible causes). Sometimes the guesses pan out, sometimes not.

 The most important thing you can do, imo, is to profile the code, first
 when it's behaving well and then when it's behaving badly.

 All you have to do is

M-x elp-instrument-package RET org RET

 run your agenda command and then

M-x elp-results RET

 to get the results.

 Nick



Re: [O] slow agenda view and scrolling through headlines

2011-11-13 Thread Susan Addy
I don't think so. I just restarted emacs and compiled the agenda about 15
times in a row and it was fast. But - if I leave it to do something else
for a while, often the next time I compile agenda it is slow, even if I
haven't changed the org mode agenda files in the meantime.

  Thanks again.

On Sun, Nov 13, 2011 at 5:49 PM, Samuel Wales samolog...@gmail.com wrote:

 Does it slow down depending on the number of times you run agenda?



Re: [O] slow agenda view and scrolling through headlines

2011-11-13 Thread Susan Addy
Ok - I tried adding (setq font-lock-verbose nil), but there was no change.
It is still fast when I open emacs, and then some time later (after I
switch to another program for some time and back) it is slow. Sometimes it
will become fast again, and sometimes I recall (I think) it has been slow
right when I open it.

Also, to clarify, the slow scrolling through headlines is in normal view,
not agenda view. It tends to be correlated with the agenda being slow.

   Thanks,
  Susan

On Sun, Nov 13, 2011 at 2:58 PM, Nick Dokos nicholas.do...@hp.com wrote:

 Susan Addy susan.e.a...@gmail.com wrote:

  Thanks Bernt. I checked and Linum-mode is not enabled.
 
  Also, I using emacs 22.3.1 and org-mode 7.7 (if it helps).
 
 
  On Sun, Nov 13, 2011 at 2:16 PM, Bernt Hansen be...@norang.ca wrote:
 
  Susan Addy susan.e.a...@gmail.com writes:
 
   Below is a list of my agenda command - maybe it is too long? When
 it
   is slow, it is slow no matter what TODO I am trying to compile.
  
   Any thoughts?
   Thank you!
 
  If you have linum-mode enabled you should turn that off.  Others have
  reported slow navigation when that is enabled.
 
  HTH,
  Bernt
 
 

 There have been various discussions on agenda slowness in the past -
 check the mailing list for some guesses (linum-mode, font-lock, property
 inheritance, code compilation and perhaps others have been suggested as
 possible causes). Sometimes the guesses pan out, sometimes not.

 The most important thing you can do, imo, is to profile the code, first
 when it's behaving well and then when it's behaving badly.

 All you have to do is

M-x elp-instrument-package RET org RET

 run your agenda command and then

M-x elp-results RET

 to get the results.

 Nick



Re: [O] slow agenda view and scrolling through headlines

2011-11-13 Thread Nick Dokos
Susan Addy susan.e.a...@gmail.com wrote:

 Ok - I tried adding (setq font-lock-verbose nil), but there was no
 change. It is still fast when I open emacs, and then some time later
 (after I switch to another program for some time and back) it is
 slow. Sometimes it will become fast again, and sometimes I recall (I
 think) it has been slow right when I open it. 
 
 Also, to clarify, the slow scrolling through headlines is in normal
 view, not agenda view. It tends to be correlated with the agenda being
 slow. 
 

Could it be that emacs is swapped out after you leave it for a while and
it takes a long time to get swapped back in? But if so, it would get
faster soon thereafter. Does the machine swap at all?

OS and version? org version? emacs version? do you share the machine or are you 
the
only user on it? how much memory? CPUs?

Nick



Re: [O] Regression: Empty TODO lines

2011-11-13 Thread Carsten Dominik

On Nov 14, 2011, at 12:46 AM, Nicolas Goaziou wrote:

 Hello,
 
 Carsten Dominik carsten.domi...@gmail.com writes:
 
 commit dfcb6faef11a2439b56b18a6289803361d402130 (Provide more consistent 
 regexps for headlines)
 makes the global TODO list fail on headlines with a TODO keyword but no text 
 following:
 
 * TODO This one works
 * TODO
  This one fails (note, there is not even a space after TODO.
 
 While I agree that a TODO line with not text is not good, I think
 it should not break the TODO list view.  I am attaching the backtrace.
 
 It should now be fixed in master. Thanks.

Hi Nicolas,

I think you meant to call org-trim on the results of buffer-substring.
I just pushed a fix for this - please double-check that this is what you meant.

Regards

- Carsten