ConTeXt exporter makes me happy

2022-02-24 Thread Jan Ulrich Hasecke
Dear org-mode developers,
dear Jason,

thanks a lot for org-mode and the ConTeXt exporter.
https://github.com/Jason-S-Ross/ox-context

With your help, in the last few months I setup a complete authoring and
publishing environment for my needs with org-mode and ox-context. I
collect my thoughts with org-roam, outline and write my texts with Emacs
and org-mode and typeset my books with ConTeXt. Perfect match!

ConTeXt is a wonderful tool to typeset books. It is much more flexible
than LaTeX and very powerful. 

Before ox-context my authoring and publishing setup was a combination of
Markdown, Pandoc and ConTeXt. It was quite perfect and handsome. The
only drawback of this setup is the break between my Zettelkasten
(org-roam) and my publishing tools.

So, I am very happy that ox-context is there and is continually
improved.  The possibility to export to ConTeXt is a good reason to
learn more facets of org-mode which is quite a big beast.

juh 

-- 
Autoren-Homepage: . http://literatur.hasecke.com
Satiren & Essays: . http://www.sudelbuch.de
Privater Blog:  http://www.hasecke.eu
Netzliteratur-Projekt:  http://www.generationenprojekt.de




signature.asc
Description: PGP signature


Re: Beginning with org-babel.

2022-02-24 Thread William Denton

On 25 February 2022, Steven Harris wrote:


The current problem is that I have a config file that I want to substitute
a value into.  I want the conf-mode highlighting.  Conf is not a
programming language of course, just a text format.

I'm trying something like

#+begin_src conf :tangle yes :noweb yes
 [defaults]
 private_key_file = <>
#+end_src

I have tried something similar to the SQL comment example in the
documentation to no avail and also setting :var headers. How can I
substitute a value here?


I think there are a few different ways, but they depend on Org knowing about the 
language of the source block (as I realized after writing most of this, and 
deciding I'd send it along anyway in case it's helpful):


One way I do it is like so, first with defining a variable.

#+NAME: RUBY_VERSION
| 3.1.1 |

Then, in a source block, call in the variable with :var, like so:

#+begin_src shell :tangle conforg/scripts/ruby-install-personal.sh :shebang 
"#!/bin/bash" :var RUBY_VERSION=RUBY_VERSION
rbenv install --verbose $RUBY_VERSION
rbenv global $RUBY_VERSION ~/conforg/scripts/ruby-install-gems.sh
echo "Now run bundle install where needed."
#+end_src

I'm using the RUBY_VERSION variable name in two places: first on its own in Org, 
then in the shell script as an environment variable that is set to the value of 
the Org variable.  No point in using two different variable names for this, I 
thought.  But in other cases one would want to.


(This is from Conforguration,¹ my system for setting up my dot files and some 
languages or services I want to run from source.)


