Using Org and eev together - problem with source blocks

2019-11-09 Thread Eduardo Ochs
Hi list,

I gave a presentation about eev at the EmacsConf a few days ago, and
after the conference I started to work on a tutorial to explain how to
use Org and eev together... links:

  http://angg.twu.net/emacsconf2019.html
  http://angg.twu.net/LATEX/2019emacsconf-long.pdf (slides)
  http://www.youtube.com/watch?v=86yiRG8YJD0=774 (demo)
  http://www.youtube.com/watch?v=86yiRG8YJD0=956 (demo: eepitch)
  http://angg.twu.net/eev-intros/find-org-intro.html (eev+Org, html)
  http://angg.twu.net/eev-intros/find-org-intro  (eev+Org, src)
  https://lists.gnu.org/archive/html/emacs-orgmode/2013-11/msg00124.html

I am longtime Org user that only uses a few features of Org - mainly
the ones here,

  (info "(org)Document Structure")

and when I tried to explain in my tutorial how to execute org source
blocks I stumbled on a behavior that I found very puzzling... I will
copy the relevant code here. The section on preparation says to run
these sexps,

  (require 'org)
  (require 'ob-sh)
  ;; or: (require 'ob-shell)
  (require 'ob-python)

and then a bit later the tutorial has this:



# (info "(org)Working With Source Code")
# (info "(org)Evaluating code blocks")

#+BEGIN_SRC sh
seq 200 204
#+END_SRC

#+BEGIN_SRC python
def square (x):
return x*x

print(square(5))
#+END_SRC



but when I run the shell block with C-c C-c I get these errors

  Error reading results: (user-error No table at point)
  Code block produced no output.

and an empty "#+RESULTS:" block in Emacs24, and the right results
block in some later versions of Emacs, and 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"... =(

Thanks in advance!

  Eduardo Ochs
  http://angg.twu.net/#eev


Re: Bug: LaTeX output of numbered TODO plain list items lose numbering. [9.1.9 (release_9.1.9-65-g5e4542 @ /usr/share/emacs/27.0.50/lisp/org/)]

2019-11-09 Thread Brian Carlson
On 11/9/19 6:59 AM, Fraga, Eric wrote:

> On Friday,  8 Nov 2019 at 21:28, Brian Carlson wrote:
>> So it seems that the numbering of numbered items in a plain list are not
>> maintained when the numbered item is also a TODO plain list item.
> This is a "feature", not a bug.  The intention was to export check box
> lists nicely to LaTeX, showing which were done and which were not.  This
> doesn't mix well with any other type of list except for simple bullet
> points unfortunately.

This is, indeed, a very odd "feature." Why change the numbering to not match 
what the org file shows? 

This is especially problematic if you use internal links...

--8<---cut here---start->8---
* My tasks
  1. one item
  2. Something interesting
 1. [X] <> another item
  3. A note that isn't really a ToDo
 1. Here we refer to item [[target]] saying it's related.
 2. another item

--8<---cut here---end--->8---

That file give the following LaTeX output. (I've omitted the Table of 
Contents). 
Notice that the reference is to "2." The actual reference is to 2.1 but since 
it's a plain list todo so it references the WRONG item.
--8<---cut here---start->8---

1 My tasks
  1. one item
  2. Something interesting
[X] another item
  3. A note that isn't really a ToDo
(a) Here we refer to item 2 saying it's related
(b) another item
--8<---cut here---end--->8---

This is inconsistent with the org mode content. It is also inconsistent 
with the HTML output, which IMHO matches the intent of the org mode file:
--8<---cut here---start->8---

1 My tasks
  1. one item
  2. Something interesting
 1. [X] another item
  3. A note that isn't really a ToDo
 1. Here we refer to item 2.1 saying it's related.
 2. another item
--8<---cut here---end--->8---



This change in behavior, err 'feature', should at least be documented 
in that it is shocking to a user. The full ramification of the change
may require quite a few documented use cases. Perhaps the "feature creator"
or someone who understands the reasoning wouldn't mind documenting this 
inconsistency in LaTeX exports (but not other Export targets)?

In the mean time, I guess I'll just have to add some "override" lisp to my 
init file to do the sane and expected thing. This is very unfortunate since
org-latex-item is pretty big. I don't think I can easily just advise this
function. 

> The only way around it is to have them as separate lists (e.g. two empty
> lines between the check box item and the numbered items) and start the
> numbered list with the desired number ([@2], I believe).

But I don't want separate lists. I want a "todo list" that's numbered but 
doesn't change the numbering when I add a comment or wish to refer to another
 task in that list.  Having to constantly update the numbering every time I 
change my list seems sort of contrary to the whole simplicity of Org Mode.  

I find this a very odd exception to just the LaTeX export.

Thanks, 
;-b





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: Fwd: Re: Finally figuring out some ob-sqlite stuff -- for worg?

2019-11-09 Thread Eric Abrahamsen
"Thomas S. Dye"  writes:

> Cancel that, I was looking at a cached version of the page.

I guessed that was what happened :)




Re: Finally figuring out some ob-sqlite stuff -- for worg?

2019-11-09 Thread Eric Abrahamsen
Stefan Nobis  writes:

> Eric Abrahamsen  writes:
>
>> Okay, it's up. If anyone wants to explain to me the point of the
>> "where exists" clause in the SQL, I would be interested to hear. It
>> works as expected this way, but is that clause necessary?
>
> Yes, very necessary. Without it, all ratings would be changed - the
> two example rows without ratings (ids 5 and 12) would get the values
> from the intermediary org table, every other row in table bookreview
> would get its rating attribute set to null (because there is no
> matching entry in the temporary updates table).
>
> Remember: update without a where clause always touches every single
> row of the complete table.
>
> The "where exists" clause ensures that only those rows of bookreviews
> are touched that are present in the intermediary org table. If you do
> not like "where exists" you could say "where bookreview.id in (select
> id from udpates)".

Beautiful, this explains it perfectly. I had the sense that was the
purpose, but my very straightforward programming brain was insisting
that that job should be done with something like your final tip above:
update only if the id is in the updates table.

I was confused in part because the "where exists (select *..." looks
like its main purpose is to return rows. Will the select subquery
actually restrict the values that are available for updating/comparison
in the update statement? Or does the "exists" mean the subquery is
treated as a plain yes/no boolean, and the update still has access to
anything it likes? Ie, we could write "where exists (select " to
the same effect? Hope that's clear!

In essence, the "where exists" is acting as an "inner join"...

Sorry for the off-topic SQL detour! And thanks very much for this cogent
explanation.

Eric





Cannot export org mode to collapsible HTML

2019-11-09 Thread Kris Brown
Hi, I am trying to have basic folding functionality for my org file that
has been exported to HTML. I am using Emacs 26.2 (9.0) and Org 9.1.9 on a
Mac.

This seems to be a built-in feature: JavaScript supported display of web
pages
. I
downloaded my own copy of org-info.js
. However, I cannot see any
difference when I use the #+INFOJS_OPT commands or not (org with
, org without
, html with
, html without
). I would expect to
see collapsible headers and no TOC displayed when I use those commands.

There *is* a difference in the generated HTML files (an extra CDATA region
with a bunch of statements like: *org_html_manager.set("VIEW", "info");*)
but nothing different visually.

Is this happening because org-info.js is no longer being maintained
?
Another solution I saw was Daniel Clemente's tool
,
though I am at a total loss for what to specify in the org file to
incorporate his esquemadorg.js script. I appreciate any help that could let
me export large org files to HTML while having the headers be collapsible.


Bug: Effort prompt write malformed input in agenda file even after reporting the error [9.1.9 (release_9.1.9-65-g5e4542 @ /usr/local/share/emacs/26.3/lisp/org/)]

2019-11-09 Thread Firmin Martin


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

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

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


In the agenda buffer, I've called the `org-set-effort` function
with the `e` key, and input "-" which is malformed. I did receive
an error `Invalid duration format: "-"`, but the "-" has still been
written in the entry as an effort property.

As a consequence of this bug, opening the agenda buffer raise again
the error `Invalid duration format: "-"` which results that the agenda
buffer cannot be opened. The malformed line  

 :Effort:   -

can only be found by a dichotomic search which is quite annoying.
For a similar issue, see here

https://emacs.stackexchange.com/questions/36111/invalid-duration-format-org-agenda/53637#53637

Maybe other functions have the same behavior (writing
malformed value on the agenda even after reporting the error).


Emacs  : GNU Emacs 26.3 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.8)
 of 2019-10-22
