Re: Babel: Programmatically evaluate a heading and subtrees?

2021-03-01 Thread Ken Mankoff
Hi Nathan,

On 2021-02-20 at 11:10 -08, Nathan Neff  wrote...
> I have some code like this:
>
> * Heading 1
>
> # code block name:FOO
>
> ** Subheading 1
>
> # code block
>
> ** Subheading 2
>
> # code block
>
> I find that I often want to evaluate the code in Heading 1 and its
> subheadings.
>
> Currently, I navigate to Heading 1 and then use org-babel-execute-subtree
>
> I see that there's a function called org-babel-goto-named-src-block,
> so I think I could write a small function to jump to FOO in Heading 1
> and then run execute subtree and then jump back to my previous
> location in Emacs.
>
> Is there a more programmatic or built-in way? For example:
> org-babel-execute-block-and-subheadings FOO

What about,

(defun my/eval-parent-subtree()
  (save-excursion
(outline-up-heading 1)
(org-babel-execute-subtree)))

And then binding that to some key or something? Or (outline-up-heading 99) if 
you always want to go to "*". Or make that line a bit more dynamically 
controllable by use of 'prefix-arg' ?

  -k.



Re: ob-haskell

2021-01-03 Thread Ken Mankoff
Hi Lawrence,

This isn't a method for official language support, but I've had success with 
entirely unsupported REPLs and ob-screen. A .screenrc can launch the REPL, and 
then Org ob-screen just sends each line to the buffer. It works OK for me.

  -k.

On 2021-01-02 at 13:44 -08, Lawrence Bottorff  wrote...
> I recently wimped out of trying to update ob-haskell as an official
> maintainer, but I'd eventually like to get back to it -- *after *I get
> some base understanding of what Haskell is (Zeno's paradox-land?) and
> how the ghci works. Basically, the ghci is what it is -- tautological,
> but true. And that means when ob-haskell does nothing but dump the
> contents of a babel code block into ghci, it's no better than if the
> user had typed in into the REPL line-by-line. A quick run-down:
>
> :set +m supposedly alerts ghci that a multi-line expression is coming, will
> come; but typically, it doesn't infer this very well.
>
> Enclosing code in :{ ... :} is fairly good -- again you can type this in at
> the REPL prompt and see how it works -- however, there are gotchas.
>
> a plain block:
>
> #+begin_src haskell
> ...code...
> #+end_src
>
> is okay when you only have a one-liner to evaluate. But again, ob-haskell
> seems to do nothing but take the block contents and dump it to the ghci
> REPL as though the user had typed it in line-by-line, Enter, Enter...
>
> What would be nice is if a C-c C-c inside a block could somehow act as
> though the ghci were being sent a regular  *.hs buffer in haskell-mode --
> and that, of course, cumulatively. C-' creates a decent haskell-mode
> environment, BTW, so some form of a babel block to haskell-mode connection
> does exist
>
> So am I on the right track? It's obvious at this point raw dumps into the
> REPL aren't optimal, i.e., are fraught. What is, e.g., geiser doing
> that ob-haskell isn't?
>
> LB
>
> PS: Eventually, I'll try to glean some hints from the Jupyter Haskell
>  effort.
>
> PPS: GHCI User's Guide
> 
> doesn't
> really tell me anything other than yes, ob-haskell is raw-dumping into an
> environment that isn't designed to play nice with babel.




org-todo-yesterday with 1-day repeater tasks: repeats tomorrow

2020-12-14 Thread Ken Mankoff
Hello list,

I regularly use org-todo-yesterday or org-agenda-todo-yesterday. However, with 
a 1-day repeater task, or any ++ repeater, it sets the repetition using today 
as the starting point, not yesterday.

It seems like the repeater time and date-setter is not respecting 
"org-extend-today-until", which has this wonderful docstring:

"""IMPORTANT:  This is a feature whose implementation is and likely will
remain incomplete.  Really, it is only here because past midnight seems to
be the favorite working time of John Wiegley :-)"""

Are other experiencing this behavior? Is there some prefix arg I am missing 
that I should be using? I have not found other complaining about this behavior 
or reporting this issue, so I wonder if I'm missing something. If not, I'll 
work on submitting a patch.

Thanks,

  -k.



Re: Is there possibility to provide back links to each finely grained part of Org file?

2020-11-09 Thread Ken Mankoff


On 2020-11-09 at 03:38 -08, Eric S Fraga  wrote...
> On Sunday,  8 Nov 2020 at 23:40, Jean Louis wrote:
>> I know that #names exist in HTML export for *** headings. Do they or
>> can they exist for every paragraph or item listed?
>
> Maybe not quite what you want but you can place anchors (aka targets)
> anywhere you want in your document using <>. I use these
> for within-document linking but I imagine you can link to these from
> other documents as well (untested).

Also I imagine https://github.com/alphapapa/org-make-toc or 
https://github.com/snosov1/toc-org that already auto-make TOCs to every header 
could be hacked to add paragraph-level links?

  -k.




Re: Thoughts on the standardization of Org

2020-11-03 Thread Ken Mankoff
Hi Eric,

On 2020-11-03 at 05:00 -08, Eric S Fraga  wrote...
> The benefits of org mode for me are that it is Emacs. [...] I find it
> difficult to see any further standardization that would provide any
> real benefits *to me*. If others see those benefits, excellent! All
> power to them and I hope there is success in greater use of org
> documents outside Emacs which would possibly trickle back benefits
> into org mode in Emacs.

No need to apologize!

I'm similar to you re emacs usage and cannot imagine I'd leave it even if 
3rd-party implementations existed. There is no way that 3rd party tool would 
also read my email, have magit, implement all of Org that I use, edit TeX, etc.

But I'm weary of seeing all my colleagues say "Jupyter" and not "Org" when it 
comes to sharing their code/work. I have a fantasy that in 5 years I tell 
someone who doesn't use Emacs but uses Atom or some other editor to "pip 
install org-lsp" and then double-click on this Org file I just emailed you, and 
then right-click on the code block and select "evaluate" from the popup menu. 
That sounds horrific to me as a user, except the part where I can interact more 
powerfully with more colleagues.

In this fantasy this adds no additional effort or stress to the current devs, 
because we're a big diverse community, and if TEC doesn't want to work on Org 
core code, but does want to make an emacs-lsp or org-lsp, more power to them.

  -k.



Re: Thoughts on the standardization of Org

2020-11-03 Thread Ken Mankoff


On 2020-11-03 at 00:24 -08, David Rogers  wrote...
> I disagree (in principle, not just because it would be difficult) with
> the idea of “expanding beyond Emacs”. Org-mode benefits greatly from
> current and future Emacs development, and asking to standardize “just
> the parts that are not Emacs” would cause Org-mode to lose that huge
> advantage. Org-mode relies heavily on the editor it’s built on, and if
> it ceased to rely on Emacs, it would be forced to rely on “nothing at
> all” instead. Not only that, but for Org-mode users being able to
> count on all of Emacs is a big part of why it works. This means
> separating Org-mode from Emacs is a “lose-lose” idea.

It seems like you have never used Orgzly or read on Org file on GitHub. Those 
are not ideas, but are actual current real-world win-win implementations of 
parts of Org outside of Emacs.

More of these would be better.

Everyone on this thread who says you can't separate Org from Emacs is correct 
that it is unreasonable to expect a 100 % bit-compatible and 
keystroke-compatible experience outside of Emacs. I don't think that level of 
re-implementation was what the OP was suggesting.

Again: GitHub. Orgzly. The conversation should move from "it can't be done" or 
"it isn't helpful" (why so much negativity on this thread?) to

+ What parts can be standardized and re-implemented outside of Emacs.
+ How do we define graceful failure for the other parts.
+ How do we support 3rd-party implementation in a way that benefits all of us.

  -k.



Re: Thoughts on the standardization of Org

2020-11-01 Thread Ken Mankoff


To all who argue that Org is too tightly coupled to Emacs to consider working 
with it outside of Emacs, I point to GitHub. The fact that GitHub natively 
renders Org files "well enough" is a huge benefit to those of us who use Org. 
It is also useful for gaining new users (assuming more users is a good thing).

Therefore, if other tools have the ability to do *something* with an Org file 
(display most of it well enough, allow editing without breaking things, maybe 
implementing a simple Babel interpreter for a few popular languages, whatever), 
this would be A Good Thing.

For example, I'd contribute more to Stack Exchange sites if I could answer 
using Org syntax rather than Markdown syntax. None of these 3rd party 
implementations need to be comprehensive or perfect, just as the GitHub 
renderer is neither complete nor perfect. But we all benefit from the GitHub 
rendering.

  -k.




Re: New website - back to the old unicorn!

2020-10-28 Thread Ken Mankoff


On 2020-10-28 at 08:40 -07, Daniele Nicolodi  wrote...
> If I can bikeshed a bit more: I like the lighter page background that
> is currently on http://orgomode.org more than the darker one in the
> new version.

A few more minor comments based on the current version at 
https://orgmode.tecosaur.com/

1) Code block should use some coloring for header blocks and code body. The 
current theme highlights almost everything else but the header and code 
background.

2 and more important) Use the most popular language to get the most people 
interested. There are probably a lot more Python programmers than shell 
scripters. I suggest the code example should be a minimal (~6 lines?) of Python 
that produces either (or both) a simple graph or ~3 column table.

Also, I just noticed you can click on the sections (sections, babel header, 
results) to collapse them! :).

Which led me to an Org bug: The TODO Is 28 % complete, or 2/7, but 2/7*100 = 
28.5714285714, so I think it should be 29 % complete.

  -k.



Re: Please help by becoming a maintainer for an Org Babel file

2020-10-27 Thread Ken Mankoff


I'll help maintain ob-screen.el

  -k.


On 2020-10-26 at 01:07 -07, Bastien  wrote...
> Dear all,
>
> we are looking for more maintainers of individual Org Babel files.
>
> Jack and Ian are already in, I added myself to ob-clojure.el.
>
> If you feel like proposing yourself for maintaining an Org Babel
> language, that would be super helpful.
>
> Thanks a lot!




Re: official orgmode parser

2020-10-26 Thread Ken Mankoff


On 2020-10-26 at 14:00 -07, Tom Gillespie  wrote...
>> list ::= ('+' string newline)+ sublist?
>> sublist ::= (indent list)+
>>
>> I think this captures lists?
>
> Ah yes, I see my mistake here. In order for this to work the parser
> has to implement significant whitespace, so whitespace cannot be
> parsed into a single token. I think everything works out after that.

If we agree that the syntax above captures lists and sublists, then I think we 
could apply the same methods to the issue of headlines and sub-headlines?

  -k.



Re: official orgmode parser

2020-10-26 Thread Ken Mankoff


On 2020-10-26 at 10:59 -07, Tom Gillespie  wrote...
> You can identify headlines, but you can't identify nesting level;

Do you need to? This is valid as an entire Org file, I think:

*** foo
* bar
* baz

And that can be represented in EBNF. I'm not aware of places where behavior is 
indent-level specific, except inline tasks, and that edge case can be 
represented.

> There is a similar issue with the indentation level in
> order to correctly interpret plain lists.

list ::= ('+' string newline)+ sublist?
sublist ::= (indent list)+

I think this captures lists?

> Another example of something that requires a stack is the greater
> blocks, where you have #+begin_{name} and #+end_{name}, and the names
> must match.

Definitely not able to be represented in EBNF, unless as you say {name} is a 
limited vocabulary.

  -k.



Re: official orgmode parser

2020-10-26 Thread Ken Mankoff


On 2020-10-26 at 09:24 -07, Nicolas Goaziou  wrote...
> # This is a comment (1)
>
> #+begin_example
> # This is not a comment (2)
> #+end_example
>
> AFAICT, you cannot distinguish between lines (1) and (2) with EBNF.

I agree. I think this is a better (correct?) example than the footnotes on Org 
Syntax page.

  -k.




Re: official orgmode parser

2020-10-26 Thread Ken Mankoff

On 2020-10-26 at 07:21 -07, Nicolas Goaziou  wrote...
> Ken Mankoff  writes:
>
>> I question if this is possible because EBNF is for context-free
>> grammars, but I *think* Org syntax is context-free.
>
> It's not as explained in a footnote in the Org syntax document.

Yes, I meant to write that I think Org syntax is maybe *not* context-free, and 
therefore EBNF can't capture all of it. But it could still be very helpful and 
capture most of it.

But the more I think about it, the more I think Org may be context-free.

For the footnotes, I'm not sure that "(1) In particular, the parser requires 
stars at column 0 to be quoted by a comma when they do not define a headline" 
violates context. An "*" in the first column defines a header. It can be 
escaped by anything else too (" *" works too). If ",*" has a special meaning, 
that can be captured elsewhere in the syntax.

I'm also not sure (2) violates context-freeness, at least in the EBNF sense 
where a context can include a newline. See for example:

section ::= "*"+ string (tag+) newline (planning newline)? (property_drawer 
newline)?

planning ::= ("SCHEDULED:" "<" date_or_time ">")? ("DEADLINE:" "<" date_or_time 
">")?

property_drawer ::= ":PROPERTIES:" newline drawer_contents newline ":END:"

drawer_contents ::= ":" property ":" whitespace string

Where the first line, "section" is represented graphically as the attached 
image.

I guess I'm not 100% clear what "context-free" means. EBNF can represent a 
language where a for loop has an opening and closing brace. The closing brace 
is context-dependent, just as the planning or property drawers are.

I recently used EBNF to represent a CSV file with header, and I was unable to 
capture the requirement that the header column must have the same number of 
fields or commas as the data section. I think that is context-free. 



  -k.


Re: official orgmode parser

2020-10-26 Thread Ken Mankoff
Hello,

On 2020-09-23 at 01:09 -07, Bastien  wrote...
> I disagree that a parser is too difficult to maintain because Org is a
> moving target. Org core syntax is not moving anymore, a parser can
> reasonably target it. That's what is done with the Ruby parser, in use
> in this small project called github.com :)

Do you think it would be useful (or possible) to represent the current Org 
syntax in EBNF form so that people can use the EBNF to build parsers or 
graphically understand the form? I'm thinking of a nice page of railroad 
diagrams from this tool: https://github.com/GuntherRademacher/rr

I question if this is possible because EBNF is for context-free grammars, but I 
*think* Org syntax is context-free. Even if not, I think those railroad 
diagrams might be useful for parser-writers and can still describe 99 % of the 
syntax, even if a few extra sentences are needed to clarify some edge case.

  -k.



[O] babel bash :var tables - change from associative to index arrays

2020-09-12 Thread Ken Mankoff
Hi Org List,

I'd like to submit a patch so that all bash babel arrays are indexed. Are there 
cons to this that I'm not seeing? It might break some existing code that 
expects associative arrays. Could this be a breaking change that is included in 
Org 5.0? I'd like to check on the likely acceptance of such a patch before I 
take the time to code it.

Currently Org Babel uses associative arrays for multi-column bash :var inputs, 
and indexed arrays if single column. Put differently, for 1D tables the array 
is indexed [0,1,...,n] and for 2D arrays it is indexed using the first column. 
Example at the bottom of this email.

There are some drawbacks to this method: 1) It drops rows if the first column 
is not unique (I have tables where the first three columns make a unique index 
from "|year|month|day|value") and 2) associative arrays do not maintain order, 
so the code cannot rely on the order of the rows (see example below where 
"foo2,bar2" order is swapped).

If all arrays are indexed, these two issues would go away.

  -k.


#+NAME: tbl1D
| foo1  |
| bar1  |

