Bug: ODT export of Chinese text inserts spaces for line breaks

2021-06-28 Thread James Harkins
Consider the following org document.

* Test
1本人不想亲自拿到学历学位证书、急于离校者,可书面委托他人代领学历学位证
书,29日起即可离校;2本人想亲自领取学历学位证书者,按学校规定的程序及有关
要求办理离校手续,领取相关证书后离校;

This was produced by pasting in a single, long line, and then using alt-Q (a 
normal thing to do, and good for readability, because org-mode doesn't wrap 
lines by default).

Exporting to ODT produces the following (body text, omitting titles, headers 
and such).

1本人不想亲自拿到学历学位证书、急于离校者,可书面委托他人代领学历学位证 书,29日起即可离校;2本人想亲自领取学历学位证书者,按学校规定的程序及有关 
要求办理离校手续,领取相关证书后离校;

Between 证 and 书, and between 关 and 要, there is a space. Chinese typography does 
not allow for spaces mid-sentence.

So, it would make sense to add a rule to the exporter: if one of the characters 
before or after a source-text line break is a Chinese, Japanese or Korean 
character, do not add a space. (The space is valid, of course, if the 
characters on either side of the line breaks are Roman or [I would guess] 
Cyrillic as well.)

(Side note: Exporting to a LaTeX buffer shows that the line breaks have been 
copied into the .tex document as is -- but, provided that you have a 
`usepackage{xeCJK}` in the preamble, LaTeX produces correct, space-free output. 
So -- Org "gets away with it" because of LaTeX's handling of CJK text. It seems 
for ODT, Org needs to handle the spacing within its own logic.)

This is org 9.1.9... bit old, I know, but I'm gonna take a wild guess that this 
has not been a high-visibility issue.

hjh



Re: Org agenda to Android calendar without Google Calendar in the middle

2021-03-08 Thread James Harkins
Peter Hardy:
> An alternative Android app that you might like to look at is Orgzly

Hm, I think I'll start here. Good tip, thanks!
hjh



Re: [O] Equivalent of timeline?

2019-06-29 Thread James Harkins

On June 29, 2019 06:45:51 Samuel Wales  wrote:


i was going to code the following, and documented it first,
but cannot code it.  maybe it
will be of smoe use in thinking about the problem.