Package: Org mode version 9.1.9 (release_9.1.9-65-g5e4542 @ 
/usr/local/share/emacs/26.3/lisp/org/)




Bug: Cursor Disapears in Org-Src Blocks in Indent Mode [9.2.6 (release_9.2.6-559-ga01a8f @ /Users/djm/.emacs.d/straight/build/org/)]

2019-11-09 Thread Dylan McDowell
Hello,

Expected Behavior: My cursor is always visible throughout my entire
org-document

Actual Behavior: When moving through org-src blocks, my cursor is
visible until I move it to the end of the line. Then my cursor disapears
and only shows up when the cursor is placed in the middle of the line.

This behavior only happens when I hit 'org-block-begin-line', continues
through the 'org-block' face and 'org-block-end-line'.

Also, this behavior only happens if 'org-ident-mode' is turned on.

Also, this behavior only happens if I have the aforementioned faces set
to a different background color.

To summarize:

Org-Indent-Mode: On
Org-Block Faces: Different color than default bg
Cursor Behavior: Unexpected

Org-Indent-Mode: Off
Org-Block Faces: Different color than default bg
Cursor Behavior: Expected

Org-Indent-Mode: On
Org-Block Faces: Default bg
Cursor Behavior: Expected

Even with removing the rest of my 'init.el' and only changing the
org-block faces this same behavior happens. I suspect this might have
something to do with the new ':extend' keyword, but this behavior
persists even when I don't set ':extend t'.

