Re: [O] Multiple bibliography files with ox-bibtex and html export

2016-09-27 Thread Thibault Marin

Hi, sorry for the delay, I was away for a while.

> I'd suggest 2 :) But not that I don't use this feature.
>
> It should be easy to unify the code: something along the lines of starting 
> the process, and then looping over bibtex files and sending them one by one 
> to bibtex2html's standard input.
>
> Cheers,
> Clément.

Please find attached a tentative patch using `process-send-string'.  It seems to
work on my test cases, but I don't know how to wait for the bibtex2html process
to finish before processing the output.  I am currently using a while loop (see
l. 96 of the patch or l. 256 of the patched ox-bibtex.el) combined with a
sentinel changing the while condition upon completion.  This seems suboptimal
but I don't know how to achieve that more elegantly.

I still have a few questions:
1. How can I wait on the subprocess to complete after all the bib files have
   been passed via stdin?
2. Why is this approach preferred over concatenating bib files and delegating
   processing to the bibtex2html executable?

Thanks for the help,
thibault

>From 66edb29f79ddcdf90a47cd8626fb9f04167f5997 Mon Sep 17 00:00:00 2001
From: thibault 
Date: Tue, 27 Sep 2016 22:36:57 -0500
Subject: [PATCH] ox-bibtex.el: Support multiple bib files in HTML export

* contrib/lisp/ox-bibtex.el (org-bibtex-process-bib-files): Pass
input bibliography files to asynchronous bibtex2html process.
---
 contrib/lisp/ox-bibtex.el | 69 +--
 1 file changed, 49 insertions(+), 20 deletions(-)

diff --git a/contrib/lisp/ox-bibtex.el b/contrib/lisp/ox-bibtex.el
index 56dec38..ca7839f 100644
--- a/contrib/lisp/ox-bibtex.el
+++ b/contrib/lisp/ox-bibtex.el
@@ -188,18 +188,26 @@ Return new parse tree."
   (lambda (keyword)
 	(when (equal (org-element-property :key keyword) "BIBLIOGRAPHY")
 	  (let ((arguments (org-bibtex-get-arguments keyword))
-		(file (org-bibtex-get-file keyword))
+		(files (split-string (org-bibtex-get-file keyword) ","))
 		temp-file
 		out-file)
 	;; Test if filename is given with .bib-extension and strip
-	;; it off. Filenames with another extensions will be
+	;; it off. Filenames with another extensions will be
 	;; untouched and will finally rise an error in bibtex2html.
-	(setq file (if (equal (file-name-extension file) "bib")
-			   (file-name-sans-extension file) file))
-	;; Outpufiles of bibtex2html will be put into current working directory
-	;; so define a variable for this.
-	(setq out-file (file-name-sans-extension
-			(file-name-nondirectory file)))
+	(setq files
+		  (mapcar
+		   (lambda (file)
+		 (if (equal (file-name-extension file) "bib")
+			 (file-name-sans-extension file)
+		   file))
+		   files))
+	;; Output files of bibtex2html will be put into current
+	;; working directory so define a variable for this.
+	(setq out-file
+		  (if (> (length files) 1)
+		  (concat (buffer-file-name) "-combined")
+		  (file-name-sans-extension
+		   (file-name-nondirectory (car files)
 	;; limit is set: collect citations throughout the document
 	;; in TEMP-FILE and pass it to "bibtex2html" as "-citefile"
 	;; argument.
@@ -216,18 +224,39 @@ Return new parse tree."
  :options
  (append (plist-get arguments :options)
 	 (list "-citefile" temp-file))
-	;; Call "bibtex2html" on specified file.
-	(unless (eq 0 (apply
-			   'call-process
-			   (append '("bibtex2html" nil nil nil)
-   '("-a" "-nodoc" "-noheader" "-nofooter")
-   (let ((style
-	  (org-not-nil
-	   (org-bibtex-get-style keyword
- (and style (list "--style" style)))
-   (plist-get arguments :options)
-   (list (concat file ".bib")
-	  (error "Executing bibtex2html failed"))
+	;; Call "bibtex2html" on specified files.
+	(let ((process-complete nil)
+		  (bibtex2html-proc
+		   (or
+		(apply
+		 'start-process
+		 (append '("bibtex2html" "*bibtex2html-proc*")
+			 '("bibtex2html" "-a" "-nodoc"
+			   "-noheader" "-nofooter")
+			 (let ((style
+(org-not-nil
+ (org-bibtex-get-style keyword
+			   (and style (list "--style" style)))
+			 (plist-get arguments :options)
+			 `("-o" ,out-file)))
+		(error "Unable to start bibtex2html process"
+	  (when bibtex2html-proc
+		(set-process-sentinel
+		 bibtex2html-proc
+		 (lambda (process event)
+		   (when (equal event "finished\n")
+		 (setq process-complete t
+		(dolist (file files)
+		  (let ((file-content
+			 (with-temp-buffer
+			   (insert-file-contents (concat file ".bib"))
+			   (buffer-string
+		(process-send-string bibtex2html-proc file-content)))
+		(process-send-eof bibtex2html-proc))
+	  ;; FIXME: How to wait for process to finish?
+	  (while (not process-complete)
+		(accept-process-output bibtex2html-proc)
+		(sit-for 1)))
 	(and temp-file (delete-file temp-file))
 	;; 

Re: [O] editing header at boh edits link

2016-09-27 Thread Nicolas Goaziou
Hello,

Samuel Wales  writes:

> * [[link][label]]
>
> c-a
> insert text
> edits label
>
> my expectation was would insert header text
> to edit label i expected to do c-a right left or so


FWIW, I cannot reproduce it in development version.

Regards,

-- 
Nicolas Goaziou



Re: [O] Fwd: comment lines inside org tables

2016-09-27 Thread Nicolas Goaziou
Hello,

"Rolf Sander (MPI)"  writes:

> Thanks for the suggestion. However, this won't help me very much. Even
> with the "/", the width of the "animal" column is expanded to the width
> of the comment, which can be very long. I could add a narrowing marker
> but I want to see the comments, not hide them.

Then I don't understand what you really want. You want to comment a row,
but it's not clear wrt to what action.

Anyway, in the general case, there is no way to comment a row.

Regards,

-- 
Nicolas Goaziou



Re: [O] Babel and clojure vars

2016-09-27 Thread Nick Dokos
Lawrence Bottorff  writes:

> Once before I was wondering why :vars doesn't seem to work properly with 
> clojure. This works:
>
> #+begin_src clojure :var a='(1 2 3 4 5)
> (count a)
> #+end_src
>
> #+RESULTS:
> : 5
>
> as well as this
>
> #+begin_src emacs-lisp :var a=(number-sequence 1 5)
> a
> #+end_src
>
> #+RESULTS: num-seq-test1
> | 1 | 2 | 3 | 4 | 5 |
>
> but this is a no go. . . .
>
> #+begin_src clojure c=(range 10)
> (count c)
> #+end_src
>

Is `range' a clojure function? If so, that's expected:

(info "(org) var") says:

,
|The values passed to arguments can either be literal values,
| references, or Emacs Lisp code (see *note Emacs Lisp evaluation of
| variables: var.).
`

[The syntax is wrong too: it should read

#+begin_src clojure :var c=(range 10)
 (count c)
#+end_src

but it's not going to work unless you define an emacs-lisp function called range
and teach it to emacs.]

The following works (I don't have clojure installed here, so I replaced it with 
scheme):

--8<---cut here---start->8---
#+BEGIN_SRC emacs-lisp
(defun range (N)
  (if (<= N 1)
  (list N)
(nconc (range (- N 1)) (list N
#+END_SRC

#+begin_src scheme :var c=(range 10)
(define (count l)
   (if (null? l)
 0
 (1+ (count (cdr l)

(count c)
#+end_src

#+RESULTS:
: 10
--8<---cut here---end--->8---

-- 
Nick




[O] Babel and clojure vars

2016-09-27 Thread Lawrence Bottorff
Once before I was wondering why :vars doesn't seem to work properly with
clojure. This works:

#+begin_src clojure :var a='(1 2 3 4 5)
(count a)
#+end_src

#+RESULTS:
: 5

as well as this

#+begin_src emacs-lisp :var a=(number-sequence 1 5)
a
#+end_src

#+RESULTS: num-seq-test1
| 1 | 2 | 3 | 4 | 5 |

but this is a no go. . . .

#+begin_src clojure c=(range 10)
(count c)
#+end_src

eval doesn't help, either.


LB


Re: [O] Count words under subtrees

2016-09-27 Thread Thorsten Jolitz
Giacomo M  writes:

Hi,

> right now I manually =er/expand-region= (from expand-region.el) until
> I select a subtree, and then =count-words-region= to get number of
> words for the subtree. I was wondering whether anybody already coded
> some lisp to programmatically have this count, ideally one count per
> TOC entry (and perhaps excluding headline words in the count).

AFAIK there are two libraries that show the "weight" of a folded subtree
based on hidden lines as little headline cookies - if that helps. Not
sure about their state, they might just work:

,
| https://github.com/tj64/org-hlc
| https://github.com/pinard/org-weights
`

and org-hlc is build into outshine, so if you open (e.g.) an elisp file
that is structured with outshine headers (= outcommented org-headers),
and have outshine minor-mode enabled, you can use

,[ C-h f outshine-toggle-hidden-lines-cookies RET ]
| outshine-toggle-hidden-lines-cookies is an interactive Lisp function
| in `outshine.el'.
| 
| (outshine-toggle-hidden-lines-cookies)
| 
| Toggles status of hidden-lines cookies between shown and hidden.
`

and will see something like this, i.e. folded headers with 'hidden lines
cookies':

,
|  55:;; * Prerequisites
|  56:;; ** Start Message and Start Time [#8]
|  65:;; ** Setup Parts :mytag: [#79]
| 145:;; ** Environment [#92]
| 238:;; ** Loading Emacs Lisp Libraries
| 239:;; *** Features [#64]
| 304:;; *** Library Search [#144]
| 449:;; *** Package Manager [#39]
| 489:;; *** Autoloads [#5]
| 495:;; ** Debugging [#8]
| 504:;; * [Screen Input Keys Cmd Enter Exit] [#1]
| 506:;; ** 1 (info "(emacs)Screen") [#3]
| 510:;; *** 1.1 (info "(emacs)Point")
| 511:;; *** 1.2 (info "(emacs)Echo Area") [#4]
| 516:;; *** 1.3 (info "(emacs)Mode Line") [#4]
| 521:;; *** 1.4 (info "(emacs)Menu Bar") [#2]
`


-- 
cheers,
Thorsten




[O] Bug: Feature request: more automatic updating of cookies [8.3.6 (8.3.6-4-g4835be-elpaplus @ /home/jorge/.emacs.d/elpa/org-plus-contrib-20160926/)]

2016-09-27 Thread Jorge
Paste the following in an Org buffer:
--8<---cut here---start->8---
* Cookie_a [0/0]
* TODO Dummy_a
* Cookie_b [0/1]
** TODO Dummy_b
--8<---cut here---end--->8---

Within that buffer:
   1. Move point to the line of Dummy_a.
   2. 
I wished the cookie to be updated to [0/1] but it is not.

Then:
   1. Move point to the line of Dummy_b.
   2. C-c C-x C-w
   3. Move point to the line of Dummy_a at column 0.
   4. C-c C-x C-y
I wished both cookies to be updated.  They are not.

The manual [[info:org#Checkboxes][says]]:
Checkbox statistic cookies are updated automatically if you toggle
checkboxes with `C-c C-c' and make new ones with `M-S-'.  TODO
statistics cookies update when changing TODO states.  If you delete
boxes/entries or add/change them by hand, use this command to get things
back into sync.

I request the feature of Org automatically updating cookies when using
structure editing commands such as C-c C-x C-w, C-c C-x C-y, ,
 and friends.  This could be governed by a user option.

The point is that C-u C-c # (to update cookies in the entire buffer) takes
long enough that I only call it a few times per week.  This means that cookies
can get out of sync.  Then I try to remember manually invoking C-c # on the
relevant line every time it goes out of sync, but I sometimes omit it.

Regards

Emacs  : GNU Emacs 25.1.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.18.9)
 of 2016-09-18
Package: Org-mode version 8.3.6 (8.3.6-4-g4835be-elpaplus @
/home/jorge/.emacs.d/elpa/org-plus-contrib-20160926/)

current state:
==
(setq
 org-tab-first-hook '(org-hide-block-toggle-maybe
org-babel-hide-result-toggle-maybe org-babel-header-arg-expand)
 org-speed-command-hook '(org-speed-command-default-hook
org-babel-speed-command-hook)
 org-occur-hook '(org-first-headline-recenter)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-confirm-shell-link-function 'yes-or-no-p
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
org-src-mode-configure-edit-buffer)
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-babel-pre-tangle-hook '(save-buffer)
 org-mode-hook '(#[nil "\300\301\302\303\304$\207" [org-add-hook
change-major-mode-hook org-show-block-all append local] 5]
#[nil "\300\301\302\303\304$\207" [org-add-hook change-major-mode-hook
org-babel-show-result-all append local]
  5]
org-babel-result-hide-spec org-babel-hide-all-hashes org-eldoc-load)
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-ctrl-c-ctrl-c-hook '(org-babel-hash-at-point
org-babel-execute-safely-maybe)
 org-cycle-hook '(org-cycle-hide-archived-subtrees
org-cycle-hide-drawers org-cycle-show-empty-lines
 org-optimize-window-after-visibility-change)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 )

-- 
• I am Brazilian.  I hope my English is correct and I welcome corrections.
• Please adopt free formats like PDF, ODF, Org, LaTeX, Opus, WebM and 7z.
• Free (as in free speech) software for Android: https://f-droid.org/



Re: [O] Fwd: comment lines inside org tables

2016-09-27 Thread Rolf Sander (MPI)

Hello Nicolas,


Try
|   | animal  | size  | number |
| / | don't forget to add elephants here: |   ||


Thanks for the suggestion. However, this won't help me very much. Even
with the "/", the width of the "animal" column is expanded to the width
of the comment, which can be very long. I could add a narrowing marker
but I want to see the comments, not hide them.

 Best regards
Rolf

--
---
  Rolf Sander  phone: [+49] 6131/305-4610
  Max-Planck Institute of Chemistryemail: rolf.san...@mpic.de
  PO Box 3060, 55020 Mainz, Germany homepage: www.rolf-sander.net
---
   www.atmospheric-chemistry-and-physics.net
www.geoscientific-model-development.net
---



[O] Fwd: Re: Fwd: comment lines inside org tables

2016-09-27 Thread Rolf Sander (MPI)

Hello John,


Use a footnote? It's just a temporary reminder right?


No. Even though there are a few temporary reminders, most of the comment
lines are permanent. They describe different blocks of lines.

Sorry if my example was oversimplified. I thought presenting the full
table (currently 871 lines, 20 columns and a width of 234 characters)
would be too confusing. Maybe the following example is better:

|---++|
| animal| size   | number |
|---++|
# mammals (see also https://en.wikipedia.org/wiki/Mammal):
| gnus  | big|  3 |
| elephants | very big   |  1 |
# insects (see also https://en.wikipedia.org/wiki/Insect):
| gnats | small  |   1000 |
| flies | also small |   2000 |
# other:
| python| long   | 2.7.12 |
|---++|

Is there a way to tell org-tbl to simply ignore a line, without
converting it into |--+--+--| ?

I'm flexible with respect to the comment character. In the example I
chose "#" but anything else would be fine as well, for example "//" or
"|#" or whatever...

Best regards
Rolf

--
---
   Rolf Sander  phone: [+49] 6131/305-4610
   Max-Planck Institute of Chemistryemail: rolf.san...@mpic.de
   PO Box 3060, 55020 Mainz, Germany homepage: www.rolf-sander.net
---
www.atmospheric-chemistry-and-physics.net
 www.geoscientific-model-development.net
---



Re: [O] Fwd: comment lines inside org tables

2016-09-27 Thread Nicolas Goaziou
Hello,

"Rolf Sander (MPI)"  writes:

> I need to put comments inside a very big table which then should
> basically looks like this:
>
> |+---+|
> | animal | size  | number |
> |+---+|
> | gnus   | big   |  3 |
> # don't forget to add elephants here:
> | gnats  | small |   1000 |
> |+---+|

Try

  |---+-+---+|
  |   | animal  | size  | number |
  |---+-+---+|
  |   | gnus| big   |  3 |
  | / | don't forget to add elephants here: |   ||
  |   | gnats   | small |   1000 |
  |---+-+---+|


See (info "(org) Advanced features").

Regards,

-- 
Nicolas Goaziou



Re: [O] Fwd: comment lines inside org tables

2016-09-27 Thread John Kitchin
Use a footnote? It's just a temporary reminder right?

On September 27, 2016, at 6:56 AM, "Rolf Sander (MPI)"  
wrote:

Hello,

I need to put comments inside a very big table which then should
basically looks like this:

|+---+|
| animal | size  | number |
|+---+|
| gnus   | big   |  3 |
# don't forget to add elephants here:
| gnats  | small |   1000 |
|+---+|

However, if I simply add a line in the middle of the table, org-tbl
splits it into separate tables with different column widths:

|+--+|
| animal | size | number |
|+--+|
| gnus   | big  |  3 |
# don't forget to add elephants here:
| gnats | small | 1000 |
|---+---+--|

If I start the comment line with "|", the comment becomes an active part
of the table and goes into the first column:

|-+---+|
| animal  | size  | number |
|-+---+|
| gnus| big   |  3 |
| don't forget to add elephants here: |   ||
| gnats   | small |   1000 |
|-+---+|

If I start the comment with "|-", it turns into a line separator and the
comment text disappears.

Any suggestions?

   Best regards
  Rolf

-- 
---
Rolf Sander  phone: [+49] 6131/305-4610
Max-Planck Institute of Chemistryemail: rolf.san...@mpic.de
PO Box 3060, 55020 Mainz, Germany homepage: www.rolf-sander.net
---
 www.atmospheric-chemistry-and-physics.net
  www.geoscientific-model-development.net
---



Re: [O] Name of code pieces when exported to PDF

2016-09-27 Thread Sebastian Christ
On 2016-09-26 17:32, Nick Dokos  wrote:
 >> #+caption: MainClass
 >> #+name: MainClass
 >> 
 >> #+begin_src ...
 > That seems indeed to be necessary (at least in a few experiments that
 > I've run), but it's less than ideal (duplication of information).

In this peculiar case, yes. But, at least for me, I use each for a
different purpose that doesn't duplicate the information. I'm using
org-ref for references and most of the time a more meaningful
caption. For example:

#+caption: A class with a main method
#+name: lst-main
#+begin_src java

Regards,

Sebastian

-- 
Sebastian (Rudolfo) Christ
http://rudolfochrist.github.io
GPG Fingerprint: 306D 8FD3 DFB6 4E44 5061
 CE71 6407 D6F8 2AC5 55DD




[O] Fwd: comment lines inside org tables

2016-09-27 Thread Rolf Sander (MPI)

Hello,

I need to put comments inside a very big table which then should
basically looks like this:

|+---+|
| animal | size  | number |
|+---+|
| gnus   | big   |  3 |
# don't forget to add elephants here:
| gnats  | small |   1000 |
|+---+|

However, if I simply add a line in the middle of the table, org-tbl
splits it into separate tables with different column widths:

|+--+|
| animal | size | number |
|+--+|
| gnus   | big  |  3 |
# don't forget to add elephants here:
| gnats | small | 1000 |
|---+---+--|

If I start the comment line with "|", the comment becomes an active part
of the table and goes into the first column:

|-+---+|
| animal  | size  | number |
|-+---+|
| gnus| big   |  3 |
| don't forget to add elephants here: |   ||
| gnats   | small |   1000 |
|-+---+|

If I start the comment with "|-", it turns into a line separator and the
comment text disappears.

Any suggestions?

  Best regards
 Rolf

--
---
   Rolf Sander  phone: [+49] 6131/305-4610
   Max-Planck Institute of Chemistryemail: rolf.san...@mpic.de
   PO Box 3060, 55020 Mainz, Germany homepage: www.rolf-sander.net
---
www.atmospheric-chemistry-and-physics.net
 www.geoscientific-model-development.net
---



Re: [O] Count words under subtrees

2016-09-27 Thread Eric S Fraga
On Tuesday, 27 Sep 2016 at 09:01, Giacomo M wrote:
> Dear all,
>
> right now I manually =er/expand-region= (from expand-region.el) until I 
> select a subtree, and then =count-words-region= to get number of words 
> for the subtree. I was wondering whether anybody already coded some lisp 
> to programmatically have this count, ideally one count per TOC entry 
> (and perhaps excluding headline words in the count).

Cannot help you directly although this topic has come up before on this
list.

However, I can point you to C-c @ (org-mark-subtree) as a quick way to
select the whole subtree which at least makes the process a little less
painful.

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.1.50.1, Org release_8.3.6-1149-g582233



Re: [O] Count words under subtrees

2016-09-27 Thread Eric S Fraga
And you could always use one of the solutions presented here:

https://www.emacswiki.org/emacs/WordCount

to have the word count in the mode line.  Mark a subtree and
automatically see the word count.

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.1.50.1, Org release_8.3.6-1149-g582233



[O] Count words under subtrees

2016-09-27 Thread Giacomo M

Dear all,

right now I manually =er/expand-region= (from expand-region.el) until I 
select a subtree, and then =count-words-region= to get number of words 
for the subtree. I was wondering whether anybody already coded some lisp 
to programmatically have this count, ideally one count per TOC entry 
(and perhaps excluding headline words in the count).


Thanks,

Giacomo