#+NAME: tbl2D
| foo2  | 42 |
| bar2  | 24 |

#+NAME: print_tbl
#+BEGIN_SRC bash :var tbl=tbl1D
for key in "${!tbl[@]}"; do
  row=${tbl[$key]}
  echo $key $row
done
#+END_SRC

#+CALL: print_tbl(tbl=tbl1D)

#+RESULTS:
| 0 | foo1 |
| 1 | bar1 |

#+CALL: print_tbl(tbl=tbl2D)

#+RESULTS:
| bar2 | 24 |
| foo2 | 42 |



Re: Can you automatically noweb include?

2020-08-06 Thread Ken Mankoff
Actual example:


* Prologue test
:PROPERTIES:
:header-args:python+: :prologue "import numpy as np; import os"
:END:

#+BEGIN_SRC python :results output
print(np.__version__)
#+END_SRC

#+RESULTS:
: 1.18.4




On Wed, Aug 5, 2020 at 3:03 PM Ken Mankoff  wrote:

> What about using :pre or :prologue and setting it at the header or
> document level?
>
> Please excuse brevity. Sent from tiny pocket computer with
> non-haptic-feedback keyboard.
>
> On Wed, Aug 5, 2020, 14:22 George Mauer  wrote:
>
>> Use case:
>>
>> I'm using ob-racket <https://github.com/togakangaroo/ob-racket> but this
>> would apply just as well to a few other workflows I have with python or js.
>>
>> I would like to write a helper function in a src block and then
>> automatically have access to it in other src blocks further down the
>> document. I don't really want a stateful session (nor does ob-racket
>> support sessions) so I essentially want the equivalent of automatically
>> including it everywhere so I don't have to type it out all the time (and
>> have it screw up syntax coloring/indentation).
>>
>> Is this currently possible? Does anyone have any ideas for how to extend
>> things so it is?
>>
>


Re: Can you automatically noweb include?

2020-08-05 Thread Ken Mankoff
What about using :pre or :prologue and setting it at the header or document
level?

Please excuse brevity. Sent from tiny pocket computer with
non-haptic-feedback keyboard.

On Wed, Aug 5, 2020, 14:22 George Mauer  wrote:

> Use case:
>
> I'm using ob-racket  but this
> would apply just as well to a few other workflows I have with python or js.
>
> I would like to write a helper function in a src block and then
> automatically have access to it in other src blocks further down the
> document. I don't really want a stateful session (nor does ob-racket
> support sessions) so I essentially want the equivalent of automatically
> including it everywhere so I don't have to type it out all the time (and
> have it screw up syntax coloring/indentation).
>
> Is this currently possible? Does anyone have any ideas for how to extend
> things so it is?
>


Re: [PATCH] 3 improvements to ob-screen

2020-07-15 Thread Ken Mankoff


On 2020-07-15 at 20:12 -07, Kyle Meyer  wrote...
> Well, applied, but not pushed yet. In the second patch, the session
> name is no longer passed to string-match; it was in the original patch
> at . I'll fix it up
> locally before pushing.

Argh - I apologize for introducing that bug. Thank you for catching it and 
accepting the patches. I'll look at the tweaks you made to the commit messages 
to learn what is preferred for my next contribution.

  -k.



Re: [PATCH] 3 improvements to ob-screen

2020-07-15 Thread Ken Mankoff

On 2020-07-14 at 20:08 -07, Kyle Meyer  wrote...
> Could you add a changelog entry to the body of this commit message and
> the others?

I made the changes you requested. Updated patches attached.

  -k.

>From d7b7555969ce0e58653c5b5a78d9a4a0bebbacdf Mon Sep 17 00:00:00 2001
From: "Kenneth D. Mankoff" 
Date: Tue, 14 Jul 2020 13:29:36 -0700
Subject: [PATCH 1/3] ob-screen: Execute last line in block (send newline)

* lisp/ob-screen.el (org-babel-screen-session-write-temp-file): insert
newline after body.
---
 lisp/ob-screen.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lisp/ob-screen.el b/lisp/ob-screen.el