Here is an example of how I am modifying the faces:

(org-block (:background gruvbox-dark1 :extend t))

(org-block-begin-line (:underline gruvbox-dark4 :background
gruvbox-dark0 :foreground gruvbox-dark4 :extend t))

(org-block-end-line (:overline gruvbox-dark4 :background
gruvbox-dark0 :foreground gruvbox-dark4 :extend t))

Emacs : GNU Emacs 27.0.50 (build 2, x86_64-apple-darwin19.0.0, NS 
appkit-1894.00 Version 10.15 (Build 19A583))
of 2019-11-08
Package: Org mode version 9.2.6 (release_9.2.6-559-ga01a8f @ 
/Users/djm/.emacs.d/straight/build/org/)

current state:
==
(setq
org-src-mode-hook '(config-org--supress-final-newline 
org-src-babel-configure-edit-buffer
org-src-mode-configure-edit-buffer)
org-link-shell-confirm-function 'yes-or-no-p
org-insert-heading-respect-content t
org-metadown-hook '(org-babel-pop-to-session-maybe)
org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
org-highlight-sparse-tree-matches nil
org-enforce-todo-dependencies t
org-src-tab-acts-natively t
org-imenu-depth 4
org-startup-folded 'content
org-blocker-hook '(org-block-todo-from-children-or-siblings-or-parent)
org-mode-hook '(#[0 "\300\301\302\303\304$\207" [add-hook 
change-major-mode-hook org-show-all append local] 5]
#[0 "\300\301\302\303\304$\207"
[add-hook change-major-mode-hook org-babel-show-result-all append local] 5]
org-babel-result-hide-spec org-babel-hide-all-hashes toc-org-mode 
org-bullets-mode
visual-line-mode yas-minor-mode)
org-outline-path-complete-in-steps nil
org-archive-hook '(org-attach-archive-delete-maybe)
org-confirm-elisp-link-function 'yes-or-no-p
org-startup-indented t
org-agenda-before-write-hook '(org-agenda-add-entry-text)
org-metaup-hook '(org-babel-load-in-session-maybe)
org-bibtex-headline-format-function #[257 "\300\236A\207" [:title] 3 "\n\n(fn 
ENTRY)"]
org-babel-pre-tangle-hook '(save-buffer)
org-tab-first-hook '(org-babel-hide-result-toggle-maybe 
org-babel-header-arg-expand)
org-hide-emphasis-markers t
org-catch-invisible-edits 'smart
org-occur-hook '(org-first-headline-recenter)
org-indirect-buffer-display 'current-window
org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-show-empty-lines
org-optimize-window-after-visibility-change)
org-speed-command-hook '(org-speed-command-activate 
org-babel-speed-command-activate)
org-clock-persist-file "/Users/djm/.cache/emacs/var/org/clock-persist.el"
org-refile-allow-creating-parent-nodes 'confirm
org-id-locations-file "/Users/djm/.cache/emacs/var/org/id-locations.el"
org-confirm-shell-link-function 'yes-or-no-p
org-link-parameters '(("attachment" :follow org-attach-open-link :export 
org-attach-export-link :complete
org-attach-complete-link)
("id" :follow org-id-open) ("eww" :follow eww :store org-eww-store-link)
("rmail" :follow org-rmail-open :store org-rmail-store-link)
("mhe" :follow org-mhe-open :store org-mhe-store-link)
("irc" :follow org-irc-visit :store org-irc-store-link :export org-irc-export)
("info" :follow org-info-open :export org-info-export :store 
org-info-store-link)
("gnus" :follow org-gnus-open :store org-gnus-store-link)
("docview" :follow org-docview-open :export org-docview-export :store
org-docview-store-link)
("bibtex" :follow org-bibtex-open :store org-bibtex-store-link)
("bbdb" :follow org-bbdb-open :export org-bbdb-export :complete 
org-bbdb-complete-link
:store org-bbdb-store-link)
("w3m" :store org-w3m-store-link) ("file+sys") ("file+emacs")
("shell" :follow org-link--open-shell)
("news" :follow #[257 "\301\300\302Q!\207" ["news" browse-url ":"] 5 "\n\n(fn 
URL)"])
("mailto" :follow #[257 "\301\300\302Q!\207" ["mailto" browse-url ":"] 5 
"\n\n(fn URL)"])
("https" :follow #[257 "\301\300\302Q!\207" ["https" browse-url ":"] 5 "\n\n(fn 
URL)"])
("http" :follow #[257 "\301\300\302Q!\207" ["http" browse-url ":"] 5 "\n\n(fn 
URL)"])
("ftp" :follow #[257 "\301\300\302Q!\207" 

customized link pointing at a src block

2019-11-09 Thread Łukasz Stelmach
Hi,

I'd like to have collapsible source code blocks in my org document
exported to HTML. To collapse and restore I have used[1]. The library
requires a link (or a button) with appropirate properties. A link needs
to point (href) to a block and have additional custom data-toggle
property. On Debian9/Emacs 24/org-mode 8.x I was able to craft such
links by hand

#+HTML: Show

#+NAME: code1
#+BEGIN_SRC python
return 42
#+END_SRC

On Debian10/Emacs26/org-mode 9.1.9 src blocks with a NAME get
automatically generated id-s (org-export-get-reference) and I can see no
way to determine href in my HTML snippet. (ATTR_HTML before org-mode
link does not work as advertised in the manual either).

Is there any way to generate a link (or a button) for every code block
with matching href/id you can recommend?

[1] https://getbootstrap.com/docs/4.2/components/collapse/

Kind regards,
-- 
Było mi bardzo miło.  --- Rurku. --- ...
>Łukasz<--- To dobrze, że mnie słuchasz.


signature.asc
Description: PGP signature


Fwd: Re: Finally figuring out some ob-sqlite stuff -- for worg?

2019-11-09 Thread Thomas S. Dye

Cancel that, I was looking at a cached version of the page.

Thanks again for the documentation.

All the best,
Tom

Thomas S. Dye writes:

Okay, it's up. If anyone wants to explain to me the point of 
the

"where
exists" clause in the SQL, I would be interested to hear. It
works as
expected this way, but is that clause necessary?


The 'if exists' clause protects against an SQLite error raised 
if
you ask to delete a table that doesn't exist.  The code will 
work
without it if the table exists, but will exit without creating 
the

table if not.

Thanks for a useful addition to the Org babel SQLite
documentation.  I agree with you that Org mode tables are a
convenient way to enter SQL data, keeping in mind that table
columns can't be rearranged without changes to the SQL code.

All the best,
Tom



--
Thomas S. Dye
http://tsdye.online/tsdye



Re: Finally figuring out some ob-sqlite stuff -- for worg?

2019-11-09 Thread Thomas S. Dye



Okay, it's up. If anyone wants to explain to me the point of the 
"where
exists" clause in the SQL, I would be interested to hear. It 
works as

expected this way, but is that clause necessary?


The 'if exists' clause protects against an SQLite error raised if 
you ask to delete a table that doesn't exist.  The code will work 
without it if the table exists, but will exit without creating the 
table if not.


Thanks for a useful addition to the Org babel SQLite 
documentation.  I agree with you that Org mode tables are a 
convenient way to enter SQL data, keeping in mind that table 
columns can't be rearranged without changes to the SQL code.


All the best,
Tom

--
Thomas S. Dye
http://tsdye.online/tsdye



Re: Finally figuring out some ob-sqlite stuff -- for worg?

2019-11-09 Thread Stefan Nobis
Eric Abrahamsen  writes:

> Okay, it's up. If anyone wants to explain to me the point of the
> "where exists" clause in the SQL, I would be interested to hear. It
> works as expected this way, but is that clause necessary?

Yes, very necessary. Without it, all ratings would be changed - the
two example rows without ratings (ids 5 and 12) would get the values
from the intermediary org table, every other row in table bookreview
would get its rating attribute set to null (because there is no
matching entry in the temporary updates table).

Remember: update without a where clause always touches every single
row of the complete table.

The "where exists" clause ensures that only those rows of bookreviews
are touched that are present in the intermediary org table. If you do
not like "where exists" you could say "where bookreview.id in (select
id from udpates)".