Sure, those are good tips. Much appreciated! I don't mind taking it from 
there (though I probably can't do it quickly). I think my need in this case 
is simpler than yours -- I won't have multiple timestamps per outline node.



i think timeline (L) was retired from org because it
code-rotted as org developed new features, and it only
supported one file, which goes against org's sylvan (forest)
philosophy.


Sure -- features get dropped for legitimate reasons, but that always causes 
some user pain, too. Might have been nice to document an alternative rather 
than just making it a lot harder. (I don't really care if it's specifically 
"timeline" or something else, but I also don't think it should require a 
dive into the API to do something that had been easy.)


hjh

Sent with AquaMail for Android
https://www.mobisystems.com/aqua-mail







[O] Equivalent of timeline?

2019-06-28 Thread James Harkins
I recently had to make a document listing my professional activities (lectures 
and performances). Items are dated.

I would like to see an overview of them, sorted by date.

In the past I would have used a Timeline agenda for this, but that's no longer 
possible.

https://www.reddit.com/r/orgmode/comments/7hps9j/rip_orgtimeline/ provides a 
custom agenda command that is supposed(?) to mimic the old timeline, but it 
didn't.

So how does one do it?

hjh




Re: [O] ODT export --> opening in Okular?

2018-12-11 Thread James Harkins
 On Tue, 11 Dec 2018 01:00:15 +0800  wrote 
 
> Check your ~/.mailcap and/or /etc/mailcap file as well: there are indeed 
> many twisty passages through org-open-file, so you may end up calling 
> whatever the system has set up (correctly or not). 
> Nick 

Aha, that was the answer. Apparently installing Okular adds this bit of 
silliness into /etc/mailcap:

application/vnd.oasis.opendocument.text; okular %s --icon okular -caption 
Okular; test=test -n "$DISPLAY"

... which I find now has also been reported to Debian as a bug:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=857443

I still think it's insane, but at least now it's clear where the insanity lies: 
with Okular's inflated sense of self-importance :D

But, what I still don't understand is, after adding an ODT entry to 
org-file-apps, why did org revert to querying mailcap...?

Value: ((auto-mode . emacs)
 ("\\.mm\\'" . default)
 ("\\.x?html?\\'" . "/usr/bin/firefox %s")
 ("\\.odt\\'" . "/usr/bin/libreoffice6.0 %s")
 ("\\.pdf\\'" . "/usr/bin/okular %s"))

Original value was 
((auto-mode . emacs)
 ("\\.mm\\'" . default)
 ("\\.x?html?\\'" . default)
 ("\\.pdf\\'" . default))

... this has exactly zero effect. Org ignores the odt line here, where I would 
expect an org-specific preference setting to override the system default.

hjh




Re: [O] ODT export --> opening in Okular?

2018-12-09 Thread James Harkins
 On Mon, 10 Dec 2018 07:25:13 +0800 briangpowell  
wrote  
> * Suggest you try changing this:
> 
>  ("\\.odt\\'" . "libreoffice6.0 %s"
> * To this instead:
> 
>  ("\\.odt\\'" . "libreoffice %s"
> --since "libreoffice6.0" is a specific link that is subject to change--not 
> only by you but by your chosen operating system package manager

Nope.

$ libreoffice --help
The program 'libreoffice' is currently not installed.

(I installed libreoffice by downloading from their website, not using Ubuntu 
packages -- because I had some issues with it a while back and the advice from 
their user community is always, don't use system-bundled packages because they 
are out of date.)

In any case, it doesn't make a difference: org still insists on issuing the 
command for okular.

I also tried the full path to the binary /usr/bin/libreoffice6.0 -- still 
exports to Okular.

As a final test, I deleted both the PDF and ODT entries from org-file-apps -- 
so that there is absolutely no reference in any org code file or variable to 
okular -- and it is *still* opening the exported ODT in okular! Which strikes 
me as insane.

org-open-file seems to be a rather complex function. I can't make heads or 
tails of it. If I had to guess, I would suppose that it has some fallback 
position that doesn't depend on org configuration variables.

Anyway, the solution for now, as I'm under some time pressure, is to declare 
that ODT export is broken on my system until I can scrape together some time to 
upgrade org. PDF export is actually OK for now (and working fine).

hjh




[O] ODT export --> opening in Okular?

2018-12-09 Thread James Harkins
Hi,

I realize I'm running an older version of org-mode (8.3.3), but things are 
working for me generally and I'm not in a position to monkey around with my 
environment right now.

Anyway, something strange. A few months ago, I was able to export to ODT and 
the file would open in LibreOffice. But, just now, emacs insists on issuing a 
command to open it in okular.

Creating ODT file...
Running zip -mX0 project-notes.odt mimetype
Running zip -rmTq project-notes.odt .
Created /blah/blah/project-notes.odt
Parsing archive file...done.
Running okular /blah/blah/project-notes.odt --icon okular -caption Okular...done

Okular? That makes no sense at all.

I tried adding an entry to org-file-apps to force it to use libreoffice6.0 to 
open ODT files, but this is having no effect.

 '(org-file-apps
   (quote
((auto-mode . emacs)
 ("\\.mm\\'" . default)
 ("\\.x?html?\\'" . "/usr/bin/firefox %s")
 ("\\.pdf\\'" . "/usr/bin/okular %s")
 ("\\.odt\\'" . "libreoffice6.0 %s"

I can find no hard coded reference to Okular anywhere in the org source code.

This is quite mysterious to me. If it's using a particular app to open this 
type of file, I should be able to find some settings or some instruction 
somewhere. But I can't.

How to fix this?

hjh




Re: [O] Incorrect references to LaTeX Listings

2018-01-10 Thread James Harkins
 On Tue, 09 Jan 2018 20:35:37 +0800 Eric S Fraga  wrote 
 
> Check org-latex-prefer-user-labels. 

OK, this works for me, thanks.

FWIW, org-latex-prefer-user-labels eluded me in the documentation. Now that you 
pointed me to it, I see the reason for the change, but I wouldn't have guessed 
it on my own.

I'll update org when I can.

In any case, thanks.
hjh




[O] Incorrect references to LaTeX Listings

2018-01-09 Thread James Harkins
I have several org documents containing source code listings, with references 
such as the following:

```
* Section
#+name: codeblock
#+caption: Hello, world.
#+BEGIN_SRC C
// Hello, world
#+END_SRC

Reference to [[codeblock]].
```

I've been doing this for years, never had any problem.

Today, I get the following sort of LaTeX export (assuming the Listings package):

```
\section{Section}
\label{sec:orgheadline1}
\lstset{language=C,label=codeblock,caption={Hello, 
world.},captionpos=b,numbers=none}
\begin{lstlisting}
// Hello, world
\end{lstlisting}

Reference to \ref{orgsrcblock1}.
```

Well, there is no label orgsrcblock1, so the exported document shows "??" 
instead of a listing number.

I checked the manual to see if any of the syntax had changed, but I don't see 
any. I also tried doing

#+CAPTION:
#+NAME:
#+BEGIN_SRC
...

... but no difference -- I still get the wrong reference in the text.

So, how do I make source block references work the way they used to? Rather 
critical for me -- this is one of /the/ main reasons why I prefer to write in 
org and export LaTeX.

org 8.3.3 -- I'm using the packages provided by Ubuntu 16.04. (I realize distro 
packages are usually behind, but I wouldn't have expected a seriously broken 
org version to make it into package repositories, especially for a feature 
whose malfunction would not be tolerated by the technical writers in org's user 
base. So I suspect there must be some configuration issue, rather than a bug.)

hjh




Re: [O] Deadline warning period, and property to override it

2017-11-20 Thread James Harkins
 On Mon, 20 Nov 2017 15:50:58 +0800 Eric S Fraga <esfli...@gmail.com> wrote 
 
> On Sunday, 19 Nov 2017 at 10:54, James Harkins wrote: 
> > 2. Is there a property to override the warning period for specific 
> > headlines? For example, if I have a project due on a certain date, a 
> > two-week warning makes sense. But, for paying the rent, a two-week 
> > warning means that I see the warning for half the month, which is a 
> > bit too much. I'd like to make that one 7 days. 
>  
> you can specify the warning time directly in the time stamp.  See 
> example in the info manual (section 8.3: deadlines and scheduling). 

Perfect on both questions, thanks!

I overlooked the "-time" specifier, probably because it's in a longer paragraph 
with other points. Thanks for pointing me to the place where I should look 
closer.

hjh




[O] Deadline warning period, and property to override it

2017-11-19 Thread James Harkins
Hi,

Two questions about deadline items in the agenda.

1. The default warning period for upcoming deadlines is 14 days. There must be 
a variable to control this, but I'm having trouble finding it in the manual.

2. Is there a property to override the warning period for specific headlines? 
For example, if I have a project due on a certain date, a two-week warning 
makes sense. But, for paying the rent, a two-week warning means that I see the 
warning for half the month, which is a bit too much. I'd like to make that one 
7 days.

Thanks,
hjh




Re: [O] function for inserting a block

2017-11-09 Thread James Harkins
One more vote in favor of not removing my own use, I added 

Anyway, just an opinion. "<" macros save me tons of time with ox-latex 
markup. I like them.


hjh

Sent with AquaMail for Android
http://www.aqua-mail.com






Re: [O] Beamer_act property is misnamed in org-mode Ubuntu package

2017-09-27 Thread James Harkins

On September 27, 2017 14:03:06 Eric S Fraga <esfli...@gmail.com> wrote:


On Wednesday, 27 Sep 2017 at 11:53, James Harkins wrote:

Hi,

There seems to be a mistake in the org-mode Ubuntu 16.02 packages.

For beamer, if I C-c C-x p to add a property, one of the predefined options is:

 :BEAMER_act(Act): 1


I think (could be wrong on this) that org includes any properties you
already have as pre-defined options available to you.  Maybe you have
this property already in your file?


No, I have never used this (incorrect) property. This occurs in a brand new 
org file too.


Oh, just did a search: ox-beamer.el, line 81, defines columns for beamer 
properties, including the incantation "%10BEAMER_act(Act)" -- which, except 
for the %10, matches the behavior precisely. It appears that C-c C-x p is 
treating this as the true name of the property, when it's really something 
for display.


Anyway, the string inserted by C-c C-x p just doesn't work.

hjh

Sent with AquaMail for Android
http://www.aqua-mail.com






[O] Beamer_act property is misnamed in org-mode Ubuntu package

2017-09-26 Thread James Harkins
Hi,

There seems to be a mistake in the org-mode Ubuntu 16.02 packages.

For beamer, if I C-c C-x p to add a property, one of the predefined options is:

 :BEAMER_act(Act): 1

But it should be

 :BEAMER_act: 1

The former is ignored in the generated LaTeX. The latter produces a correct 
overlay spec.

Is that still the case in the most recent org release? If yes, I'd like to file 
it as a bug report. If not... I guess it's time to dump the Ubuntu packages.

hjh




[O] org-after-todo-statistics-hook vs checkboxes

2017-09-24 Thread James Harkins
Hi,

Some time ago, I wanted an item's TODO state to update automatically based on 
the [/] statistics cookie:

(defun hjh-org-summary-todo (n-done n-not-done)
  "Switch entry to DONE when all subentries are done, to TODO otherwise."
  (let (org-log-done   ; turn off logging
org-log-states
(neverTodo (cdr (assoc "NeverTODO" (org-entry-properties)
  (if (not neverTodo)
  (org-todo
   (if (= n-not-done 0)
   "DONE"
 (if (= n-done 0) "TODO" "INPROG"))

(add-hook 'org-after-todo-statistics-hook 'hjh-org-summary-todo)

E.g., [0/2] --> TODO, [1/2] --> INPROG, [2/2] --> DONE.

It works for subtrees:

* Tree 2 [0/0]
** Subtree 1
** Subtree 2

If I set TODO on Subtree 1, I get:

* TODO Tree 2 [0/1]
** TODO Subtree 1
** Subtree 2

Somehow, on my old system, I had worked it out so that this would also happen 
for checkboxes underneath the tree. But that isn't happening anymore.

* Tree [0/2]
  - [ ] Checkbox 1
  - [ ] Checkbox 2

If I C-c C-c on either check box, I expect the statistics cookie to update to 
[1/2] (this works), AND the after-statistics hook to run and update Tree's todo 
state to INPROG. The latter is no longer working in my system.

What do I have to do to make this work for checkboxes too?

(I use checkboxes a lot because I also use mobileorg for android, which adds an 
ID property to everything that goes into an exported agenda view, including all 
TODOs. So, e.g., I have a task "Review e-mailed student work" and under this 
task will be a large number of short-duration subtasks. The subtasks do not 
need org-ids. So I would really prefer to use checkboxes for these, and I don't 
understand why the statistics hook doesn't work here.)

Org 8.3.3 from Ubuntu packages.

Thanks,
James




Re: [O] Sibling visibility when accessing an item from the agenda

2017-09-16 Thread James Harkins
 On Sat, 16 Sep 2017 15:30:52 +0800 Nicolas Goaziou 
 wrote  
> Does customizing `org-show-context-detail' fix your issues? 

Hi,

Thanks, it would have taken me quite some time to find that.

The default was "ancestors." Changing it to "local" works well for me.

I'm puzzled because, for years, it was behaving as I wanted. I believe the 
former behavior was "local" -- I have a slight shred of a doubt only because, 
when things are working as you expect, you take the behavior for granted and 
don't pay attention to all of the details.

I'm 100% certain that I was seeing at least the next sibling when jumping to an 
item from the agenda. If I had been seeing the "ancestors" behavior all along, 
I would have asked this question years ago and set it explicitly.

So, again, somehow this morning, one minute I had good behavior, and literally 
five minutes later (no restart, no software update, no quit/relaunch Emacs), it 
was a different, inconvenient behavior. I don't understand how that could 
happen.

Thanks for the tip, though. The behavior now is much better.

hjh




Re: [O] Sibling visibility when accessing an item from the agenda

2017-09-15 Thread James Harkins
> What is the setting to control the visibility of the 4th-level siblings here? 
>  
> How I got to this point: 
>  
> - All headings collapsed (only top-level visible) 
> - Go to the agenda week view 
> - Put the cursor on the entry for "Elec. 2a 01" and hit return. 

A bit of poking around, and I found I can use C-c C-r as a workaround.

But... I've been using this system for a few years now, and today is the first 
time I needed to look for C-c C-r.

I'm quite sure in the past, when jumping from the agenda to a specific heading, 
org would show the heading *and* the next sibling (and hide the others, which 
is OK with me). But today, magically, in the middle of a session, the behavior 
changed. I didn't change any customization variables, just, one minute it was 
fine and the next it wasn't.

Such a mystery...
hjh




Re: [O] Sibling visibility when accessing an item from the agenda

2017-09-15 Thread James Harkins
Sorry, I had meant to attach a screenshot. Here it is.
James

 On Sat, 16 Sep 2017 09:47:45 +0800 James Harkins <jamshar...@zoho.com> 
wrote  
> Hi, 
>  
> What is the setting to control the visibility of the 4th-level siblings here? 
>  
> How I got to this point: 
>  
> - All headings collapsed (only top-level visible) 
>  
> - Go to the agenda week view 
>  
> - Put the cursor on the entry for "Elec. 2a 01" and hit return. 
>  
> The catch is... my school requires me to take notes on every class session. 
> That means I need to type plain text underneath this heading. But, org has 
> "helpfully" marked this area to be invisible. If I put the cursor on the 
> flush-left ellipsis and hit return to open up some space, I don't see the 
> open space. Same if I put the cursor after the ellipsis for the properties 
> drawer. 
>  
> That is, org thinks accessing an item from the agenda is a read-only 
> operation, but I need to write into it -- org's assumption is invalid. 
>  
> So the only way I currently know to enter the text is to go up to the parent 
> level, collapse it, and expand it to show all the siblings... for 14 class 
> sessions every week. That is going to get really old. 
>  
> There must be a way to get org to show the sibling headings of the one that 
> was selected from the agenda. 
>  
> Thanks, 
> hjh 


[O] Sibling visibility when accessing an item from the agenda

2017-09-15 Thread James Harkins
Hi,

What is the setting to control the visibility of the 4th-level siblings here?

How I got to this point:

- All headings collapsed (only top-level visible)

- Go to the agenda week view

- Put the cursor on the entry for "Elec. 2a 01" and hit return.

The catch is... my school requires me to take notes on every class session. 
That means I need to type plain text underneath this heading. But, org has 
"helpfully" marked this area to be invisible. If I put the cursor on the 
flush-left ellipsis and hit return to open up some space, I don't see the open 
space. Same if I put the cursor after the ellipsis for the properties drawer.

That is, org thinks accessing an item from the agenda is a read-only operation, 
but I need to write into it -- org's assumption is invalid.

So the only way I currently know to enter the text is to go up to the parent 
level, collapse it, and expand it to show all the siblings... for 14 class 
sessions every week. That is going to get really old.

There must be a way to get org to show the sibling headings of the one that was 
selected from the agenda.

Thanks,
hjh




Re: [O] Flattening references in ODT export

2017-09-10 Thread James Harkins
 On Sun, 10 Sep 2017 04:18:08 -0400 Nicolas Goaziou 
<m...@nicolasgoaziou.fr> wrote  
> >   On Sat, 09 Sep 2017 05:06:24 -0400 James Harkins 
> > <jamshar...@zoho.com> wrote   
> >> I guess next I'm going to try to hack ox-odt.el... 
> > 
> > Hm, that's going to be too complicated. 
>  
> I can help you doing so. 

Thanks. At this point, I've decided to abandon org export so that I can have 
more direct control over the captions and indexes. A bit painful decision, 
because I really like the way org handles in-line formatting, but the final 
document needs to "just work."

But... it might be an enhancement to put on the wish list. As far as I can see, 
org assumes that figure categories should always be kept separate and indexed 
separately, and the assumption seems to be embedded pretty deeply. It would be 
worth having a switch in the export options to turn that off.

hjh




Re: [O] Flattening references in ODT export

2017-09-09 Thread James Harkins
  On Sat, 09 Sep 2017 05:06:24 -0400 James Harkins <jamshar...@zoho.com> 
wrote  
> I guess next I'm going to try to hack ox-odt.el...

Hm, that's going to be too complicated. So I suppose my only other option is to 
make an SVG for every code example, and include only images. Or hack the xml by 
hand in the final editing stage.

But it's strange... it seems like it should be simple enough to have one 
counter for both figures and listings. I'm surprised that org seems to be 
really quite adamant that nobody would ever, ever want this.

hjh




Re: [O] Flattening references in ODT export

2017-09-09 Thread James Harkins
 On Fri, 08 Sep 2017 23:52:33 -0400 James Harkins <jamshar...@zoho.com> 
wrote  
> Is there a way to have "figure" references in ODT exports be simply a flat 
> list? 
>  
> Meaning -- I would like "Example 1," "Example 2," etc. (or "Figure," doesn't 
> really matter). 
>  
> With "num:nil," "Listing 1," "Listing 2," "Listing 3," but there is also a 
> figure, which becomes "Figure 1." So there's a listing and a figure with the 
> same index number.

So I found variable-help for org-odt-category-map-alist.

BTW the variable's help conflicts with the org manual. The manual says, to 
change the displayed label, you should change the second string for the 
category, but the help in Emacs indicates it's actually the fourth string.

Manual says:

 (setq org-odt-category-map-alist
   '(("__Figure__" "Illustration" "value" "Figure" 
org-odt--enumerable-image-p)))

Should be:

 (setq org-odt-category-map-alist
   '(("__Figure__" "Figure" "value" "Illustration" 
org-odt--enumerable-image-p)))

But it's still not working. Maybe I'm misunderstanding the fields. I thought 
keying __Figure__ and __Listing__ both to the OD-VARIABLE "Illustration" would 
make both of them share one numeric sequence:

(setq org-odt-category-map-alist
  '(("__Table__" "Table" "value" "Table" org-odt--enumerable-p)
 ("__Figure__" "Illustration" "value" "Figure" org-odt--enumerable-image-p)
 ("__MathFormula__" "Text" "math-formula" "Equation" 
org-odt--enumerable-formula-p)
 ("__DvipngImage__" "Equation" "value" "Equation" 
org-odt--enumerable-latex-image-p)
 ("__Listing__" "Illustration" "value" "Figure" org-odt--enumerable-p)))

... but they still get separate counters.

One suspicious thing in content.xml:









Org generates two Illustration counters...?

OK, so org has an inherent limitation that every distinct type of labeled 
entity must have a separate counter. Well, bother.

I guess next I'm going to try to hack ox-odt.el... (and, mental note, don't 
write for a journal ever again that won't accept PDF, 'cause the ODT exporter 
is really not mature by comparison. And don't tell me to write directly in 
LibreOffice, I have reasons why that is a terrible idea for me. I'll explain 
them another time if you like.)

hjh




[O] Flattening references in ODT export

2017-09-08 Thread James Harkins
Hi,

Is there a way to have "figure" references in ODT exports be simply a flat list?

Meaning -- I would like "Example 1," "Example 2," etc. (or "Figure," doesn't 
really matter).

With "num:nil," "Listing 1," "Listing 2," "Listing 3," but there is also a 
figure, which becomes "Figure 1." So there's a listing and a figure with the 
same index number. Hm.

I am pretty sure this will not satisfy the journal's style requirements.

It seems there is some customizability here[1], but which predicate should I 
use in place of org-odt--enumerable-image-p for listings?

I'm willing to avoid SRC blocks if that will help.

Also, it may not help to wrap all of these entities in FIGURE blocks, because I 
found (the hard way) ODT export fails if an image is inside a figure block.

Thanks,
hjh

[1] 
http://orgmode.org/manual/Labels-and-captions-in-ODT-export.html#Labels-and-captions-in-ODT-export




[O] ODT export of SVG image, wrong size properties

2017-09-07 Thread James Harkins
Hi,

I am exporting a document to ODT, including a small SVG image.

#+name: Notation1
#+caption: Transcription into Western notation of an example pattern string.
#+attr_odt: :width 6.88 :height 1.87
[[./notated-example.svg]]

The frame properties, however, do not respect the given size attributes.






"svg:width" and "svg:height" are correct, but the style also specifies 
~rel-height="scale"~ and, in LibreOffice 5.1, this overrides the specific 
height. So the image gets squashed: it's displayed with 33% of the height it 
should have.

Initially I tried without any "#+attr_odt" and got the incorrect display. The 
org manual says:

> To embed img.png with a height of 10 cm while retaining the original 
> height:width ratio, do the following
> 
>   #+ATTR_ODT: :height 10
>   [[./img.png]]

But I get the same incorrect result this way as well. So I tried setting the 
width and height explicitly to the SVG's dimensions, and the display is still 
wrong.

hjh




Re: [O] ox-odt: List items contain body paragraphs, confusing styles

2017-08-20 Thread James Harkins

On August 20, 2017 18:13:13 Nicolas Goaziou  wrote:


Out of curiosity, instead of creating a new style, wouldn't some
standard style be enough, e.g., "Text_20_body_20_indent"?

Also, what happens in the following cases

- ...

  #+begin_quote
  Quoted paragraph
  #+end_quote

  #+begin_center
  Centered paragraph
  #+end_center

Should the use "Quotations" and "OrgCenter", which inherit from
"Text_20_body", or some new style inheriting from the one dedicated to
text in plain lists?


Interesting questions -- however, I'm leaving tomorrow for a week's 
holiday. So I won't get to this for awhile.


I should also say: This is the first time I've needed the ODT exporter for 
anything serious. So, I shouldn't be taken as any sort of authority on how 
the styles "should" work. I'm reporting behavior that seemed odd to me and, 
to the extent that I have time, I don't mind prowling around in the ODT 
data structures to see what is going on inside. That's about the extent of 
what I can do. I'm not affiliated with LibreOffice in any way... In fact, I 
quite dread using it. TBH I prefer exporting to LaTeX, but it's a 
humanities journal and they don't understand about superior technology :D


That said, I'm not sure why those cases would be challenging. In the normal 
list item case, you have a list item node enclosing one or more paragraph 
nodes. In the cases you mentioned, the list item node would contain a quote 
block or centered block node. As I understand the exporter, the depth-first 
traversal would encode the child nodes normally, and pass the encoded 
result up to the list item parent. My observation of LO is that it tries to 
merge properties from the list style and paragraph style, which it would do 
if it's centered, block quote or whatever. So my guess is, do nothing 
special for these cases. But that's a guess.


hjh

Sent with AquaMail for Android
http://www.aqua-mail.com






Re: [O] ox-odt: List items contain body paragraphs, confusing styles

2017-08-20 Thread James Harkins
 On Sat, 19 Aug 2017 07:55:00 -0400 Nicolas Goaziou 
 wrote  
> OK. So could you tell me what should be the style name? 
>  
> Do we need to add it to some style file somewhere? If so, what would be 
> its definition? 

OK, I just got the expected output by the following:

- Add "OrgListTextBody" to the stylesheet. I didn't try to do it directly in 
text (I don't know ODT XML that well). I created the style with that name in 
LO, setting the indent parameters to 0. That gave me this definition in 
styles.xml:


  


It's probably enough to specify only ~fo:text-indent="0in"~, but I didn't test 
that because I'm not sure how to write the modified styles.xml back into the 
ODT archive. (LO auto-generated all 4 parameters.)

- Then, use my filter to apply OrgListTextBody to the paragraphs contained 
within list items.

The resulting display in LO is correct.

hjh




Re: [O] ox-odt: List items contain body paragraphs, confusing styles

2017-08-19 Thread James Harkins
  On Sat, 19 Aug 2017 04:36:58 -0400 Nicolas Goaziou 
 wrote  
> Adding a special style to every paragraph contained in a plain list is 
> very easy to do. Just let me know if it happens to be the way to solve 
> the issue at hand. 

I think that is the correct solution. (Again, only one paragraph style for all 
list levels.)

I realized just now, I couldn't reproduce the problem because I was still using 
the filter! I just disabled the filter, regenerated the stylesheet, and the 
problem reappeared.

So here are steps to reproduce:

1. According to the org-manual[1], create an empty org odt document to export 
to ODT (creating org-specific styles). C-e o O to export and open.

2. In this document, edit "Text body" to add 0.5" of first-line indent.

3. Save the document.

4. Create a new org document including ~#+ODT_STYLES_FILE: 
"./ox-odt-generate-stylesheet.odt"~ (replacing with your path) and some list 
items.

5. C-e o O, and you'll see incorrect indentation for the list items.

hjh

[1] http://orgmode.org/manual/Applying-custom-styles.html#Applying-custom-styles




Re: [O] ox-odt: List items contain body paragraphs, confusing styles

2017-08-17 Thread James Harkins
  On Thu, 17 Aug 2017 10:33:29 -0400 Nicolas Goaziou 
 wrote  
 > So, what style-name should have the inner paragraph? If it is a new 
 > style, what would be its definition? 
 >  
 > It's not difficult to check, upon exporting a paragraph, if it belongs 
 > to a list item or not: (org-element-lineage paragraph '(item)) 
 >  
 > BTW, is it different for nested paragraphs, e.g., what should be the 
 > style for the following 3 paragraphs: 
 >  
 >   - para 1 
 >  
 > para 2 
 >  
 > - para 3 

Hm. Good question.

I'm going to admit to a bit of frustration now... after about 45 minutes poking 
around in XML, I did a fresh ox-odt test with a fresh style sheet, and I can't 
reproduce the problem. !!! Hours, over the last two days, wasted.

So I must have done something funky to that initial stylesheet. (WYSIWYG tools, 
who knows what it could be. Really teed off at that journal for not allowing 
LaTeX.)

So I would say, postpone this issue unless I can gather more evidence.

A short answer to your questions is that every list item does consist of 
paragraphs, and each paragraph must have a paragraph style, but -- the 
paragraph style can be the same one, even at different list levels. There is no 
need for a different paragraph style for each list level, and you don't have to 
do anything special for multiple paragraphs within a list item.

hjh




[O] ox-odt: List items contain body paragraphs, confusing styles

2017-08-16 Thread James Harkins
Hi, haven't been active here for a while (which is a good thing -- it means I 
haven't had any problems worth mentioning!).

Now I have one -- ODT export encodes list items as a list-item containing a 
"text:p":




blah blah




When LibreOffice reads this, it applies indentation settings from the 
Text_20_body paragraph style to the list item. So, for instance, if you're 
writing for a journal that requires a .doc and it also requires paragraphs to 
be first-line indented, it becomes impossible to have hanging bullets in bullet 
lists -- the list outdents the bullet by 0.25" but the paragraph style then 
indents this by 0.5" for a net indent of 0.25".

ask.libreoffice.org says "It is usually preferable to make paragraph styles 
formatting lists independent from bulk text styles"[1] -- i.e., applying the 
same style to a list-item paragraph as to a free-standing paragraph is not 
recommended.

I can guess structurally why this occurs -- I suppose org parses it as a 
list-item node containing a paragraph node, and the paragraph node is encoded 
first, without any knowledge of its context.

I will try to write a filter for this, but this looks like an unexpected 
interaction, so, perhaps a bug.

Thanks,
hjh

[1] 
https://ask.libreoffice.org/en/question/123222/text-body-style-with-intent-affects-bulleted-list-style-as-well/




Re: [O] ob-lilypond and LaTeX floats/captions

2016-02-26 Thread James Harkins

On February 27, 2016 5:57:01 AM Nicolas Goaziou  wrote:


> My question, then, is: What is needed to get ob-lilypond to support
> LaTeX floats and captions? (I have a sneaky feeling it isn't trivial,
> but it's worth asking in any case.)

You are applying the name and caption to the source block, which is
removed (:exports results), not to the results of the source block. So,
you need to generate the results first, or at least put a RESULTS
keyword below, and apply the name and caption to it.


A-ha. Thank you. So, "What is needed to get ob-lilypond to support LaTeX 
floats and captions" is to RTFM ;)


I have often exported source code to LaTeX listings, but only infrequently 
exported results. So I wasn't clear on the mechanism. Now that you explain 
it, it makes perfect sense: the properties belong to an entity that I asked 
it not to export.


Thanks again - I can take it from here.

(PS This project is a write-up of an improvisational composition -- a lot 
of text description of the procedure, with some examples in musical 
notation along the way. It blows my mind that I can write the lilypond 
scores directly into the org document, and it all renders with C-c C-e l p. 
org-mode FTW! Again!)


hjh

Sent with AquaMail for Android
http://www.aqua-mail.com







[O] ob-lilypond and LaTeX floats/captions

2016-02-26 Thread James Harkins
Especially looking for users of ob-lilypond:

I currently have a few LilyPond source code blocks that are working quite well 
as inline graphics (exported to LaTeX), e.g.:

#+BEGIN_SRC lilypond :exports results :noweb yes :file ex1.eps
...
#+END_SRC

When I export, it (correctly) asks if I want to evaluate the source block, and 
the export (correctly) includes the line:

\includegraphics[width=.9\linewidth]{ex1.eps}

So far, so good.

Now, I would like to make the results a floating figure, with a caption and a 
#+name reference. So I added the following to the above block:

#+name: ex1
#+caption: One possible form of "seed" material to start the performance.
#+BEGIN_SRC lilypond :exports results :noweb yes :file ex1.eps
...
#+END_SRC

... but the #+name is not converted into a label, and the #+caption is also 
ignored.

My question, then, is: What is needed to get ob-lilypond to support LaTeX 
floats and captions? (I have a sneaky feeling it isn't trivial, but it's worth 
asking in any case.)

hjh

[O] Doc suggestion: Clarify subtree export properties

2015-07-09 Thread James Harkins
I think the manual could be a bit clearer on one point of the use of :EXPORT_*: 
properties.

http://orgmode.org/manual/Export-settings.html#Export-settings

~~
When exporting only a subtree, each of the previous keywords3 can be overridden 
locally by special node properties. These begin with ‘EXPORT_’, followed by the 
name of the keyword they supplant. For example, ‘DATE’ and ‘OPTIONS’ keywords 
become, respectively, ‘EXPORT_DATE’ and ‘EXPORT_OPTIONS’ properties.
~~

And...

~~
[2] If you want to configure many options this way, you can use several 
#+OPTIONS lines.
~~

*If* you already know what you're doing, then you know that you can't have 
multiple properties of the same name in the same PROPERTIES drawer.

If you are reading the manual because you don't already know what you're doing, 
then you might simply convert the default block of options (inserted by C-c C-e 
# default RET) into multiple lines of properties, and then get annoyed when 
many of them are ignored.

Perhaps add this?

~~
... become, respectively, ‘EXPORT_DATE’ and ‘EXPORT_OPTIONS’ properties. Note 
that multiple EXPORT_OPTIONS lines are not supported, because node properties 
must have unique identifiers.
~~

hjh





[O] org-mobile-pull put a heading at the document head

2015-03-16 Thread James Harkins
Hi,

org-mobile-pull just messed up.

I have a top level heading, Dates. In mobileorg (android), I created a 
second-level heading under it, Entrance exams, and then a third level heading 
under that, Auditions, with a scheduled date. That was on my phone.

Later, I synced on the phone and did C-c C-x RET g, and this produced:

* Entrance exams#+LAST_MOBILE_CHANGE: 2015-03-16 21:30:23
* Dates

Instead of adding Entrance exams as the last child under Dates, it placed 
the heading (with no line break) at the beginning of the buffer, pushing 
#+LAST_MOBILE_CHANGE to the middle of the line (nonsensically).

Org-mode version 8.3beta (release_8.3beta-467-gcbb4c5 @ 
/home/dlm/share/org-mode.git/lisp/)

hjh



Re: [O] Comment on Org Export Reference

2015-03-06 Thread James Harkins

On March 6, 2015 7:21:50 PM Nicolas Goaziou m...@nicolasgoaziou.fr wrote:


James Harkins jamshar...@qq.com writes:

 The page covers a lot of details, but less in the way of context. For
 instance, the toolbox is documented extensively, but I didn't see
 a comprehensive list of the transcoding functions that a backend
 should implement

There is no rule about what a back-end should implement (besides
template).


Should, or could.


Anyway full list of supported elements and objects, along
with all associated properties is in Org Element API document[fn:1].


Ah, OK! The connection between these and the exporter was, for whatever 
reason, not obvious to me. (I may perhaps be forgiven for this: a search of 
the export reference for API yielded no results.)


Maybe all the document needs is to call attention to the relationship and 
give a few examples. *That* is something I can handle. A full tutorial is 
more time than I can afford now, but might not be needed after all.


hjh

Sent with AquaMail for Android
http://www.aqua-mail.com





[O] Comment on Org Export Reference

2015-03-06 Thread James Harkins
I've been working on an export backend for personal use, and I find the 
documentation on worg to be... not quite what I need. In the spirit of 
suggesting an avenue for improvement, then:


The page covers a lot of details, but less in the way of context. For 
instance, the toolbox is documented extensively, but I didn't see a 
comprehensive list of the transcoding functions that a backend should 
implement, nor details of these functions' inputs, nor recommendations for 
handling elements that aren't obvious (tags, links, footnotes...). In my 
first attempt, I even left out ox-*-template -- I had no idea what the 
template was or its importance! (It is actually sort of covered on worg, 
but it's buried in a quoted docstring with nothing to highlight its rather 
crucial nature.)


I've had to infer these from ox-ascii.el, which also covers a lot of cases 
that aren't relevant to this exporter, making it hard to guess what is 
strictly necessary. The result for me has been rather remarkable amounts of 
wasted time.


I also wonder about documenting functions without documenting their 
arguments. Like, yesterday I was trying to use org-export-get-parent: 
first, find out that the function exists on worg, then switch to emacs and 
C-h f it to find out *really* how to use it. Why C-h f? Because the worg 
page says *nothing* about the arguments!


At the very least, another section needs to be added, listing the elements 
that need to be transcoded. Also some common cases might be nice, e.g., 
what's the canonical way to access tags? Properties? Typical cases for 
links that you wouldn't think of unless you already know what you're doing 
(but if you already knew what you're doing, you wouldn't be scouring the 
reference)?


I'll add that, despite some painful false starts, I've got a shocking 
amount of the elements working already. Some, that I might have expected to 
be hard (e.g., plain lists) were close to trivially easy! So I'd say the 
exporter design is a thing of beauty -- serious applause for this -- it's 
just that the entry point involves too much puzzling over source code and 
not enough well-organized explanation.


hjh

Sent with AquaMail for Android
http://www.aqua-mail.com







[O] (org-element-property :title ...) not returning a string

2015-03-04 Thread James Harkins
I've got:

(defun org-scdoc-headline (headline contents info)
  Transcode a HEADLINE element from Org to ASCII.
CONTENTS holds the contents of the headline.  INFO is a plist
holding contextual information.
  ;; Don't export footnote section, which will be handled at the end
  ;; of the template.
  (unless (org-element-property :footnote-section-p headline)
(let* ((title (org-element-property :title headline))
   (allcaps (upcase title))
... blah blah

It's choking on (upcase...) because 'title' ends up being an element object, 
and *not* the value of the :title property.

Why?

http://orgmode.org/worg/dev/org-export-reference.html is not helpful in 
answering this question.

hjh





Re: [O] (org-element-property :title ...) not returning a string

2015-03-04 Thread James Harkins

On March 4, 2015 7:18:11 PM James Harkins jamshar...@qq.com wrote:


I've got:

(defun org-scdoc-headline (headline contents info)
  (unless (org-element-property :footnote-section-p headline)
(let* ((title (org-element-property :title headline))
   (allcaps (upcase title))
... blah blah

It's choking on (upcase...) because 'title' ends up being an element 
object, and *not* the value of the :title property.


Never mind, I needed to wrap the org-element-property call inside 
org-export-data.


That much is working now! Next question... maybe tomorrow.

hjh

Sent with AquaMail for Android
http://www.aqua-mail.com





Re: [O] Exporter: Derived backend options-alist

2015-03-02 Thread James Harkins

On March 3, 2015 12:51:31 AM Nicolas Goaziou m...@nicolasgoaziou.fr wrote:


 Then I created an org file that begins:

 #+BEGIN_SRC org
   ,#+title:: PulseCount
   ,#+summary:: Pulse counter.
   ,#+related:: Classes/Stepper
   ,#+categories:: UGensTriggers

It should be

  #+title: PulseCount


Gah... doubled colons, which are part of scdoc syntax but not org. That's a 
10:30 PM brain failure. Thanks for the second pair of eyes.


I have another question about source blocks, but, separate question, 
separate thread.


hjh

Sent with AquaMail for Android
http://www.aqua-mail.com







[O] Exporter: Derived backend options-alist

2015-03-02 Thread James Harkins
I'm trying to derive an exporter backend from ASCII. I need to add some export 
options, so I have:

#+BEGIN_SRC {emacs-lisp}
(org-export-define-derived-backend 'scdoc 'ascii
  :translate-alist  ... omitted for brevity...
  :options-alist
  '((:categories CATEGORIES nil nil t)
(:related RELATED nil nil t)
(:summary SUMMARY nil nil t)
(:redirect REDIRECT nil nil t))
)

... snip snip...

(defun org-scdoc-template (contents info)
  Return complete document string after SCDoc conversion.
CONTENTS is the transcoded contents string.  INFO is a plist
holding export options.
  (let* ((title (org-export-data (plist-get info :title) info))
(categories (org-export-data (plist-get info :categories) info))
(related (org-export-data (plist-get info :related) info))
(summary (org-export-data (plist-get info :summary) info))
(redirect (org-export-data (plist-get info :redirect) info))
(output (format TITLE:: %s\n title)))
(if categories (setq output (concat output (format CATEGORIES:: %s\n 
categories
(if related (setq output (concat output (format RELATED:: %s\n 
categories
(if summary (setq output (concat output (format SUMMARY:: %s\n 
categories
(if redirect (setq output (concat output (format REDIRECT:: %s\n 
categories
(concat output \n\n contents)))
#+END_SRC

(Pardon the un-idiomatic Emacs-lisp.)

Then I created an org file that begins:

#+BEGIN_SRC org
  ,#+title:: PulseCount
  ,#+summary:: Pulse counter.
  ,#+related:: Classes/Stepper
  ,#+categories:: UGensTriggers

  ,* Description
  Each trigger increments a counter which is output as a signal.
#+END_SRC

Then I run org-scdoc-export-as-scdoc, and I get as the first few lines:

TITLE:: 
CATEGORIES:: 
RELATED:: 
SUMMARY:: 
REDIRECT:: 

... telling me that the template function retrieved empty strings for all the 
export options.

Obviously I've done something wrong, but... what? (let ((title 
(org-export-data (plist-get info :title) info)))...) is copied from 
ox-latex.el, and ox-latex clearly has no problem accessing the title.

Thanks in advance. I'm sure I'll have other questions later.

hjh





[O] Advice on handling translations in export

2015-02-22 Thread James Harkins
Just wondering if anyone has any experience with texts written in org, 
which then need to be translated.


The simplest thing, of course, would be an org file for the original 
language, and then separate files for other languages. Markup and export 
are simpler this way, but future edits would be harder to sync.


For the edit/sync problem (and also because hey, we're org users, meaning 
born tinkerers), I'm wondering if it's worth interleaving the languages in 
the same file, with some kind of tagging to select one or more languages 
for export. I'm struggling to imagine how that would look. Regular org tags 
wouldn't work because they're hierarchical, and there's no point in 
considering any sort of scheme for this if you can't keep original text and 
translation close together.


Maybe language prefixes, which an export filter could process? Perhaps:

* en: Hello
 fr: Bonjour

To be honest, I'm a bit skeptical of doing this at all because it would be 
a chunk of work and it would clutter the org files visually. But if someone 
has figured out a clever way, I'd be curious to hear about it.


Thanks in advance --
hjh

Sent with AquaMail for Android
http://www.aqua-mail.com







Re: [O] closing column mode for beamer export

2015-02-12 Thread James Harkins
Eric S Fraga e.fraga at ucl.ac.uk writes:

 On Wednesday, 11 Feb 2015 at 11:46, L.Larrabee Strow wrote:
  Here is the simplest example I can come up with.  I changed the four
  figures to text.  Note that in comments, I show where I can add
  \end{columns} and \begin{columns} to the org-generated .tex files, and I
  get what I want, a 2x2 set of figures.
 
 Thanks.
 
 I can get this to work by inserting an empty non-column block with
 heading ignored between the two pairs of blocks, as in the attached:

Again, this is a hack. Beamer export has the :B_columns: tag for exactly
this purpose.

hjh




Re: [O] closing column mode for beamer export

2015-02-11 Thread James Harkins
Larrabee Strow strow at umbc.edu writes:

 
 I am trying to put a second row of two columns in a org beamer slide.
 
 No problems with doing the first row, two column.
 
 I can't figure out any way to put in the second row of two columns.
 (I am trying to show a 2x2 grid of images, with titles.)
 
 It appears to me I need something that produces and \end{columns}
 after my first row of columns.

This is what the :B_columns: tag is for. (And, finally *I* can help someone
else, instead of asking a question!!)

In the example, I'm cutting out some spaces before tags.

#+OPTIONS: H:1

* Frame
** First row:B_columns:
   :PROPERTIES:
   :BEAMER_env: columns
   :END:
*** Left:BMCOL:
:PROPERTIES:
:BEAMER_col: 0.5
:END:
Stuff here
*** Right   :BMCOL:
:PROPERTIES:
:BEAMER_col: 0.5
:END:
More stuff here
** Second row   :B_columns:
   :PROPERTIES:
   :BEAMER_env: columns
   :END:
*** Left:BMCOL:
:PROPERTIES:
:BEAMER_col: 0.5
:END:
Stuff here
*** Right   :BMCOL:
:PROPERTIES:
:BEAMER_col: 0.5
:END:
More stuff here

In the exported LaTeX code, you'll get two \begin{columns} ... \end{columns}
pairs.

hjh




Re: [O] Hidden files from beamer export, not cleaned up by org

2014-12-02 Thread James Harkins
Nick Dokos ndokos at gmail.com writes:

 Somewhere but probably not in org - it can't clean up what it does not
 know about. What system is this? Does this have anything to do with
 
 http://en.wikipedia.org/wiki/Filesystem_in_Userspace
 
 perhaps?

That's probably it. I set up my machine to dual-boot Windows and Ubuntu (I'd
happily do without Windows, but I have to teach some Windows-only software),
and (as far as I recall) I'm seeing this only on an NTFS partition mounted
into the /media directory. It makes sense for Fuse to be involved in that case.

I won't worry about it, then, or maybe hack up a post-export hook.

Thanks for clarifying,
hjh




[O] SCHEDULED in a comment line is not ignored by sparse-tree

2014-12-02 Thread James Harkins
This appears to be buggy behavior, but I'm asking here first in case it might 
already have been fixed.

A couple of months ago, I was trying to create a repeating timestamp for two 
different days of the week. First I tried a diary-sexp, but that wasn't 
compatible with habits, so I gave that up. But I didn't want to throw away the 
string completely, because it took some digging to figure it out. So I put #  
at the beginning of the SCHEDULED line and thought that would be the end of it. 
(In the source block, # has two spaces before it. These come from C-c ' 
editing. In my original file, the # for the comment is flush left.)

#+BEGIN_SRC org
  ,** TODO Update lesson grades 2 :Comp:
 SCHEDULED: 2014-12-06 Sat 23:59 .+1w
 :PROPERTIES:
 :STYLE:habit
 :LOGGING:  TODO MAYBE INPROG MTG | DONE(!) POSTPONED CANCELED
 :END:
  #   SCHEDULED: %%(memq (calendar-day-of-week date) '(3 6))
#+END_SRC

Just now, I tried to open a sparse-tree view with a scheduled date range -- C-c 
/ c c D (set range) -- and got the message:

byte-code: Bad timestamp `%%(memq (calendar-day-of-week date) '(3 6))'
Error was: (Not a standard Org-mode time string: %%(memq (calendar-day-of-week 
date) '(3 6)))

This is the only occurrence of memq anywhere in this org file, so it *must* be 
coming from this line. So, whatever regexp is handling scheduled timestamp 
searches doesn't check whether the line is a comment or not.

There may be a valid reason for this behavior, but I tend to think a comment 
should always be a comment.

hjh



[O] Hidden files from beamer export, not cleaned up by org

2014-12-01 Thread James Harkins
I've just noticed -- after exporting an org file using the beamer backend, two 
hidden files are left in the directory. They both contain LaTeX code, so I'm 
quite sure they're coming from the export.

.fuse_hidden01c1:
~~
\relax 
\providecommand\hyper@newdestlabel[2]{}
\providecommand\HyperFirstAtBeginDocument{\AtBeginDocument}
\HyperFirstAtBeginDocument{\ifx\hyper@anchor\@undefined
\global\let\oldcontentsline\contentsline
\gdef\contentsline#1#2#3#4{\oldcontentsline{#1}{#2}{#3}}
~~ ... And so on, for 90 lines

.fuse_hidden01c10002:
~~
\BOOKMARK [2][]{Outline0.1}{``Lifted''}{}% 1
\BOOKMARK [2][]{Outline0.2}{``Lifted''\040sounds}{}% 2
~~

Unlike the other LaTeX temporary files, these are not cleaned up after the 
export.

Bug?
hjh





[O] Beamer export, file-link format

2014-11-23 Thread James Harkins
I'm using org + beamer, and I've put in some links like this:

\href{media/something.mp3}{Listen: Something}

I want Listen: Something to appear in another color. LaTeX is steadfastly 
refusing to do this: all links appear in the normal document font and color.

Hyperref is invoked in the preamble like so:

\usepackage{hyperref}

That is, I am not using hidelinks for this presentation.

What do I need to do so that the links stand out in the export?

hjh





[O] Documentation for NOBLOCKING property?

2014-11-22 Thread James Harkins
Just now, I needed to exempt a couple of subtrees from TODO dependency 
blocking. I found that you can do this by setting a subtree property NOBLOCKING.

This option appears to be undocumented (by which I mean, it isn't mentioned in 
the manual's dependency checking page, and a web search for orgmode todo 
noblocking turned up pages about TODOs but none with any obvious reference to 
noblocking). I found the property by grepping the .el sources for blocked to 
find the org-todo function, and then scanning the function until I found 
something that looked like property access.

Was it intentional to omit this from the documentation?

hjh



[O] org-mobile-pull leaves a messed-up sparse tree display

2014-11-12 Thread James Harkins
Attached to this e-mail, please find an image of the appearance of one of my 
org buffers after doing org-mobile-pull.

Before the pull, I collapsed all the subtrees (S-TAB once).

The pull added some new nodes. The nodes appear to be filed correctly. But, it 
looks like org is trying to do some kind of sparse tree display, but it's 
hiding some line breaks that should not be hidden.

If I collapse the subtrees and reopen them, then the display is correct. But 
then I lose any visual cues about where the new information got filed. I'd 
better hope that I remember where I put them...

I'm extremely busy at the moment, not much time to hack up a reproducer. I'll 
do it if there's a fairly good chance that somebody will look at this bug. But 
I wanted to ask first what's the likelihood of getting it fixed. (If it's 
unlikely, then I'll reserve my time for other tasks.)

Thanks,
hjh



Re: [O] Repeated teaching classes and stopping date

2014-11-11 Thread James Harkins
Rasmus rasmus at gmx.us writes:

 Also check
 `org-clone-subtree-with-time-shift'.

FWIW, I always create a separate subtree, with a single timestamp, for every
class session. Advantages:

- Individual status for each session: DONE, POSTPONED or CANCELED.

- If a single class in a series needs to be rescheduled, it's easy.

- I can add notes under the subtree, to plan for the session or note
important things that happened in class. So then my calendar is not just a
calendar -- it also helps with content organization. (That IMO is the whole
point of org-mode: it's not just a calendar!)

YMMV of course.

hjh




[O] Hook after handling repeating TODO?

2014-11-04 Thread James Harkins
Is there a hook that runs after a TODO state change triggers a repeat?

I have a few weekly tasks that I've set up as habits. These refer to scheduled 
lessons. I have the idea that it would be pretty cool to include in the habit 
entry a link pointing to the next lesson. When I mark the habit DONE, it 
processes the repeat (updates the habit's scheduled time and switches the state 
back to TODO). That would be the point to find the next lesson for that group 
of students and update the link text. The most reliable way would be to search 
for the earliest lesson whose scheduled time is later than the updated 
timestamp for the habit.

I did some searching but didn't find a hook that appeared obviously to be 
suitable. I suppose a TODO state-change hook might have worked, provided that 
the repeating timestamp will be processed before the state change. 
Unfortunately, it appears that it goes in the opposite order: in 
org-auto-repeat-maybe, (org-todo to-state) occurs at line 13152, well before 
processing the new timestamp (13172-13209). So I guess not that one.

Any ideas? Thanks,
hjh





Re: [O] M-S-up/down on plain lists containing text (or multilevel lists)

2014-11-03 Thread James Harkins
Nicolas Goaziou mail at nicolasgoaziou.fr writes:

 Both `M-S-up' and `M-S-down' work line wise and ignore any structure
 around point. OTOH, `M-up' and `M-down' should do what you want.

BTW the name of the menu item is misleading. C-h C-k M-S-up:

~~
It is bound to M-S-up, menu-bar Org Edit Structure Move
Subtree Up, menu-bar Tbl Row Delete Row.
~~

This is why I thought that M-S-up/down would work on entry + contents -- I
looked in the Emacs menu and saw Move Subtree Up, and I didn't think to
check the docstring (which contradicts the name in the menu by saying,
correctly, Drag the line at point up).

hjh




Re: [O] M-S-up/down on plain lists containing text (or multilevel lists)

2014-11-03 Thread James Harkins
At Mon, 03 Nov 2014 13:48:56 +0100,
Nicolas Goaziou wrote:
 James Harkins jamshar...@qq.com writes:
  BTW the name of the menu item is misleading. C-h C-k M-S-up:
 
  ~~
  It is bound to M-S-up, menu-bar Org Edit Structure Move
  Subtree Up, menu-bar Tbl Row Delete Row.
 
 What improvement are you suggesting then?

Upon further reflection, I think the best would be to bind org-metaup/down to 
the move subtree menu items, rather than org-shiftmetaup. I'm guessing that 
this is the more common use case (because moving a whole subtree doesn't 
destroy the structure of that subtree, while moving a line does), so I think it 
would make more sense to put the more common case in the menu.

hjh





[O] M-S-up/down on plain lists containing text (or multilevel lists)

2014-11-02 Thread James Harkins
In plain lists, if there is indented text underneath a list item, is it 
considered to belong to the list item, or is it just freestanding text?

I'm asking because M-S-up/down doesn't take indented text into account. These 
commands only move the line marked with a list-item indicator (- etc.).

* Heading
  - List item 1
  - List item 2
Indented text
  - List item 3

Position the point on List item 2 and hit M-S-down. You'll get this, which 
seems wrong to me:

* Heading
  - List item 1
Indented text
  - List item 2
  - List item 3

I expected:

* Heading
  - List item 1
  - List item 3
  - List item 2
Indented text

My opinion is that this is a bug, but it's also possible that I don't fully 
understand how org interprets plain lists. It does seem that org has a concept 
of indented text belonging to the list item, because you can use TAB to 
collapse a list item containing indented text, but you can't use it on a list 
item followed by non-indented text.

* Heading
  - List item 1: TAB can fold this item
Indented text
  - List item 2: TAB displays a message in the minibuffer EMPTY ENTRY
Non-indented text
  - List item 3

I also see the same bizarre behavior of M-S-up/down if a list item has a 
sub-list under it.

My org is up-to-date as of 10/15/2014.

hjh



Re: [O] M-S-up/down on plain lists containing text (or multilevel lists)

2014-11-02 Thread James Harkins

On November 2, 2014 4:25:53 PM Nicolas Goaziou m...@nicolasgoaziou.fr wrote:


Actually, it isn't. This is a feature.

Both `M-S-up' and `M-S-down' work line wise and ignore any structure
around point. OTOH, `M-up' and `M-down' should do what you want.


Ah, OK... It would be a bug if there were no function to move a list item 
with its contents. Since there is such a function, just on a different key 
binding, no bug. Thanks.


hjh

Sent with AquaMail for Android
http://www.aqua-mail.com







Re: [O] after-todo-statistics hook for checkboxes

2014-10-17 Thread James Harkins
At Fri, 17 Oct 2014 22:22:20 +0200,
Nicolas Goaziou wrote:
 This is because checkboxes (plain lists) are not related to TODO
 keywords (headlines). There are TODO statistics cookies and checkbox
 statistics cookies. Only the former run a hook once updated.

Thanks for clarifying. I hadn't understood that distinction.

It occurred to me, after I sent my last e-mail, that someone might want one 
action after updating todo statistics and a different action after updating 
checkbox statistics. Using the same hook for both wouldn't be correct in that 
case.

So let me update my issue report/feature request:

-- If there is a hook to do something after updating todo statistics, then it 
would make sense to have a hook for updating checkbox statistics as well. That 
hook should be called with the same arguments (n-done n-not-done) so that the 
user could use one function for both, if desired.

I can do this pretty easily and update the documentation. I don't have FSF 
papers signed, but I'm willing to get that ball rolling as well.

But before spending any time on that, I want to ask if this is okay. I 
understand the objection against pressing org-after-todo-statistics-hook into 
service for checkboxes. If there's an objection against simply *having* a hook 
for checkboxes, I'm afraid I don't understand that.

Thanks for your patience,
hjh





Re: [O] after-todo-statistics hook for checkboxes

2014-10-16 Thread James Harkins
At Thu, 16 Oct 2014 18:39:46 +0200,
Nicolas Goaziou wrote:
 `org-todo-statistics-hook' is used for TODO (i.e. headlines) and
 `org-checkbox-statistics-hook' is used for checkboxes (i.e. lists).
 I see no bug here (although they aren't called with the same arguments,
 but that's another story).

I'm sorry to be a pest, but I did get sent on a wild goose chase by what is 
either a/ faulty behavior or b/ a faulty docstring. The docstring of 
org-after-todo-statistics-hook says: Hook that is called after a TODO 
statistics cookie has been updated. Well, that isn't true. Changing a checkbox 
updates a stats cookie, and the hook is *not* called. And it took more than an 
hour to figure that out. So, for the sake of users dealing with this in the 
future, let's at least fix the docstring then.

It isn't clear to me how to use org-checkbox-statistics-hook or 
org-todo-statistics-hook for my use case. This isn't about alternative ways of 
collecting statistics (org-checkbox-statistics-hook's docstring). I'm willing 
to switch to that, but less willing to trawl through the org sources (again) to 
figure it out. At least, not today.

hjh

For reference, from http://orgmode.org/worg/doc.html#hooks:

org-checkbox-statistics-hook nil

Hook that is run whenever Org thinks checkbox statistics should be updated.
This hook runs even if checkbox rule in
`org-list-automatic-rules' does not apply, so it can be used to
implement alternative ways of collecting statistics
information.


org-todo-statistics-hook nil

Hook that is run whenever Org thinks TODO statistics should be updated.
This hook runs even if there is no statistics cookie present, in which case
`org-after-todo-statistics-hook' would not run.


org-after-todo-statistics-hook nil

Hook that is called after a TODO statistics cookie has been updated.
Each function is called with two arguments: the number of not-done entries
and the number of done entries.

For example, the following function, when added to this hook, will switch
an entry to DONE when all children are done, and back to TODO when new
entries are set to a TODO status.  Note that this hook is only called
when there is a statistics cookie in the headline!

 (defun org-summary-todo (n-done n-not-done)
   Switch entry to DONE when all subentries are done, to TODO otherwise.
   (let (org-log-done org-log-states)   ; turn off logging
 (org-todo (if (= n-not-done 0) DONE TODO







[O] after-todo-statistics hook for checkboxes

2014-10-15 Thread James Harkins
org-after-todo-statistics-hook allows you to do something to a node after its 
statistics cookie got updated. Unfortunately, it does this only for TODO 
subheadings and it doesn't work with checkboxes.

Use case: Grading assignments. Each assignment is a subheading. Each student's 
work for that assignment is a plain list item with a checkbox. When I finish 
grading one of them, I tick off the checkbox. At this point, I want the 
heading's TODO status to change:

- If all items are complete, change it to DONE.
- If there exist both finished and unfinished list items, change it to INPROG.
- If all items are still open, change it to TODO. (This could happen if I 
mistakenly ticked a checkbox and then un-ticked it.)

This should then cascade upward to the parent's statistics, all the way to the 
top level, so I can see at a glance (even with all top-level trees folded) that 
there is something remaining to grade.

I don't want to use subheadings for each student's work, because then my TODO 
agenda views will get cluttered with multiple entries per assignment.

Actually... after a little more poking around, the problem seems to be that 
org-update-checkbox-count refers to no hooks whatsoever. Should it go toward 
the end, here? (Untested.)

  (mapc (lambda (cookie)
  (let* ((beg (car cookie))
 (end (nth 1 cookie))
 (percentp (nth 2 cookie))
 (checked (car (nth 3 cookie)))
 (total (cdr (nth 3 cookie)))
 (new (if percentp
  (format [%d%%] (/ (* 100 checked)
  (max 1 total)))
(format [%d/%d] checked total
(goto-char beg)
(insert new)
(delete-region (point) (+ (point) (- end beg)))
(run-hook-with-args 'org-after-todo-statistics-hook
checked (- total checked))
(when org-auto-align-tags (org-fix-tags-on-the-fly
cookies-list

hjh





Re: [O] after-todo-statistics hook for checkboxes

2014-10-15 Thread James Harkins
On Wed, 15 Oct 2014 19:08:31 +0800
James Harkins jamshar...@qq.com wrote:

 org-after-todo-statistics-hook allows you to do something to a node after its 
 statistics cookie got updated. Unfortunately, it does this only for TODO 
 subheadings and it doesn't work with checkboxes.
 (snip)
 Actually... after a little more poking around, the problem seems to be that 
 org-update-checkbox-count refers to no hooks whatsoever. Should it go toward 
 the end, here? (Untested.)
 
   (mapc (lambda (cookie)
 (let* ((beg (car cookie))
(end (nth 1 cookie))
(percentp (nth 2 cookie))
(checked (car (nth 3 cookie)))
(total (cdr (nth 3 cookie)))
(new (if percentp
 (format [%d%%] (/ (* 100 checked)
 (max 1 total)))
   (format [%d/%d] checked total
   (goto-char beg)
   (insert new)
   (delete-region (point) (+ (point) (- end beg)))
   (run-hook-with-args 'org-after-todo-statistics-hook
   checked (- total checked))
   (when org-auto-align-tags (org-fix-tags-on-the-fly
   cookies-list

After dinner, I tested the change that I had speculated about, and... it works 
exactly correctly.

* TODO Test A [0/2]
** TODO Test B [0/2]
   - [ ] 1
   - [ ] 2
** TODO Test C

C-c C-c on 1 (with my hook function[1]):

* TODO Test A [0/2]
** INPROG Test B [1/2]
   - [X] 1
   - [ ] 2
** TODO Test C

C-c C-c on 2:

* INPROG Test A [1/2]
** DONE Test B [2/2]
   - [X] 1
   - [X] 2
** TODO Test C

So I'm submitting this as a TINYCHANGE patch. Do with it as you will, although 
I will keep using it locally until something better comes along.

hjh

[1]
(defun hjh-org-summary-todo (n-done n-not-done)
  Switch entry to DONE when all subentries are done, to TODO otherwise.
  (let (org-log-done org-log-states)   ; turn off logging
(org-todo
 (if (= n-not-done 0)
 DONE
 (if (= n-done 0) TODO INPROG)

(add-hook 'org-after-todo-statistics-hook 'hjh-org-summary-todo)
From cbb4c589b1ed65152485ea2b687eb54ff7e2e478 Mon Sep 17 00:00:00 2001
From: James Harkins jamshar...@dewdrop-world.net
Date: Wed, 15 Oct 2014 21:32:28 +0800
Subject: [PATCH] Run org-after-todo-statistics-hook when toggling a checkbox

* org-list.el (org-update-checkbox-count): Run
org-after-todo-statistics-hook for each affected cookie.

TINYCHANGE
---
 lisp/org-list.el |2 ++
 1 file changed, 2 insertions(+)

diff --git a/lisp/org-list.el b/lisp/org-list.el
index b1d47c9..2fdda6b 100644
--- a/lisp/org-list.el
+++ b/lisp/org-list.el
@@ -2553,6 +2553,8 @@ With optional prefix argument ALL, do this for the whole buffer.
 		(goto-char beg)
 		(insert new)
 		(delete-region (point) (+ (point) (- end beg)))
+		(run-hook-with-args 'org-after-todo-statistics-hook
+checked (- total checked))
 		(when org-auto-align-tags (org-fix-tags-on-the-fly
 	cookies-list
 
-- 
1.7.9.5



Re: [O] after-todo-statistics hook for checkboxes

2014-10-15 Thread James Harkins

On October 15, 2014 9:45:32 PM Nicolas Goaziou m...@nicolasgoaziou.fr wrote:


See also org-checklist.el in contrib/.


Ok, I'll have a look. Not at my computer now.

I do think this issue qualifies as a bug (albeit minor). The real behavior 
deviates from the documentation (in a way that's difficult to justify 
logically). IMO it should be fixed, or the documentation should explain 
that the after todo statistics hook doesn't work for checkboxes without 
requireing org-checklist.


hjh

Sent with AquaMail for Android
http://www.aqua-mail.com







Re: [O] Sharing: Agenda skip function to remove future-scheduled items

2014-10-14 Thread James Harkins
Sebastien Vauban sva-news@... writes:

 I use the following (tricky) settings, which should 
do what you have in
 mind, if I'm not mistaken:
 
 #+begin_src emacs-lisp
   ;; Don't show scheduled entries in the global 
`todo' list.
   (setq org-agenda-todo-ignore-scheduled 'future)
 
   ;; Don't show entries scheduled in the future in the 
global
   ;; `todo' list (until they are within the warning 
period).
   (setq org-agenda-todo-ignore-deadlines 'near)
 
   ;; Honor `todo' list `org-agenda-todo-ignore...' 
options also
   ;; in the `tags-todo' list.
   (setq org-agenda-tags-todo-honor-ignore-options 
t)
 #+end_src

Interesting. How would I apply those settings to only 
one custom agenda command, while leaving the 
others with the default behavior of showing future 
schedules?

hjh




[O] org-habit for multiple arbitrary days in a week

2014-10-13 Thread James Harkins
I have a task that I want to track using org-habit. I've spent about an hour 
looking through the manual and other sites, but so far the problem remains 
intractable.

With org-habit, it's easy to track something that should be done on one 
particular day of the week: .+1w.

It appears not to be easy to track something that should be done on two 
arbitrary days of the week.

It's easy to schedule something for two specific days of the week using a sexp. 
But, org-habit (for sensible reasons) doesn't support sexps.

I can also add multiple SCHEDULED lines. But org-habit doesn't work well with 
this either.

** TODO Update lesson gradesheet   
:Comp:
   SCHEDULED: 2014-10-13 Mon +1w
   SCHEDULED: 2014-10-17 Fri +1w
   :PROPERTIES:
   :STYLE:habit
   :LOGGING:  TODO MAYBE INPROG MTG | DONE(!) POSTPONED
   :END:

Now, if I mark this item DONE, org-habit moves *both* scheduled dates forward 
to next week, even though 10-17 is still in the future and it's neither needed 
nor desirable to advance it. That is, scheduled dates that are today or in the 
past should move up, while scheduled dates in the future should be left alone. 
I guess the issue with that would be that you couldn't set a task DONE earlier 
than scheduled. That's not an issue for this specific task, but maybe for 
others.

I suppose the worst case is that I could create two Update lesson gradesheet 
entries, but that seems highly inelegant...?

Thanks in advance for any advice.

hjh





Re: [O] org-habit for multiple arbitrary days in a week

2014-10-13 Thread James Harkins
At Mon, 13 Oct 2014 17:56:04 +0200,
Nicolas Goaziou wrote:
  ** TODO Update lesson gradesheet   
  :Comp:
 SCHEDULED: 2014-10-13 Mon +1w
 SCHEDULED: 2014-10-17 Fri +1w
 
 You can't. This is invalid Org syntax (only one scheduled keyword per
 entry).

I see... perhaps it should be filed under wish list to support an arbitrary 
days of week repeater style. One way might be something like 2014-10-13 Mon 
+4d +3d: First advance by 4 days, then by 3 days, then 4 again and so on.

I would call it a low priority enhancement. There might actually be some 
benefit to tracking consistency on the two days separately. But the fact 
remains, if someone needed to treat it as one task that happens on two or three 
arbitrary days during the week (always the same days) and it wouldn't be useful 
for her to split them, org-habit currently does not support this as far as I 
can see.

hjh





[O] Sharing: Agenda skip function to remove future-scheduled items

2014-10-13 Thread James Harkins
I often ask questions, or complain about things (or both at the same time), so 
it's nice to share something.

I was making a block agenda, splitting up tasks by location (loosely inspired 
by GTD). But I realized that I didn't want to see items that are scheduled for 
the future, because this is my agenda view for what tasks are available right 
now. For example, if I have a task to update my grade sheet, it doesn't make 
sense to do that before I've taught the lessons -- so I don't want to see the 
task until it's actually due.

I didn't find a straightforward way to use a property search such as scheduled 
is nil or scheduled  today, but I did (with some false starts) hack up a skip 
function that seems to do the job. So, in the relevant blocks, I have 
(org-agenda-skip-function 'hjh-skip-future-scheduled), and... perfect.

(I'm sure it's not the most efficient, but I found elisp's time comparisons to 
be confusing, and I didn't want to consider time-of-day either. Performance is 
OK for my use.)

hjh

; agenda skip function to remove items scheduled for a future date
(defun hjh-skip-future-scheduled ()
  Skip trees that are scheduled in the future
  (let* ((subtree-end (save-excursion (org-end-of-subtree t)))
 (schedprop (cdr (assoc SCHEDULED (org-entry-properties
 (schedymd (if(stringp schedprop) (substring schedprop 0 10
(if schedymd
(if (string (format-time-string %Y-%m-%d (current-time)) schedymd) 
subtree-end nil)
  nil)))





Re: [O] [ox-latex] How to force ALL captions below their referents?

2014-10-03 Thread James Harkins
On Thu, 02 Oct 2014 18:54:20 +0200
Nicolas Goaziou m...@nicolasgoaziou.fr wrote:

 You mean moving `org-latex-table-caption-above' to
 `org-latex-caption-above' and making sure every block complies to the
 variable?

Sorry for the late reply. I wasn't feeling quite well yesterday.

Something like that would do it, I think. I hesitate about breaking
backward compatibility, but at the same time, I'm hard-pressed to
imagine why one would want captions to be differently placed in the
same document.

I suppose, if somebody needs to move a caption to the top or bottom
overriding the default, it could be an attribute, hypothetically:

#+name: blah
#+caption: blah blah
#+attr_latex: :captionpos t
#+begin_figure
...
#+end_figure

t would put it at the top, :captionpos b at the bottom and
:captionpos nil (or not specified) would use the default from the
configuration variable.

Reasonable?
hjh




[O] [ox-latex] How to force ALL captions below their referents?

2014-10-02 Thread James Harkins
I'm struggling a bit with caption placement in LaTeX export.

In the document I'm working on now, I have:

- Image links, exported as floating figures (by inclusion of a
  caption). ox-latex places the caption at the end of the figure
  environment, so the caption appears below the image.

#+name: fig1
#+caption: blah blah
#+attr_latex: :width 0.75\textwidth
[[./img/blahblah.png]]

\begin{figure}[htb]
\centering
\includegraphics[width=0.75\textwidth]{./img/blahblah.png}
\caption{\label{fig1}blah blah}
\end{figure}

- A figure block containing some figures. The entire block should be
  captioned. ox-latex places a caption first in the figure environment,
  so the caption is on top.

#+name: product1
#+caption: blah blah
#+begin_figure
#+begin_latex
\begin{subfigure}[b]{0.4\textwidth}
\includegraphics[width=\textwidth]{./img/blah1.png}
\end{subfigure} \hfill \begin{subfigure}[b]{0.4\textwidth}
\includegraphics[width=\textwidth]{./img/blah2.png}
\end{subfigure}
#+end_latex
#+end_figure

\begin{figure}
\caption{\label{product1}blah blah}
\begin{subfigure}.. (omitted)
\end{figure}

I don't like the typographical inconsistency. It would be much better,
I think, if I could specify in one place that I want *all* captions
below or above the entity being captioned.

It seems somebody recognized a while ago that this was a problem, and
introduced org-latex-table-caption-above. But this applies only to
tables, not to figure special blocks, nor to source code blocks, and
probably some other cases that I can't think of. Well,  I can customize
org-latex-listings-options to include (captionpos b), but I think
this is not quite ideal because:

a/ image captions always go at the bottom;
b/ table captions can be configured;
c/ listings captions can be configured in a different variable;
d/ many types of captions always go at the top, conflicting with a/.

Is there a plan to deal with this, other than my hacking ox-latex
locally?

hjh






Re: [O] Selected export depending on back-end

2014-09-15 Thread James Harkins
Lars Tveito larstvei at ifi.uio.no writes:

 I am writing a compendium in org, and want to be able to generate slides
 from the same org file.
 
 I'd like to be able to mark some sections for exporting if I'm
 generating slides, and for other formats (like LaTeX and HTML) export
 everything as normal. It would also be nice if I could change the
 #+OPTIONS according to what I'm exporting to.

This worg page doesn't cover exactly the same requirements, but it's closely 
related. Perhaps some of it might give you some hints.

http://orgmode.org/worg/exporters/beamer/beamer-dual-format.html

It doesn't go as far as selecting subtrees independently depending on backend. 
It does show how to include text in the article layout that is omitted from 
the slideshow layout.

A caveat (in general, not only for my approach): the Beamer exporter uses org 
markup somewhat differently from the normal LaTeX exporter. I'd be surprised 
(or impressed!) if you found a way to use the same markup for both the LaTeX 
and Beamer exporters. Very simple markup may be OK; anything complicated may 
be rough.

hjh




Re: [O] Do not export single newlines to latex

2014-06-09 Thread James Harkins
Alexander Baier alexander.baier at mailbox.org writes:

 I am writing a document for which my main export target is latex.  To
 obtain reasonable diffs wrt version control systems, I use one line
 per sentence in addition to =visual-line-mode= as was mentioned in this
 post last November http://thread.gmane.org/gmane.emacs.orgmode/78332.
 
 The problem with this is that these newlines get translated to newlines
 in latex aka \\newline.

I use the LaTeX exporter routinely, and I have never seen this behavior. For
instance,

~~~ org input file
* Headline
The first sentence.
The second sentence.
~~~

~~~ LaTeX export (minus preamble)
\begin{document}

\maketitle
\tableofcontents

\section{Headline}
\label{sec-1}
The first sentence.
The second sentence.
% Emacs 23.3.1 (Org mode 8.2.5f)
\end{document}
~~~

I also checked the customization variables in the org-export-latex group,
and I didn't see anything immediately relevant to newline translation.

So I can think of a couple of possibilities:

- You might have some strange configuration lying around somewhere.
(Additional evidence that you're seeing nonstandard behavior is that none of
the .el files in the org distribution contain the string 'newline', let
alone 'newline'.)

- Or you might be using a newer org than I'm using, in which case you might
be seeing a regression bug. (As far as I know, a single line break in the
input should definitely not translate into \\newline!!)

 I want the export back end to ignore those
 single newlines and only insert \\newline into the latex document
 upon encountering two consecutive newlines in my org-mode file.

Two consecutive line breaks in the input should be copied over directly into
the .tex file. It's then up to LaTeX to interpret this -- per its own
standards -- as a paragraph break. Again, \\newline would be quite
exceptional.

hjh




Re: [O] org-table: Reference *one* cell below a hline?

2014-06-04 Thread James Harkins

On Friday, May 30, 2014 7:50:39 PM HKT, Bastien wrote:

James Harkins jamshar...@gmail.com writes:

I have this:

| Section  | Seconds |
|--+-|
| Theme|  54 |
| 12/8 |  80 |
| 6/8  |  66 |
| Clarinet | 116 |
| Oboe |  89 |
| Bassoon  |  60 |
|--+-|
|  | |

#+TBLFM: @II+1$2=vsum(@I$2..@II$2)


When I run this from master, I get this user-error:

Can't assign to hline relative reference

which implies that hline relative references are not supported here.
Don't you get this error?  What version of Org and Emacs are you running? 


Org-version says Org-mode version 8.2.5f (release_8.2.5f-518-gd74205 @ 
/home/dlm/share/org-mode.git/lisp/) -- the latest commit in my working 
environment is af6f14d9. And, This is GNU Emacs 23.3.1 
(x86_64-pc-linux-gnu, GTK+ Version 2.24.10).


If assigning to an hline-relative reference is not supported, would it be a 
valid feature request?


hjh



Re: [O] DTD prohibited

2014-06-02 Thread James Harkins
Bastien bzg at gnu.org writes:

 
 Hi Alexander,
 
 AW alexander.willand at t-online.de writes:
 
  Now, Word no longer can open the html-documents produced by orgmode. The 
error 
  message is (translated from German): DTD prohibited.
 
 You may want to customize `org-html-doctype' but you probably need to
 digg further to know what DTD is prohibited exactly.

Apparently, all of them:

http://en.m.wikipedia.org/wiki/Document_Type_Definition

Under Security:

~~
An XML DTD can be used to create a denial of service (DoS) attack by defining 
nested entities that expand exponentially, or by sending the XML parser to an 
external resource that never returns.[10]

For this reason, .NET Framework provides a property that allows prohibiting or 
skipping DTD parsing, [10] and recent versions of Microsoft Office 
applications (Microsoft Office 2010 and higher) refuse to open XML files that 
contain DTD declarations.
~~

So, if org ODT export now depends on a DTD, then we'd have to say that we 
don't support exported files that open in MS Word.

hjh




[O] org-table: Reference *one* cell below a hline?

2014-05-29 Thread James Harkins

I have this:

| Section  | Seconds |
|--+-|
| Theme|  54 |
| 12/8 |  80 |
| 6/8  |  66 |
| Clarinet | 116 |
| Oboe |  89 |
| Bassoon  |  60 |
|--+-|
|  | |
#+TBLFM: @II+1$2=vsum(@I$2..@II$2)

After calculation (C-u C-u C-c *), I expected:

| Section  | Seconds |
|--+-|
| Theme|  54 |
| 12/8 |  80 |
| 6/8  |  66 |
| Clarinet | 116 |
| Oboe |  89 |
| Bassoon  |  60 |
|--+-|
|  | 465 |
#+TBLFM: @II+1$2=vsum(@I$2..@II$2)

I got:

| Section  | Seconds |
|--+-|
| Theme|  54 |
| 12/8 |  80 |
| 6/8  |  66 |
| Clarinet | 116 |
| Oboe |  89 |
| Bassoon  |  60 |
|--+-|
| 465  | 465 |
#+TBLFM: @II+1$2=vsum(@I$2..@II$2)

That is, @II+1$2 refers to the *entire row* beneath the second hline, 
rather than only the second column in that row. In other words, org-table 
discards the $2.


That can't be right, can it?

I'm going to add rows below 465, so I can't just use @$2.

This table won't be public, so no big deal *in this case*. But I can 
imagine cases where this would be absolutely wrong behavior.


hjh



Re: [O] New worg page: Publishing beamer slideshows and articles from one source

2014-05-13 Thread James Harkins
Suvayu Ali fatkasuvayu+linux at gmail.com writes:

 A couple of comments about formatting: the
 first two footnotes might be better as links from the text.  I propose
 the attached patch.  If you think this is fine, I'll push it.

Sure, go ahead.

hjh




[O] New worg page: Publishing beamer slideshows and articles from one source

2014-05-09 Thread James Harkins

Hi all,

Some weeks ago, I wrote here about a large project (training materials for 
the SuperCollider audio/music programming language), written entirely in 
org using the Beamer exporter to produce both slideshows and an 
article-format book for the students to use as a reference.


I just put a page up on worg describing the implementation details:

http://orgmode.org/worg/exporters/beamer/beamer-dual-format.html

The project lives at https://github.com/jamshark70/scweek2014 -- note that 
the material itself is under a Creative Commons license, CC-BY-SA. As far 
as I'm concerned, if you want to use any of the Emacs or LaTeX code, knock 
yourself out, but please don't republish the written material in any way 
that's contrary to CC-BY-SA.


Hope this is of use,
hjh




Re: [O] Seeking advice on a worg contribution

2014-05-06 Thread James Harkins

On May 6, 2014 6:15:35 PM Bastien b...@gnu.org wrote:


The formatting looks fine to me!
Please go ahead and push it on Worg.


Ok! I guess I should add some links to the new page too?


Propose a diff against this CSS:
  http://orgmode.org/worg/style/worg.css

adding text properties (like font-size, for example?) to a new
.figure p {...} class.


Ahh... The #+HTML_HEAD is good to know, but *this* is the droid I was 
looking for. Thanks!


hjh

Sent with AquaMail for Android
http://www.aqua-mail.com





Re: [O] Seeking advice on a worg contribution

2014-05-06 Thread James Harkins

On Tuesday, May 6, 2014 6:08:10 PM HKT, Bastien wrote:

If not, what do I have to do to make it do that? (At least, display
the captions slightly smaller.)


Propose a diff against this CSS:
  http://orgmode.org/worg/style/worg.css

adding text properties (like font-size, for example?) to a new
.figure p {...} class.


Here's a patch for worg.css. Captions for source code blocks are rendered 
as label... in the HTML export, with the class name org-src-name. I 
checked in Firefox, and it does change the appearance of the captions.


It's getting kind of late here and I'm running out of steam, so I'll deal 
with the links and pushing the text tomorrow.


hjh
From 67961f8baa13318e846c6b09f38f779ae8665c90 Mon Sep 17 00:00:00 2001
From: James Harkins jamshar...@dewdrop-world.net
Date: Tue, 6 May 2014 22:35:10 +0800
Subject: [PATCH] Add class definition for label.org-src-name for source-block
 captions

---
 style/worg.css |5 +
 1 file changed, 5 insertions(+)

diff --git a/style/worg.css b/style/worg.css
index 2553546..1807f28 100644
--- a/style/worg.css
+++ b/style/worg.css
@@ -926,6 +926,11 @@ content: *** 
 .rss_item a:hover {}
 .rss_date {}
 
+label.org-src-name {
+	font-size: 80%;
+	font-style: italic;
+}
+
 #show_source {margin: 0; padding: 0;}
 
 #postamble {
-- 
1.7.9.5



Re: [O] Seeking advice on a worg contribution

2014-05-05 Thread James Harkins

On Tuesday, May 6, 2014 1:04:38 AM HKT, Eric S Fraga wrote:

On Sunday,  4 May 2014 at 09:38, James Harkins wrote:

I finally finished a draft (attached, and not carefully proofread yet)
of a new worg page to outline what I had to do for a big Beamer
publishing project. 


Interesting and very useful document.  Thanks!


Thanks for taking a look. H:3 is a good idea -- I've done that, and the 
result looks much better.



The HTML code produced by the normal HTML export, which is what I assume
Worg uses, has the captions as special label classes (org-src-name) so
CSS could easily be defined if not there already.


Let's assume I'm an HTML idiot (which is true...). Is it really true, 
according to [1], that the only way to add this CSS class definition is to 
put it in a separate file and link it? It seems to be the only *documented* 
method.


I apologize if this is too basic a question... it's just, I've had a bunch 
of extra computer problems to solve lately and by now, I've pretty much hit 
the limit of web searching and teaching myself technologies that are new to 
me. It would be very helpful to me if someone could provide a for-dummies 
example of the least intrusive way to add one CSS class style. (Otherwise, 
sorry to say -- this is a relatively low priority task for me, so I will 
just submit the document as is and leave it for someone else to beautify.)


Thanks,
hjh

[1] http://orgmode.org/manual/CSS-support.html#CSS-support



[O] Seeking advice on a worg contribution

2014-05-03 Thread James Harkins
I finally finished a draft (attached, and not carefully proofread yet) of a 
new worg page to outline what I had to do for a big Beamer publishing 
project. Could somebody look it over and advise of any formatting problems? 
I guess it should be basically OK; I copied the standard worg header, and I 
stuck to normal org markup throughout.


A specific formatting question: I have several source code blocks with 
captions. The captions are formatted exactly the same as normal paragraphs. 
Will worg use a different CSS style for captions? If not, what do I have to 
do to make it do that? (At least, display the captions slightly smaller.)


Thanks,
hjh#+TITLE: Using Beamer export to produce slideshows and article-style 
handouts from the same org source
#+AUTHOR:James Harkins
#+EMAIL: 
#+DATE:  
#+LANGUAGE:  en
#+OPTIONS:   H:2 num:nil toc:t \n:nil ::t |:t ^:t -:t f:t *:t
#+OPTIONS:   tex:t d:(HIDE) tags:not-in-toc
#+STARTUP:   fold
#+CATEGORY:   worg

* Project overview

The project is training material for a one-week intensive workshop in audio 
synthesis and live-performance control in the SuperCollider programming 
language. The workshop was commissioned by CHEARS, the China 
ElectroAcoustic Resource Survey, and will be given first in Shenyang, PRC.

I wanted to have thorough presentation slides available, for some kinds of 
explanation that are difficult otherwise, and also give a PDF book to 
workshop attendees for their future reference. During the writing process, 
the book became more important, as a way to provide copyright-free 
tutorials for translation into Chinese. The book eventually grew to 237 
pages (with, admittedly, more white space per page than a standard prose 
layout), rendered from 10849 lines of LaTeX code, all of which were 
generated directly by the org Beamer exporter with no manual edits to any 
of the =tex= files.

Achieving that required some ingenuity in both org mode and LaTeX. This 
worg page documents the project's design and implementation.

* Requirements

- One org source to produce slideshows and printed material.
  - Beamer export for both formats.
- Normal /beamer/ document class for slides.
- Document class /article/ for the book, with
  =\usepackage{beamerarticle}= in the preamble.
  - Header files to determine PDF layout.
  - Additional explanatory text that will be omitted from slideshows.
- Use the beamer class option /ignorenonframetext/ for slides.
- Put notes under frame-level headings, with the beamer tag
  =B_ignoreheading=.

- Indexed glossaries of terms, classes and methods, without writing
  cumbersome LaTeX syntax for the glossaries package.
  - Keep glossary definitions in org tables.
  - Convert to LaTeX syntax using emacs-lisp source blocks.
  - Convert only once in the book combining all chapters, but once per 
slideshow.

- Extract captioned source blocks into plain-text files for SuperCollider.
  - =org-element-map= did all the hard work.

* Implementation

** One source: File structure
The LaTeX preamble controls the output format; so, to have different output 
from the same org source, the preamble must be separate from the content. 
Here, we have two headers:

- =slidehead.org=, which specifies the document class /beamer/ with
  the /presentation/ option.
- =printhead2.org=, which specifies the /article/ class and adds the
  /beamerarticle/ package so that the article class can interpret
  beamer formatting commands.

Other formatting differences are implemented here. For instance, inline 
code fragments are colored green in the slides, but remain black in the 
article.

Header files contain nothing specific to any chapter, and content files are 
strictly content, no formatting definitions. Neither of these are exported 
directly. The export files provide the title and author fields, and include 
(=#+INCLUDE:=) the appropriate header and content files. They also include 
the glossary file; details to follow.

#+name: slidehead
#+caption: Primary export options for slideshow format.
#+begin_src org
  ,#+startup: beamer
  ,#+LaTeX_CLASS: beamer
  ,#+LaTeX_CLASS_OPTIONS: [ignorenonframetext,presentation]
  ,#+BEAMER_THEME: default
#+end_src

#+name: printhead
#+caption: Primary export options for article format.
#+begin_src org
  ,#+startup: beamer
  ,#+LaTeX_CLASS: article
  ,#+LaTeX_CLASS_OPTIONS: [a4paper,twoside,11pt]
  ,#+BEAMER_THEME: default
  ,#+LATEX_HEADER: \usepackage{beamerarticle}
#+end_src

#+name: contents
#+caption: Beginning of one of the contents files.
#+begin_src org
  ,#+startup: beamer
  
  ,* Workshop introduction
  ,** Workshop introduction
  ,*** Workshop goals
  , Teach synthesis techniques by experimentation
   - SC lets us take apart synthesizer components, and put them back 
together.
   - SC's /Just-In-Time library/ makes it easy to re-patch components 
interactively.
  , Teach techniques for live control and performance
   - Control by graphic interfaces

Re: [O] org-babel, lilypond, tables

2014-05-02 Thread James Harkins
Steven Arntson steven at stevenarntson.com writes:

 I'm wondering if someone could tell me if this idea is impossible. I'm
 trying to find a way to leverage org-tables in a document containing
 lilypond markup for a piano part such that both staves occupy the same
 line, visually (instead of the lefthand notes occupying the top of the
 doc and the righthand notes occupying the bottom). Right now I'm
 accomplishing this with a vertical split in the buffer, which works, but
 is clunky.

I'm quite sure you'll have to write custom emacs-lisp for this.

I'd suggest not using tables, though. It looks fine when
you have only notes, but as soon as you need an override
(and, in piano music, you *will*, sooner or later), the table
will become very wide and you'll lose the advantage
of seeing both columns at once.

I'd probably use plain lists, one item per staff. You could
even nest lists for passages of temporary polyphony:

** Bar 1
   - ... right hand notes...
   - Poly
     - ... left hand voice 1 notes...
     - ... left hand voice 2 notes...

It'll take some extra lisp code to parse all this, but it
could work. I have a sneaky feeling, though, that more
complex notation requirements may become
inconvenient.

hjh







[O] How to test a draft of a new worg page?

2014-03-29 Thread James Harkins

Hi,

I just searched worg for test a new worg file, but the results seemed 
irrelevant to my question, so...


As promised, I'm writing up my workflow for the big workshop project. I've 
cloned worg, saved my (in progress) org file under exporters/beamer. Now 
I'd like to see what my page will look like *without* having to push 
anything.


I assume I need to specify the worg CSS and perhaps some other export 
properties, but the details are not easy to find and I don't care to guess 
at the moment.


Can somebody explain *really* how to contribute to worg?

Thanks,
hjh



Re: [O] Org is awesome

2014-03-24 Thread James Harkins
On Mar 25, 2014 3:05 AM, chandan chandanrm...@gmail.com wrote:
 Can you please post a link to the sources? I would most probably use
 it as a reference for generating different parts of any documents that
 I would create.

Not just yet.

As I said in the email that you quoted, I'm working on a worg page to
explain the project's implementation. That page will include a link to the
sources. I would rather not publish the link just now, because then I would
have to answer questions about it by email, and many of those questions are
likely to be answered in the worg page -- redundant effort.

So, just be patient -- it'll happen, but not until project documentation is
ready.

hjh


Re: [O] HTML export is using the wrong browser

2014-03-24 Thread James Harkins
On Mon, Mar 24, 2014 at 4:40 PM, Eric S Fraga e.fr...@ucl.ac.uk wrote:
 Off topic, sort of, but on Debian, as root:

   update-alternatives --config sensible-browser

 will allow you to change the default.

In my case, this was not successful.

http://ubuntuforums.org/showthread.php?t=2212948

As shown in this question, Firefox is already the default in
update-alternatives, but the alternative that it consistently chooses
is *not* the default. This makes me think that the alternatives system
is perhaps poorly designed.

Changing the default in org-file-apps to firefox %s for HTML -- that
definitely works, by bypassing sensible-browser altogether. Thanks,
Bastien, for the tip.

hjh



Re: [O] Org is awesome

2014-03-24 Thread James Harkins
On Mar 22, 2014 3:52 PM, Bastien b...@gnu.org wrote:

 James Harkins jamshar...@gmail.com writes:

  After 243 commits to a constellation of org files, producing 10849
  lines of LaTeX code from the Beamer exporter, which render into 229
  pages of beamerarticle print-ready material, including 156 captioned
  code listings (and a handful of un-numbered ones) and 27 pages of
  fully indexed glossary entries (whose LaTeX code comes from
  emacs-lisp source blocks processing org tables), I think I'm in a
  position to state with confidence:

 Nice use-case !

  ORG IS AWESOME.

 Tell it to the world with a blog entry :)

I've started on a worg page to describe the project's design. That's lower
priority than some other projects, though, might take awhile.

For those who wanted to see the article, a current draft is here:
http://ubuntuone.com/2uszkV2PDUuSgZAtnXwXzZ -- though the subject (audio
synthesis and real-time control) is likely to be esoteric for most.

hjh


[O] HTML export is using the wrong browser

2014-03-23 Thread James Harkins

OK, org is awesome, but sometimes it drives you crazy.

I have just lost an hour this morning trying to figure out how to convince 
HTML export to open the exported file in Firefox, rather than Chrome.


I noticed that C-c C-e h o was running sensible-browser, and after half 
an hour's completely wasted effort trying to understand the 
update-alternatives system, the only thing I know is that Chrome's priority 
in the system is 200 while Firefox is 40. That explains why 
sensible-browser is choosing Chrome. But I can't find any example of a 
command that will change the priority of an existing link.


So then I started poking around org options. I found that C-c C-o on an 
http hyperlink goes through browse-url, and I can configure 
browse-url-generic-program to Firefox, and C-c C-o does open such links in 
Firefox. Okay... but, C-c C-e h o *still* uses sensible-browser and opens 
it in the wrong program.


I opened the complete org manual (all on one page) and searched the page 
for browser. There is NO help anywhere in this document about the browser 
to use for HTML export.


So then I found:

(?o As HTML file and open
(lambda (a s v b)
  (if a (org-html-export-to-html t s v b)
(org-open-file (org-html-export-to-html nil s v b)))

And, looking over the definition of org-open-file, and realizing I've spent 
*a whole hour* on this problem that should be a simple matter of setting 
ONE option, I conclude... this is way too much of a puzzle. So I give up.


This should be a simple thing, so... can somebody please tell me a simple 
way to configure this?


(Yes, I am frustrated.)

hjh



[O] Org is awesome

2014-03-21 Thread James Harkins
After 243 commits to a constellation of org files, producing 10849 lines of
LaTeX code from the Beamer exporter, which render into 229 pages of
beamerarticle print-ready material, including 156 captioned code listings
(and a handful of un-numbered ones) and 27 pages of fully indexed glossary
entries (whose LaTeX code comes from emacs-lisp source blocks processing
org tables), I think I'm in a position to state with confidence:

ORG IS AWESOME.

Thanks to all the developers is insufficient.

hjh


Re: [O] HTML table export options essentially undocumented

2014-03-19 Thread James Harkins
On Mar 18, 2014 4:45 PM, Nicolas Goaziou n.goaz...@gmail.com wrote:
 Did you try column groups?

   (info (org) Column groups)

 It is not back-end specific.

No, I hadn't... I was in a rush and trying to do something that I thought
would be simple (and just a quick and dirty one-off export). Even given
more time, I'm not sure I would have thought to look in the tables section.

It may be useful to link to this from the page on tables in HTML export,
then.

hjh


[O] HTML table export options essentially undocumented

2014-03-17 Thread James Harkins

The documentation here seems rather un-detailed.

http://orgmode.org/manual/Tables-in-HTML-export.html#Tables-in-HTML-export

What I wanted to do was to have vertical rules between all columns, but not 
horizontal rules. Neither this section of the documentation, nor the 
docstring for org-html-table-default-attributes, provide any details on how 
to do this.


It's a rather busy day and I'm not in the mood to scour through the elisp 
sources, so, could someone please enlighten (and fix the docs)?


hjh



Re: [O] Bad footnotes when including org files

2014-03-15 Thread James Harkins
Xavier Garrido xavier.garrido at gmail.com writes:

 
 Hi Orgers,
 
 I am having some troubles with several org files that I want to include 
 into one general org file. To do that I use the #+INCLUDE: keywords and 
 actually, everything is working well until I add some footnotes in both 
 files. Let me show you a minimal example where the footnote numbering is 
 getting weird
 
 When I export to LaTeX the latest file, I get two footnotes with the 
 same number. The problem can be solved by changing the label of the 
 second footnote to [fn:2] but it means that I have to reorganize and 
 reorder footnotes within all the org files I will include. I am 
 wondering if it is possible to run, for example, 
 =org-footnote-renumber-fn:N= function when including files in such way 
 the user will not have to take care footnote labels.

I had exactly this problem in a big project. Poking around the customization
group org-footnote, I found:

Org Footnote Auto Label: Value Menu Create a random label
   State: SAVED and set.
   Non-nil means define automatically new labels for footnotes.
   Possible values are:
   
   nilPrompt the user for each label.
   t  Create unique labels of the form [fn:1], [fn:2], etc.
   confirmLike t, but let the user edit the created value.
  The label can be removed from the minibuffer to create
  an anonymous footnote.
   random  Automatically generate a unique, random label.
   plain  Automatically create plain number labels like [1].

I switched to random labels, and no problem since then.

I don't find any evidence of a function that will automatically switch
existing footnotes to random IDs, though, and I'm afraid I'm short of time
this morning. It should be possible, but I guess nobody has done it.

But, do set the custom var to use random labels. It will prevent the problem
for all new footnotes.

hjh




Re: [O] Insert TODO Item at Bottom

2014-03-13 Thread James Harkins
Esben Stien b0ef at esben-stien.name writes:

 Hmm, to insert the subtree at the end of the parent subtree is not what
 I needed. I need a way to insert the new TODO at the bottom of inside
 the current node.
 
 F.ex take this tree: 
 
 ** foo
 *** TODO 1
 *** TODO 2
 *** TODO 3
 
 If I stand on foo and hit a key combination, I want to insert a new
 TODO at the bottom of the current node, so that it becomes TODO 4
 
 Any way to do this?

I'm not sure if this has changed in a more recent version (I'm on org 8.2.3,
I think), but in my environment, C-RET on a headline inserts a new headline
at the same level *and* skips over any subheadings at lower levels. That is:

** Headline (Point is here)
*** TODO 1
*** TODO 2

If I hit C-RET with the point on the indicated line, then I get:

** Headline
*** TODO 1
*** TODO 2
** (Point is here)

And from here, I need only to type M-right (demote the heading) and
S-right (add TODO), producing:

** Headline
*** TODO 1
*** TODO 2
*** TODO (Point is here)

If I'm not mistaken, that matches the request: I have a new TODO headline,
one level below the headline where I started, and after all of the existing
subheadings.

Including modifier keys, that's six keystrokes: C-RET M-right S-right,
which hardly seems onerous enough to arouse much interest in various
combinations of C-u with other commands. My brain is already full. I'd
rather use combinations of simple commands I already know. (But I guess this
violates one of org-mode's governing principles: If you need three commands
to do it, why, we can cut that down to one command by adding umpteen
modifiers somewhere. :-p )

For myself, I'll stick with the Occam's Razor solution...
hjh





[O] org-element-map no-recursion argument?

2014-01-29 Thread James Harkins
I've written some emacs-lisp using org-element-map to iterate over source 
code blocks in an org buffer and insert them into another buffer, including 
a listing number and caption (so it's different from tangling).


I was just trying to tweak it to ignore source code blocks in a comment 
section.


More specifically -- I had moved some material into a Removed subtree 
(with a tag noexport). This subtree contains some source blocks, but I 
want my function to ignore these.


I thought I could wrap the entire Removed section in #+begin/end_comment, 
and then tell org-element-map to skip comment blocks for recursion.


(org-element-map tree 'src-block (lambda (element) ...)
 nil nil 'comment)

But this has no effect. I guess the src-block filter erases the distinction 
between live and commented sections.


I can work around it by commenting out the captions, but it would be nicer 
to have an entire off-limits section of the document.


hjh



[O] Conditional source-block execution based on LaTeX document class?

2014-01-26 Thread James Harkins
Just ran into something that I'm really not sure how to handle. I thought I 
could handle it with export filters, but actually it involves babel, and 
that makes it more involved than I initially suspected.


I'm working on a large project involving five beamer presentations (one per 
day), and the sources for these will be combined into one massive 
beamerarticle document for the workshop attendees' reference. (If they want 
to print it out, it will look okay, but I won't encourage the killing of 
trees -- actually my early versions of the article layout looks fine on a 
tablet.)


I'm using LaTeX's glossaries package for indexed references at the end. 
But, \newglossaryentry is really annoying. So I made some org tables for 
the glossary entries and I wrote some emacs-lisp src blocks to convert them 
into the right syntax for LaTeX. So here's the problem...


In the individual beamer slideshows, I need to put the \newglossaryentry 
commands within a frame (because I'm also using beamer's 
ignorenonframetext class option, so that I can have text that appears 
only in the article but not the slides). That is (if I have H:3):


*** Some frame
 A block
Some text

#+call: makegloss
#+results: makegloss

... then the results of the src block to go into the frame, and then beamer 
doesn't ignore them and everything works.


For the final article, I need a structure like this:

#+options: H:4

* Day 1
#+include 01-intro/01-contents.org

* Day 2
#+include 02-synthesis/02-contents.org

And the problem is, if the #+call commands are replicated in each 
0x-contents file, then I will have redundant \newglossaryentry commands in 
the LaTeX output (in the end, multiplied five times).


If there's no other way, I could live with that, but ideally, I'd like to 
be able to put the #+call lines into the master file for the article, and 
then be able to suppress their execution in the #+includes. Ideally, this 
would be automatic based on the LaTeX document class.


Any way to do this? I suppose, at worst, I can just put all of the #+call 
lines in, and simply say no to the ones I don't want in the final 
compilation.


Thanks,
hjh



[O] #+include doesn't export anything?

2014-01-26 Thread James Harkins
I had just asked a question about src-blocks in exports, but things just 
got a little weirder.


Below is my export file, referring to the master source for day 1. It 
exports *nothing* from 01-contents.org. I get all the stuff from the 
header, but 01-contents.org may as well not be there.


Is this a wrong approach?

What's strange is that babel asks me if I want to execute #+call lines that 
are only in 01-contents.org, but ox-beamer ignores the lot.


??

I'll find some workaround, but this is highly inconvenient.

hjh


~~
#+startup: beamer

#+TITLE: SuperCollider Week, Day 1 \\ Introductory SC, Synthesis and 
Sequencing

#+DATE: \today
#+AUTHOR: H. James Harkins
#+EMAIL:

#+INCLUDE: ../slidehead.org
#+include: ../glossary.org

#+include: ./01-contents.org
~~



Re: [O] #+include doesn't export anything?

2014-01-26 Thread James Harkins

On Monday, January 27, 2014 12:36:22 AM HKT, Nicolas Goaziou wrote:

What happens if you call (org-export-expand-include-keyword) in that
buffer? Are the resulting changes valid?


(Aside: This was challenging at first, b/c 
org-export-expand-include-keyword is not interactive.)


Ah... now I see it.

#+INCLUDE: ../slidehead.org
#+include: ../glossary.org

#+include: ./01-contents.org

The last heading in glossary.org is :noexport: -- then, the include for 
01-contents.org thinks that it should go underneath the last heading to be 
created in glossary.org. So, everything that was a top level heading in 
01-contents.org becomes a second-level heading, underneath a :noexport: 
tag.


So, that pretty much blows my file structure to smithereens.

I suppose it's actually debatable. But, I would have assumed that the last 
heading level in an included file would be unwound before including the 
next file. That is:


~~
#+include something.org
* Heading
#+include something-else.org
~~

... would denote everything in something-else.org by one level, while...

~~
#+include something.org

#+include something-else.org
~~

... would leave something-else.org's levels untouched, regardless of the 
headline levels in something.org.


Hm. It looks like my whole idea about structuring this project was badly 
conceived from the beginning :(  either that, or the include mechanism is 
not thoroughly thought-through.


hjh



Re: [O] #+include doesn't export anything?

2014-01-26 Thread James Harkins
On Jan 27, 2014 12:52 AM, Nicolas Goaziou n.goaz...@gmail.com wrote:
 See (info (org) Include files), in particular :minlevel keyword.

Oh... RTFM *sheepish grin*

Workflow for using org:

1. Ask/complain about something on the mailing list.

2. Get a reference to the manual.

3. Find out that org already does that.

Sorry for the complaining tone... I was inches away from declaring Day 1 of
the workshop finished, then ran into this.

Thanks again!

hjh


Re: [O] Conditional source-block execution based on LaTeX document class?

2014-01-26 Thread James Harkins

On Monday, January 27, 2014 1:35:13 AM HKT, Eric Schulte wrote:

Hi James,

Maybe you could do something like the following...

#+name: export-hdr-arg-backend-dep
#+begin_src emacs-lisp
(message do stuff)
#+end_src

#+call: export-hdr-arg-backend-dep() :exports (if (eq 
org-export-current-backend 'beamer) none results)


Ah... that's really cool. I hadn't realized you could run lisp in the 
header arguments.


I couldn't check the current export backend because the org markup uses 
beamer-specific features. The way to export the article format is to use 
the beamer backend, but with document class = article and a 
\usepackage{beamerarticle} line in the preamble.


But, I figured out a little hack: to put this at the top of the container 
file:


# ## top of slide container
#+name: set-slide-flag
#+begin_src emacs-lisp :exports results :results value latex
(setq hjh-exporting-slides 't)

#+end_src

# ## top of article container
#+name: set-slide-flag
#+begin_src emacs-lisp :exports results :results value latex
(setq hjh-exporting-slides nil)

#+end_src

Then I can test this variable in all of the #+calls.

It seems to be working. When I export from the slide container file, it 
runs each #+call once. When I export from the article container (where I 
have the calls in the container), it runs the calls for the article 
container but it does *not* execute the calls redundantly for the two slide 
show source files I have now.


Thanks for the tip -- that's working a treat!

I think I owe it to the org community to write up this workflow, after the 
project is over. The help from Nicolas, you and others has been invaluable.


hjh



[O] Table sorting on two or more columns?

2014-01-18 Thread James Harkins
Is there an existing org function to sort a table based on more than one 
column? E.g., given:


| Type | Term  | Description  |
|--+---+--|
| Filt | LPF   | Butterworth lowpass filter   |
| Filt | HPF   | Butterworth highpass filter  |
| Osc  | Pulse | Band-limited pulse wave oscillator   |
| Osc  | LFSaw | Non-band-limited sawtooth oscillator |
| Osc  | Saw   | Band-limited sawtooth oscillator |

... is there a variant of C-c ^ that will group the Types together in 
alphabetical order, and then sort each group of Terms?


hjh



Re: [O] Fwd: [bug] Beamer export fails in current master

2014-01-18 Thread James Harkins
On Jan 19, 2014 12:32 AM, Nicolas Goaziou n.goaz...@gmail.com wrote:
 I cannot reproduce the problems. Something seems to go wrong with your
 `avl-tree' library. Is it loaded properly? Do you use an old Emacs?

I see -- so, when I said it's broken in my environment, the operative words
are in my environment.

I'm on emacs 23.something (whatever apt-get serves up for Ubuntu 12.04).
That could be the problem.

I'm in the middle of a big presentation/publishing project, so I think for
now I should heed the usual advice not to muck about with a working
configuration while in production. Emacs 23 + org 8.2.4 is working fine for
me, so I'll stay with that until this project is finished. *Probably* the
upgrade would be fine, but if it's not, I couldn't afford the downtime to
fix it.

I'll add a TODO to test an emacs upgrade later.

Thanks for testing!
hjh


Re: [O] Fwd: [bug] Beamer export fails in current master

2014-01-17 Thread James Harkins

On Thursday, January 16, 2014 5:29:32 AM HKT, Nicolas Goaziou wrote:

I see nothing wrong in that process. Can you still reproduce the error
with latest Org?


Quite strange. I just moved up to current master -- Org-mode version 
8.2.5f (release_8.2.5f-518-gd74205 @ /home/dlm/share/org-mode.git/lisp/) 
-- HEAD is:


~~
commit d74205b0f9e0707642c7b81e1c33a4a059323bea
Author: Nicolas Goaziou n.goaz...@gmail.com
Date:   Fri Jan 17 23:05:20 2014 +0100

   ox-koma-letter: Improve defcustom docstrings
~~

Now, with a simple org file, just a few frames, C-c C-e l B finishes 
successfully. With my full presentation, I get a different error [1].


Moreover, I wanted to see if the :noexport: tags had something to do with 
it, so I hit shift-tab twice to show all and then M-S-5 :noexport: RET RET, 
then ! to replace all. It completed the second replacement (third 
top-level heading) and threw another error related to org-element--cache 
[2].


You can get my files at:

https://github.com/jamshark70/scweek2014

The one I was trying to export is ./shows/01-intro/01-contents.org. To 
produce the .tex file, you'll also need ./shows/slidehead.org and 
./shows/glossary.org.


It's not especially pressing -- I can keep using org 8.2.4. But, for 
whatever reason, org element cache seems to be broken in my environment.


hjh

[1]
Debugger entered--Lisp error: (wrong-number-of-arguments #[(tree data) 
\303\304H	\204
[tree cl-struct-avl-tree--tags data avl-tree--do-delete 0 error 
avl-tree--cmpfun accessing a non-avl-tree- 2 avl-tree--dummyroot 
accessing a non-avl-tree- 1] 5 
(/usr/share/emacs/23.3/lisp/emacs-lisp/avl-tree.elc . 14229)] 4)
 avl-tree-delete([cl-struct-avl-tree- nil nil ... 0] [nil nil ... 0] 
... 0] [nil [nil nil ... 0] ... 1] ... 0] nil nil 0] 
org-element--cache-compare] (keyword (:key EMAIL :value  :begin 130 
:end 141 :post-blank 1 :post-affiliated 130 :parent nil)) nil t)
 (cond ((not data) (throw ... t)) (( ... end) nil) (t (setq end ...) 
(avl-tree-delete org-element--cache data nil t)))
 (let ((node ...) data) (while node (let* ... ...)) (cond (... ...) (... 
nil) (t ... ...)))

 (while (let (... data) (while node ...) (cond ... ... ...)))
 (let ((beg ...)) (while (let ... ... ...)))
 (let ((inhibit-quit t) (offset ...) (end ...)) (let (...) (while ...)) 
(unless (zerop offset) (catch ... ...)))

 (catch (quote escape) (let (... ... ...) (let ... ...) (unless ... ...)))
 (progn (catch (quote escape) (let ... ... ...)) 
(org-element--cache-cancel-changes))
 (if (org-element--cache-pending-changes-p) (progn (catch ... ...) 
(org-element--cache-cancel-changes)))
 (when (org-element--cache-pending-changes-p) (catch (quote escape) (let 
... ... ...)) (org-element--cache-cancel-changes))
 (save-current-buffer (set-buffer buffer) (when 
(org-element--cache-pending-changes-p) (catch ... ...) 
(org-element--cache-cancel-changes)))
 (with-current-buffer buffer (when (org-element--cache-pending-changes-p) 
(catch ... ...) (org-element--cache-cancel-changes)))

 (progn (with-current-buffer buffer (when ... ... ...)))
 (if (buffer-live-p buffer) (progn (with-current-buffer buffer ...)))
 (when (buffer-live-p buffer) (with-current-buffer buffer (when ... ... 
...)))

 org-element--cache-sync(#buffer 01-contents.org2)
 (progn (org-element--cache-sync (current-buffer)))
 (if (and (not ignore-changes) (org-element--cache-pending-changes-p)) 
(progn (org-element--cache-sync ...)))
 (when (and (not ignore-changes) (org-element--cache-pending-changes-p)) 
(org-element--cache-sync (current-buffer)))
 (progn (when (and ... ...) (org-element--cache-sync ...)) (if (not ...) 
(gethash key org-element--cache-objects) (let ... ...)))
 (if (and org-element-use-cache org-element--cache) (progn (when ... ...) 
(if ... ... ...)))
 (when (and org-element-use-cache org-element--cache) (when (and ... ...) 
(org-element--cache-sync ...)) (if (not ...) (gethash key 
org-element--cache-objects) (let ... ...)))

 org-element-cache-get(3203)
 (let* ((cached ...) (begin ...)) (cond (... ... ... ...) (... ...) (... 
... ... ...) (t ...)))
 (let ((origin ...) element next) (end-of-line) (skip-chars-backward  
	\n) (cond (... ...) (... ... ...)) (goto-char origin) (let* (... ...) 
(cond ... ... ... ...)) (let (... parent special-flag) (while t ... ... 
...)))
 (save-restriction (widen) (let (... element next) (end-of-line) 
(skip-chars-backward  
	\n) (cond ... ...) (goto-char origin) (let* ... ...) (let ... ...)))
 (save-excursion (save-restriction (widen) (let ... ... ... ... ... ... 
...)))
 (org-with-wide-buffer (let (... element next) (end-of-line) 
(skip-chars-backward  
	\n) (cond ... ...) (goto-char origin) (let* ... ...) (let ... ...)))
 (catch (quote exit) (org-with-wide-buffer (let ... ... ... ... ... ... 
...)))

 org-element-at-point()
 (progn (org-element-at-point))
 (unwind-protect (progn (org-element-at-point)) (set-match-data 
save-match-data-internal (quote evaporate)))
 (let ((save-match-data-internal ...)) 

Re: [O] Extract source code /with/ captions

2014-01-17 Thread James Harkins
Nick Dokos ndokos at gmail.com writes:

 Try:
 
 --8---cut here---start-8---
  (defun hjh-print-src-blocks ()
  Iterate src blocks from org-element and print them to *Messages*.
  (interactive)
  (let ((tree (org-element-parse-buffer)))
(org-element-map tree 'src-block
  (lambda (element)
   (message \n\n\nELEMENT:)
   (print (substring-no-properties (plist-get (car (cdr element))
:caption)))
 --8---cut here---end---8---

Finally coming back to this.

It seems that the actual string-with-properties may be nested at different
levels within the :caption object. I tried Nick's version with a different
test file, and it failed with a wrong type error.

The while below seems to work, though I suppose it could throw an error
under some circumstances.

Is there an easier way to locate the real stringy-thingy in the middle of
the structure, when you can't predict exactly what the structure will be?

(defun hjh-print-src-blocks ()
  Iterate src blocks from org-element and print them to *Messages*.
  (interactive)
  (let ((tree (org-element-parse-buffer)))
(org-element-map tree 'src-block
  (lambda (element)
(setq element (car (cdr element)))
(let ((caption (plist-get element :caption)))
  (while (and caption (not (stringp caption)))
(setq caption (car caption)))
  (message \n\n\nCAPTION:)
  (print (substring-no-properties caption)))

hjh




Re: [O] Extract source code /with/ captions

2014-01-17 Thread James Harkins
For posterity, this is doing what I want.

It's with some shock that I note, I'm actually starting to understand LISP.

hjh


(defun hjh-get-string-from-nested-thing (thing)
  Peel off 'car's from a nested list until the car is a string.
  (while (and thing (not (stringp thing)))
(setq thing (car thing)))
  thing
)

(defun hjh-src-blocks-to-string ()
  Iterate src blocks from org-element and add them to a string.
  (interactive)
  (let ((tree (org-element-parse-buffer))
(string )
(counter 0))
(org-element-map tree 'src-block
  (lambda (element)
(setq element (car (cdr element)))
(let ((caption (hjh-get-string-from-nested-thing (plist-get element 
:caption)))
  (source (hjh-get-string-from-nested-thing (plist-get element 
:value
  (when caption
(setq counter (1+ counter))
(setq string (concat string (format /*
Listing %d. %s
 */

%s\n\n
  counter
  (substring-no-properties caption)
  (substring-no-properties 
source
string))

(defun hjh-src-blocks-to-buffer ()
  Put all the captioned source blocks from a buffer into another buffer.
  (interactive)
  (let* ((contents (hjh-src-blocks-to-string))
 (bufpath (buffer-file-name))
 (newname (concat (file-name-sans-extension bufpath) .scd))
 (bufname (file-name-nondirectory newname))
 (newbuf (get-buffer-create bufname)))
(with-current-buffer newbuf
  (erase-buffer)
  (insert contents)
  (set-visited-file-name newname))
(switch-to-buffer-other-window newbuf)))





[O] Using babel to generate org syntax for export

2014-01-13 Thread James Harkins

Hi,

Got a question that's not easy to search online.

I want to use an org table to define glossary entries for LaTeX. I have my 
table[1], and I have a src block[2] that reads the table and produces the 
right syntax[3]. This is already pretty helpful -- I can C-c C-c the source 
block and manually copy/paste the generated syntax into the org file that I 
will then export. 


But... I want babel to do that for me automatically. I'm almost there, but:

The resulting string is put into a verbatim environment -- which is not 
right for this case. I need the string to be inserted as if it were org 
syntax (#+LATEX_HEADER and all) that I typed by hand, and then ox-latex 
would process it like any other LaTeX header.


I've tried both :results value and : results output but the verbatim 
environment is always there.


A quick glance at ob-core.el seems to indicate that this behavior is 
hardcoded. That's... frustrating: spend 2-3 hours to get this far and then 
find that babel says, No, you can't do that, actually.


So, I'm at the end of the energy I have left to test various approaches. 
What's the best approach? I'm guessing, apply a filter to remove the 
begin/end verbatim lines. But maybe there's a magic switch in babel?


For reference:

[1] input file, nearly minimal example
[2] actual result of C-c C-e l L (removing preamble)
[3] desired result

hjh

[1]
* UGens   :noexport:
#+name: ugens01
| Type | Term | Description | Arguments   |
|--+--+-+-|
| Osc  | SinOsc   | Sinewave oscillator | freq, phase |

#+name: makegloss
#+begin_src emacs-lisp :var tbl=ugens01 :exports results :results value
(let ((str ))
 (pop tbl)
 (pop tbl)
 (while tbl
   (let ((item (car tbl)))
 (pop item)
 (setq str (concat str (format 
\\newglossaryentry{%s}{type=ugen,name={%s},description={%s. Inputs: 
(%s)}}\n

   (car item)
   (pop item)
   (pop item)
   (car item
 (setq tbl (cdr tbl
 str)
#+end_src

* Test
#+call: makegloss
#+results: makegloss

[2]
\section{Test}
\label{sec-1}
\begin{verbatim}
\newglossaryentry{SinOsc}{type=ugen,name={SinOsc},description={Sinewave 
oscillator. Inputs: (freq, phase)}}

\end{verbatim}

[3]
\section{Test}
\label{sec-1}
\newglossaryentry{SinOsc}{type=ugen,name={SinOsc},description={Sinewave 
oscillator. Inputs: (freq, phase)}}





Re: [O] Using babel to generate org syntax for export

2014-01-13 Thread James Harkins
On Jan 14, 2014 11:41 AM, Eric Schulte schulte.e...@gmail.com wrote:
 Have you tried :results raw or :results org, take a look at the
 manual page on the results header argument.

Missed that - thanks for the pointer. I looked pretty carefully at the page
on Evaluating code blocks, which says basically nothing about controlling
the result format (and also doesn't link to the header argument that would
explain it).

raw is probably the one I need. Thanks again.

hjh


  1   2   3   4   >