index 75a2dc691..3edc2c265 100644
--- a/lisp/ob-screen.el
+++ b/lisp/ob-screen.el
@@ -108,6 +108,7 @@ In case you want to use a different screen than one selected by your $PATH")
   (let ((tmpfile (org-babel-temp-file "screen-")))
 (with-temp-file tmpfile
   (insert body)
+  (insert "\n")
 
   ;; org-babel has superfluous spaces
   (goto-char (point-min))
-- 
2.25.1

>From 05dcb2a9f9acb6d15c88ac67d9268243b620cf5e Mon Sep 17 00:00:00 2001
From: "Kenneth D. Mankoff" 
Date: Tue, 14 Jul 2020 13:41:35 -0700
Subject: [PATCH 2/3] ob-screen: Respect :session name. Don't prepend
 'org-babel-session-'

* lisp/ob-screen.el (org-babel-prep-session:screen): Remove concat of
"org-babel-session-" string onto session name when creating session.

* lisp/ob-screen.el (org-babel-screen-session-socketname): Remove
concat of "org-babel-session-" string onto session name searching for
existing screen session.
---
 etc/ORG-NEWS  | 7 +++
 lisp/ob-screen.el | 6 ++
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index c366f61e0..623fa9dc3 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -380,6 +380,13 @@ From ~org-enable-priority-commands~ to ~org-priority-enable-commands~.
 From ~org-show-priority~ to ~org-priority-show~.
 
 ** Miscellaneous
+*** =ob-screen.el=: Respect screen =:session= name
+
+Screen babel session are now named based on the =:session= header 
+argument (defaults to ~default~). 
+
+Previously all session names had  ~org-babel-session-~ prepended.
+
 *** Forward/backward paragraph functions in line with the rest of Emacs
 ~org-forward-paragraph~ and ~org-backward-paragraph~, bound to
 ~~ and ~~ functions mimic more closely behaviour of
diff --git a/lisp/ob-screen.el b/lisp/ob-screen.el
index 3edc2c265..fe4698203 100644
--- a/lisp/ob-screen.el
+++ b/lisp/ob-screen.el
@@ -62,8 +62,7 @@ In case you want to use a different screen than one selected by your $PATH")
  (process-name (concat "org-babel: terminal (" session ")")))
 (apply 'start-process process-name "*Messages*"
terminal `("-T" ,(concat "org-babel: " session) "-e" ,org-babel-screen-location
-		  "-c" "/dev/null" "-mS" ,(concat "org-babel-session-" session)
-		  ,cmd))
+		  "-c" "/dev/null" "-mS" ,session ,cmd))
 ;; XXX: Is there a better way than the following?
 (while (not (org-babel-screen-session-socketname session))
   ;; wait until screen session is available before returning
@@ -97,8 +96,7 @@ In case you want to use a different screen than one selected by your $PATH")
 			 nil
 			 (mapcar
 			  (lambda (x)
-			(when (string-match
-   (concat "org-babel-session-" session) x)
+			(when (string-match x)
 			  x))
 			  sockets)
 (when match-socket (car (split-string match-socket)
-- 
2.25.1

>From d99c637f1cade54ab2f66b72ec32026a15aa03de Mon Sep 17 00:00:00 2001
From: "Kenneth D. Mankoff" 
Date: Tue, 14 Jul 2020 13:48:52 -0700
Subject: [PATCH 3/3] ob-screen: accept :screenrc header argument

* lisp/ob-screen.el (org-babel-default-header-args:screen): Add
default header argument `:screenrc' and value "/dev/null".

* lisp/ob-screen.el (org-babel-prep-session:screen): Use header
argument in variable `screenrc' and not hard-coded value.
---
 etc/ORG-NEWS  | 6 ++
 lisp/ob-screen.el | 6 --
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 623fa9dc3..5fb2af22e 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -229,6 +229,12 @@ directory configured for ClojureScript will /not/ work.
 Babel Java blocks recognize header argument =:cmdargs= and pass its
 value in call to =java=.
 
+*** =ob-screen.el=: Screen now accepts =:screenrc= header argument
+
+Screen blocks now recognize the =:screenrc= header argument and pass
+its value to the screen command via the "-c" option. The default
+remains =/dev/null= (i.e. a clean screen session)
+
 *** =RET= and =C-j= now obey ~electric-indent-mode~
 
 Since Emacs 24.4, ~electric-indent-mode~ is enabled by default.  In
diff --git a/lisp/ob-screen.el b/lisp/ob-screen.el
index fe4698203..021fef60d 100644
--- a/lisp/ob-screen.el
+++ b/lisp/ob-screen.el
@@ -40,7 +40,8 @@
 In case you want to use a different screen than one selected by your $PATH")
 
 (defvar org-babel-default-header-args:screen
-  '((:results . 

[PATCH] 3 improvements to ob-screen

2020-07-14 Thread Ken Mankoff
Hello,

The attached three patches implement a bug fix, a simplification, and a new 
feature to ob-screen.

bug fix: 001 Execute last line in block (send newline)
simplify: 002 Don't add extra characters to session name
feature: 003 Accept :screenrc header argument

I've signed the FSF docs but do not see my name here: 
https://orgmode.org/worg/org-contribute.html under "Current contributors".

  -k.

>From cb014cd2da79b30967dd24fba37d7f75569ed92d Mon Sep 17 00:00:00 2001
From: "Kenneth D. Mankoff" 
Date: Tue, 14 Jul 2020 13:29:36 -0700
Subject: [PATCH 1/3] ob-screen: Execute last line in block (send newline)

---
 lisp/ob-screen.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lisp/ob-screen.el b/lisp/ob-screen.el
index 75a2dc691..3edc2c265 100644
--- a/lisp/ob-screen.el
+++ b/lisp/ob-screen.el
@@ -108,6 +108,7 @@ In case you want to use a different screen than one selected by your $PATH")
   (let ((tmpfile (org-babel-temp-file "screen-")))
 (with-temp-file tmpfile
   (insert body)
+  (insert "\n")
 
   ;; org-babel has superfluous spaces
   (goto-char (point-min))
-- 
2.25.1

>From e6ee8bff913da35a0183f8e2c1db7021342492d9 Mon Sep 17 00:00:00 2001
From: "Kenneth D. Mankoff" 
Date: Tue, 14 Jul 2020 13:41:35 -0700
Subject: [PATCH 2/3] ob-screen: Respect :session name. Don't prepend
 'org-babel-session-'

---
 etc/ORG-NEWS  | 7 +++
 lisp/ob-screen.el | 6 ++
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index c366f61e0..623fa9dc3 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -380,6 +380,13 @@ From ~org-enable-priority-commands~ to ~org-priority-enable-commands~.
 From ~org-show-priority~ to ~org-priority-show~.
 
 ** Miscellaneous
+*** =ob-screen.el=: Respect screen =:session= name
+
+Screen babel session are now named based on the =:session= header 
+argument (defaults to ~default~). 
+
+Previously all session names had  ~org-babel-session-~ prepended.
+
 *** Forward/backward paragraph functions in line with the rest of Emacs
 ~org-forward-paragraph~ and ~org-backward-paragraph~, bound to
 ~~ and ~~ functions mimic more closely behaviour of
diff --git a/lisp/ob-screen.el b/lisp/ob-screen.el
index 3edc2c265..fe4698203 100644
--- a/lisp/ob-screen.el
+++ b/lisp/ob-screen.el
@@ -62,8 +62,7 @@ In case you want to use a different screen than one selected by your $PATH")
  (process-name (concat "org-babel: terminal (" session ")")))
 (apply 'start-process process-name "*Messages*"
terminal `("-T" ,(concat "org-babel: " session) "-e" ,org-babel-screen-location
-		  "-c" "/dev/null" "-mS" ,(concat "org-babel-session-" session)
-		  ,cmd))
+		  "-c" "/dev/null" "-mS" ,session ,cmd))
 ;; XXX: Is there a better way than the following?
 (while (not (org-babel-screen-session-socketname session))
   ;; wait until screen session is available before returning
@@ -97,8 +96,7 @@ In case you want to use a different screen than one selected by your $PATH")
 			 nil
 			 (mapcar
 			  (lambda (x)
-			(when (string-match
-   (concat "org-babel-session-" session) x)
+			(when (string-match x)
 			  x))
 			  sockets)
 (when match-socket (car (split-string match-socket)
-- 
2.25.1

>From 866f3c4788e58bf26dcf9c90cb7638f48a6a4ecc Mon Sep 17 00:00:00 2001
From: "Kenneth D. Mankoff" 
Date: Tue, 14 Jul 2020 13:48:52 -0700
Subject: [PATCH 3/3] ob-screen: accept :screenrc header argument

---
 etc/ORG-NEWS  | 6 ++
 lisp/ob-screen.el | 5 +++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 623fa9dc3..5fb2af22e 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -229,6 +229,12 @@ directory configured for ClojureScript will /not/ work.
 Babel Java blocks recognize header argument =:cmdargs= and pass its
 value in call to =java=.
 
+*** =ob-screen.el=: Screen now accepts =:screenrc= header argument
+
+Screen blocks now recognize the =:screenrc= header argument and pass
+its value to the screen command via the "-c" option. The default
+remains =/dev/null= (i.e. a clean screen session)
+
 *** =RET= and =C-j= now obey ~electric-indent-mode~
 
 Since Emacs 24.4, ~electric-indent-mode~ is enabled by default.  In
diff --git a/lisp/ob-screen.el b/lisp/ob-screen.el
index fe4698203..7115080f8 100644
--- a/lisp/ob-screen.el
+++ b/lisp/ob-screen.el
@@ -40,7 +40,7 @@
 In case you want to use a different screen than one selected by your $PATH")
 
 (defvar org-babel-default-header-args:screen
-  '((:results . "silent") (:session . "default") (:cmd . "sh") (:terminal . "xterm"))
+  '((:results . "silent") (:session . "default") (:cmd . "sh") (:terminal . "xterm") (:screenrc . "/dev/null"))
   "Default arguments to use when running screen source blocks.")
 
 (defun org-babel-execute:screen (body params)
@@ -59,10 +59,11 @@ In case you want to use a different screen than one selected by your $PATH")
   (let* ((session (cdr (assq :session 

patch: ob-screen support for user-specified screenrc [9.3.7 (9.3.7-12-g5d6868-elpaplus @ /home/kdm/.emacs.d/elpa/org-plus-contrib-20200706/)]

2020-07-09 Thread Ken Mankoff


Last ob-screen patch. I apologize if these should have been one email but they 
are there independent issues.

This patch maintains the default behavior of no screenrc "-c /dev/null", but 
adds a :screenrc header arg that allows the user to specify their default or 
any file to be used as a screenrc file.

  -k.


diff --git a/lisp/ob-screen.el b/lisp/ob-screen.el
index 75a2dc691..3769a767d 100644
--- a/lisp/ob-screen.el
+++ b/lisp/ob-screen.el
@@ -29,6 +29,8 @@
 ;; Adding :cmd and :terminal as header arguments
 ;; :terminal must support the -T (title) and -e (command) parameter
 ;;
+;; Adding :screenrc as header arguments. Defaults to /dev/null.
+;;
 ;; You can test the default setup. (xterm + sh) with
 ;; M-x org-babel-screen-test RET
 
@@ -40,7 +42,7 @@
 In case you want to use a different screen than one selected by your $PATH")
 
 (defvar org-babel-default-header-args:screen
-  '((:results . "silent") (:session . "default") (:cmd . "sh") (:terminal . 
"xterm"))
+  '((:results . "silent") (:session . "default") (:cmd . "sh") (:terminal . 
"xterm") (:screenrc . "/dev/null"))
   "Default arguments to use when running screen source blocks.")
 
 (defun org-babel-execute:screen (body params)
@@ -59,10 +61,11 @@ In case you want to use a different screen than one 
selected by your $PATH")
   (let* ((session (cdr (assq :session params)))
  (cmd (cdr (assq :cmd params)))
  (terminal (cdr (assq :terminal params)))
+ (screenrc (cdr (assq :screenrc params)))
  (process-name (concat "org-babel: terminal (" session ")")))
 (apply 'start-process process-name "*Messages*"
terminal `("-T" ,(concat "org-babel: " session) "-e" 
,org-babel-screen-location
- "-c" "/dev/null" "-mS" ,(concat "org-babel-session-" 
session)
+ "-c" ,screenrc "-mS" ,(concat "org-babel-session-" 
session)
  ,cmd))
 ;; XXX: Is there a better way than the following?
 (while (not (org-babel-screen-session-socketname session))



patch: ob-screen: don't change user-specified session name [9.3.7 (9.3.7-12-g5d6868-elpaplus @ /home/kdm/.emacs.d/elpa/org-plus-contrib-20200706/)]

2020-07-09 Thread Ken Mankoff


ob-screen prepends "org-babel-session-" to the user-specific screen name for 
some reason. I suggest this is not necessary nor optimal. One of the key points 
of 'screen' is that you can detach and attach from elsewhere. The name of the 
session is an important part of this process, and changing the user-chosen name 
complicates this. I note that in the other babel :session names I use (shell, 
Python, jupyter-python, etc.) the :session name is not modified.

  -k.



diff --git a/lisp/ob-screen.el b/lisp/ob-screen.el
index 75a2dc691..685961a7e 100644
--- a/lisp/ob-screen.el
+++ b/lisp/ob-screen.el
@@ -62,8 +62,7 @@ In case you want to use a different screen than one selected 
by your $PATH")
  (process-name (concat "org-babel: terminal (" session ")")))
 (apply 'start-process process-name "*Messages*"
terminal `("-T" ,(concat "org-babel: " session) "-e" 
,org-babel-screen-location
- "-c" "/dev/null" "-mS" ,(concat "org-babel-session-" 
session)
- ,cmd))
+ "-c" "/dev/null" "-mS" ,session ,cmd))
 ;; XXX: Is there a better way than the following?
 (while (not (org-babel-screen-session-socketname session))
   ;; wait until screen session is available before returning
@@ -97,8 +96,7 @@ In case you want to use a different screen than one selected 
by your $PATH")
 nil
 (mapcar
  (lambda (x)
-   (when (string-match
-  (concat "org-babel-session-" session) x)
+   (when (string-match session x)
  x))
  sockets)
 (when match-socket (car (split-string match-socket)



Patch: send 'return' after babel blocks sent to ob-screen [9.3.7 (9.3.7-12-g5d6868-elpaplus @ /home/kdm/.emacs.d/elpa/org-plus-contrib-20200706/)]

2020-07-09 Thread Ken Mankoff
Using ob-screen and this example:

#+begin_src screen
ls
#+end_src

The "ls" is transmitted to the screen session, but without a newline, it does 
not execute. The following patch adds a newline to all babel blocks sent to the 
screen session.

diff --git a/lisp/ob-screen.el b/lisp/ob-screen.el
index 75a2dc691..5616143fe 100644
--- a/lisp/ob-screen.el
+++ b/lisp/ob-screen.el
@@ -108,7 +108,7 @@ In case you want to use a different screen than one 
selected by your $PATH")
   (let ((tmpfile (org-babel-temp-file "screen-")))
 (with-temp-file tmpfile
   (insert body)
-
+  (insert "\n")
   ;; org-babel has superfluous spaces
   (goto-char (point-min))
   (delete-matching-lines "^ +$"))


Also, can anyone clarify why there is both

./contrib/lisp/org-screen.el
./lisp/ob-screen.el

?

Thanks,

  -k.



Bug: org-babel-ref-resolve does not find refs in a COMMENT'ed section [9.3.7 (9.3.7-elpaplus @ /home/kdm/.emacs.d/DEBUG/elpa/org-plus-contrib-20200602/)]

2020-06-05 Thread Ken Mankoff
Hello,

I think this is a recent change in behavior. I can no longer eval Babel blocks 
that expect table inputs via :var when they are in a section with a COMMENT 
status.



Here is an MWE org file:

=== BEGIN ===

* COMMENT Tables not found when section is commented

#+NAME: table
| foo |

(org-babel-ref-resolve "table")

=== END ===




When I try to eval (org-babel-ref-resolve "table"), Org reports:

org-babel-ref-resolve: Reference ‘table’ not found in this buffer

If I remove the "COMMENT" state on the heading, then the table is found.

I do not recall this happening in earlier versions of Org, but does now with 
the latest version from melpa.





Tested with /usr/bin/emacs -Q -l ~/.emacs.d/DEBUG.el ~/.emacs.d/DEBUG.org with 
DEBUG.org above and DEBUG.el containing:


(setq package-user-dir (expand-file-name "elpa" "~/.emacs.d/DEBUG"))
(require 'package)
(setq package-enable-at-startup nil)
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/;) t)
(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/;) t)
(package-initialize)
(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package))
(setq package-enable-at-startup nil)
(defvar use-package-verbose t)
(require 'use-package)
(setq use-package-always-ensure t)

(use-package org
  :ensure org-plus-contrib
  :config
  (setq org-confirm-babel-evaluate nil)
  (org-babel-do-load-languages
   'org-babel-load-languages
   '((shell . t


  -k.



Re: Help speeding up Org iCal export

2020-05-28 Thread Ken Mankoff
Hi Nicolas,

Thank you for providing suggestions about the appropriate tool. I've
profiled it, examined the variables you suggested, but am not sure what
next steps to take. I hope it is OK that I post questions about this on
this list...

On Thu, May 28, 2020 at 5:17 AM Nicolas Goaziou 
wrote:

> Ken Mankoff  writes:
>
> > When I eval `(org-icalendar-combine-agenda-files nil)`, it takes about
> > 15 seconds.
>
> OK. You may want to profile this, or use ELP.
>

Output from the profiler is here: https://pastebin.com/QvL9w69R but the key
lines seems to be:

  - org-icalendar-combine-agenda-files  15540  83%
   - apply  15540  83%
- org-icalendar--combine-files  15540  83%
 - mapconcat15536  83%
  - #   15536  83%
   - org-export-as  15162  81%
- org-export-data6493  34%
 - mapconcat 6493  34%
  - #6493  34%
   - org-export-data 6493  34%
- mapconcat  6164  33%
 - # 6160  33%
  - org-export-data  6156  33%
   - mapconcat   5674  30%

with org-export-data and mapconcat repeating, AND

- mapc   5672  30%
 - # 5672  30%
  - mapc 5672  30%
   - #   5668  30%
- #   4392  23%
 - org-id-find   4392  23%
  - org-id-update-id-locations
4376  23%
   - org-map-entries 3696  19%
- org-scan-tags  3668  19%
 + #990
  5%
 + #879
  4%
 + #830
  4%



> Some strange messages in the *Messages* buffer include:

> >
> > 22 files scanned, 7 files contains IDs and in total 23 IDs found.
>
> You may have set `org-icalendar-store-UID' somehow.
>

It is set to nil. I have only the *scratch* buffer open, and no other
buffers (although some where open earlier in this emacs session).


> > But my `org-agenda-files` variable only contains 12 files and no
> > #+INCLUDE statements.
>
> ID scanning is not limited to agenda files. Org also scans files known
> to contain ID. E.g., if, during the session, you insert an ID in
> "foo.org", later scans (in the same session) will include "foo.org".
>
> See `org-id-files' (internal variable), and `org-id-extra-files', which
> may contain even more files.
>

`org-id-files` contained a subset of my agenda files plus a few extra
(total: 7 files, and these 7 plus my agenda files do not sum to 22). When I
set it to nil, nothing significant changed, but it was reset after running
`org-icalendar-combine-agenda-files` again.

`org-id-extra-files` was set to org-agenda-text-search-extra-files. When I
set it to nil, nothing significant changed. It does not get reset when
`org-icalendar-combine-agenda-files` is run.

  -k.


[O] Help speeding up Org iCal export

2020-05-27 Thread Ken Mankoff
Hello,

When I eval `(org-icalendar-combine-agenda-files nil)`, it takes about 15 
seconds.

Some strange messages in the *Messages* buffer include:

22 files scanned, 7 files contains IDs and in total 23 IDs found.

But my `org-agenda-files` variable only contains 12 files and no #+INCLUDE 
statements.

There are also several dozen lines of

org-babel-exp process sh at position 74770...
org-babel-exp process sh at position 74830...
org-babel-exp process sh at position 75147...
...
org-babel-exp process sqlite at position 27700...
org-babel-exp process sqlite at position 27704...
org-babel-exp process sh at position 27604...
org-babel-exp process sh at position 27617...
org-babel-exp process sh at position 27691...
org-babel-exp process translate at position 27970...

(and with bash, python, emacs-lisp, and other languages). When I view for 
example the only #BEGIN_SRC translate block in any of my files it is just a 
test in my notes file:

#+BEGIN_SRC translate :src en :dest da
This is a test
#+END_SRC

I cannot eval it with C-c C-c because I have set ":eval no" system-wide with:

  (setq org-babel-default-header-args
(cons '(:eval . "no")
  (assq-delete-all :eval org-babel-default-header-args)))


Sometimes the Messages contain confirmation that a code block is disabled:

org-babel-exp process plantuml at position 27719...
Evaluation of this plantuml code block is disabled.
org-babel-exp process plantuml at position 27762...
Evaluation of this plantuml code block is disabled.


But those blocks don't have any special header:

#+begin_src plantuml :file tryout.png
...misc plantuml code here.
#+end_src


Can anyone offer suggestions why it reports scanning 22 files, and how to speed 
it up since no code should be evaluated?

Thank you,

  -k.



Re: issue tracker?

2020-05-22 Thread Ken Mankoff
On Wed, May 20, 2020 at 7:36 PM Anthony Carrico 
wrote:

> Given that the mailing list holds the issues, it would be nice if you
> could import the mailing list into your client as a lump (maildir/mbox).
> Currently you can only download it chunk by chunk, so it isn't really
> practical for a newcomer to import the whole list to do research a new
> issue before reporting it.
>

You can import it. See recent announcement to this list:
https://lists.gnu.org/archive/html/emacs-orgmode/2020-04/msg00020.html

  -k.


[O] (no)export of special blocks

2020-05-07 Thread Ken Mankoff
Hello,

I'd like to be able to optionally export/not-export a specific paragraph within 
a section, based on a top-level property. Is this possible in Org? I know I can 
toggle export of code blocks, but what about text blocks?

More specifically, I'm writing a journal article and I would like to have 
figures in the text where I think they should be:

[[./fig/foo.png]]
#+CAPTION: foo

But the journal wants the figures at the end of the document.

I'd like to replicate the "[[./fig/foo.png]]", once inline and once at the end. 
I'd then like to be able to wrap this in a #+BEGIN_SOMETHING and toggle that 
with a property to export or not. E.g:

#+BEGIN_something :export (org-macro--get-property "results-y-or-n" "")
[[./fig/foo.png]]
#+CAPTION: foo
#+END_something


I recognize that if the figure is generated from a code block I can achieve my 
desired behavior. The code can have ":exports results" set to ":exports 
(org-macro--get-property "results-y-or-n" "")", and elsewhere

:PROPERTIES:
:results-y-or-n: nil
:END:

But there are a few problems with this:

1) org-macro--get-property works for header level properties in :PROPERTIES: 
drawers, but not top level #+PROPERTY: items.

2) Not all my figures are generated from code blocks

Thanks,

  -k.



Re: Overleaf equivalent for org-babel users?

2020-04-18 Thread Ken Mankoff
I've looked a bit more into what Joseph linked to. What about using Org
locally on your computer, and sharing an http://markup.rocks + DropBox
access to your Org files for non-emacs collaborators?

If CoCalc provides something you need that you don't have locally, you
could combine CoCalc + Markup.Rocks. I heard (and CoCalc repeats) here
https://doc.cocalc.com/howto/external-tools.html that DropBox won't work on
certain linux filesystems, but I have never run into this issue yet, so it
may work.

On Sat, Apr 18, 2020 at 8:17 AM Prof. Dr. Johanna May <
johanna@th-koeln.de> wrote:

> Dear Ken,
>
> thank you very much. I'm looking into cocalc now. I already got it to
> compile some test.org file as pdf. I also set up a test file there in
> order to start finding out how to do this. Next step, I guess, would be
> to see, if org-babel works. Unfortunately, it looks like
> a bit more work since for collaboration I need to find out about
> versioning and testing the stuff and also about how to get some very
> simple interface working there, maybe for small edits github is
> nicer. But I have to admit, my experience on tramp (what is that?) and
> git is very limited, so I don't yet have an idea of how to set that up
> in a good way.
>
> Jupyter Notebooks are not what I feel is right for lecture notes in that
> subject since they cannot display circuitikz and latex export is not the
> way it should be. It's not a programming class I'm teaching and many
> students do prefer the pdf they can either print out or annotate in some
> software on their tablets or just display on their smartphone. The exam
> is in writing and on paper.
>
> I do also provide some jupyter notebooks, but only for the interested
> part of the class and they surely can manage without that. As always,
> such options are rather taken up by the more skilled, and not so much by
> the weaker students, unfortunately.
>
> Cheers, have a good weekend!
>
> J
>
> Am Samstag, 18. April 2020 um 15:59 schrieb Ken Mankoff ...
> > Hi Dr. May,
> >
> > Unfortunately I have not found Emacs + Org to be the right tools when
> collaborating. What we need is a way for Org wrap/interface/edit Jupyter
> Notebooks, since that seems to be becoming the standard. Unfortunately.
> >
> > I have had some luck with a hybrid approach using the Sage Notebook
> server. That project is no longer active (perhaps due to the success of
> Jupyter Notebooks?), but I think you can do something similar with either
> Google Colab https://colab.research.google.com or more likely CoCalc
> https://cocalc.com/
> >
> > Google Collab is just an interface to Jupyter Notebooks.
> >
> > CoCalc can also just run Jupyter Notebooks, but also lets you have a
> full Linux environment, bash shell, ssh, git, etc. I think you may need to
> pay for this level of service, but you could then run emacs remotely via
> ssh, or locally and use tramp. If the backend is git you may be able to
> work locally and sync with the webserver interface to the tools that your
> colleagues would see.
> >
> > I still don't think your colleagues would be directly editing your Org
> source though, but you may be able to get close to what you're looking for
> on those sites. Good luck, and please do post back here if you come up with
> a good solution.
> >
> >   -k.
> >
> > On 2020-04-16 at 10:22 -07, Prof. Dr. Johanna May
> >  wrote...
> >> Hey there,
> >>
> >> I've been preparing lecture notes with org-mode and lualatex export
> >> that include python diagrams and so on for about more than a year. Now
> >> my colleagues and team start to get interested in tweaking the
> >> results. Therefore, we would need some kind of online collaboration
> >> solution similar to overleaf that can compile the latex including the
> >> python (org-babel) inserts. And, obviously, versioning would also come
> >> in handy, so that would rather be github / gitlab functionality.
> >>
> >> Does anyone know of a solution like overleaf that can be used for
> >> that? Could you point me at your description of any setup needed? Or,
> >> alternatively, do you have some good description of how to set up a
> >> server / virtual machine that can do that? (at best including a
> >> virtual emacs interface, so not all users have to do all the
> >> installations locally)? If so, that description would also interest
> >> me.
> >>
> >> I would like to either use some online platform like overleaf or
> >> explain to my university colleagues who already have servers running
> >> what they could do for me.
> >>
> >> 

Re: Overleaf equivalent for org-babel users?

2020-04-18 Thread Ken Mankoff
Hi Dr. May,

Unfortunately I have not found Emacs + Org to be the right tools when 
collaborating. What we need is a way for Org wrap/interface/edit Jupyter 
Notebooks, since that seems to be becoming the standard. Unfortunately.

I have had some luck with a hybrid approach using the Sage Notebook server. 
That project is no longer active (perhaps due to the success of Jupyter 
Notebooks?), but I think you can do something similar with either Google Colab 
https://colab.research.google.com or more likely CoCalc https://cocalc.com/

Google Collab is just an interface to Jupyter Notebooks.

CoCalc can also just run Jupyter Notebooks, but also lets you have a full Linux 
environment, bash shell, ssh, git, etc. I think you may need to pay for this 
level of service, but you could then run emacs remotely via ssh, or locally and 
use tramp. If the backend is git you may be able to work locally and sync with 
the webserver interface to the tools that your colleagues would see.

I still don't think your colleagues would be directly editing your Org source 
though, but you may be able to get close to what you're looking for on those 
sites. Good luck, and please do post back here if you come up with a good 
solution.

  -k.

On 2020-04-16 at 10:22 -07, Prof. Dr. Johanna May
 wrote...
> Hey there,
>
> I've been preparing lecture notes with org-mode and lualatex export
> that include python diagrams and so on for about more than a year. Now
> my colleagues and team start to get interested in tweaking the
> results. Therefore, we would need some kind of online collaboration
> solution similar to overleaf that can compile the latex including the
> python (org-babel) inserts. And, obviously, versioning would also come
> in handy, so that would rather be github / gitlab functionality.
>
> Does anyone know of a solution like overleaf that can be used for
> that? Could you point me at your description of any setup needed? Or,
> alternatively, do you have some good description of how to set up a
> server / virtual machine that can do that? (at best including a
> virtual emacs interface, so not all users have to do all the
> installations locally)? If so, that description would also interest
> me.
>
> I would like to either use some online platform like overleaf or
> explain to my university colleagues who already have servers running
> what they could do for me.
>
> The problem is, that the collaboration colleagues are not good friends
> with coding (they prefer word to latex, excel to python ... until now,
> at least), so I'm not very inclined to suggest them to start using
> emacs. I would very much prefer some web-based solution to get them
> started. Also, such a solution might provide ways of having students
> contribute smaller bits and pieces without having to go thru the whole
> learning curve of learning the use of emacs, installing all the tools,
> etc.pp. Any ideas?
>
> Thank you very much!
>
> Cheers,
>
> J. May




Re: :tangle header argument not picked up in #+PROPERTY line or :PROPERTIES: block

2020-03-31 Thread Ken Mankoff
Yes I'm sure. From the link Thomas sent,

Any property specification, unless it is postfixed with a `+`, will *reset*
the value of that property to its current value.

C-c C-v  (for me, Charles uses C-c C-v C-i) withitn a code block shows
you the header args that are set for that block. Useful for debugging.

  -k.

On Mon, Mar 30, 2020 at 3:24 PM Joost Kremers 
wrote:

>
> On Mon, Mar 30 2020, Ken Mankoff wrote:
> > Header args overwrite. Change python to python+ to append header
> > args.
>
> Are you sure? That's not documented anywhere I can find and it
> seems to be belied by the fact that if I put the headers in the
> order:
>
> ```
> :PROPERTIES:
> :header-args:python: :tangle out1.py
> :header-args:python: :session py1 :results function
> :END:
> ```
>
> everything works as I would expect (the code blocks are tangled to
> a file `out1.py` *and* they are evaluated in a python session
> `py1`), meaning that *all* header args are picked up.
>
> If I reverse the order and add a `+` sign, like so:
>
> ```
> :PROPERTIES:
> :header-args:python+: :session py1 :results function
> :header-args:python+: :tangle out1.py
> :END:
> ```
>
> the code does indeed get tangled, but the `:results` header arg
> isn't picked up, because the code block doesn't produce any
> output.
>
> For reference, this is my test file:
>
> ```
> * Header 1
> :PROPERTIES:
> :header-args:python+: :session py1 :results function
> :header-args:python+: :tangle out1.py
> :END:
>
> #+begin_src python
> a=1
> b=2
> c=a+b
> return c
> #+end_src
>
> #+RESULTS:
> ```
>
>
> --
> Joost Kremers
> Life has its moments
>


Re: :tangle header argument not picked up in #+PROPERTY line or :PROPERTIES: block

2020-03-29 Thread Ken Mankoff
Header args overwrite. Change python to python+ to append header args.

Please excuse brevity. Sent from tiny pocket computer with non-haptic
feedback keyboard.

On Sun, Mar 29, 2020, 15:42 Joost Kremers  wrote:

>
> On Mon, Mar 30 2020, Joost Kremers wrote:
> > Looks like a bug, right?
>
> And while I'm at it, this doesn't work as expected either:
>
> ```
> #+PROPERTY: header-args :dir /home/joost/tmp/dlpy/
>
> * Header 1
> :PROPERTIES:
> :header-args:python: :tangle out1.py
> :header-args:python: :session py1 :results function
> :END:
>
> #+begin_src python
> a=1
> b=2
> c=a+b
> return c
> #+end_src
> ```
>
> I would expect that the file `out1.py` is created in the directory
> `/home/joost/tmp/dlpy`, but it's created in the same directory as
> the Org file.
>
> Are my expectations wrong or is this really a bug?
>
>
> --
> Joost Kremers
> Life has its moments
>
>


Re: Strange Org <> OS interaction w/ bad ID

2020-02-24 Thread Ken Mankoff
On Mon, Feb 24, 2020 at 10:51 AM Nicolas Goaziou 
wrote:

> > Does anyone know why Org is parsing files in random folders when
> > I have a bad ID and a <>?
>
> I don't. You may want to check `org-id-files', or walk the hash table
> `org-id-locations'.
>

(apropos "org-id-files") returns nil, which is strange because it seems to
be in Org for the past 11 years
https://github.com/bzg/org-mode/blame/a3da64ad574e6ba860ea03c1bf6af91f279d86ee/lisp/org-id.el#L216

Same with org-id-locations.

With `emacs -Q` and nothing else, should these be set?

  -k.


[O] Strange Org <> OS interaction w/ bad ID

2020-02-24 Thread Ken Mankoff
Hi Org List,

This is cross-posted here: 
https://www.reddit.com/r/emacs/comments/f8t50q/help_debugging_org_os_interaction/

I've run into a strange bug. This is reproducible on my machine with "emacs 
-Q", but not with with emacs-sandbox 
https://github.com/alphapapa/emacs-sandbox.sh/ so I don't know if you'll be 
able to recreate this...

Problem: When exporting an Org file that contains 1) <> refs and 2) 
id:link links to CUSTOM_ID, then Org parses files all over my filesystem. Given 
that this happens with "emacs -Q", I don't know why it would be opening files 
in random folders!

The MWE Org file that I'm opening and exporting is:

=== BEGIN ===

#+BEGIN_SRC emacs-lisp :results value :noweb yes :eval no-export
<>
#+END_SRC

#+NAME: bar
#+BEGIN_SRC emacs-lisp :results value :noweb yes :eval no-export
(org-version)
#+END_SRC

* Bug: Export with IDs and links
:PROPERTIES:
:CUSTOM_ID: foo
:END:

+ Link to id:foo

=== END ===

The file is eventually exported correctly and the link works. I think I found 
the bug - when I run org-lint, I am told

> 18 high  Unknown ID "foo"

And when I change "CUSTOM_ID" to "ID", then everything works. No bug. No random 
files parsed. With CUSTOM_ID I can see it parse files throughout my filesystem 
(how does it find them??) because I get this error message about 10x:

> The local variables in /path/to/folder
> contains values that may not be safe (*).
>
> Do you want to apply it? You can type
> [snip]
> 
> * eval: (pyvenv-activate "/path/to/anaconda/envs/env")

The bug needs both the id: link to CUSTOM_ID *and* the <> ref. If I 
comment out the <> ref, then the bug does not appear.

I thought named IDs were supposed to go into CUSTOM_ID properties rather than 
ID properties. Is this incorrect?

Does anyone know why Org is parsing files in random folders when I have a bad 
ID and a <>?

Thanks,

 -k.




Building MWE DEBUG.org template file

2020-02-23 Thread Ken Mankoff
Hello,

I'm trying to build a DEBUG.org that makes it easy to share MWEs of bugs I run 
across in Emacs packages. I'd like it to load the latest Org mode by default. 
Then for any given bug I load the needed packages, configure them, and 
demonstrate the bug.

Right now when I run the attached file, the first time I run it everything 
appears to work correctly. It installs Org from melpa into a temporary elpa 
folder, and the output of

#+BEGIN_SRC emacs-lisp :results value :noweb yes
<>
<>
(org-version nil t)
#+END_SRC

is:

#+RESULTS:
: Org mode version 9.3.6 (9.3.6-4-gdfa7a3-elpaplus @ 
/home/kdm/.emacs.d/DEBUG/elpa/org-plus-contrib-20200217/)

But when I load the file a second time in a clean emacs session (i.e. 
/usr/bin/emacs -Q ~/.emacs.d/DEBUG.org & ), then the Org version is incorrect, 
and I see:

#+RESULTS:
: Org mode version 9.1.9 (release_9.1.9-65-g5e4542 @ 
/home/kdm/.emacs.d/DEBUG/elpa/org-plus-contrib-20200217/)


Can anyone explain what I'm doing incorrectly in the attached file?

Thanks,

  -k.


Run this debug Org file in a clean emacs session with:

/usr/bin/emacs -Q ~/.emacs.d/DEBUG.org & 

Initialize Emacs to reproduce this bug. Press `C-c C-c` in the Org Babel block below.

#+BEGIN_SRC emacs-lisp :results value :noweb yes
<>
<>
(org-version nil t)
#+END_SRC

#+RESULTS:
: Org mode version 9.3.6 (9.3.6-4-gdfa7a3-elpaplus @ /home/kdm/.emacs.d/DEBUG/elpa/org-plus-contrib-20200217/)

* Bug
** COMMENT Example Bug

Put example code here for this bug.

#+BEGIN_SRC emacs-lisp :results value
(defmacro measure-time ( body)
  "Measure the time it takes to evaluate BODY."
  `(let ((time (current-time)))
 ,@body
 (message "%.06f" (float-time (time-since time)

(measure-time (message "hello, world"))
#+END_SRC

#+RESULTS:
: 0.000134


* Init
** Emacs

#+NAME: init_emacs
#+BEGIN_SRC emacs-lisp :results none
(setq package-user-dir (expand-file-name "elpa" "~/.emacs.d/DEBUG"))

(require 'package)
(setq package-enable-at-startup nil)
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/;) t)
(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/;) t)

(package-initialize)
;; Bootstrap `use-package'
(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package))
(setq package-enable-at-startup nil)

(defvar use-package-verbose t)
(require 'use-package)
(setq use-package-always-ensure t)
;(setq use-package-always-defer t)
;; (require 'diminish);; if you use :diminish
;; (require 'bind-key)   
#+END_SRC

** Org

#+NAME: init_org
#+BEGIN_SRC emacs-lisp :results none
(use-package org
  :ensure org-plus-contrib)
(setq org-confirm-babel-evaluate nil) ;; don't ask to eval code
(org-babel-do-load-languages
 'org-babel-load-languages
 '((emacs-lisp . t)   
   (shell . t)))
#+END_SRC





Re: Automatic LaTeX preview toggling

2020-02-18 Thread Ken Mankoff
Recent melpa package does this:
https://github.com/io12/org-fragtog

  -k.


Please excuse brevity. Sent from tiny pocket computer with non-haptic
feedback keyboard.

On Thu, Feb 13, 2020, 21:20 Ag Ibragimov  wrote:

>
> I just recently discovered that this excellent code snippet that I found
> long time ago here:
> http://slumpy.org/blog/2017-02-01-automatic-latex-preview-in-org-mode
>
> which is based on even older post originally written by John Kitchin:
>
>
> http://kitchingroup.cheme.cmu.edu/blog/2015/10/09/Automatic-latex-image-toggling-when-cursor-is-on-a-fragment/
>
> unfortunately stopped working. I guess I missed it, at some point it seems
> org--list-latex-overlays function was removed.
>
> Does anyone know if there's updated version of this thing somewhere? Or
> maybe this was extracted into some plugin or something that can be
> installed from MELPA maybe and I don't even know?
>
>


Re: How to set time limit and memory limit for execution of source blocks

2020-02-09 Thread Ken Mankoff
On 2020-02-03 at 22:40 -08, Anoop GR  wrote...
> How do I enforce the same on my orgmode source blocks. I want the
> execution to stop whenever it exceeds the above limits on memory and
> time.

There are several packages that implement :async source blocks via the :async 
header arg. It seems like one of these could be fairly easy to adapt to monitor 
the process it spawns.

  -k.




Re: Properties Drawer versus tags

2019-12-20 Thread Ken Mankoff


On 2019-12-19 at 22:24 -08, Lawrence Bottorff 
wrote...
> Very simple, largely philosophical question: When/why use a properties
> drawer below a heading versus just using tags on the heading? What are
> the advantages, disadvantages of both?

Tags are binary. They are there or not.

Property drawers allow you to assign values to variables.

I've never fully understood why some property drawers are set to binary. For 
controlling LaTeX export I have both a property ":clearpage: t" and a tag 
":ignore:", and the tag makes more sense to me. Some of those may only exist in 
my personal config.

  -k.



Re: noweb multiple block together

2019-11-25 Thread Ken Mankoff
Hi Sebastian,

On 2019-11-24 at 22:24 -08, Sebastian Miele  wrote...
> there is the possibility to give a common name to multiple blocks via
> the header arg :noweb-ref. That works in the way you looking for.

Yes this does what I want. I once knew but then forgot about this. Thank you 
for reminding me.

  -k.




noweb multiple block together

2019-11-24 Thread Ken Mankoff
Hello,

When tangling blocks, I can tangle multiple blocks by setting a (sub)-tree 
level property, or ":tangle foo" in multiple headers. Is there a way to achieve 
the same thing with noweb?

I've tried giving multiple blocks the same "+name:" and then <>, but only 
one seems to be included. Does this feature exist through some mechanism?

Thanks,

  -k.



Re: Using Org and eev together - problem with source blocks

2019-11-10 Thread Ken Mankoff


On 2019-11-10 at 15:36 +01, Eduardo Ochs  wrote...
> Changing the Python source block to
>
> #+BEGIN_SRC python :output results
>
> Are you sure that you wrote it correctly?

I'm pretty sure I did not. Try ":results output"

  -k.




Re: Using Org and eev together - problem with source blocks

2019-11-10 Thread Ken Mankoff


On 2019-11-10 at 02:54 +01, Eduardo Ochs  wrote...
> #+BEGIN_SRC python
> def square (x):
> return x*x
>
> print(square(5))
> #+END_SRC
>
> [...] when I run the Python block with C-c C-c I always get a results
> block like this (without the indentation):
>
>   #+RESULTS:
>   : None
>
> What am I doing wrong? I expected an output of "25"... =(

Adding ":output results" makes this work for me, but I'm not using emacs24.

  -k.



Re: where to place caption so babel results include caption?

2019-11-09 Thread Ken Mankoff


On 2019-11-06 at 17:53 +01, Ken Mankoff  wrote...
> On 2019-11-06 at 17:05 +01, Berry, Charles  wrote...
>> M-: (org-babel-map-src-blocks nil (org-babel-insert-result ""
>> '("replace"))) RET

An improvement: Don't insert #+results: if they don't already exist:

(org-babel-map-src-blocks nil
(if (org-babel-where-is-src-block-result)
(org-babel-insert-result "" '("replace"

  -k.



Re: where to place caption so babel results include caption?

2019-11-06 Thread Ken Mankoff


On 2019-11-06 at 17:05 +01, Berry, Charles  wrote...
> M-: (org-babel-map-src-blocks nil (org-babel-insert-result ""
> '("replace"))) RET
>
> HTH,

Yes that helps! A simple solution. Thank you.

  -k.



[O] where to place caption so babel results include caption?

2019-11-06 Thread Ken Mankoff
Hello,

If I have a babel block that generates a table and I'd like latex attributes 
associated with that table, it seems to work well if I do this:

#+NAME: foo
#+BEGIN_SRC bash :results table
echo "${RANDOM}|${RANDOM}|"
echo "${RANDOM}|${RANDOM}|"
#+END_SRC

#+caption: foo
#+latex_attr: :placement [!h]
#+RESULTS: foo
| 17326 | 29919 |
| 30565 |  9548 |


And I can re-run the babel block and CAPTION and ATTR_LATEX remain.

But if I want to clean with =[C-u] C-c C-v k= or 
(org-babel-remove-result-one-or-many) and regenerate =C-c C-v C-b= or 
(org-babel-execute-buffer), then this happens:


#+RESULTS: foo
| 17225 | 29253 |
| 18433 | 27388 |

#+caption: foo
#+latex_attr: :placement [!h]

If I place CAPTION and LATEX_ATTR above the babel block it isn't exported 
correctly. Is there some way to have this work?

Thanks,

  -k.



Re: Org mode for meeting minutes

2019-10-31 Thread Ken Mankoff
Hello,

I think you can achieve that table with existing functionality.

(setq org-agenda-overriding-columns-format "%ITEM %TODO %DEADLINE")

And then agenda column view (C-c C-x C-c) shows a similar output.

I think similar outputs and methods could be used with :property: keywords too 
for adding follow-up dates to task, team-members, effort estimates, etc.

  -k.



Re: [O] Creating a (RabbitMQ) diagram

2019-10-17 Thread Ken Mankoff


On 2019-10-17 at 13:12 +02, PICCA Frederic-Emmanuel 
 wrote...
> https://en.wikipedia.org/wiki/PGF/TikZ

Or you can do it with Ditaa, http://plantuml.com, others that may be easier to 
use than TikZ.

  -k.




Re: [O] [PATCH] Add :eval only-manual to babel blocks

2019-10-16 Thread Ken Mankoff


On 2019-10-16 at 12:38 +02, Nicolas Goaziou  wrote...
> Of course, meawhile, do not rely on undefined behaviour :)

Would you accept a documentation patch that defines the current behavior?

Then I get what I want, and it is on future developers to not mess it up :).

  -k.




Re: [O] [PATCH] Add :eval only-manual to babel blocks

2019-10-16 Thread Ken Mankoff
Hi Nicolas,

On 2019-10-16 at 12:38 +02, Nicolas Goaziou  wrote...
> Note that what you want, i.e., to distinguish behaviour depending on
> the location of the call stack is cheesy, at best. Think about macros,
> user-defined functions, etc.

Yes, it felt a bit hackish. But I'm new to this level of Org coding.

> The Emacs' answer to this is usually to check if call to a function is
> interactive, or not.

Can you provide a more obvious hint? :) I've read the documentation on 
called-interactively-p but have not had success yet with that function. The 
bottom of that doc string suggests this is not an appropriate use for it.

I've read the manual part on "Distinguish Interactive Calls"[1] but working 
through those examples I can't get deeper called functions to know if the 
nth-parent was called interactively or not.

Would you solve this issue somewhere completely different? Like an advice 
around the org-ctrl-c-ctrl-c function or something?

Thanks,

  -k.

[1] 
https://www.gnu.org/software/emacs/manual/html_node/elisp/Distinguish-Interactive.html



Re: [O] [PATCH] Add :eval only-manual to babel blocks

2019-10-16 Thread Ken Mankoff


On 2019-10-14 at 09:10 +02, Ken Mankoff  wrote...
> With this patch and ":eval only-manual" in a babel header,
>
> Org evaluates the source code if it is run via ~org-ctrl-c-ctrl-c~
> (e.g. =C-c C-c= in the babel block), but not if run via the
> ~org-babel-execute-buffer~ function.

Hmm. So it turns out (I think) this patch isn't necessary. The behavior I 
wanted and thought I implemented is actually the default behavior! I think the 
behavior is undefined for :eval not equal to "yes", "no", or "query", but the 
current undefined implementation does what I want.

  -k.




Re: [O] JShell support in Babel?

2019-10-15 Thread Ken Mankoff


On 2019-10-15 at 13:04 +02, Jarmo Hurri  wrote...
> JShell is a pretty nifty tool for exploring and demonstrating basic Java
> features. Has anyone happened to write support for it in Babel?

You can start working with it even without official Babel support:

#+BEGIN_SRC bash :results verbatim
jshell
int a[] = {0,1,3,5,8}
a
a[3] = 42
a

""
#+END_SRC
#+RESULTS:
#+begin_example
|  Welcome to JShell -- Version 11.0.4
|  For an introduction type: /help intro

jshell> int a[] = {0,1,3,5,8}
a ==> int[5] { 0, 1, 3, 5, 8 }

jshell> a
a ==> int[5] { 0, 1, 3, 5, 8 }

jshell> a[3] = 42
$3 ==> 42

jshell> a
a ==> int[5] { 0, 1, 3, 42, 8 }

jshell> 

jshell> ""
#+end_example


The last line doesn't P (from REPL) until I added the "". You can probably find 
a more elegant solution using :post.

  -k.
  



[O] [PATCH] Add :eval only-manual to babel blocks

2019-10-14 Thread Ken Mankoff

With this patch and ":eval only-manual" in a babel header,

Org evaluates the source code if it is run via ~org-ctrl-c-ctrl-c~ (e.g. =C-c 
C-c= in the babel block), but not if run via the ~org-babel-execute-buffer~ 
function.

This is my first contribution to Org core. I've signed FSF papers. 

  -k.

diff --git a/doc/org-manual.org b/doc/org-manual.org
index 59591894d..aa72c642c 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -17051,6 +17051,12 @@ evaluating untrusted code blocks by prompting for a confirmation.
   Org does not evaluate the source code when exporting, yet the user
   can evaluate it interactively.
 
+- =only-manual= ::
+
+  Org evaluates the source code if it is run via ~org-ctrl-c-ctrl-c~
+  (e.g. =C-c C-c= in the babel block), but not if run via the 
+  ~org-babel-execute-buffer~ function.
+
 - =query-export= ::
 
   Org prompts the user for permission to evaluate the source code
diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index 572f97919..15fadadf0 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -228,7 +228,9 @@ should be asked whether to allow evaluation."
   (let* ((headers (nth 2 info))
 	 (eval (or (cdr  (assq :eval headers))
 		   (when (assq :noeval headers) "no")))
-	 (eval-no (member eval '("no" "never")))
+	 (manual (and (not (eq nil (member 'org-ctrl-c-ctrl-c (org--function-stack
+		  (not (eq nil (member eval '("only-manual"))
+	 (eval-no (member eval '("no" "never" "only-manual")))
 	 (export org-babel-exp-reference-buffer)
 	 (eval-no-export (and export (member eval '("no-export" "never-export"
 	 (noeval (or eval-no eval-no-export))
@@ -240,10 +242,24 @@ should be asked whether to allow evaluation."
  (nth 0 info) (nth 1 info))
 		  org-confirm-babel-evaluate
 (cond
+ (manual t)
  (noeval nil)
  (query 'query)
  (t t
 
+(defun org--function-stack ()
+  "Return the current call stack function names."
+  ;; https://emacs.stackexchange.com/questions/7396/
+  (butlast (mapcar 'cl-second 
+		   (let ((frames)
+			 (frame)
+			 (index 5))
+		 (while (setq frame (backtrace-frame index))
+		   (push frame frames)
+		   (incf index))
+		 (remove-if-not 'car frames)
+
+
 (defun org-babel-check-evaluate (info)
   "Check if code block INFO should be evaluated.
 Do not query the user, but do display an informative message if


Re: [O] Bug and quick bugfix

2019-10-13 Thread Ken Mankoff


On 2019-10-13 at 09:26 +02, Nicolas Goaziou  wrote...
> IIRC, the label has to be included in the caption command. I applied a
> different solution. Let me know if that works for you.

I thought so too. But I couldn't find a definitive answer for this when 
searching about this last night.

  -k.




Re: [O] Babel eval w/ C-c C-c but not (org-babel-execute-buffer)

2019-10-10 Thread Ken Mankoff


On 2019-10-11 at 00:13 +02, Tim Cross  wrote...
> My concern with this suggestion is that I think it my result in
> 'surprising' or unexpected results for users.

I hope nobody would be surprised if they C-u C-u C-c C-c'd ! :) Just as they 
shouldn't be surprised if the :cache is ignored, if run with prefix-arg. But I 
do understand your concern and agree with it.

> Perhaps an additional recognised configuration value for :export and
> :tangle, such as 'manual', which might mean something like 'onl[y]
> evaluate/tangle this block when requested with block level commands,
> not buffer level.

Yes, I agree this is preferred. The only reason I implemented the first version 
using prefix-arg is because I could see how to do that easily. I started down 
the path you describe above and ran into my own lisp and org limitations.

I'm open to implementation suggestions. My plan is to modify 
(org-babel-check-confirm-evaluate) and use introspection and see if 
(org-ctrl-c-ctrl-c) is in the call stack, and if so, return t. Does this make 
sense? Is there some better way to determine how 
org-babel-check-confirm-evaluate was reached? Or some better place to add the 
feature? Also, I'd use ":eval only-manual" unless someone suggests another 
value ("only-on-cc"?)

Thanks,

  -k.



Re: [O] Babel eval w/ C-c C-c but not (org-babel-execute-buffer)

2019-10-10 Thread Ken Mankoff
Hi Charles,

On 2019-10-10 at 18:22 +02, Berry, Charles  wrote...
> If the language mode you use supports of evaluation of the src edit
> buffer (e.g. ESS[R], Python), you can issue
>
> C-c C-v v C-c C-b
>
> for ESS[R] or
>
> C-c C-v v C-c C-c
>
> for Python (I think)
>
> The commands will expand :var args and noweb declarations, then
> execute the corresponding 'send-buffer' command regardless of :eval.

This could work in theory, but doesn't for bash on my system. And (I think) 
with this method tables of output are not then injected back into the Org 
buffer that can be exported as part of the document.

> Why not use something like this
>
> :eval (ok2run)
>
> where `ok2run' consults a property to decide whether to eval the block?

I need to think about this some more... Can you describe more how you picture 
this working? Off the top of my head, I am picturing a top-level property 
setting :eval (ok2run) and then blocks I want to always run have :eval yes and 
blocks I want to run interactively only have a new property, ":eval-on-c-c" set 
to "t". The, (ok2run) checks for eval-on-c-c as a header arg and returns 't' if 
it exists and 'nil' if it does not?


While your suggestions do work for some cases, they feel like work-arounds for 
a missing feature. Isn't the feature I'm proposing a logical enhancement? Why 
would someone C-c C-c (or C-u C-u C-c C-c) on a code block if they didn't want 
it to run? Shouldn't an explicit request override a local header or 
top-level-document flag that says "don't eval"?

  -k.




Re: [O] Babel eval w/ C-c C-c but not (org-babel-execute-buffer)

2019-10-10 Thread Ken Mankoff
Hello,

I think that even when ":eval no" is set, eval should happen if the user 
explicitly requests it.

The use case is that I have code that takes an unreasonable amount of compute 
time to run it in Emacs (e.g. a full day of compute time). I think even with 
:async this type of code should be run outside of emacs, so I tangle it and run 
the python or bash scripts in a terminal.

Elsewhere in the project (Org file) I have babel blocks that I want to update 
throughout the file. I do this by cleaning all result blocks with =C-u C-c C-v 
k= or (org-babel-remove-result-one-or-many), then executing all blocks (without 
=:eval no=) using =C-c C-v C-b= or (org-babel-execute-buffer).

In order to not spend days of compute time when I eval 
(org-babel-execute-buffer), I set :eval no to the computationally heavy babel 
blocks. But during development it would be nice to run these... hence the 
conflict with the current Org behavior and my desire for a new feature.

The two-line change at the bottom implements the following behavior:

When the prefix arg is passed to org-babel-execute-src-block, the block is 
evaluated regardless of the :eval flag.

Note that this doubles up on the prefix arg behavior, which is already set 
according to the documentation:

> With prefix argument ARG, force re-execution even if an existing
> result cached in the buffer would otherwise have been returned.

Questions for the list:

Is this feature something that makes sense?

If yes, then do you also think that tangling should occur when explicitly 
requested (i.e. C-u C-c C-v C-t), even if :tangle no is set?

Suggestions for a better implementation?

Thanks,

  -k.


diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index 572f97919..9f9add334 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -646,7 +646,7 @@ block."
 ;; Merge PARAMS with INFO before considering source block
 ;; evaluation since both could disagree.
 (cl-callf org-babel-merge-params (nth 2 info) params)
-(when (org-babel-check-evaluate info)
+(when (or arg (org-babel-check-evaluate info))
   (cl-callf org-babel-process-params (nth 2 info))
   (let* ((params (nth 2 info))
 (cache (let ((c (cdr (assq :cache params
@@ -663,7 +663,7 @@ block."
(let ((result (org-babel-read-result)))
  (message (replace-regexp-in-string "%" "%%" (format "%S" result)))
  result)))
-((org-babel-confirm-evaluate info)
+ ((or arg (org-babel-confirm-evaluate info))
  (let* ((lang (nth 0 info))
 (result-params (cdr (assq :result-params params)))
 ;; Expand noweb references in BODY and remove any




Re: [O] noweb and :var statements

2019-10-06 Thread Ken Mankoff
Hi Sebastian,

Thanks for your help. I was running with "-Q" but must have been making some 
other mistakes. It does work.

As for your other email... I do know several tangles can go to the same file. 
And I may be using <> incorrectly, but I'm using it for the following 
reasons:

1) I'd like to bury code that must run first but is inconsequential at the 
bottom of the Org file. Noweb lets me have a tangled <> at the top, and 
then hide the lengthy <> code elsewhere. Is this a correct use case?

2) I'd like to import 10 tables, so I thought a noweb function might be useful 
for code reuse.

I finally got the behavior I'm looking for. What I need to remember/understand 
is that <> just pastes the body, and <> evaluates the function. 
From this, my Python code needs to generate Python code! I now have the 
following MWE that behaves as I want both for in-buffer C-c C-c eval of main 
code block and tangled results. The key bit of code is the last babel block.

Thanks for your help,

  -k.


* MWE init
#+BEGIN_SRC emacs-lisp :results output
(setq org-confirm-babel-evaluate nil)
(org-babel-do-load-languages 'org-babel-load-languages '((python . t)))
(print (emacs-version))
(print (org-version nil t))
(org-babel-tangle)
#+END_SRC

* Main Project

#+NAME: main
#+BEGIN_SRC python :tangle MWE3.py :noweb yes :results output
<>
print(t42.sum())
print(t100.sum())
#+END_SRC

#+RESULTS: main
: 84.0
: 100.0

* Data Tables
#+NAME: table_42
| foo |
|-|
|  42 |
|  42 |

#+NAME: table_100
| bar |
|-|
| 100 |

* Setup

#+NAME: setup
#+BEGIN_SRC python :noweb yes
import numpy as np
<>
<>
#+END_SRC

* Table Import Code

#+NAME: import_table_to_varname
#+BEGIN_SRC python :var table=table_42 :var varname="foo" :noweb yes :results 
output
print(varname + "=np.array(" + str(table) + ").astype(np.float).flatten()")
#+END_SRC



Re: [O] noweb and :var statements

2019-10-06 Thread Ken Mankoff


On 2019-10-06 at 21:52 +02, Sebastian Miele  wrote...
> I wrote:
>
>> [..]
>>
>> However, something like the following may suit your use case. (For the
>> header-args property see section 15.2 (Using Header Arguments) of the
>> manual.)
>>
>> * A Heading
>> :PROPERTIES:
>> :header-args: :var table=table_foo
>> :END:
>>
>> #+NAME: table_foo
>> | foo |
>> |-|
>> |  42 |
>> | 100 |
>>
>> #+NAME: import
>> #+BEGIN_SRC python
>> import numpy as np
>> table = np.array(table).astype(np.float).flatten()
>> #+END_SRC
>>
>> #+BEGIN_SRC python :noweb yes :tangle import_noweb.py
>> <>
>> #+END_SRC
>
> Just the following works too, of course:
>
> #+NAME: table_foo
> | foo |
> |-|
> |  42 |
> | 100 |
>
> #+NAME: import
> #+BEGIN_SRC python
> import numpy as np
> table = np.array(table).astype(np.float).flatten()
> #+END_SRC
>
> #+BEGIN_SRC python :noweb yes :var table=table_foo :tangle import_noweb.py
> <>
> #+END_SRC

The result of tangling this is "import_noweb.py" contains:

import numpy as np
table = np.array(table).astype(np.float).flatten()

And I'd like it to somewhere include the line:
table = [42,100]
or something similar. I don't have the table data in the tangled code.

  -k.



Re: [O] noweb and :var statements

2019-10-06 Thread Ken Mankoff
Hi Sebastian,

I'm not getting the results I expect from your MWE either. Perhaps I gave too 
much code and asked X when what I really want is Y. I think I've distilled it 
to this:

What is the most elegant Org way to get a table into a Python array?

I can code it directly:

#+BEGIN_SRC python
<>
print(foo)
#+END_SRC


And now I can hide <> in a section at the bottom of the document. If it 
looks like this, everything works:

#+NAME: setup
#+BEGIN_SRC python
foo = np.array([42,43,44])
#+END_SRC

But is there a more elegant method? Can I get the same behavior if the data I 
want is in an Org table rather than hard-coded directly in Python?





Ideally, I'd like to have:

#+NAME: setup
#+BEGIN_SRC python
<>
<>
#+END_SRC

And a #+NAME: setup block that takes a :var table and sticks it in the :var 
varname variable.

And then after calling <> be able to use variable "foo" and "bar" that 
are generated from column or 2D Org tables elsewhere in the document. Can I do 
this in Org?

Thanks,

  -k.




[O] noweb and :var statements

2019-10-06 Thread Ken Mankoff
Hi Org list,

I'm having with noweb and variables. Can someone explain what I'm doing wrong? 
For example, if I have this table:

#+NAME: table_foo
| foo |
|-|
|  42 |
| 100 |

And I want to import it into Python and use it, I can do that like this:

#+NAME: import
#+BEGIN_SRC python :var table=table_foo :session foo
import numpy as np
table = np.array(table).astype(np.float).flatten()
#+END_SRC

Eval of this block works, and if I tangle it, I see:

> table=[[42], [100]]
> import numpy as np
> table = np.array(table).astype(np.float).flatten()

But if I want to use that block elsewhere via noweb, it doesn't seem to work:

#+BEGIN_SRC python :results output drawer :noweb yes :session foo :tangle 
import_noweb.py
<>
#+END_SRC

The code runs and in a clean *foo* session I do have my table variable, but I 
*also* get an error. The buffer contains the text at the bottom of this 
message, and the tangled code in import_noweb.py is only "nil".

How can I 1) run noweb blocks with variables and 2) tangle noweb blocks with 
variables (i.e. tangle tables into source files).

Thanks,

  -k.


table=[[42], [100]]
Python 2.7.15+ (default, Jul  9 2019, 16:51:35) 
[GCC 7.4.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> >>> python.el: native completion setup loaded
>>> 
>>> import numpy as np
table = np.array(table).astype(np.float).flatten()

open('/tmp/babel-Mb4ojd/python-GEnZeZ', 'w').write(str(_))


'org_babel_python_eoe'
>>> Traceback (most recent call last):
  File "", line 1, in 
NameError: name '_' is not defined
>>> >>> >>> 'org_babel_python_eoe'
>>> 
>>> 
>>> 
>>> 
>>> 'org_babel_python_eoe'
'org_babel_python_eoe'
>>> 



[O] Babel eval w/ C-c C-c but not (org-babel-execute-buffer)

2019-10-02 Thread Ken Mankoff
Hello,

I'm interested in having code blocks that do not eval when I run 
(org-babel-execute-buffer) but do when the cursor is within them and I 
explicitly want to execute them by entering C-c C-c.

I cannot get this behavior playing around with the :eval header argument. Is 
the behavior I described possible?

Thanks,

  -k.



Re: [O] Org babel tangle: Don't export code

2019-09-24 Thread Ken Mankoff


On 2019-09-25 at 01:07 +02, Tim Cross  wrote...
> I just put :tangle no in the block header e.g.
>
> #+begin_src emacs-lisp :tangle no
>
> #+end_src

Also,

* COMMENT Section
#+BEGIN_SRC
# not exported because of COMMENT
#+END_SRC

  -k.




Re: [O] Modify a variable before it is passed to babel (or exported)?

2019-09-16 Thread Ken Mankoff
Hello,

I solved this with (org-sbe). For example, using "add-one" and "table" from the 
original email

#+Name: test-add-one
#+BEGIN_SRC python :results output values :var data=(org-sbe add-one (data 
table))
print(data)
#+END_SRC

#+RESULTS: test-add-one
: 43

Or

src_elisp{(org-sbe add-one (data table))} {{{results(=43=)}}}

   -k.

On 2019-09-16 at 10:21 -07, Ken Mankoff  wrote...
> I'd like to modify a variable with a babel block before another block
> sees the variable. For example, I always want to add one to a
> variable:
>
> #+NAME: add-one
> #+BEGIN_SRC bash :results verbatim :var data=0
> data=$(( data + 1 ))
> echo $data
> #+END_SRC
>
> #+RESULTS: add_one
> : 1
>
> Test it:
>
> #+CALL: add_one(data=42)
>
> #+RESULTS:
> : 43
>
> Can I use =add_one= to modify data passed elsewhere?
>
> For example, given 
>
> #+NAME: table
> | 42 |
>
> I'm having trouble defining a =print_table= function that prints 43, using 
> the =add_one= either via :prologue or <> or some other method. 
> Preferably prologue because then the add_one function could be in a different 
> language.
>
>
> I can get halfway to what I want with a :post option, but need this to be a 
> :pre or :prologue. Example using :post
>
> #+NAME: python_using_add_one
> #+BEGIN_SRC python :results output values :post add-one(data=*this*) 
> print(42)
> #+END_SRC
>
> #+RESULTS: python_using_add_one
> : 43
>
> Any suggestions how to use this feature with :pre or :prologue?
>
> Thanks,
>
>   -k




[O] Modify a variable before it is passed to babel (or exported)?

2019-09-16 Thread Ken Mankoff


I'd like to modify a variable with a babel block before another block sees the 
variable. For example, I always want to add one to a variable:

#+NAME: add-one
#+BEGIN_SRC bash :results verbatim :var data=0
data=$(( data + 1 ))
echo $data
#+END_SRC

#+RESULTS: add_one
: 1

Test it:

#+CALL: add_one(data=42)

#+RESULTS:
: 43

Can I use =add_one= to modify data passed elsewhere?

For example, given 

#+NAME: table
| 42 |

I'm having trouble defining a =print_table= function that prints 43, using the 
=add_one= either via :prologue or <> or some other method. Preferably 
prologue because then the add_one function could be in a different language.


I can get halfway to what I want with a :post option, but need this to be a 
:pre or :prologue. Example using :post

#+NAME: python_using_add_one
#+BEGIN_SRC python :results output values :post add-one(data=*this*) 
print(42)
#+END_SRC

#+RESULTS: python_using_add_one
: 43

Any suggestions how to use this feature with :pre or :prologue?

Thanks,

  -k



[O] Babel, bash, :variables, and tangling

2019-09-15 Thread Ken Mankoff
Hi List,

I'm having some trouble getting babel executed in Emacs and scripts that are 
tangled to behave the same. I think I've distilled it down to an MWE. I'd like 
to inject

#+NAME: table
| 1 | 2 |
| 3 | 4 |

into a bash workflow where I need each of those 4 items with their respective 
row and column. That is, redefine the table so that it is:

| x | y | z |
| 0 | 0 | 1 |
| 0 | 1 | 2 |
| 1 | 0 | 3 |
| 1 | 1 | 4 |

I can do this in a babel block like this:

#+NAME: import
#+BEGIN_SRC sh :results output :tangle no :var table=table
rm -f tmpfile
lineno=0
echo "${table}" | while read line; do
  colno=0
  echo ${line} | tr ' ' '\n' | while read entry; do
echo $lineno "|" $colno "|" $entry >> tmpfile
colno=$(( $colno + 1 ))
  done
  lineno=$(( $lineno + 1 ))
done

echo ""
cat tmpfile
#+END_SRC

#+RESULTS: import
:
: 0 | 0 | 1
: 0 | 1 | 2
: 1 | 0 | 3
: 1 | 1 | 4

And I can call it with:

#+CALL: import(table=table)

And I get the results I want

But when I tangle it out, the tangled file defines "table" like this:

unset table
declare -A table
table['1']='2'
table['3']='4'

And then the algorithm does not work.

Am I doing something incorrectly here with respect to executing babel blocks 
inside Emacs v. tangling to external files? Any suggestions how to get similar 
behavior inside emacs and outside emacs?

Thanks,

  -k.



Re: [O] minimal testing setup for pdf export?

2019-08-26 Thread Ken Mankoff


On 2019-08-27 at 03:20 +02, Matt Price  wrote...
> Can someone point me to a minimal setup for testing PDF export with "emacs
> -Q"? I am unable to produce a pdf with default settings and I am pretty
> sure  that the latex is invalid... but I'm having trouble testing it since
> I 9still) know so little about latex.

I blank file is an MWE. It is highly unlikely Org is producing something 
invalid here. I'd look at operator error :) What version of Emacs? What version 
of Org?

  -k.




Re: [O] insert date-stamp for one month

2019-08-18 Thread Ken Mankoff
On 2019-08-18 at 03:58 -04, Uwe Brauer  wrote...
> I sometimes need to insert a date-stamp which corresponds to one month
> in a year, say march 2019. I usually insert <2019-03-01
> Fri>--<2019-03-31 Sun>, but this is cumbersome to do manually.
>
> Somebody has a better idea or know how to insert something like <03.2019>

What about picking one day in the month, but only displaying the month?

e.g. 
https://emacs.stackexchange.com/questions/2243/how-can-i-change-org-mode-time-format-for-one-buffer

https://stackoverflow.com/questions/50233694/org-mode-edit-timestamp-with-custom-format

https://emacs.stackexchange.com/questions/32889/can-the-format-of-a-timestamp-in-an-org-mode-document-be-locally-adjusted-for-ex

  -k.



Re: [O] join two or more tables

2019-08-18 Thread Ken Mankoff
On 2019-08-18 at 04:23 -04, Uwe Brauer  wrote...
> I was googling this a bit, I found more complicated scenarios, but not
> how to join one or more tables.
>
> [...]
>
> I want to generate a new table total-nuts, which is just a combination
> of the two tables, nuts and nuts2 

Does https://github.com/tbanel/orgtbljoin do what you want?

  -k.
  




Re: [O] [Proposal] Source Blocks with Post-Extensions

2019-07-26 Thread Ken Mankoff


On 2019-07-26 at 08:58 -04, Martin Alsinet  wrote...
> I usually have a shell buffer nearby and go there to inspect the
> failed tests when I get no output. The problem is that shell blocks do
> not capture stderr. John Kitchin wrote a blog post
> 
> about this problem and provided a solution that may work for you, but
> I have not tried it yet.

Ah yes... from my own comments there:

#+begin_src sh :results raw drawer :prologue "exec 2>&1" :epilogue ":"
python -m pytest ./utils
#+end_src

Thanks for reminding me about my past self.

  -k.



Re: [O] [Proposal] Source Blocks with Post-Extensions

2019-07-26 Thread Ken Mankoff
Hi Martin,

On 2019-06-26 at 18:09 -04, Martin Alsinet  wrote...
> I use a different approach, where I tangle the source into files in
> modules and then I import those modules from other blocks. This allows
> me to organize my document with different sections for the code and
> its tests, which then get exported into their corresponding files.

Thanks for providing this pytest code below. It runs nicely because your tests 
pass. It does not run if a test fails. The shell block that runs pytest reports

Babel evaluation exited with code 1
Code block produced no output.

Do you have some way of capturing failed pytest tests in Org Babel?

Thanks,

  -k.
  
> * Square Function
>
> This function receives a number and returns its square
>
> #+BEGIN_SRC python :tangle ./utils/math.py :mkdirp yes
> def square(x):
> return x * x
> #+END_SRC
>
> ** __init__.py (module setup)
>
> #+begin_src python :tangle ./utils/__init__.py :mkdirp yes
> from utils.math import square
>
> #+end_src
>
> ** Test cases
>
> 1. The square of five should be 25
> 2. The square of zero should be 0
> 3. The square of a negative number should be positive
>
> #+BEGIN_SRC python :tangle ./utils/test_square.py :mkdirp yes
> from utils.math import square
>
> def test_square_of_five():
> assert square(5) == 25
>
> def test_square_of_zero():
> assert square(0) == 0
>
> def test_square_of_negative():
> assert square(-5) > 0
> #+END_SRC
>
> *** Run tests
>
> #+begin_src sh :results output raw
> pytest ./utils
> #+end_src
>
> #+RESULTS:
> = test session starts
> ==
> platform linux -- Python 3.7.3, pytest-4.6.3, py-1.8.0, pluggy-0.12.0
> rootdir: /app
> collected 3 items
>
> utils/test_square.py ...
> [100%]
>
> === 3 passed in 0.08 seconds
> ===
>
>



Re: [O] Show breadcrumbs of nodes in agenda

2019-07-26 Thread Ken Mankoff


On 2019-07-26 at 06:47 -04, Florian Lindner  wrote...
> the agenda only shows the title of nodes, like:
>
> capture:TODO Task 1
>
> Often, I have a structure like
>
> * Project A
> ** Task 1
>
> * Project B
> ** Task 1
>
> Is there a way to also show the title of the parent in agenda buffer
> or even full breadcrumbs?

Under Project A:

C-c C-x p RET CATEGORY RET Project A or some descriptive text RET

repeat for B.

  -k.



Re: [O] org-links for Gnus in imap with Gmail (for a convenient todo.org list)

2019-07-26 Thread Ken Mankoff


On 2019-07-26 at 03:14 -04, Joseph Vidal-Rosset  
wrote...
> Did you want to suggest that it is not difficult to adapt such a
> function for gnus by replacing the mention of mu4e by gnus' in the
> code?

I wasn't suggesting anything, just letting you/others know that the 
functionality you described exists elsewhere, and hoping that that information 
would be useful and not noise.

  -k.



Re: [O] org-links for Gnus in imap with Gmail (for a convenient todo.org list)

2019-07-25 Thread Ken Mankoff


On 2019-07-25 at 12:24 -04, Joseph Vidal-Rosset  
wrote...
> Documentation to create a todo.org list  that provides links to email as
> tasks   is  not   seldom  on   the  web.   I  recommend   for  example
> [[http://pragmaticemacs.com/]]. 
>
> But for gnus-imap-gmail users, it is more difficult to get the same
> thing.

FYI, here is the mu4e implementation defined so that the standard 
org-store-link properly work based on msgid:

https://github.com/djcb/mu/blob/master/mu4e/org-mu4e.el#L117

When viewing email I use the same keybindings as elswhere, C-l to store link, 
and C-c C-l to paste it and I get:

[[mu4e:msgid:325foo...@mx.google.com][SUBJECT OF EMAIL]]

  -k.




Re: [O] Links to LaTeX equations

2019-06-28 Thread Ken Mankoff
Hi Eric,

On 2019-06-28 at 10:55 -02, Fraga, Eric  wrote...
> I would like to be able to use org fully with respect to links and
> targets. If I define a label in LaTeX directly, \label{an-equation}
> for instance, I get no benefit from using an org link to it, e.g.
> [[an-equation]]

Why don't you define the link in Org?

#+NAME: eq:foo
\begin{equation}
foo
\end{equation}

  -k.



Re: [O] Output result of source block to a file

2019-06-05 Thread Ken Mankoff


On 2019-06-05 at 12:41 +02, Roger Mason  wrote...
> I want to output the result of the evaluation of a (python) source
> block to a (graphics) file and have a link to the file inserted in the
> buffer.
>
> Here is the code:
>
> #+begin_src python :results value file :file scaleplot02.pdf :exports results 
> :var data=test
>   print ("[[./%s]]" % file)
> #+end_src

What about :var file="scaleplot02.pdf".

  -k.




Re: [O] Slight problems with links

2019-04-30 Thread Ken Mankoff
Hi Emmanuel,

I have looked into PDF and DOCX export repeatedly over the years with different 
versions of Org and Pandoc and Google Docs and keep finding that the best 
method is Org -> LaTeX, and then LaTeX -> DOCX with Pandoc. I use this babel 
block to achieve this:

#+BEGIN_SRC sh :results verbatim :var fn=(file-name-sans-extension 
(buffer-name))
bibexport -o ${fn}.bib ${fn}.aux
pandoc -f latex -i ${fn}.tex -t DOCX -o ${fn}.docx --bibliography ./${fn}.bib
#+END_SRC

The first line may not be needed. That extracts the references used in this 
document from my single massive (3500 element) bib file. The advantage of this 
Org -> LaTeX -> Pandoc -> DOCX  method is that if you need to patch something 
for Pandoc (e.g. to fix your code captions or something) you could insert a 
NoWeb <> block before the pandoc line that generates a 
second, corrected, LaTeX file.

Note that I don't use org-ref, just the standard Org referencing code, but I 
don't see why this would change anything, if you're able to generate PDFs that 
meet your requirements.

  -k.
  

On 2019-04-29 at 19:48 -0200, Emmanuel Charpentier  
wrote...
> Dear John,
> Indeed, I missed your point. I'll have to bet back to you after
> reading, understanding the code (org-mode is a tall order...) and
> *thinking*.
> However, the troubling fact that ox-latex manages to export org's
> labelling correctly shows that its author might be up to somethong.
> Indeed I just checked that its exported docx can be converted by pandoc
> into a "correct" docx (correct here meaning that my captions are
> correctly labelled and numbered).
> Have to think again...
> --Emmanuel Charpentier
> Le lundi 29 avril 2019 à 17:23 -0400, John Kitchin a écrit :
>> I think you have missed the main point. My point was first to find
>> some format that pandoc faithfully converts to docx with all the
>> features you need, and then we can figure out how to turn org-ref/org 
>> into that format. So, if you can write a LaTeX document that is
>> correctly converted to docx (correct bibliography, figure labels, and
>> cross-references, correct code, etc), then we can probably get org to
>> output the right latex. But if LaTeX isn't converted to docx
>> correctly in pandoc, it does not seem likely that org will either
>> with any simple exporter.
>> John
>> 
>> ---
>> Professor John Kitchin 
>> Doherty Hall A207F
>> Department of Chemical Engineering
>> Carnegie Mellon University
>> Pittsburgh, PA 15213
>> 412-268-7803
>> @johnkitchin
>> http://kitchingroup.cheme.cmu.edu
>> 
>> 
>> 
>> On Mon, Apr 29, 2019 at 5:19 PM Emmanuel Charpentier <
>> emm.charpent...@free.fr> wrote:
>> > Dear John,
>> > Le lundi 29 avril 2019 à 16:57 -0400, John Kitchin a écrit :
>> > > For org-ref, there isn't much magic on what happens on export.
>> > > LaTeX is certainly the most well supported, and it seems like org
>> > > -> latex -> pandoc is the only way that makes sense to get to
>> > > docx to me.  Using pandoc on org files directly is probably
>> > > hopeless unless you can get pandoc to include some definitions
>> > > for the org-ref links.
>> > 
>> > This might be difficult : the development of ox-pandoc seems to not
>> > be very active at the moment...
>> > > Some of the link types in org-ref have some exports defined for
>> > > org, html, latex, sometimes ascii. If one of these works well
>> > > with pandoc we could try to make them output something useful for
>> > > them, or at least make sure that org->org export turns them into
>> > > something useful. 
>> > 
>> > I'm currently looking at the ox-latex exporter in order to
>> > understand what it does for source blocks with org's names and
>> > captions (and try to fix the fact that they are labeled and nubered
>> > as figures...). Theis understanding might help me to go in the
>> > direction  you suggest.
>> > > Getting figure/table numbers has always been tricky; I don't
>> > > think this worked well with pandoc, and handling it on the org
>> > > side requires some preprocessing to add numbers. For now, the ox-
>> > > word exporter in scimax comes closest, but it isn't a feature I
>> > > use a lot, so it hasn't been improved in a while.
>> > 
>> > Again, looking at what ox-latex does for org's names and captions
>> > might be helpful. Ox-pandoc seems to do a decent job on docx
>> > output.
>> > > John
>> > > 
>> > > ---
>> > > Professor John Kitchin 
>> > > Doherty Hall A207F
>> > > Department of Chemical Engineering
>> > > Carnegie Mellon University
>> > > Pittsburgh, PA 15213
>> > > 412-268-7803
>> > > @johnkitchin
>> > > http://kitchingroup.cheme.cmu.edu
>> > > 
>> > > 
>> > > 
>> > > On Mon, Apr 29, 2019 at 1:06 PM Emmanuel Charpentier <
>> > > emm.charpent...@free.fr> wrote:
>> > > > Dear list,
>> > > > 
>> > > > 
>> > > > 
>> > > > one of my uses od org-mode is to prepare documents wrapping R
>> > > > (and
>> > > > 
>> > > > sometimes Sagemath) call results in 

Re: [O] Porting Apple Calendars to org-mode

2019-04-24 Thread Ken Mankoff


On 2019-04-24 at 21:56 +0200, Mohamed Wael Khobalatte 
 wrote...
> The file(s) you linked to usually assume a generated list of ics files
> no?

I didn't link to any files. There are *many* ical2org packages, many different 
ones. The one I currently use does expect an ICS file. If you use iCloud you 
have access to these. If your calendar is 100% local, then try this ical2org 
code: https://github.com/mankoff/ical2org  I used to maintain that fork, and 
used it many years ago with an only-local iCal setup that did not have ICS 
files, just some weird Apple folder structure in ~/Library/.

Sorry I can't help more. The code is old and I'm going offline for the next 5 
weeks. But if you look at these two different ical2org, the ruby 
implementation, the Perl implementation, etc. one of them might do what you 
want.

  -k.




Re: [O] Porting Apple Calendars to org-mode

2019-04-24 Thread Ken Mankoff
Hi Mohamed,

On 2019-04-24 at 21:32 +0200, Mohamed Wael Khobalatte
 wrote...
org-mode),
> Does anyone know how I can get my Apple calendar to show up in
> org-mode as readonly (preferably)? I had no luck with org-mac-iCal.

There are several tools named ical2org - different languages, implementations, 
and/or forks. I used to use one of them when I was on OS X and it worked well 
for me.

I'm not on OS X anymore but use something called "ical2orgpy" that downloads 
ICS files from Google and Outlook (and could from iCloud I think?) and converts 
them to read-only Org buffers. The top line is

-*- eval: (eval (progn (auto-revert-mode 1) (read-only-mode 1))); -*-

So they are read-only and Emacs updates them when the buffer gets changed on 
disk w/o any questions.

  -k.




Re: [O] Tracking time from one state to another?

2019-04-23 Thread Ken Mankoff
Hi Malcom,

I think we're talking about two different things here. When you change TODO 
state, the time of the change is recorded. This is what you're doing.

Org also has a time-tracking feature that is totally separate. You can "clock 
in" and "clock out" of a task which starts and stops a timer. You can then 
generate reports about that timer. The timer can be activated regardless of the 
TODO state, but you could also have the timer start (clock in) every time you 
set the state to "WORKING_ON_IT" or "INPROGRESS", and the timer stop (clock 
out) whenever the task is in NEXT or WAITING state.

Then you can generate a CLOCK REPORT for each task and sub-task, which is the 
amount of time you actually worked on it (i.e. the amount of time it spent in 
the WORKING_ON_IT state.

This is a different workflow than your current one - it uses the Org clocking 
feature, not just the TODO status feature.

  -k.

On 2019-04-23 at 08:07 +0200, Malcolm Matalka  wrote...
> Ken Mankoff  writes:
>
>> Hi Malcom,
>>
>> On 2019-04-17 at 14:20 +0200, Malcolm Matalka  wrote...
>>> Is it possible in org-mode to track, and report, the duration of
>>> certain state transitions in org-mode? In particular, I'm interested
>>> in tracking how long it takes me to go from a state that means I'm
>>> actively working on an item to it being in a done state?
>>>
>>> In my case, an item might go from working, to waiting, to working, to
>>> done.  And in this case I'm only really interested in the last working
>>> to done time.
>>
>> Org doesn't have a built-in feature to turn on/off the clock when you
>> change state, as far as I know. But it has the opposite - you can
>> change state when you clock in or out of a task.
>
> I don't want to turn on/off the clock when I change state, I want to get
> a report on the time between certain state transitions.  That
> information is stored in the LOGBOOK (assuming one has that turned on).
>
>>
>> See section 7 here 
>> https://writequit.org/denver-emacs/presentations/2017-04-11-time-clocking-with-org.html#helpful-things
>>
>> And/or maybe thread here w/ some code 
>> https://lists.gnu.org/archive/html/emacs-orgmode//2009-04/msg00315.html
>>
>> So perhaps you can achieve this by changing your workflow a bit. Instead of 
>> changing state, just clock in and have the state set to INPROGRESS. Clock 
>> otu and have it set to WAITING. When it is done, it may be a two-step 
>> process of setting to DONE and making sure the clock is stopped.
>>
>> Would this achieve what you're looking for?
>
> Unfortunately no.  I need to track the total time I spend in a task for
> billing reasons, but what I'm interested in here is how quickly I
> complete a task when there are no blockers/dependencies.  And the way
> that presents itself in my LOGBOOK is the time between the final
> transition from NEXT to DONE.  Before that, a TODO can go from NEXT, to
> WAITING, and back and forth.
>
>>
>>   -k.




Re: [O] Tracking time from one state to another?

2019-04-22 Thread Ken Mankoff
Hi Malcom,

On 2019-04-17 at 14:20 +0200, Malcolm Matalka  wrote...
> Is it possible in org-mode to track, and report, the duration of
> certain state transitions in org-mode? In particular, I'm interested
> in tracking how long it takes me to go from a state that means I'm
> actively working on an item to it being in a done state?
>
> In my case, an item might go from working, to waiting, to working, to
> done.  And in this case I'm only really interested in the last working
> to done time.

Org doesn't have a built-in feature to turn on/off the clock when you change 
state, as far as I know. But it has the opposite - you can change state when 
you clock in or out of a task.

See section 7 here 
https://writequit.org/denver-emacs/presentations/2017-04-11-time-clocking-with-org.html#helpful-things

And/or maybe thread here w/ some code 
https://lists.gnu.org/archive/html/emacs-orgmode//2009-04/msg00315.html

So perhaps you can achieve this by changing your workflow a bit. Instead of 
changing state, just clock in and have the state set to INPROGRESS. Clock otu 
and have it set to WAITING. When it is done, it may be a two-step process of 
setting to DONE and making sure the clock is stopped.

Would this achieve what you're looking for?

  -k.




Re: [O] Smart archiving of subtrees with parent headlines

2019-04-02 Thread Ken Mankoff
I'm not an advanced lisper so I hate to say "this seems like it should be
easy" - it isn't for me. But while playing around with the default archive
behavior (C-c C-x C-a OR C-c C-x C-s?), I notice that ":ARCHIVE_OLPATH:
Testing/SomeTest Archive Project" is include in the archived item. So Org
appears to know where the item should go (if not at the top level). It
seems like it should be easy to either a) put it in the right place when
archiving, b) put it in the right place at some later point in time or c)
perform a search on the archive file that at least limits the results to a
tree or subtree. I can do the last one!

  -k.


On Fri, Mar 29, 2019 at 8:18 AM Ken Mankoff  wrote:

>
> On 2019-03-29 at 03:23 +0100, Mark Edgington  wrote...
> > But it sounds like you're saying that it won't work with the latest
> > git versions?
>
> elpa, not git. But yes, this code is expecting and calling functions no
> longer in the core code.
>
>   -k.
>
>


Re: [O] Smart archiving of subtrees with parent headlines

2019-03-29 Thread Ken Mankoff


On 2019-03-29 at 03:23 +0100, Mark Edgington  wrote...
> But it sounds like you're saying that it won't work with the latest
> git versions?

elpa, not git. But yes, this code is expecting and calling functions no longer 
in the core code.

  -k.




Re: [O] Smart archiving of subtrees with parent headlines

2019-03-28 Thread Ken Mankoff
On Tue, May 1, 2018 at 11:01 AM Bastien  wrote:

> Hi Mark,
>
> Mark Edgington  writes:
>
> > I don't know why not -- I'm OK with the code being used in
> > org-archive.el.  As far as I'm concerned, you can use it however you
> > wish (it is based on Ken's code though, so he would also need to sign
> > off on its use, I suppose).
>
> Would you like to contribute by submitting a patch against master?
>
> For this you would need to sign FSF copyright assignment.
>
> See http://orgmode.org/request-assign-future.txt
>
>
Replying to an email almost 1 year old. I've lost archive-to-subtree
functionality recently and don't know how to get it back w/ the recent Org
code changes. While searching I found this old thread where Mark & Bastien
suggest I'd need to sign off on someone using some code I pasted. I got
that code from elsewhere, and only did minor customizations. In my original
email I link to where I got the code from (
https://lists.gnu.org/archive/html/emacs-orgmode/2014-08/msg00109.html ). I
don't think I have the rights to sign off on this, but sure, you can use
what I pasted and my customizations. I've signed the FSF documents already,
a long time ago. It seems like archive-to-subtree should be a core
functionality, and if someone were to get that working again I'd be happy
to test and use it.

  -k.


[O] Archiving to a subtree

2019-03-17 Thread Ken Mankoff
Hello list,

I used to archive items to a subtree (in an archive file) using some functions 
provided on this list back in 2014 [1]. I recently updated Org and this code 
stopped working because the 'org-extract-archive-file' function has been 
removed. This was commit 9d603b1854f658202024807c17ffc1fd47a3cd74

Does anyone have a replacement function that archives sub-items to sub-trees? 
I'm looking for behavior that will take **bar:

file.org:
* Foo
** Bar

And archive it to **bar under *foo like this:

archive/file.org_archive
* Foo
** Bar

I don't see any mention of this in the NEWS.org.

Thanks,

  -k.


[1] https://lists.gnu.org/archive/html/emacs-orgmode/2014-08/msg00109.html




Re: [O] Macro that calls external program

2019-03-11 Thread Ken Mankoff
Hi Josh,

On 2019-03-10 at 23:37 +0100, Josh  wrote...
> I am new to emacs and orgmode. I spent the last couple days reading
> most of the docs before diving in,

Welcome!

> but I didn't see anywhere how I could have a macro that instead of
> replacing the macro with lisp code, calls an external program instead.
>
> Something like:
> #+MACRO: func   call /home/josh/mybinary $1
>
> {{{func(Text Argument)}}}
>
> and this would be setup to call an external program and the output of
> the program would replace the macro on export.
>
> /home/josh/mybinary "Text Argument"

I do wonder if you're asking an XY problem, especially after reading your 
follow-up question about running an entire Org file through a pre-filter.

Why does it have to be a macro that you call? Why not #+NAME:'d Babel code 
block, which can (presumably) run any program you want.

  -k.



Re: [O] Set checkbox to intermediate in code

2019-03-02 Thread Ken Mankoff


On 2019-02-28 at 08:51 +0100, Cecil Westerhof  wrote...
> I can set a checkbox to intermediate with:
> C-u C-u C-c C-x C-b

FYI, C-c C-c toggles boxes too. Shorter than C-c C-x C-b.

  -k.




Re: [O] Mark vacation days

2019-01-27 Thread Ken Mankoff
Hi,

On 2019-01-27 at 12:20 -0800, JRSS  wrote...
> This is a bit over my head still. I'm trying to wrap my head around it.
>
> I see what it does (colors day-of-the-week 1 and day-of-the-week-3,
> which are Monday and Wednesday, red) but not sure how to tie it to a
> category (so say, category "vacation" would be red).
>
> Once I have the function do that, I can go in and change it so that
> different categories will be different colors.

It's a bit over my head for this use case too. Sorry. When I saw it I thought 
the use case was a list of holidays, which is easier to implement. You could 
maintain this list in an easy-to-access format as a variable near where you 
implement this function. A dynamic list based on tagged Org items is certainly 
more complicated.

  -k.



Re: [O] Mark vacation days

2019-01-27 Thread Ken Mankoff
Hi,

On 2019-01-27 at 07:20 -0800, JRSS  wrote...
> Does anyone know where I start getting something like this working?
> Programming is not my strong suit, but I can slowly wrap my head
> around some bits of code.

It looks like this function might be a good place to start:

https://emacs.stackexchange.com/questions/28905/color-specific-days-in-different-background-in-org-agenda

  -k.



Re: [O] Preparing a cost estimate with Org

2019-01-24 Thread Ken Mankoff


On 2019-01-24 at 09:35 -0800, Lele Gaifax  wrote...
>> You could perhaps do this with code, so it is only one C-c C-c?
>
> I did not understand what you mean with "do this with code" though:
> some kind of a macro or what?

I meant write a Babel Block in your favorite language that takes a table as 
input (i.e. the table is now a Python or R dataframe) and parses, reformats, 
and spits out a new table as you want.

You can even set a hook so that babel block executes on export, which means the 
whole system is automated.

  -k.




Re: [O] Preparing a cost estimate with Org

2019-01-24 Thread Ken Mankoff
Hi Lele,

On 2019-01-24 at 07:59 -0800, Lele Gaifax 
wrote...
> The only problem with this approach is that it requires a manual
> intervention to build the "cost estimate" table: first I recompute the
> "efforts" one with C-c C-c, then I copy its body to the other table,
> delete the third column and eventually do a C-c C-c on its TBLFM to
> recompute the costs.

You could perhaps do this with code, so it is only one C-c C-c? Alternatively, 
is OrgAggregate useful? https://github.com/tbanel/orgaggregate

> Is there a more efficient/automatic way to achieve a similar result? I
> mean, is there a way to
>
> b) filter out entries with a particular tag/property, so that I can
> keep the original estimate

Here is a hack to filter clock entries by tag:

https://lists.gnu.org/archive/html/emacs-orgmode//2009-09/msg00205.html

Finally, the Clock Table documentation 
https://orgmode.org/manual/The-clock-table.html mentions ‘:match’ with link to 
https://orgmode.org/manual/Matching-tags-and-properties.html#Matching-tags-and-properties
 which lets you do negative matches in one of their examples. Can you include 
only relevant tags, or exclude the tags you want to exclude using that syntax?

  -k.



Re: [O] Tracking Tags ??

2019-01-23 Thread Ken Mankoff


On 2019-01-23 at 12:22 -0800, John Kitchin  wrote...
> I see, that only finds files with the particular tag. I think the goal of
> this is to get a list of all the tags, for use in completion, for example.

I do not think grep is the right solution, but as an ugly hack it can find most 
of my tags rather easily. Tags are wrapped in "::" and at the end of the line, 
I think. Assuming that, then,

grep -h -E -o "\:.*\:$" *.org | grep -v -E 
"PROPERTIES|CATEGORY|END|LOG|STYLE|REPEAT|ID|RESULTS" | tr ':' '\n' | sort | 
uniq -c | sort -n

Gives all my tags sorted by usage (I don't use them much) plus a few stray 
words others...

Since drawers are usually begin on the 1st column, or within the first few 
columns, an alternative to the negative grep could be "cat *.org | cut -c10- | 
..." or some other method to skip the first few columns, rather than growing 
the negative grep list.

  -k.




Re: [O] org-ref exports nicely to html but not to odt

2019-01-04 Thread Ken Mankoff


On 2019-01-04 at 22:37 +0100, Uwe Brauer  wrote:
> I exported the org file in question to latex (I could also start
> directly with latex for that matter.)

Yes.

> Could I stick with bibtex?

Yes. No need to use biber + biblatex, you can stick with bibtex.

I only run that command because my massive 3000+ bib file contains things that 
pandoc has trouble with (accents? Not sure). That command extracts the bibtex 
entries used in the current document.

As I write this I realize this means you don't even need to compile the PDF 
and/or run bibtex. If you have a TeX file and an appropriate accompanying 
BiBTeX file, that should work.

> pandoc -f latex -t docx -o test.docx --bibliography 
> /home/oub/texmf/bibtex/bib/bibgraf.bib  test.tex
>
> /home/oub/texmf/bibtex/bib/bibgraf.bib is my main bibtex date base.
>
> But this did not work pandoc gets frozen.
>
> What do I miss.

I don't know. Try with a small bib file with 1 entry (and a TeX file that only 
cites that one entry). Does that work? Then maybe your bibgraf.bib has the same 
problem mine does (although I recall pandoc issuing an error and crashing, not 
just freezing).

If this method works with a MWE, then the issue my be your full bib file. In 
this case you need to extract the entries used in this document (e.g. my 
method). Presumably this subset does not cause the pandoc issue. I also find 
extracting the entries useful for archiving a project.

You can extract entries as I showed, or "bibexport .aux" (requires a 
compiled PDF), or 
http://korrekt.org/page/Note:How_to_Extract_Used_Entries_From_BibTeX_Files or 
other methods...

  -k.



Re: [O] org-ref exports nicely to html but not to odt

2019-01-04 Thread Ken Mankoff


On 2019-01-04 at 18:08 +0100, Uwe Brauer  wrote:
> When I export it to html, the bibliography comes out nice. When I
> export it to odt, the resulting odt files contains a lot of rubbish.
>
> A kludge is to export it to html and then open it with LO/OO and copy
> it in an empty odt file, but is there any other solution?

I find the best ODT comes from LaTeX -> pandoc -> ODT. I have the following 
section at the bottom of my default Org template workbook.

  -k.



* DOCX  :noexport:

Exporting to DOCX by using pandoc to convert the LaTeX export to DOCX seems to 
work much better than using Org directly. This means you need to export to 
LaTeX, properly compile the latex (to get the references correct), then run the 
BibTeX code block below 1x (and re-run each time you update any references), 
then run the Pandoc code block to convert the TeX file to DOCX.

** BibTeX   :noexport:
#+BEGIN_SRC sh :results verbatim :var fn=(file-name-sans-extension 
(buffer-name))
biber ${fn} --output_format bibtex
#+END_SRC
#+RESULTS:

** Pandoc
#+BEGIN_SRC sh :results verbatim :var fn=(file-name-sans-extension 
(buffer-name))
pandoc -f latex -t docx -o ${fn}.docx --bibliography ./${fn}_biber.bib ${fn}.tex
#+END_SRC
#+RESULTS:



[O] LaTeX preamble from Babel blocks

2018-12-22 Thread Ken Mankoff
Hello,

I thought I saw a recent mention that instead of

#+LATEX_HEADER: foo

it is now possible to do

#+BEGIN_SRC latex :some-header-option some-value
foo
#+END_SRC

And have "foo" appear in the *preamble*, not body.

Is this correct? I cannot find the syntax searching the mailing list archives. 
Can someone share the syntax, if it exists?

Thanks,

  -k.



Re: [O] non-math superscripts in LaTeX export

2018-12-17 Thread Ken Mankoff


On 2018-12-17 at 15:45 -0800, Nicolas Goaziou  wrote:
>> It seems to me like a^b should export as a\textsuperscript{b}.
>> Do others agree?
>
> I think you're right. I changed "ox-latex" to use \textsubscript and
> \textsuperscript in master. Could you check the result is correct now?

Seems to work.

I spent ~10 minutes browsing the code before I wrote the list, because I would 
have liked to submit a patch rather than just a comment/question. After your 
quick reply I thought "this must have been fairly easy" and I went and looked 
at the changeset

https://code.orgmode.org/bzg/org-mode/commit/0811af50b49de832b74222189695a09327ef6e6b

I would love to contribute more to this project but am still far from being 
able to do what you just did there.

Anyway... I'd have a hard time doing my work without Org, and I'm once again 
reminded that Org is People. Thank you for helping maintain and improve it!

  -k.




Re: [O] non-math superscripts in LaTeX export

2018-12-17 Thread Ken Mankoff


I know pandoc is not the Org reference implementation, but digging into this 
further I noticed that pandoc exports a^{b} from Org to LaTeX the way I 
expected/hoped Org would:

$ echo "a^{b}" | pandoc -f Org -t latex
a\textsuperscript{b}

  -k.

On 2018-12-17 at 14:21 -0800, Ken Mankoff  wrote:
> Hi,
>
> This file:
>
> Math mode: a\(^{b}\)
> Non-math mode: a^{b}
> What I'd like: a\textsuperscript{b}
>
> Is exported to this LaTeX code:
>
> Math mode: a\(^{b}\)
> Non-math mode: a\(^{\text{b}}\)
> What I'd like: a\textsuperscript{b}
>
>
> When viewing a PDF from that LaTeX source, the first (Math mode) appears 
> correct. The second (non-math) appears correct in the PDF, but I'm not sure 
> it is in the LaTeX source. The third looks correct.
>
>
> A more severe end-product appearance issue comes downstream. I find Pandoc 
> generates better ODT and DOCX files than Org when the inputs are complicated. 
> When viewing a DOCX generated from the above LaTeX with:
>
> $ pandoc -f LaTeX -i foo.tex -t DOCX -o foo.docx foo.tex
>
> there is a more serious issue: The b power is not attached to the a, so there 
> is an empty box and it looks like this (where ^b is actually raised as a 
> superscript):  a[]^b. Or see attached screenshot.
>
> I've tried toggling #+OPTIONS ^:{} and ^:nil but it doesn't solve this. It 
> seems to me like a^b should export as a\textsuperscript{b}. Do others agree? 
> Or is this a pandoc bug I should be raising in that project?
>
> Thanks,
>
>   -k.




[O] non-math superscripts in LaTeX export

2018-12-17 Thread Ken Mankoff
Hi,

This file:

Math mode: a\(^{b}\)
Non-math mode: a^{b}
What I'd like: a\textsuperscript{b}

Is exported to this LaTeX code:

Math mode: a\(^{b}\)
Non-math mode: a\(^{\text{b}}\)
What I'd like: a\textsuperscript{b}


When viewing a PDF from that LaTeX source, the first (Math mode) appears 
correct. The second (non-math) appears correct in the PDF, but I'm not sure it 
is in the LaTeX source. The third looks correct.


A more severe end-product appearance issue comes downstream. I find Pandoc 
generates better ODT and DOCX files than Org when the inputs are complicated. 
When viewing a DOCX generated from the above LaTeX with:

$ pandoc -f LaTeX -i foo.tex -t DOCX -o foo.docx foo.tex

there is a more serious issue: The b power is not attached to the a, so there 
is an empty box and it looks like this (where ^b is actually raised as a 
superscript):  a[]^b. Or see attached screenshot.

I've tried toggling #+OPTIONS ^:{} and ^:nil but it doesn't solve this. It 
seems to me like a^b should export as a\textsuperscript{b}. Do others agree? Or 
is this a pandoc bug I should be raising in that project?

Thanks,

  -k.




Re: [O] cannot export to beamer.

2018-12-16 Thread Ken Mankoff


On 2018-12-16 at 10:16 -0800, Uwe Brauer  wrote:
> So the problem is in my init file and I am quite sure that it has to
> do with the following lines in my custom- file
>
>  '(org-latex-classes

What is the full line here? Is this a "setq"?

I have:

(add-to-list 'org-latex-classes
   `("copernicus"
 "\\documentclass{copernicus}
   [NO-DEFAULT-PACKAGES]
   [NO-PACKAGES]...

At it doesn't damage the existing setup, juts adds to it...

  -k.




Re: [O] cannot export to beamer.

2018-12-15 Thread Ken Mankoff


On 2018-12-15 at 09:38 -0800, Uwe Brauer  wrote:
> I am very used to the beamer style and it works on my machine quite
> well.

But it doesn't work quiet well according to this email. What changed? Are you 
on a new machine? Is LaTeX installed?

> Now I took the example
> https://orgmode.org/manual/A-Beamer-example.html#A-Beamer-example
>
> And wanted to export it to beamer but obtained the message 
> user-error: Unknown LaTeX class ‘beamer’
>
> Which leaves me puzzled. 

I'm using Org -> Beamer. I don't know it well, but on my system I do not have

#+LATEX_CLASS: beamer

I do have

#+STARTUP: beamer

However, the example you linked to works fine with for me with either of those 
settings. 

  -k.



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

2018-12-09 Thread Ken Mankoff


On 2018-12-09 at 17:45 -0800, James Harkins  wrote:
> 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).

But export is not the same as opening. Export should work.

  -k.



  1   2   3   4   5   >