-- 
Until the next mail...,
Stefan.



calc embedded mode and org tables

2019-11-09 Thread Fraga, Eric
Hello all,

I use calc embedded mode for many simple calculations.  I have the need
to refer to some previously calculated values using calc in an org
table.  So, for instance, if I have the embedded formula

x := 3 + ln(10) => 5.303

in my org buffer, is there some way to access the value of x in an org
table?  I've tried a formula with '(calc-eval "x") but that did not work.

Thanks,
eric

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.2.6-552-g8c5a78



Re: Finally figuring out some ob-sqlite stuff -- for worg?

2019-11-09 Thread Eric Abrahamsen
"Fraga, Eric"  writes:

> This looks quite useful and would be nice to have on Worg.  Thanks.

Okay, it's up. If anyone wants to explain to me the point of the "where
exists" clause in the SQL, I would be interested to hear. It works as
expected this way, but is that clause necessary?




Re: Bug: LaTeX output of numbered TODO plain list items lose numbering. [9.1.9 (release_9.1.9-65-g5e4542 @ /usr/share/emacs/27.0.50/lisp/org/)]

2019-11-09 Thread Fraga, Eric
On Friday,  8 Nov 2019 at 21:28, Brian Carlson wrote:
> So it seems that the numbering of numbered items in a plain list are not
> maintained when the numbered item is also a TODO plain list item.

