Re: [O] setting a custom flag for src blocks

2016-12-10 Thread Charles C. Berry

On Sat, 10 Dec 2016, Matt Price wrote:


On Sat, Dec 10, 2016 at 12:19 AM, Matt Price  wrote:




On Fri, Dec 9, 2016 at 12:19 PM, Eric S Fraga  wrote:


On Friday,  9 Dec 2016 at 16:42, Matt Price wrote:

I think I am getting closer, actually (details soon, when I have a
fully working  solution)).


[deleted]


I *think* that I'm looking for an export filter. From what I can see, it
has access to all the information that  the  initial export function does.


It does not. :-(

When `org-babel-exp-process-buffer' runs (under `org-export-as'), all the 
header info is dropped.


There might be a way to backtrack from the copy buffer to the original and 
remap the src blocks, but it seems like the wrong way to go. It would be a 
lot of work, I think.


More below ...


So now I'm wondering what the easiest way is to set a simple flag for a src
block, and make that flag available to the export filter.  For instance, if
I want a particular block to be renderd in klipse on export, could I
specify somehow:

#+HEADER: klipsify t
#+BEGIN_SRC: javascript
console.log("success");
#+END_SRC

or alternatively in a subtree:

* Lots of Examples
:PROPERTIES:
#+PROPERTY: header-args:javascript  :klipsify t
:END:

#+BEGIN_SRC: javascript
console.log("success");
#+END_SRC



I think the better way to go is to do all the formatting in babel. That 
is, make a babel src block handle the formatting for you and subvert the 
normal mechanisms.


To do this, write a src block that is given the name of another src
block, that grabs the body (and if you really need it the header
info), formats it as you need, and inserts it in final form wrapped
in an `export html' block.

So if you had a src block named `codeA' and one named `klipsify' which
has the code needed to render the output you desire depending on the
value of

: :var src-blk-name="my-codes"

then a

#+CALL:klipsify("codeA")

line will put the output in the exported document.

Something like this:

#+NAME: codeA
#+BEGIN_SRC: javascript :eval never-export :exports none
console.log("success");
#+END_SRC

#+NAME: klipsify
#+header: :var src-blk-name="my-code" :exports none
#+header: :results raw :wrap export html
#+BEGIN_SRC emacs-lisp
  (save-excursion
(org-babel-goto-named-src-block
 src-block-name)
(let ((body-code
   (org-babel-expand-src-block)))
  (klipsify-my-code body-code)))
#+END_SRC

Obviously, you need to defun `klipsify-my-code' or whatever.


All the code blocks would need to be named and have these headers:

:  :eval never-export :exports none

or maybe

:  :exports results

You would use the latter, if you want the results of evaluating the code 
to appear in the exported document. Put the #+CALL line just before the 
code block and then the code will appear first and the results next.


HTH,

Chuck



Re: [O] Custom agenda column format issues with org mode 9.0

2016-12-10 Thread Nicolas Goaziou
Hello,

Christian Prothmann  writes:

> I just updated to version 9.0 (elpa version Nov 18) and experienced issues 
> with the custom agenda views in column format.
> I had previously specified my custom agenda views using: 
> org-agenda-overriding-columns-format %Custom1  etc. 
> After the switch to version 9, I only got the default column format
> output: %25ITEM %TODO %3PRIORITY %TIMESTAMP, when I selected my custom
> column agenda view––although each column still had the custom column
> name, the column content was populated according to the default format
> (%25ITEM %TODO etc.).

Fixed. Thank you.

Regards,

-- 
Nicolas Goaziou



Re: [O] Multiple underscores crash org latex export; other exporters survive

2016-12-10 Thread Nicolas Goaziou
Hello,

Scott Randby  writes:

> First, a_b_c and a_bc give nearly identical results when processed
> except that the spacing between letters in the subscript coming from
> a_b_c is wider than that in the subscript coming from a_bc. The spacing
> issue can be seen more clearly by comparing the processed versions of
> a_b_c_d and a_bcd. The wider spacing looks funny when compared to
> surrounding text.
>
> Second, I've been considering the issue of what the primary meaning of
> a_b_c should be when it is used in a file. Since underscores are used in
> LaTeX to designate subscripts in mathematical expressions, it is clear
> to me that a_b_c should mean a_(b_c) instead of a_(bc). Similarly, a^b^c
> should mean a^(b^c) instead of a^(bc). I really can't think of any case
> when I would type in a_b_c in order to get a_(bc).

I chose this translation because

  1. It was the easiest to implement;
  2. It is the closest to what Org (unlike to LaTeX) really sees;
  3. It doesn't matter since it is a pathological case.

> Finally, I question the use of text style instead of math style when
> a_b, a^b, or similar expressions are exported to LaTeX. TeX was designed
> to produce beautiful typeset mathematics, and the math style is an
> essential part of that beauty. Math style is also the expected way of
> presenting mathematical expressions in all of the professional journals
> that I read and use. New users may not be aware of professional
> standards, but we could help them be aware by translating a_b_c as
> \(a_{b_{c}}\) exactly. Similarly a^b^c would be translated as
> \(a^{b^{c}}\) exactly.

I strongly disagree. 

Org is not a front-end to LaTeX. LaTeX is but one of its export output
formats. In most of the others, sup/superscript doesn't force math mode
on the user. 

In Org, if you want to enter math mode, you need to explicitly request
it, e.g., with:

  a_{$1 + 1$}

> However, the translation of a_b_c doesn't matter a whole lot to me since
> I always use \(a_{b_{c}}\) or $a_{b_{c}}$ in my Org documents.

Exactly.

Regards,

-- 
Nicolas Goaziou



Re: [O] Bug: Preview equation fails using dvipng - incorrect string [9.0.1 (9.0.1-elpaplus @ d:/Users/nish.joseph/.emacs.d/elpa/org-plus-contrib-20161118/)]

2016-12-10 Thread Nicolas Goaziou
Hello,

Nish Joseph  writes:

> The process to create PNG of equation fails as there is an added `"` in
> the command line string. Expected behaviour is the correct command 
> line args to generate a PNG. dvipng works fine on a separate terminal. 
> Here is the partial list from my limited knowledge of debugging
>
> shell-command("dvipng -fg \"rgb 0.972549 0.972549 0.94902\" -bg \"rgb
> 0.156863 0.164706 0.211765\" -D \"120.0\" -T tight -o
> \"d:/Users/nish.joseph/AppData/Local/Temp/\"\"orgtex7708Klj\".png
> \"d:/Users/nish.joseph/AppData/Local/Temp/orgtex7708Klj.dvi\"" # *Org Preview LaTeX Output*>)
>
> The problem i suspect is
> \"d:/Users/nish.joseph/AppData/Local/Temp/\"\"orgtex7708Klj\".png

I think this was fixed recently.

Regards,

-- 
Nicolas Goaziou



Re: [O] Multiple underscores crash org latex export; other exporters survive

2016-12-10 Thread Scott Randby
On 12/07/2016 06:21 AM, Nicolas Goaziou wrote:
> Hello,
> 
> Scott Randby  writes:
> 
>> On 12/06/2016 06:50 PM, Nicolas Goaziou wrote:
>>> I fixed it in maint. Basically, a_b_c is translated as a\(_b\)\(_c\).
>>
>> With this solution, "a" will be exported as text while "b" and "c" will
>> be exported as a single subsrcipt using the math font.
> 
> Not at all. I simplified the output for clarity but the real generated
> code is
> 
>   a\(_{\text{b}}\)\(_{\text{c}}\)
> 
>> I would prefer that a_b_c be translated as \(a_{b_{c}}\).
> 
> As you pointed out, the string is ambiguous anyway. The point of the fix
> is to generate valid LaTeX code. You can obtain the above unambiguously
> with
> 
>   a_{b_c}

I have a few comments about the choice you've made for the translation
of underscores that do not appear in \(...\) or $...$ expressions. I've
attached a PDF to help explain my points.

First, a_b_c and a_bc give nearly identical results when processed
except that the spacing between letters in the subscript coming from
a_b_c is wider than that in the subscript coming from a_bc. The spacing
issue can be seen more clearly by comparing the processed versions of
a_b_c_d and a_bcd. The wider spacing looks funny when compared to
surrounding text.

Second, I've been considering the issue of what the primary meaning of
a_b_c should be when it is used in a file. Since underscores are used in
LaTeX to designate subscripts in mathematical expressions, it is clear
to me that a_b_c should mean a_(b_c) instead of a_(bc). Similarly, a^b^c
should mean a^(b^c) instead of a^(bc). I really can't think of any case
when I would type in a_b_c in order to get a_(bc).

Finally, I question the use of text style instead of math style when
a_b, a^b, or similar expressions are exported to LaTeX. TeX was designed
to produce beautiful typeset mathematics, and the math style is an
essential part of that beauty. Math style is also the expected way of
presenting mathematical expressions in all of the professional journals
that I read and use. New users may not be aware of professional
standards, but we could help them be aware by translating a_b_c as
\(a_{b_{c}}\) exactly. Similarly a^b^c would be translated as
\(a^{b^{c}}\) exactly.

However, the translation of a_b_c doesn't matter a whole lot to me since
I always use \(a_{b_{c}}\) or $a_{b_{c}}$ in my Org documents.

Scott Randby

> 
> Regards,
> 


Org-Subscripts-Superscripts.pdf
Description: Adobe PDF document


Re: [O] Using an org based init file slows down emacs startup by 50x..help needed :(

2016-12-10 Thread Thomas S. Dye
Aloha Xebar,

Xebar Saram writes:

> Ok so i think the reason really is that i have way to many lisp code blocks
> as suggested. i found out a very interesting post that maybe of interest to
> alot of org users
>
> http://www.holgerschurig.de/en/emacs-efficiently-untangling-elisp/
>
> this creates a new function that very efficiently tangles my org file and
> the time goes from 6 minutes to 25 seconds!!
>
> this is a link to an example init file
>
> https://bitbucket.org/holgerschurig/emacsconf/src/416b2bba2d1d334b9c6ddbd56f8c7f8bd8bc4aab?at=master

Have you seen Eric Schulte's starter-kit
(http://eschulte.github.io/emacs24-starter-kit/)?  Using it, I keep my
initialization functions in a few different Org mode files, which the
starter-kit tangles to .el iff the Org mode file has been changed since
it was last tangled.  I'm able to keep the initialization process
reasonably organized (I'm the limiting factor), without the wait.

hth,
Tom

-- 
Thomas S. Dye
http://www.tsdye.com



Re: [O] Bug with Habits and Active Dates

2016-12-10 Thread craven
> This was fixed recently. You need to wait for the next release.

Thank you very much for the swift fix!

Greetings, Peter



[O] Bug: Preview equation fails using dvipng - incorrect string [9.0.1 (9.0.1-elpaplus @ d:/Users/nish.joseph/.emacs.d/elpa/org-plus-contrib-20161118/)]

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

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

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


The process to create PNG of equation fails as there is an added `"` in
the command line string. Expected behaviour is the correct command 
line args to generate a PNG. dvipng works fine on a separate terminal. 
Here is the partial list from my limited knowledge of debugging

shell-command("dvipng -fg \"rgb 0.972549 0.972549 0.94902\" -bg \"rgb
0.156863 0.164706 0.211765\" -D \"120.0\" -T tight -o
\"d:/Users/nish.joseph/AppData/Local/Temp/\"\"orgtex7708Klj\".png
\"d:/Users/nish.joseph/AppData/Local/Temp/orgtex7708Klj.dvi\"" #)

The problem i suspect is
\"d:/Users/nish.joseph/AppData/Local/Temp/\"\"orgtex7708Klj\".png

Kind Regards

Nish Joseph

Emacs  : GNU Emacs 25.1.1 (x86_64-w64-mingw32)
 of 2016-09-22
Package: Org mode version 9.0.1 (9.0.1-elpaplus @ 
d:/Users/nish.joseph/.emacs.d/elpa/org-plus-contrib-20161118/)

current state:
==
(setq
 org-tab-first-hook '(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-html-format-drawer-function '(closure
   (htmlize-buffer-places 
org-html-format-table-no-css
htmlize-css-name-prefix htmlize-output-type 
htmlize-output-type
htmlize-css-name-prefix t)
   (_name contents) contents)
 org-latex-format-inlinetask-function 
'org-latex-format-inlinetask-default-function
 org-confirm-shell-link-function 'yes-or-no-p
 org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default
 org-latex-format-headline-function 'org-latex-format-headline-default-function
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 org-latex-format-drawer-function '(closure (t) (_ contents) contents)
 org-odt-format-headline-function 'org-odt-format-headline-default-function
 org-from-is-user-regexp nil
 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 '((closure
  (org-inlinetask-min-level buffer-face-mode-face org-mode-map 
org-tbl-menu
   org-org-menu org-struct-menu org-entities org-last-state 
org-id-track-globally
   org-clock-start-time texmathp-why remember-data-file
   org-agenda-tags-todo-honor-ignore-options 
iswitchb-temp-buflist
   calc-embedded-open-mode calc-embedded-open-formula 
calc-embedded-close-formula
   align-mode-rules-list org-emphasis-alist 
org-emphasis-regexp-components
   org-export-registered-backends org-modules 
org-babel-load-languages t)
  nil
  (add-hook (quote change-major-mode-hook) (quote 
org-show-block-all) (quote append)
   (quote local))
  )
 (closure
  (org-bracket-link-regexp org-src-window-setup *this*
   org-babel-confirm-evaluate-answer-no 
org-src-preserve-indentation
   org-src-lang-modes org-edit-src-content-indentation 
org-babel-library-of-babel t)
  nil
  (add-hook (quote change-major-mode-hook) (quote 
org-babel-show-result-all)
   (quote append) (quote local))
  )
 org-babel-result-hide-spec org-babel-hide-all-hashes 
org-eldoc-load)
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-ascii-format-drawer-function '(closure (t) (_name contents _width) 
contents)
 org-odt-format-inlinetask-function 'org-odt-format-inlinetask-default-function
 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-odt-format-drawer-function '(closure
  (hfy-user-sheet-assoc hfy-html-quote-regex 
hfy-html-quote-map
   hfy-face-to-css hfy-begin-span-handler 
hfy-end-span-handler
   archive-zip-extract 
nxml-auto-insert-xml-declaration-flag t)
  (_name contents) contents)
 org-html-format-headline-function 'org-html-format-headline-default-function
 org-link-parameters '(("id" :follow org-id-open)
   ("rmail" :follow org-rmail-open :store

[O] setting a custom flag for src blocks

2016-12-10 Thread Matt Price
On Sat, Dec 10, 2016 at 12:19 AM, Matt Price  wrote:

>
>
> On Fri, Dec 9, 2016 at 12:19 PM, Eric S Fraga  wrote:
>
>> On Friday,  9 Dec 2016 at 16:42, Matt Price wrote:
>> > I think I am getting closer, actually (details soon, when I have a
>> > fully working  solution)).
>>
>> I look forward to seeing it!
>>
>
> OK, I've run into the limits of my knowledge.
>
> There are at least 2 plugins that will give a live code execution
> environemnt within an HTML presentation:
> - RevealEditor, which adds one global Ace editor instance to the
> presentation, and which shows the live rendering of HTML, CSS, and JS code
> when the html encoding follows the format:
>
> [1,2,3].map ((x) => x + 
> 1)
> 
>
>
> - klipse, which  instantiates a new instance of CodeMirror for every
> appropriately formatted set of tags in the form:
>
> [1,2,3].map ((x) => x + 
> 1)
>
> Meanwhile, html export (and also reveal export) will give something more like:
>
> [1,2,3].map  style="color: #8c8c8c;">((x) 
> => x + 1)
>
> I would like to conditionally export
>
> - revealeditor-compatible code if (a) a flag "org-reveal-use-editor" is set 
> AND (b) the code block meets certain criteria, e.g. language and maybe 
> something in the header like "make-live t"
>
> - klipse-compatible code if (a) a flag "org-reveal-klipsify is set AND 
> similar conditions to (b) above
>
> - standard html output if neither of the above conditions is met.
>
> What are the best ways do achieve this, do you think? Thanks guys,
>
>
I *think* that I'm looking for an export filter. From what I can see, it
has access to all the information that  the  initial export function does.
So now I'm wondering what the easiest way is to set a simple flag for a src
block, and make that flag available to the export filter.  For instance, if
I want a particular block to be renderd in klipse on export, could I
specify somehow:

#+HEADER: klipsify t
#+BEGIN_SRC: javascript
console.log("success");
#+END_SRC

or alternatively in a subtree:

* Lots of Examples
:PROPERTIES:
#+PROPERTY: header-args:javascript  :klipsify t
:END:

#+BEGIN_SRC: javascript
console.log("success");
#+END_SRC

 Thanks again, matt


Re: [O] Using an org based init file slows down emacs startup by 50x..help needed :(

2016-12-10 Thread Xebar Saram
Ok so i think the reason really is that i have way to many lisp code blocks
as suggested. i found out a very interesting post that maybe of interest to
alot of org users

http://www.holgerschurig.de/en/emacs-efficiently-untangling-elisp/

this creates a new function that very efficiently tangles my org file and
the time goes from 6 minutes to 25 seconds!!

this is a link to an example init file

https://bitbucket.org/holgerschurig/emacsconf/src/416b2bba2d1d334b9c6ddbd56f8c7f8bd8bc4aab?at=master

i really think this should go somewhere in the org documentation

best to all

Z

On Sat, Dec 10, 2016 at 2:53 PM, Xebar Saram  wrote:

> Ok some more exploring made me realize that also using `M-x
> org-babel-load-file` on the setting.org file and tangling it takes a LONG
> time (like 6-7 minutes) so its not a problem of the init its the actual
> tangling of the file. 6-7 minutes cant be normal right?
>
> im attaching my settings.org file
>
> would appreciate any help
>
> Z
>
>


Re: [O] Add preamble support to ob-plantuml.el

2016-12-10 Thread Nicolas Goaziou
Thibault Marin  writes:

> Please find attached a patch updating ORG-NEWS.

Perfect. Applied. Thank you.

Regards,



Re: [O] Add preamble support to ob-plantuml.el

2016-12-10 Thread Thibault Marin
Hi,

Please find attached a patch updating ORG-NEWS.

Thanks,
thibault

>From 3d335b093d4e95b14cc71317d2aef024f1c64fd5 Mon Sep 17 00:00:00 2001
From: thibault 
Date: Sat, 10 Dec 2016 08:27:48 -0600
Subject: [PATCH] * etc/ORG-NEWS: Header arguments support for PlantUML source
 blocks

---
 etc/ORG-NEWS | 5 +
 1 file changed, 5 insertions(+)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index b6b3123..c115cf9 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -82,6 +82,11 @@ Where clue > 0
 ,#+END_SRC
 #+end_example
 
+ PlantUML: add support for header arguments
+
+[[http://plantuml.com/][Plantuml]] source blocks now support the [[http://orgmode.org/manual/prologue.html#prologue][~:prologue~]], [[http://orgmode.org/manual/epilogue.html#epilogue][~:epilogue~]] and
+[[http://orgmode.org/manual/var.html#var][~:var~]] header arguments.
+
 *** New variable : ~org-bibtex-headline-format-function~
 This allow to use a different title than entry title.
 *** Horizontal rules are no longer ignored in LaTeX table math mode
-- 
2.9.3



Re: [O] tangling files on export not working properly

2016-12-10 Thread Nicolas Goaziou
Hello,

mcg  writes:

> Hello,
>
> When exporting my document to latex I want org-mode to tangle a few code 
> blocks.
>
> #+NAME: tangle_files
> #+BEGIN_SRC emacs-lisp :exports results :eval query-export
>
> (org-babel-tangle-file "~/thesis/chapter/NH.org")
>
> #+END_SRC
>
> When I run the code block manually it works fine
> *Messages*: "Tangled 2 code blocks from NH.org"
>
> However, even though the is run on export, nothing gets tangled:
> "Tangled 0 code blocks from 04.NH.org"
>
> Is there any explanation for this? Anything I'm overlooking?

Doesn't you need to add :tangle yes to the block header?

Actually, adding this correctly tangle the file upon exporting the
document.

Regards,

-- 
Nicolas Goaziou



Re: [O] Add preamble support to ob-plantuml.el

2016-12-10 Thread Nicolas Goaziou
Hello,

Thibault Marin  writes:

> The attached patch removes the useless definition of
> `org-babel-plantuml-var-to-plantuml' (the regexp is moved to the
> `org-babel-variable-assignments:plantuml' function) but keeps the
> `org-babel-plantuml-make-body' function, useful for testing.

Fair enough. I applied your patch.

Would you mind providing an ORG-NEWS entry for the added feature?

> Thanks for the guidance.

Thank you for the work.

Regards,

-- 
Nicolas Goaziou



Re: [O] Using an org based init file slows down emacs startup by 50x..help needed :(

2016-12-10 Thread Nicolas Goaziou
Hello,

Xebar Saram  writes:

> can anyone help me with this, i really would appreciate you guys help with
> this as its driving me mad :)

Please provide a profiler report (see `profiler-start') and possibly
instrument Org using `elp-instrument-package' so that we know what part
is the most time consuming.

Note that tangling is a somewhat slow process. You could try to diminish
the number of blocks involved or maybe try spreading them among
different sections.

Regards,

-- 
Nicolas Goaziou



[O] Using an org based init file slows down emacs startup by 50x..help needed :(

2016-12-10 Thread Xebar Saram
Hi all

So after a few months of frustration today i discovered the issue that's
been bothering me for a long time..the REALLY slow emacs startup (sometimes
5 minutes or more).

The cause is the org mode init file i use. what i currently have in my
setup is

A. this init.el:

(require 'package)
;since we are using use-package-don't autoload anythings
(setq package-enable-at-startup nil)

(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/";))
(add-to-list 'package-archives '("marmalade" . "
https://marmalade-repo.org/packages/";))
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/";))
;; org maybe suspect of hanging melpa, if you have hangs disable this first
(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/";))
;; Initialize installed package
(package-initialize)

;; Bootstrap `use-package'
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))

(org-babel-load-file (expand-file-name "~/.emacs.d/settings.org"))


B. My config stored in settings.org which alot  of lisp code (like 17,000
lines..yeah i like to tinker :))

Using this method i discovered that every time i make a small change to
setting.org and restart emacs the setting.org gets tangled to settings.el
and emacs takes nearly 5!!! minutes to start..yeah thats painful as you can
imagine.

BUT what i discovered today is that if i just stick my config chunks from
setting.org (ie the tangled setting.el file) into init.el, emacs starts
super fast each time, even when i change the init.el file!

can anyone help me with this, i really would appreciate you guys help with
this as its driving me mad :)

thx alot in advance

Z