But Org knows about shell scripts and can pass variables in to them (like it can 
with SQL), and Org doesn't know about INI files or other config files the same 
way.  So (unless I'm mistaken) this method won't work.


However, surely there's another way ...

Bill

¹ https://github.com/wdenton/conforguration

--
William Denton
https://www.miskatonic.org/
Librarian, artist and licensed private investigator.
Toronto, Canada

Beginning with org-babel.

2022-02-24 Thread Steven Harris
Hi All

Ansible is a system configuration-management tool that is based on
"playbooks".  These are collections of mostly YAML files, but also Jinja2
templates and unix configuration files.  To execute one needs to run a unix
shell command with a python virtualenv set up and usually some environment
variables set.

Painfully much of this lives fragmented in a nested directory structure,
many of the files in which are named "main.yml".   Sometimes  the same
information has to be set in two places with incompatible formats , such as
a config file and an environment variable.

I am trying to bring some literate programming to bear on this can of worms
so have reached for Babel.  It's my first use of it.

The current problem is that I have a config file that I want to substitute
a value into.  I want the conf-mode highlighting.  Conf is not a
programming language of course, just a text format.

I'm trying something like

#+begin_src conf :tangle yes :noweb yes
  [defaults]
  private_key_file = <>
#+end_src

I have tried something similar to the SQL comment example in the
documentation to no avail and also setting :var headers. How can I
substitute a value here?

Cheers

Steven


Re: [BUG] Prompted to submit (unsure what happened) [9.5.2 (9.5.2-g072523 @ /Users/apc/.emacs.d/straight/build/org/)]

2022-02-24 Thread Alejandro Pérez Carballo
One more question: wouldn't replacing `org-in-src-block-p' with a function that 
calls `org-in-src-block-p' only when in org-mode and returns `nil' elsewhere 
suffice to make something that's like `org-in-src-block-p' but that will work 
outside org-mode? E.g.: 

(defun my/org-in-src-block-p ( arg)
  (if (derived-mode-p 'org-mode)
  (org-in-src-block-p)
nil))

I'm using this for now as a replacement and it seems to do the trick, at least 
for my present purposes. 

Best, 

Alejandro



> On Feb 24, 2022, at 11:27 AM, Alejandro Pérez Carballo  
> wrote:
> 
> I found the source of the problem. I was trying to disable 
> `electric-quote-mode' when in a src block, and found this snippet somewhere: 
> 
> ```
> (add-hook 'electric-quote-inhibit-functions #'org-in-src-block-p)
> ```
> 
> Any thoughts on alternative ways of achieving similar behavior? Presumably 
> I'd need to find a way to make `electric-quote-inhibit-functions` vary 
> depending on whether I am in org-mode. But I'm very much an Elisp illiterate, 
> so I'd appreciate any suggestions here. 
> 
> Best, 
> 
> Alejandro
> 
>> On Feb 24, 2022, at 5:39 AM, Ihor Radchenko  wrote:
>> 
>> Alejandro Pérez Carballo  writes:
>> 
>>> Sorry about the unclear report. I was indeed _not_ in an org buffer. I do 
>>> not think I was using minibuffer completion, but I cannot remember. I now 
>>> just got a similar error message, this time when working on an Elisp 
>>> buffer. The error message says: 
>>> 
>>> Warning (org-element-cache): org-element--cache: Org parser error in 
>>> setup-biblio.el::5918. Resetting.
>>> The error was: (error "rx ‘**’ range error")
>>> Backtrace:
>>> "  backtrace-to-string(nil)
>>> org-element-at-point()
>>> org-in-src-block-p()
>>> run-hook-with-args-until-success(org-in-src-block-p)
>>> electric-quote-post-self-insert-function()
>>> self-insert-command(1 34)
>>> funcall-interactively(self-insert-command 1 34)
>>> call-interactively(self-insert-command nil nil)
>>> command-execute(self-insert-command)
>>> "
>> 
>> Thanks for the backtrace! It is very clear that something in 
>> electric-quote-mode-hook (or maybe in electric-quote-inhibit-functions)
>> is calling org-in-src-block-p.
>> 
>> org-in-src-block-p does not work outside Org mode. It used to (at least,
>> it did not throw an error), but it is not the case anymore and it was
>> never guaranteed that Org functions can reliably work outside Org mode.
>> 
>> I do not see explicit customisation adding org-in-src-block-p in your
>> config from the first email. I presume that some third-party package is
>> adding org-in-src-block-p to electric-quote-mode. I would first try to
>> check the values of electric-quote-inhibit-functions and
>> electric-quote-mode-hook and check if they contain org-* staff. Then, I
>> would bisect the config to find out which package is doing it. What you
>> are seeing is a bug in that package and should be reported.
>> 
>> Best,
>> Ihor
> 




Re: Inserting links stored in `org-store-link-plist`

2022-02-24 Thread Alejandro Pérez Carballo
Thanks for your reply. I can store the ID calling `org-store-link' if 
`org-id-link-to-org-use-id' is set to a non-nil value. But I wanted to be able 
to have `org-id-link-to-org-use-id' set to nil and also have a function to 
store an ID link. (I make use of ID only in certain files and try to avoid them 
otherwise, preferring the default method of using a link to the file with a 
search string pointing to the current line in most cases.)  

I had expected that `org-insert-link' would be able to retrieve links stored 
both with `org-store-link' and `org-id-store-link'—it seemed like a natural 
assumption, perhaps because I do not know of other reasons for having an 
interactive function that stores links aside from being able to insert them 
later?  But if the point of `org-id-store-link' is not to supply values for 
`org-insert-link', please ignore this.

For now, I've just defined a simple wrapper that temporarily sets the value of 
`org-id-link-to-org-use-id' to `use-existing' and calls `org-store-link', and 
that works fine.

Thanks again, 

Alejandro

> On Feb 23, 2022, at 7:50 AM, Max Nikulin  wrote:
> 
> On 18/02/2022 06:26, Alejandro Pérez Carballo wrote:
>> After storing a link to an ID using `org-id-store-link` I would've
>> expected the stored link to be made available when calling
>> `org-insert-link`,
> I would expect that to store ID link it should be enough to call 
> `org-store-link' having proper configuration. This function calls 
> `org-id-store-link`, see 
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/tree/lisp/ol.el#n1634
> 
> Unfortunately you did not describe your real problem (or your goal). I am 
> aware of a problem with storing CUSTOM_ID links but it is unlikely related to 
> your one: 
> https://list.orgmode.org/e2c807a7-1924-6f08-9e63-4f70aee9d...@gmail.com




Re: ConTeXt exporter makes me happy

2022-02-24 Thread Juan Manuel Macías
juh writes:

> thanks a lot for org-mode and the ConTeXt exporter.
> https://github.com/Jason-S-Ross/ox-context
>
> With your help, in the last few months I setup a complete authoring and
> publishing environment for my needs with org-mode and ox-context. I
> collect my thoughts with org-roam, outline and write my texts with Emacs
> and org-mode and typeset my books with ConTeXt. Perfect match!
>
> ConTeXt is a wonderful tool to typeset books. It is much more flexible
> than LaTeX and very powerful.
>
> Before ox-context my authoring and publishing setup was a combination of
> Markdown, Pandoc and ConTeXt. It was quite perfect and handsome. The
> only drawback of this setup is the break between my Zettelkasten
> (org-roam) and my publishing tools.
>
> So, I am very happy that ox-context is there and is continually
> improved.  The possibility to export to ConTeXt is a good reason to
> learn more facets of org-mode which is quite a big beast.

Although I prefer LaTeX to ConTeXt for my typesetting and publishing
work, I agree that ConTeXt is an excellent tool, and for many users it
can provide a number of advantages over LaTeX. I agree also that Jason
has done a great job with ox-context, and I join in the congratulations.

I recommend LaTeX users, and even users of LaTeX via Org-Mode, to give
ConTeXt a try, if you haven't tried it yet. And of course try
ox-context. One of the historical drawbacks of ConTeXt has always been
its poor documentation, compared to LaTeX's documentation (it's not
really deficient, but what abounds is the documentation at a more
technical level). But luckily there is now an excellent ConTeXt
introductory manual, written by Joaquín Ataz López and with translations
(so far) into English, French, Russian and Serbian:

https://github.com/contextgarden/not-so-short-introduction-to-context

Best regards,

Juan Manuel




Re: [BUG] Prompted to submit (unsure what happened) [9.5.2 (9.5.2-g072523 @ /Users/apc/.emacs.d/straight/build/org/)]

2022-02-24 Thread Alejandro Pérez Carballo
I found the source of the problem. I was trying to disable 
`electric-quote-mode' when in a src block, and found this snippet somewhere: 

```
(add-hook 'electric-quote-inhibit-functions #'org-in-src-block-p)
```

Any thoughts on alternative ways of achieving similar behavior? Presumably I'd 
need to find a way to make `electric-quote-inhibit-functions` vary depending on 
whether I am in org-mode. But I'm very much an Elisp illiterate, so I'd 
appreciate any suggestions here. 

Best, 

Alejandro

> On Feb 24, 2022, at 5:39 AM, Ihor Radchenko  wrote:
> 
> Alejandro Pérez Carballo  writes:
> 
>> Sorry about the unclear report. I was indeed _not_ in an org buffer. I do 
>> not think I was using minibuffer completion, but I cannot remember. I now 
>> just got a similar error message, this time when working on an Elisp buffer. 
>> The error message says: 
>> 
>> Warning (org-element-cache): org-element--cache: Org parser error in 
>> setup-biblio.el::5918. Resetting.
>> The error was: (error "rx ‘**’ range error")
>> Backtrace:
>> "  backtrace-to-string(nil)
>>  org-element-at-point()
>>  org-in-src-block-p()
>>  run-hook-with-args-until-success(org-in-src-block-p)
>>  electric-quote-post-self-insert-function()
>>  self-insert-command(1 34)
>>  funcall-interactively(self-insert-command 1 34)
>>  call-interactively(self-insert-command nil nil)
>>  command-execute(self-insert-command)
>> "
> 
> Thanks for the backtrace! It is very clear that something in 
> electric-quote-mode-hook (or maybe in electric-quote-inhibit-functions)
> is calling org-in-src-block-p.
> 
> org-in-src-block-p does not work outside Org mode. It used to (at least,
> it did not throw an error), but it is not the case anymore and it was
> never guaranteed that Org functions can reliably work outside Org mode.
> 
> I do not see explicit customisation adding org-in-src-block-p in your
> config from the first email. I presume that some third-party package is
> adding org-in-src-block-p to electric-quote-mode. I would first try to
> check the values of electric-quote-inhibit-functions and
> electric-quote-mode-hook and check if they contain org-* staff. Then, I
> would bisect the config to find out which package is doing it. What you
> are seeing is a bug in that package and should be reported.
> 
> Best,
> Ihor




ConTeXt exporter makes me happy

2022-02-24 Thread juh

Dear org-mode developers,
dear Jason,

thanks a lot for org-mode and the ConTeXt exporter.
https://github.com/Jason-S-Ross/ox-context

With your help, in the last few months I setup a complete authoring and
publishing environment for my needs with org-mode and ox-context. I
collect my thoughts with org-roam, outline and write my texts with Emacs
and org-mode and typeset my books with ConTeXt. Perfect match!

ConTeXt is a wonderful tool to typeset books. It is much more flexible
than LaTeX and very powerful.

Before ox-context my authoring and publishing setup was a combination of
Markdown, Pandoc and ConTeXt. It was quite perfect and handsome. The
only drawback of this setup is the break between my Zettelkasten
(org-roam) and my publishing tools.

So, I am very happy that ox-context is there and is continually
improved.  The possibility to export to ConTeXt is a good reason to
learn more facets of org-mode which is quite a big beast.

juh

--
Autoren-Homepage: . http://literatur.hasecke.com
Satiren & Essays: . http://www.sudelbuch.de
Privater Blog:  http://www.hasecke.eu
Netzliteratur-Projekt:  http://www.generationenprojekt.de





Re: Footnote tooltips (an attempt)

2022-02-24 Thread Juan Manuel Macías
John Kitchin writes:

> that is a nice solution. I probably should have read the docstring on
> org-footnote-get-definition  a little more closely, it has the
> definition you need in it!

Well, it's a minor detail. The really brilliant thing here is your idea
of passing the function as a help-echo value, instead of a text string.
It works like a charm! :-).

(I didn't know that the help-echo property could accept a function as a
value, and reading the documentation I realize that this has a lot of
potential...).

Best regards, And thanks again,

Juan Manuel 



"Warning: Missing format argument"

2022-02-24 Thread Michael Powe

Hello,

Received the following in a emacs-lisp src block. The warning was 
delivered after I reformatted a comment block with ESC-q. I was in the 
code edit buffer (C-c ').



Warning (comp): org-refile.el:566:17: Warning: Missing format argument
Warning (comp): org-refile.el:574:19: Warning: Missing format argument


Org mode version 9.5.2 (release_9.5.2-390-g282a01.dirty @ 
c:/Users/micha/AppData/Roaming/.emacs.d/org-new/org-mode/lisp/)


GNU Emacs 29.0.50 (build 2, x86_64-w64-mingw32) of 2022-02-10

Thanks.

mp

--
"Do not neglect to do good, and to share what you have." - Hebrews 13:16a
Michael Powe
Naugatuck CT USA
po...@ctpowe.net




Re: [BUG] Prompted to submit (unsure what happened) [9.5.2 (9.5.2-g072523 @ /Users/apc/.emacs.d/straight/build/org/)]

2022-02-24 Thread Ihor Radchenko
Alejandro Pérez Carballo  writes:

> Sorry about the unclear report. I was indeed _not_ in an org buffer. I do not 
> think I was using minibuffer completion, but I cannot remember. I now just 
> got a similar error message, this time when working on an Elisp buffer. The 
> error message says: 
>
> Warning (org-element-cache): org-element--cache: Org parser error in 
> setup-biblio.el::5918. Resetting.
>  The error was: (error "rx ‘**’ range error")
>  Backtrace:
> "  backtrace-to-string(nil)
>   org-element-at-point()
>   org-in-src-block-p()
>   run-hook-with-args-until-success(org-in-src-block-p)
>   electric-quote-post-self-insert-function()
>   self-insert-command(1 34)
>   funcall-interactively(self-insert-command 1 34)
>   call-interactively(self-insert-command nil nil)
>   command-execute(self-insert-command)
> "

Thanks for the backtrace! It is very clear that something in 
electric-quote-mode-hook (or maybe in electric-quote-inhibit-functions)
is calling org-in-src-block-p.

org-in-src-block-p does not work outside Org mode. It used to (at least,
it did not throw an error), but it is not the case anymore and it was
never guaranteed that Org functions can reliably work outside Org mode.

I do not see explicit customisation adding org-in-src-block-p in your
config from the first email. I presume that some third-party package is
adding org-in-src-block-p to electric-quote-mode. I would first try to
check the values of electric-quote-inhibit-functions and
electric-quote-mode-hook and check if they contain org-* staff. Then, I
would bisect the config to find out which package is doing it. What you
are seeing is a bug in that package and should be reported.

Best,
Ihor



Re: Footnote tooltips (an attempt)

2022-02-24 Thread John Kitchin
that is a nice solution. I probably should have read the docstring on
org-footnote-get-definition  a little more closely, it has the definition
you need in it!

John

---
John Kitchin (he/his)
Professor
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
http://kitchingroup.cheme.cmu.edu
https://pointbreezepubs.gumroad.com/ pycse bookstore


On Wed, Feb 23, 2022 at 9:04 PM Juan Manuel Macías 
wrote:

> Hi John,
>
> John Kitchin writes:
>
> > I think this might be a simpler approach. what you want (I think) is
> > to leverage font-lock on tooltips to set a help-echo function instead
> > of a string. You can override org-activate-footnote-links with an
> > advice (which makes it easy to undo of you need). The tooltip function
> > then looks up the tooltip when you ask for it. The 3 pieces are below.
> > the first function looks up and returns a tooltip. the second is a
> > lightly modified version of org-activate-footnote-links which just
> > replaces the footnote reference string with the first function. the
> > last piece is the override advice. you could use a minor mode to
> > toggle the advice on and off.
>
> Thank you very much for your comment and code, which has helped me to
> clarify my ideas. Your approach is in a certain way similar to the last
> version of my attempt, which I attached in the previous message: through
> a first function I get the definition of each note, which is returned as
> a text string. And I also override via `advice-add'
> 'org-activate-footnonte-links' with a new function, which is also
> slightly modified, including a variable that gets the tooltip from the
> first function. The problem is that with my approach the tooltip does
> not appear on the fly, but when the next note is added. I think what my
> first function (the one that gets the footnote definition) was missing
> was the three arguments of your first function: `_win _obj position' and
> the (goto-char position), and pass it as a symbol (not as a variable) to
> the second function that overrides org-activate-footnote-links, as you
> do in your code. Modifying my function from your code, it would look
> something like this:
>
> (defun my-org-fn-get-def (_win _obj position)
>   (save-excursion
> (goto-char position)
> (let* ((el (org-element-context))
>(label (org-element-property :label el))
>(def (nth 3 (org-footnote-get-definition label
>   (when def (concat "Footnonte: " def)
>
> And it seems that now the tooltips appear instantly, and are updated in
> real time.
>
> Best regards,
>
> Juan Manuel
>


Re: Pandoc and nested emhases

2022-02-24 Thread Max Nikulin

On 18/02/2022 19:31, Juan Manuel Macías wrote:

Max Nikulin writes:


So formally this feature of pandoc is a bug (due to different kind of
parser). It is the reason why a corpus of tests should exist in a
format that can be easily imported from various programming languages.


Your conclusions seem logical to me. It may sound a bit surrealistic to
think that Pandoc is doing it wrong precisely for doing it "right", but...


Even pandoc is not perfect (at least not really consistent):

printf '%s' '- [[https://orgmode.org/][Lorem :: Ipsum]]' \
  | pandoc -f org -t html

[[https://orgmode.org/;>https://orgmode.org/][Lorem
Ipsum]]



Default zero-width workaround does not work for e.g. for code snippets 
since it would break syntax of target programming language:


printf '%s' '- src_haskell{monoidBSFold :: FilePath -> IO Counts}' \
  | pandoc -f org -t html

Examples are inspired by the following message:

Cash Weaver. Bug with exporting list with link item containing "::" to 
markdown. Sat, 12 Feb 2022 12:12:45 -0800.

https://list.orgmode.org/CABGRHLkLGXYgGNm4CXK_LjOTGTpsLO=5aWD=fypd1amy2qd...@mail.gmail.com