This is a "feature", not a bug.  The intention was to export check box
lists nicely to LaTeX, showing which were done and which were not.  This
doesn't mix well with any other type of list except for simple bullet
points unfortunately.

The only way around it is to have them as separate lists (e.g. two empty
lines between the check box item and the numbered items) and start the
numbered list with the desired number ([@2], I believe).

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.2.6-552-g8c5a78



Re: Bug: ob-plantuml: using @start prefix in buffer returns nil body due to nil assignments [N/A (N/A @ /nix/store/1hmx5h1kn25p7s31h31dz7g3kn1dc6qx-emacs-packages-deps/share/emacs/site-lisp/org/)]

2019-11-09 Thread Jarmo Hurri


Greetings Terje.

Terje Larsen  writes:

> I noticed that I cannot run C-c C-c to convert plantuml source blocks
> since the commit (4e854974be9788f029f2d73f829c4d51d2b83faf), see changes
> at:
> https://code.orgmode.org/bzg/org-mode/commit/4e854974be9788f029f2d73f829c4d51d2b83faf#diff-9c9a333463276ff17be763269a5042f92a40817R73
>
> If I have a simple source block as such as:
>
> #+BEGIN_SRC plantuml :file output.png
> @startuml
> actor Foo1
> actor Foo2
> Foo1 -> Foo2 : Test
> @enduml
> #+END_SRC
>
> When I try to run C-c C-c I receive the following error message:
> org-babel-execute-src-block: Wrong type argument: char-or-string-p,
> nil

I started using plantuml in org last week (and am enjoying it greatly),
so take this with a hint of salt from a beginner. Still, at least in my
installation, your source code block works fine without '@startuml' and
'@enduml':

#+BEGIN_SRC plantuml :file output.png
actor Foo1
actor Foo2
Foo1 -> Foo2 : Test
#+END_SRC

All the best,

Jarmo