Re: [PATCH] org.el: Warning for unsupported markers in `org-set-emphasis-alist'

2022-11-03 Thread Ihor Radchenko
Max Nikulin  writes:

> On 21/11/2021 17:01, Ihor Radchenko wrote:
>> Max Nikulin writes:
>> 
>>> My draft version is attached. Ihor, thank you for inspiration. Feel free
>>> to improve it. I hope, it makes problem more apparent to user who tries
>>> to customize markers.
>
> A patch is attached. I have dropped changes in documentation since I am 
> not the author of them.

Sorry for the late reply.

I have reviewed the patch, and I'd like to suggest a new version with the
following changes:
1. Use `set-default-toplevel-value' instead of `set' that might be
   quirky in some scenarios.
2. Use `warn' instead of `message' as more alarming.
3. Remove verbatim in ("=" org-verbatim verbatim), ("~" org-code
   verbatim), and the :type spec.  AFAIU, they are unused. But can you
   please double-check?

>From 919fc426f298755886f6f3df22ce9670a7cf67c6 Mon Sep 17 00:00:00 2001
Message-Id: <919fc426f298755886f6f3df22ce9670a7cf67c6.1667544252.git.yanta...@posteo.net>
From: Max Nikulin 
Date: Mon, 22 Nov 2021 23:56:15 +0700
Subject: [PATCH v3] org.el: Warn about unsupported markers in
 `org-set-emphasis-alist'

* lisp/org.el (org-emphasis-alist, org-set-emphasis-alist): Change
custom variable type definition and add :set parameter to warn users
that non-standard marker characters are ignored.  Remove unused third
list entry from the default value.

Attempts to introduce new markers have been discussed enough times to
add some code that should prevent wasting of time.

Unfortunately there is no way to issue warning for e.g. `setq'.

Link: https://orgmode.org/list/878rxoa6lk.fsf@localhost
---
 lisp/org.el | 50 ++
 1 file changed, 42 insertions(+), 8 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index d8708f8f2..43be34daf 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -3628,12 +3628,31 @@ (defvar org-emphasis-regexp-components
 
 You need to reload Org or to restart Emacs after setting this.")
 
+(defun org-set-emphasis-alist (var value)
+  "Set VAR (`org-emphasis-alist') to VALUE.
+Warn user that Org syntax can not be extended with new emphasis
+markers if such attempt is detected.  The function is intended for
+:set argument of `defcustom'."
+  (set-default-toplevel-value var value)
+  (let ((unsupported
+	 (delq nil
+	   (mapcar
+(lambda (entry)
+  (let ((marker (car entry)))
+(unless (member marker '("*" "/" "_" "=" "~" "+")) marker)))
+value
+(when unsupported
+  (warn "Unsupported markup characters '%s' detected in `%s'"
+	(mapconcat #'identity unsupported " ")
+	(symbol-name var
+  value)
+
 (defcustom org-emphasis-alist
   '(("*" bold)
 ("/" italic)
 ("_" underline)
-("=" org-verbatim verbatim)
-("~" org-code verbatim)
+("=" org-verbatim)
+("~" org-code)
 ("+" (:strike-through t)))
   "Alist of characters and faces to emphasize text.
 Text starting and ending with a special character will be emphasized,
@@ -3641,18 +3660,33 @@ (defcustom org-emphasis-alist
 marker characters and the face to be used by font-lock for highlighting
 in Org buffers.
 
+Do not change the characters and do not add new ones to use custom
+markers for existing styles or to introduce new styles.  Org syntax is
+not meant to be configurable and such modifications will not work with
+export.
+
 You need to reload Org or to restart Emacs after customizing this."
   :group 'org-appearance
   :set 'org-set-emph-re
   :version "24.4"
   :package-version '(Org . "8.0")
+  :set #'org-set-emphasis-alist
   :type '(repeat
-	  (list
-	   (string :tag "Marker character")
-	   (choice
-	(face :tag "Font-lock-face")
-	(plist :tag "Face property list"))
-	   (option (const verbatim)
+  (group
+   (choice
+:tag "Marker"
+(const :tag "*Bold*" "*")
+(const :tag "/Italic/" "/")
+(const :tag "_Underline_" "_")
+(const :tag "+Strike-through+" "+")
+(const :tag "=Verbatim=" "=")
+(const :tag "~Code~" "~")
+;; To warn users that it does not work.
+(string :tag "Unsupported ignored character"))
+   (choice
+:tag "Font"
+(face :tag "Face")
+(plist :tag "Property list")
 
 (defvar org-protecting-blocks '("src" "example" "export")
   "Blocks that contain text that is quoted, i.e. not processed as Org syntax.
-- 
2.35.1


-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 


Re: Docstrings and literate programming (good practices?)

2022-11-03 Thread Marcin Borkowski


On 2022-11-04, at 06:45, to...@tuxteam.de wrote:

> On Thu, Nov 03, 2022 at 08:03:05PM -0700, Samuel Wales wrote:
>> i wonder if emacs or org has what you might call semi-literate or
>> etaretil docstring functions?
>> 
>> for example, you have a body of non-literate elisp code, and you have
>> a manual.  it could be redundant to describe commands and what they do
>> and their options, if the docstrings are good.
>> 
>> why not include the docstrings of all commands in some nice format in
>> the .org manual via some mechanism?
>
> Ah. Javadoc and their descendants. I tend to call that "illiterate
> programming"...

I spat my tea. :-)  Thanks, that's a nice one!

Though this _may_ work in some cases.  For example, imagine you divide
your package into two files – one with user-facing commands and another
one with internal functions.  If you order the former one carefully, the
"extract docstrings" might actually work as a documentation.

Still, a "normal" documentation seems a better (even if more
time-consuming) options.

Also, such docstring-based documentation is still better than none.

Best,

-- 
Marcin Borkowski
http://mbork.pl



Re: How to align all tables at once?

2022-11-03 Thread Jean Louis
* Ihor Radchenko  [2022-11-04 07:50]:
> Jean Louis  writes:
> 
> > I am using Org mode for presentation and would like to use it's tables
> > for presentation only.
> >
> > In particular I need the function org-table-align to align the table
> > in presentation mode.
> 
> I am not sure if I understand your use-case, but you may consider
> looking at 3.2 Column Width and Alignment section of the manual.

Yes, I look inside.

My use case is that Org buffer is used for presentation purpose, it is
not a file, it is generated buffer. This means tables cannot be
aligned before, but after, as the Org buffer does not exist before, it
exists only after rendering.

Then I look in the code by searching for variable
`org-startup-align-all-tables', and I find this within `define-derived-mode':

  (unless org-inhibit-startup
(org-unmodified
 (when org-startup-with-beamer-mode (org-beamer-mode))
 (when (or org-startup-align-all-tables org-startup-shrink-all-tables)
   (org-table-map-tables
(cond ((and org-startup-align-all-tables
org-startup-shrink-all-tables)
   (lambda () (org-table-align) (org-table-shrink)))
  (org-startup-align-all-tables #'org-table-align)
  (t #'org-table-shrink))
t))

And I think such larger definitions shall rather be split into smaller
useful functions.

For myself I have made this, which I need to additonally invoke via M-x then it 
works:

(defun rcd-org-table-align-all ()
  (interactive)
  (read-only-mode 0)
  (org-table-map-tables
   (lambda () (org-table-align) (org-table-shrink))
   t)
  (read-only-mode 1))

> #+STARTUP: align
> will align all the tables when opening an Org file.

And in this case I would like it on the end initialization, not
before. But problem is temporarily solved for Org mode by using M-x
rcd-org-table-align-all as my presentation buffer is in read only mode.

Org has nicer table in its source. Asciidoctor does not have, but then
Asciidoctor renders better PDF tables. So I am now using both
versions, Org and Asciidoctor.

⟦ (ignore (setq my-total 0)) ⟧
⟦ (ignore (defun my-add (n) (setq my-total (+ my-total n)) 
   (format "UGX %s" n))) ⟧

== Monthly Expenses

[cols="4,>1"]
|===
| Description  | Value   

| Communications and Reporting Officer I/C | ⟦ (my-add 60) ⟧ 
| Prospecting Staff member | ⟦ (my-add 45) ⟧ 
| Prospecting Staff member | ⟦ (my-add 45) ⟧ 
| Food for workers on project  | ⟦ (my-add 90) ⟧ 
| Transport Expenses   | ⟦ (my-add 100) ⟧
| Rental   | ⟦ (my-add 30) ⟧ 
| 500 Prospecting Checks with mapping  | ⟦ (my-add (pct-plus 500 .30)) ⟧
>| *TOTAL*:| *⟦ (format "UGX %s" my-total) 
>⟧*
|===

> Babel also auto-aligns tables in results.

Would it be possible to put Org as Babel source, so that I have Org
table inside of Babel and cause Babel to render automatically on the
end of buffer rendering and invocation of org derived mode?

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



Re: Docstrings and literate programming (good practices?)

2022-11-03 Thread tomas
On Thu, Nov 03, 2022 at 08:03:05PM -0700, Samuel Wales wrote:
> i wonder if emacs or org has what you might call semi-literate or
> etaretil docstring functions?
> 
> for example, you have a body of non-literate elisp code, and you have
> a manual.  it could be redundant to describe commands and what they do
> and their options, if the docstrings are good.
> 
> why not include the docstrings of all commands in some nice format in
> the .org manual via some mechanism?

Ah. Javadoc and their descendants. I tend to call that "illiterate
programming"...

> would that be a good practice?  seems useful abstractly.

... but I might be biased. I tend to detest its results. Especially
composed with languages having compulsive type declarations.

Cheers
-- 
t


signature.asc
Description: PGP signature


Re: Line breaks and brackets in LaTeX export

2022-11-03 Thread Max Nikulin

On 04/11/2022 11:23, Ihor Radchenko wrote:

Max Nikulin writes:

Ihor Radchenko writes:


These arguments mean that auto-cleaning \\[0pt] is not always safe and
may be a subject of surrounding LaTeX context.


I still believe that

  something\\[0pt]%__ORG_EXPORT__

is quite safe to remove (depending on the following character) and
unlikely harmful if remained for some reason.


What about the side effect you mentioned in a previous email?


   TeX reads

   "a% comment
  b"

   as "ab", dropping newline and starting spaces.


Unlike in Org, in TeX "a\\b" still contains a line break. Besides exotic 
packages and user setups it should just work. After all, during normal 
operation all "%__ORG_EXPORT__" should be stripped by a filter. They are 
just marks where a decision is necessary whether to retain "[0pt]" or to 
remove it.


On 03/11/2022 22:48, Juan Manuel Macías wrote:

Max Nikulin writes:


I have not managed to convince even the tabularray developer. And I
have not tried to find a way to reach more LaTeX developers.


I think that people from the LaTeX team and the authors of the most
popular packages are often very active on tex.stackexchange.com


Stackexchange is for questions, not for discussions and bugs. At certain 
point I was going to ask a question there, I even prepared a draft. 
After that I decided to try a command expanding to nothing and found 
\empty. I was not aware that tabularray uses a different approach to 
parsing.



And the repo on GitHub for the LaTeX project: https://github.com/latex3


https://github.com/latex3/latex3/issues may be an appropriate place, 
thank you.







Re: Can someone give an init.el wherein can start customize it?

2022-11-03 Thread Ihor Radchenko
Mati  writes:

> Can someone give an init.el wherein can start customize it?

I do not think that we can help you much here.

Config highly depends on your personal preferences and choice of
packages. (That's the whole point!) We are unlikely to understand what
you really want to achieve just from seeing the code and your limited
explanations.

The best we can suggest is:
1. Start from small config and add things gradually, so that you can see
   if something is broken after specific addition.
2. Do not put things you do not understand. If you really want something
   and you do not understand how a code snippet from internet works, ask
   on reddit/mailing list/matrix room/IRC, or dig into Emacs/Elisp/Org
   manual for better explanations.
3. Leave commentary on why you put specific piece of code into your
   config and how the code works. It will be extremely (I repeat,
   extremely!) useful when you go back to examine the config in future.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: How to center an image directly in org-mode (without exporting)

2022-11-03 Thread Ihor Radchenko
Cletip Cletip  writes:

> My problem is quite simple to understand: when I activate
> "org-toggle-inline-images", I would like my images to be centered. Indeed,
> I tried this in a org-file
>
> #+ATTR_ORG: :width 800 :center t
>
> [[file:images/anImage.png]]
>
>
> But it obviously doesn't work.

AFAIK, there is no easy way to do this, especially if you want the
centering to be preserved on resize.

> Does anyone have a tip?
>
> (I'm thinking of creating a function that, each time the size of the window
> changes, readjusts the number of spaces to put so that my image is
> centered. It's not a very clean solution, but could it work?)

What you are thinking is probably the only sane way. Though you do not
have to insert actual spaces. May instead use display property. See
40.16.3 Pixel Specification for Spaces section of Elisp manual.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: How to align all tables at once?

2022-11-03 Thread Ihor Radchenko
Jean Louis  writes:

> I am using Org mode for presentation and would like to use it's tables
> for presentation only.
>
> In particular I need the function org-table-align to align the table
> in presentation mode.

I am not sure if I understand your use-case, but you may consider
looking at 3.2 Column Width and Alignment section of the manual.

#+STARTUP: align
will align all the tables when opening an Org file.

Babel also auto-aligns tables in results.

Or you can call org-table-align manually.
Also, see org-table-map-tables.

> If it is possible to "jump backwards to Org table" and invoke
> org-table-align, I could do that with subsequent function, is it?

Indeed.


-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: Line breaks and brackets in LaTeX export

2022-11-03 Thread Ihor Radchenko
Max Nikulin  writes:

>> Ihor Radchenko writes:
>> 
>>> These arguments mean that auto-cleaning \\[0pt] is not always safe and
>>> may be a subject of surrounding LaTeX context.
>
> I still believe that
>
>  something\\[0pt]%__ORG_EXPORT__
>
> is quite safe to remove (depending on the following character) and 
> unlikely harmful if remained for some reason.

What about the side effect you mentioned in a previous email?

>  TeX reads
>
>  "a% comment
> b"
>
>  as "ab", dropping newline and starting spaces.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



bug#53393: 29.0.50; org mode timestamp C-c C-c not updating day of week

2022-11-03 Thread Ihor Radchenko
Rudolf Adamkovič  writes:

> Ihor Radchenko  writes:
>
>>> recently did update the day of the week but no long does
>
>> Fixed on main.
>
> Please see the attached patch with a regression test.

Thanks!

> +:LOGBOOK:
> +CLOCK: [2022-11-03 Thu 00:00]--[2022-11-03 Thu 00:01] =>  0:01
> +:END:

Let's not use 00:00 times. This may fail the test in some unusual time
zones.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 





Re: [PATCH] Ignore flaky ob-python tests

2022-11-03 Thread Ihor Radchenko
Christian Köstlin  writes:

> I somehow seem to remember that the async tests were also broken with
> python.el (python-mode.el not installed).
> at least sometimes?

I only recall the underscore test.

Note that I debugged the async tests with your rake builds, and I have
identified that async tests are failing because of python-mode
inclusion. (python-mode is not supported by async ob-python code).

> or is this only the underscore test?
> If it's only the underscore test, I would suggest not installing
> python-mode for ci and ignoring the really flaky tests (i think the
> underscore one is a candidate here).

Yes. Please, go ahead and remove python-mode from the CI tests.

We are likely going to deprecate python-mode support. See
https://orgmode.org/list/87r0yk7bx8.fsf@localhost

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [BUG] Post MacOS Monterey update. Error shows at start-up. error:image-type: Invalid image type 'svg' No splash screen shows [9.5.5 (release_9.5.5 @ /Applications/Emacs.app/Contents/Resources/li

2022-11-03 Thread Ihor Radchenko
Thomas Bumbera  writes:

> Error shows at start-up.  error:image-type: Invalid image type 'svg'  No 
> splash screen shows

Thanks for reporting! It looks like the error happens only with your
personal configuration.

Have you tried to follow
https://orgmode.org/manual/Feedback.html#Feedback and start from bare
Emacs (emacs -Q)? Does the error appear then? If no, what is the minimal
configuration required to trigger the error?

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Clarification on :results file vs. :results graphics file (was: [BUG] ob-doc-maxima.org and ob-maxima.el)

2022-11-03 Thread Ihor Radchenko
Leo Butler  writes:

>>> @@ -145,7 +151,7 @@ This example is from 
>>> [[http://maxima.sourceforge.net/maxima-gnuplot.html][a tuto
>>>  ,#+name: 3d-maxima
>>>  ,#+header: :file images/maxima-3d.png
>>>  ,#+header: :exports results
>>> -,#+header: :results graphics
>>> +,#+header: :results graphics file
>>
>> Using graphics together with file does not make sense.
>
> Ok. But I am not sure the code agrees with you. In ob-core.el,
> `org-babel-graphical-output-file' is defined as:
>
> (defun org-babel-graphical-output-file (params)
>   "File where a babel block should send graphical output, per PARAMS.
> Return nil if no graphical output is expected.  Raise an error if
> the output file is ill-defined."
>   (let ((file (cdr (assq :file params
> (cond (file (and (member "graphics" (cdr (assq :result-params params)))
>file))
>  ...
>
> Is it, in your opinion, ob-maxima's responsibility to add "graphics" to
> :result-params when :results file is specified?

No. Let me put what the manual says on the question:

- :results header argument has multiple argument classes

Each code block can take only one option per class:

Collection
 For how the results should be collected from the code block;

Type
 For which type of result the code block will return; affects how
 Org processes and inserts results in the Org buffer;

Format
 For the result; affects how Org processes results;

Handling
 For inserting results once they are properly formatted.

:results file is the Type class.
:results graphics is the Format class.

They can be used together. I was wrong in my earlier reply.

‘file’
 Interpret as a filename.  Save the results of execution of the code
 block to that file, then insert a link to it.  You can control both
 the filename and the description associated to the link.

‘graphics’
 When used along with ‘file’ type, the result is a link to the file
 specified in ‘:file’ header argument.  However, unlike plain ‘file’
 type, nothing is written to the disk.  The block is used for its
 side-effects only, as in the following example:

(Note: I'd say "nothing is written to the disk" is a bit misleading
here. I am attaching a patch with clarification)

When we have :file foo.png :results file, Org will take the command
output, write it to foo.png, and insert the link to foo.png as code
block result.

When we have :file foo.png :results file graphics, Org will not write to
foo.png itself. Instead, it will expect the code execution to create
foo.png as a side effect. The code output will be ignored and the link
to foo.png will be inserted.

Note: ob-maxima wraps `org-babel-graphical-output-file' into
ignore-errors, which will hide missing :file spec error from user.
Unsure about the reasons behind it.

> @@ -77,6 +77,9 @@
>"Execute a block of Maxima entries with org-babel.
>  This function is called by `org-babel-execute-src-block'."
>(message "Executing Maxima source code block")
> +  ;; Make `:results file' imply `:results graphics file'
> +  (when (member "file" (assq :result-params params))
> +(push "graphics" (alist-get :result-params params)))

This will be wrong, as I explained above. :results file and :results
graphics file are expected to behave differently in the manual.

>From 73821c511e723e324e3f7aa9424003b8993ed412 Mon Sep 17 00:00:00 2001
Message-Id: <73821c511e723e324e3f7aa9424003b8993ed412.1667534563.git.yanta...@posteo.net>
From: Ihor Radchenko 
Date: Fri, 4 Nov 2022 12:01:19 +0800
Subject: [PATCH] org-manual: Clarify :results file graphics header argument
 meaning

* doc/org-manual.org (Format): Clarify the difference between
:results file and :results file graphics.  Update the example to
something that can be tried locally.
---
 doc/org-manual.org | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index dc2fc57cd..b3071ec6d 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -18408,13 +18408,17 @@ *** Format
 
   When used along with =file= type, the result is a link to the file
   specified in =:file= header argument.  However, unlike plain =file=
-  type, nothing is written to the disk.  The block is used for its
-  side-effects only, as in the following example:
+  type, code block output is not written to the disk.  The block is
+  expected to generate the file by its side-effects only, as in the
+  following example:
 
   #+begin_example
-  ,#+begin_src shell :results file link :file "download.tar.gz"
-  wget -c "https://example.com/download.tar.gz";
+  ,#+begin_src shell :results file link :file "org-mode-unicorn.svg"
+wget -c "https://orgmode.org/resources/img/org-mode-unicorn.svg";
   ,#+end_src
+
+  ,#+RESULTS:
+  [[file:org-mode-unicorn.svg]]
   #+end_example
 
 - =org= ::
-- 
2.35.1


-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more 

Re: [BUG] ob-doc-maxima.org and ob-maxima.el

2022-11-03 Thread Ihor Radchenko
Leo Butler  writes:

>> You basically need to evaluate the code block manually to have it
>> present in the original file without a need to evaluate during export.
>>
>> I do not have maxima on my system. It would be welcome if you evaluate
>> the code blocks with missing results manually and submit a patch with.
>
> Attached.

There is no need to wrap the results into example blocks. They will
better be as is. Org export will take care about choosing what to
export: code, results, or both.

>> Using graphics together with file does not make sense.
>
> Ok. But I am not sure the code agrees with you. In ob-core.el,
> `org-babel-graphical-output-file' is defined as:

Let's discuss it in a separate thread. I will need to study the code a
bit more to understand what we promise in the manual vs. actual state of
the code.

>  #+name: 3d-maxima
>  #+header: :file images/maxima-3d.png
> -#+header: :results graphics
>  #+header: :exports results
> +#+header: :results file
>  #+begin_src maxima 
>programmode: false;
>
> plot3d(atan(-x^2+y^3/4),[x,-4,4],[y,-4,4],[grid,50,50],[gnuplot_pm3d,true]);
>  #+end_src
>  
> -#+results: 3d-maxima
> +Which produces the code:
> +
> +#+begin_example
> +,#+RESULTS: 3d-maxima
>  [[file:images/maxima-3d.png]]
> +#+end_example
> +
> +and the image:
> +
> +#+RESULTS: 3d-maxima
> +[[https://orgmode.org/worg/org-contrib/babel/languages/images/maxima-3d.png]]
> +

I am a bit confused here. Did you hand-craft the results?
  
> -#+NAME: solve-maxima
> +#+NAME: tex-maxima
>  #+HEADER: :exports results
>  #+BEGIN_SRC maxima :results raw
>tex(exp(-x)/x);
>  #+END_SRC
>  
> +Which produces the code:
> +#+begin_example
> +,#+RESULTS: tex-maxima
> +$${{e^ {- x }}\over{x}}$$
> +#+end_example
> +that is rendered as:
> +#+RESULTS: tex-maxima
> +$${{e^ {- x }}\over{x}}$$

Please make #+RESULTS a separate paragraph. It may otherwise not be
correctly recognized.

> --- a/lisp/ob-maxima.el
> +++ b/lisp/ob-maxima.el
> @@ -77,6 +77,9 @@
>"Execute a block of Maxima entries with org-babel.
>  This function is called by `org-babel-execute-src-block'."
>(message "Executing Maxima source code block")
> +  ;; Make `:results file' imply `:results graphics file'
> +  (when (member "file" (assq :result-params params))
> +(push "graphics" (alist-get :result-params params)))
>(let ((result-params (split-string (or (cdr (assq :results params)) "")))
>   (result
>(let* ((cmdline (or (cdr (assq :cmdline params)) ""))

Let's move the ob-maxima changes and discussion about graphics to a
separate thread.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [BUG] ob-shell :stdin is broken on the main branch

2022-11-03 Thread Max Nikulin

On 04/11/2022 09:42, Ihor Radchenko wrote:

Max Nikulin writes:


#+name: lbl
#+begin_example
line 1
line 2
#+end_example

#+begin_src bash :stdin lbl
cat
#+end_src

Second one signals "Wrong number of arguments" at least in Emacs-26 with
Org main HEAD.


This is only on Emacs 26.

Fixed on main now.


Thank you, I do not get that error full of trash characters any more.





Re: processing a literal example line by line in a shell source block?

2022-11-03 Thread Max Nikulin

On 03/11/2022 01:17, Greg Minshall wrote:

hi.  i have a text in a named #+begin_example ... #+end_example block.
i would like to process this text line by line in a shell (bash, say)
code block.  but, it appears that the individual lines are not
separated, but passed as one long string to the source block.  (example
below.)

#+name: lbl
#+begin_example
line 1
line 2
#+end_example


You may use :stdin instead of :var, see 
https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-shell.html


#+begin_src bash :stdin lbl
  while read -r -a arr ; do
  printf 'value\t%s\n' "${arr[1]}"
  done
#+end_src

#+RESULTS:
| value | 1 |
| value | 2 |


#+begin_src bash :var input=lbl :var in2='("first" "second")
   echo ${#input[@]}
   echo ${#in2[@]}
   echo ${input}
#+end_src


There is a nice tool: shellcheck. It should not be difficult to define a 
function that feeds current source block to it. The only point is to 
specify shell type since shebang is missed. In some cases even bash -n 
before running a script may save some time during debugging.







Re: Docstrings and literate programming (good practices?)

2022-11-03 Thread Samuel Wales
i wonder if emacs or org has what you might call semi-literate or
etaretil docstring functions?

for example, you have a body of non-literate elisp code, and you have
a manual.  it could be redundant to describe commands and what they do
and their options, if the docstrings are good.

why not include the docstrings of all commands in some nice format in
the .org manual via some mechanism?

would that be a good practice?  seems useful abstractly.


On 11/3/22, Rudolf Adamkovič  wrote:
> Juan Manuel Macías  writes:
>
> Hello Juan!
>
>> I can duplicate the text, but it seems to be a bit redundant, right?
>> So what is the best way to proceed when doing literate programming
>> with any language that supports docstrings?  Apologies in advance if
>> the question is a bit silly, but I'm not a professional programmer and
>> don't have an academic background in it, so I don't know if there is
>> any good practice on these things :-)
>
> A "bit silly" question?  I find your question rather profound.  Thank
> you for bringing it up!
>
> Personally, I recommend to use both docstrings and literate programming
> idiomatically, not mixing them.
>
> Literate programming exposes thinking and exploration.
>
> For example, the literate portion can show different approaches you
> tried but abandoned, something that does not belong to the function
> itself, nor in its docstring.  Or, it can include examples, piece-wise
> performance analysis, computer science background, mathematical model,
> citations of prior work, and so on.  Add some assertions and you will
> have literate tests as well.
>
> A docstring describes the function from the outside, as a black box, and
> if you did a good job with it, it makes it simpler for the consumer to
> use your function.
>
> Literate programming, on the other hand, goes deeper.  It describes the
> thinking that went into the function, comfortably exposing its insides
> and opening the black box of its abstraction.
>
> Rudy
> --
> "Strange as it may sound, the power of mathematics rests on its evasion
> of all unnecessary thought and on its wonderful saving of mental
> operations."
> -- Ernst Mach, 1838-1916
>
> Rudolf Adamkovič  [he/him]
> Studenohorská 25
> 84103 Bratislava
> Slovakia
>
>


-- 
The Kafka Pandemic

A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com



Re: Org 9.6-pre and Bash sessions

2022-11-03 Thread Ihor Radchenko
Rudolf Adamkovič  writes:

> Ihor Radchenko  writes:
>
>> Feel free to change it in the patch together with tests.
>
> Thank you for driving the discussion and for giving me the opportunity
> to solve the problem (and not just temporarily, but with tests).  What
> do you think about the attached patch?

Applied onto main changing the commit summary to "org-babel: ...".
This change will affect all the babel backends that use
`org-babel-eval'.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=f7b16402e6a694d592210f766544f6114056b4b0

A small note: If stderr does not contain a trailing newline, it will be
displayed as

Stderr output with no trailing newline[ Babel evaluation exited with code 1 ]

One may argue that it is ugly.
On the other hand, adding an extra newline will make stderr with and
without the newline indistinguishable.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [BUG] ob-shell :stdin is broken on the main branch

2022-11-03 Thread Ihor Radchenko
Max Nikulin  writes:

> Try the following source code blocks:
>
> #+begin_src elisp
>(require 'ob-shell)
> #+end_src
>
> #+name: lbl
> #+begin_example
> line 1
> line 2
> #+end_example
>
> #+begin_src bash :stdin lbl
>cat
> #+end_src
>
> Second one signals "Wrong number of arguments" at least in Emacs-26 with 
> Org main HEAD.

This is only on Emacs 26.

Fixed on main now.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=2924c778482a2e62e3bc906fbd3ecd18beb1d11f

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: processing a literal example line by line in a shell source block?

2022-11-03 Thread Greg Minshall
Ihor,

> Try
> 
> #+name: lbl
> #+begin_example
> line 1
> line 2
> #+end_example
> 
> #+begin_src bash :var input=lbl :results output
>   echo "${input}"
> #+end_src

ah, the double quotes!  thanks very much!

cheers, Greg



bug#53393: 29.0.50; org mode timestamp C-c C-c not updating day of week

2022-11-03 Thread General discussions about Org-mode.
Ihor Radchenko  writes:

>> recently did update the day of the week but no long does

> Fixed on main.

Please see the attached patch with a regression test.

Rudy

>From 51f1ee245a99e30402d7fd2d069d3e223ad5c15d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rudolf=20Adamkovi=C4=8D?= 
Date: Thu, 3 Nov 2022 22:47:44 +0100
Subject: [PATCH] test-org-clock: Test DWIM update of days

* testing/listp/test-org-clock (test-org-clock/clock-drawer-dwim): Add
new test for DWIM updates of days for clocks in logbook drawers.

Reported-by: Bruce E. Robertson 
Link: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=53393
---
 testing/lisp/test-org-clock.el | 16 
 1 file changed, 16 insertions(+)

diff --git a/testing/lisp/test-org-clock.el b/testing/lisp/test-org-clock.el
index f992c8d7a..4798c42b7 100644
--- a/testing/lisp/test-org-clock.el
+++ b/testing/lisp/test-org-clock.el
@@ -273,6 +273,22 @@ the buffer."
   (org-log-into-drawer nil))
   (org-clock-drawer-name))
 
+(ert-deftest test-org-clock/clock-drawer-dwim ()
+  "Test DWIM update of days for clocks in logbook drawers."
+  (should (equal "* Foo
+:LOGBOOK:
+CLOCK: [2022-11-03 Thu 00:00]--[2022-11-03 Thu 00:01] =>  0:01
+:END:
+"
+ (org-test-with-temp-text
+ "* Foo
+:LOGBOOK:
+CLOCK: [2022-11-03 ??? 00:00]--[2022-11-03 ??? 00:01] =>  0:01
+:END:
+"
+   (org-ctrl-c-ctrl-c)
+   (buffer-string)
+
 
 ;;; Clocktable
 
-- 
2.38.1

-- 
"Thinking is a momentary dismissal of irrelevancies."
-- Richard Buckminster Fuller, 1969

Rudolf Adamkovič  [he/him]
Studenohorská 25
84103 Bratislava
Slovakia


Re: [PATCH] Ignore flaky ob-python tests

2022-11-03 Thread Christian Köstlin
Hi Ihor,

I somehow seem to remember that the async tests were also broken with
python.el (python-mode.el not installed).
at least sometimes? or is this only the underscore test?
If it's only the underscore test, I would suggest not installing
python-mode for ci and ignoring the really flaky tests (i think the
underscore one is a candidate here).

I somehow got the async things mixed up with the flaky tests, which is
not true for python-mode.el installed.

what do you think?

I really would like to see python tests pass ...

Kind regards,
Christian

On Thu, Nov 3, 2022 at 8:13 AM Ihor Radchenko  wrote:
>
> Christian Köstlin  writes:
>
> > With my patch the tests are still failing but the testsuite continues
> > to run and returns
> > with 0 as status code (one can see the failed test though).
>
> FYI, I am using automated scripts to run make test locally on multiple
> Emacs versions. 0 status code would do no good for my testing.
>
> >> Maybe we can instead provide some variable that can turn-on ignoring
> >> some problematic tests only during CI tests?
> > Yes ... that would also be possible e.g. skip the test or test nothing
> > if it's running on the ci.
> > (I am talking only about the 3 tests!).
>
> More like just 1 test with underscore :)
> The 3 tests in the patch are real failures because ob-python does not
> fully support python-mode.el.
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 



Re: Docstrings and literate programming (good practices?)

2022-11-03 Thread Rudolf Adamkovič
Juan Manuel Macías  writes:

Hello Juan!

> I can duplicate the text, but it seems to be a bit redundant, right?
> So what is the best way to proceed when doing literate programming
> with any language that supports docstrings?  Apologies in advance if
> the question is a bit silly, but I'm not a professional programmer and
> don't have an academic background in it, so I don't know if there is
> any good practice on these things :-)

A "bit silly" question?  I find your question rather profound.  Thank
you for bringing it up!

Personally, I recommend to use both docstrings and literate programming
idiomatically, not mixing them.

Literate programming exposes thinking and exploration.

For example, the literate portion can show different approaches you
tried but abandoned, something that does not belong to the function
itself, nor in its docstring.  Or, it can include examples, piece-wise
performance analysis, computer science background, mathematical model,
citations of prior work, and so on.  Add some assertions and you will
have literate tests as well.

A docstring describes the function from the outside, as a black box, and
if you did a good job with it, it makes it simpler for the consumer to
use your function.

Literate programming, on the other hand, goes deeper.  It describes the
thinking that went into the function, comfortably exposing its insides
and opening the black box of its abstraction.

Rudy
-- 
"Strange as it may sound, the power of mathematics rests on its evasion
of all unnecessary thought and on its wonderful saving of mental
operations."
-- Ernst Mach, 1838-1916

Rudolf Adamkovič  [he/him]
Studenohorská 25
84103 Bratislava
Slovakia



[BUG] Post MacOS Monterey update. Error shows at start-up. error:image-type: Invalid image type 'svg' No splash screen shows [9.5.5 (release_9.5.5 @ /Applications/Emacs.app/Contents/Resources/lisp

2022-11-03 Thread Thomas Bumbera



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.




Emacs  : GNU Emacs 28.2 (build 1, aarch64-apple-darwin21.1.0, NS appkit-2113.00 
Version 12.0.1 (Build 21A559))
of 2022-09-12
Package: Org mode version 9.5.5 (release_9.5.5 @ 
/Applications/Emacs.app/Contents/Resources/lisp/org/)

current state:
==
(setq
org-link-elisp-confirm-function 'yes-or-no-p
org-bibtex-headline-format-function #[257 "\300\236A\207" [:title] 3 "\n\n(fn 
ENTRY)"]
org-agenda-files '("/Users/thomasbumbera/EmacsProj/gtd.org")
org-export-before-parsing-hook '(org-attach-expand-links)
org-archive-hook '(org-attach-archive-delete-maybe)
org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers
  org-cycle-show-empty-lines
  org-optimize-window-after-visibility-change)
org-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)
org-confirm-shell-link-function 'yes-or-no-p
outline-isearch-open-invisible-function 'outline-isearch-open-invisible
org-agenda-before-write-hook '(org-agenda-add-entry-text)
org-src-mode-hook '(org-src-babel-configure-edit-buffer
 org-src-mode-configure-edit-buffer)
org-confirm-elisp-link-function 'yes-or-no-p
org-speed-command-hook '(org-speed-command-activate
  org-babel-speed-command-activate)
org-tab-first-hook '(org-babel-hide-result-toggle-maybe
  org-babel-header-arg-expand)
org-link-shell-confirm-function 'yes-or-no-p
org-babel-pre-tangle-hook '(save-buffer)
org-agenda-loop-over-headlines-in-active-region nil
org-occur-hook '(org-first-headline-recenter)
org-metadown-hook '(org-babel-pop-to-session-maybe)
org-link-parameters '(("attachment" :follow org-attach-follow :complete
org-attach-complete-link)
   ("id" :follow org-id-open)
   ("eww" :follow org-eww-open :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)
   ("doi" :follow org-link-doi-open :export
org-link-doi-export)
   ("file+sys") ("file+emacs")
   ("shell" :follow org-link--open-shell)
   ("news" :follow
#[514 "\301\300\302Q\"\207"
  ["news" browse-url ":"] 6 "\n\n(fn URL ARG)"]
)
   ("mailto" :follow
#[514 "\301\300\302Q\"\207"
  ["mailto" browse-url ":"] 6 "\n\n(fn URL ARG)"]
)
   ("https" :follow
#[514 "\301\300\302Q\"\207"
  ["https" browse-url ":"] 6 "\n\n(fn URL ARG)"]
)
   ("http" :follow
#[514 "\301\300\302Q\"\207"
  ["http" browse-url ":"] 6 "\n\n(fn URL ARG)"]
)
   ("ftp" :follow
#[514 "\301\300\302Q\"\207" ["ftp" browse-url ":"]
  6 "\n\n(fn URL ARG)"]
)
   ("help" :follow org-link--open-help :store
org-link--store-help)
   ("file" :complete org-link-complete-file)
   ("elisp" :follow org-link--open-elisp))
org-metaup-hook '(

Re: [BUG] ob-doc-maxima.org and ob-maxima.el

2022-11-03 Thread Leo Butler
Hi Ihor,

On Thu, Nov 03 2022, Ihor Radchenko  wrote:

> Leo Butler  writes:
>
>> In worg's documentation of ob-maxima.el[fn:1], there are several bugs.
>
> Thanks for reporting!

Thank you for the feedback. I will comment inline below.

>
>> 1. In the subsection `Inline Display of Maxima LaTeX Output', the
>> results are missing.
>
> It is because source block evaluation is disabled on server side when
> generating WORG website from org sources.

Ahhh! Of course.

>
> You basically need to evaluate the code block manually to have it
> present in the original file without a need to evaluate during export.
>
> I do not have maxima on my system. It would be welcome if you evaluate
> the code blocks with missing results manually and submit a patch with.

Attached.

>
>> ... This is because the code block is named
>> `solve-maxima', the same as in the section `Solver'. Export results in
>> that output being put in the `Solver' section (I don't know if that
>> should be considered a bug in Org).
>
> No, the source block in the Solver section is different. It just has
> the same name. Name duplicate should be fixed indeed.

That was fixed in the patch I sent, and the attached one.

>
>> 2. In `3D Plots', the header arguments do not result in a link to a
>> generated file being created on evaluation of the code block. I am
>> unsure if this is a bug in Org, ob-maxima.el or ob-doc-maxima.org or
>> what.
>> On reading the description of the =:results graphics=
>> header[fn:2], it looks like there is blame to go around.
>
> Makes sense. Can you please report this inconsistency in more details in
> a separate email? It looks like something is not right with ob-maxima
> code in the treatment of :results graphics.

Sure. I was playing with ob-doc-octave.org, too, and I see that there is
a similar problem there.

>
>> @@ -145,7 +151,7 @@ This example is from 
>> [[http://maxima.sourceforge.net/maxima-gnuplot.html][a tuto
>>  ,#+name: 3d-maxima
>>  ,#+header: :file images/maxima-3d.png
>>  ,#+header: :exports results
>> -,#+header: :results graphics
>> +,#+header: :results graphics file
>
> Using graphics together with file does not make sense.

Ok. But I am not sure the code agrees with you. In ob-core.el,
`org-babel-graphical-output-file' is defined as:

(defun org-babel-graphical-output-file (params)
  "File where a babel block should send graphical output, per PARAMS.
Return nil if no graphical output is expected.  Raise an error if
the output file is ill-defined."
  (let ((file (cdr (assq :file params
(cond (file (and (member "graphics" (cdr (assq :result-params params)))
 file))
 ...

Is it, in your opinion, ob-maxima's responsibility to add "graphics" to
:result-params when :results file is specified?

> We should probably fix ob-maxima with :results file first.
> Ideally, the code here should be simply
> ,#+header: :results file

The attached patch to lisp/ob-maxima.el makes the example work with your
suggested header.

>
>>  #+begin_example
>> -,#+NAME: solve-maxima
>> -,#+HEADER: :exports none
>> -,#+BEGIN_SRC maxima :results raw
>> +,#+NAME: tex-maxima
>> +,#+HEADER: :exports results
>> +,#+BEGIN_SRC maxima :results latex
>
> This will break WORG page. We are exporting to HTML, not latex and the
> results wrapped into #+begin_export latex will not be exported to the
> website. What's wrong with raw?

Yes, you are right about WORG. I was testing by building a pdf and
didn't think to build the html page. My mistake. The patch I am sending
builds a working html page.

There is a problem, though. When evaluating the code block

#+NAME: tex-maxima
#+HEADER: :exports results
#+BEGIN_SRC maxima :results raw
  tex(exp(-x)/x);
#+END_SRC

multiple times, the results are appended below each other. Adding the
option `drawer', or changing the results to latex (or html), prevents
this. I will open a separate email report about this.

Leo

diff --git a/org-contrib/babel/languages/ob-doc-maxima.org b/org-contrib/babel/languages/ob-doc-maxima.org
index 810c9ef4..eb760eff 100644
--- a/org-contrib/babel/languages/ob-doc-maxima.org
+++ b/org-contrib/babel/languages/ob-doc-maxima.org
@@ -111,7 +111,9 @@ powers of 12, where the powers are passed with a variable.
   print(12^x);
 #+end_src
 
-#+results: test-maxima
+Which produces the result:
+
+#+RESULTS: test-maxima
 : 26.06280316745402
 
 ** Solver
@@ -137,6 +139,14 @@ Of course, =maxima= is more than a calculator.
   print(solution);
 #+end_src
 
+Which produces the result:
+
+#+RESULTS: solve-maxima
+: solve: solution:
+: x = - 4
+:  x = 4
+: [%t1, %t2] 
+
 ** 3D plots
 With =gnuplot= installed (4.0 or higher), 3D graphics are possible.
 This example is from [[http://maxima.sourceforge.net/maxima-gnuplot.html][a tutorial on the maxima/gnuplot interface]].
@@ -145,7 +155,7 @@ This example is from [[http://maxima.sourceforge.net/maxima-gnuplot.html][a tuto
 ,#+n

TIP: use svglite as device in for producing plots in R/ESS code blocks

2022-11-03 Thread Cook, Malcolm
I wanted to use svglite as the driver for producing .svg plots within org.

It took a little poking around but the solution was one line:

```
(setf (alist-get  :svg org-babel-R-graphics-devices   ) '("svglite" "file"))
```

Of course it requires:

```
library(svglite)
```

...to have been called in the R session.

This greatly simplifies using org to author graphics heavy literate programming 
/ exploratory data analyses, especially in combination with
 -  
https://emacs.stackexchange.com/questions/29871/how-to-embed-svg-output-of-org-mode-src-block-as-inline-svg-in-html-export
 
 - building emacs with svg support

I mention this TIP in case anyone else is similarly inclined, and in case they 
have additional TIPs that similarly improve working with org/ESS/R/svg

Oh, and, you can set it back with:

```
(setf (alist-get  :svg org-babel-R-graphics-devices   ) '("svg" "file"))
```

... and there is probably some juju to make it buffer local 😉

Cheers,

Malcolm Cook


RE: org-assert-version considered harmful

2022-11-03 Thread Cook, Malcolm
>> It should not be necessary and it does not happen on my side (as you can
> >> imagine, I re-compile very often).
> >
> > Perhap's my issue stems from the particular versions of org I was upgrading 
> > between and/or (earlier) poor management of multiple contending org 
> > versions (e.g. git head v. melpa v. system).
> 
> That might be possible. Because Emacs does not properly update macro
> definitions in the already compiled files.
> 
> See https://orgmode.org/list/jwvsfkv5s7l.fsf-monnier+em...@gnu.org

That is exactly the message which suggested my workaround of inserting a `make 
clean` into my manta.  Thanks for the confirmation!
  
> 
> However, the current, more forgiving, version of org-assert-version
> should only complain when upgrading to different Org version. make clean
> is a good measure even during normal upgrades though. Because of the
> Emacs limitation.
> 
> > ```
> > cd ~/.emacs.d/org-mode && git pull && make clean && make autoloads && make 
> > PERL5LIB=
> > ```
> >
> > And then relaunch emacs, where it gets picked up due to:
> >
> > ```
> > (use-package org ;org-plus-contrib ; instead of org-mode
> > :pin manual 
> > :load-path "~/.emacs.d/org-mode/lisp"
> > ...
> > )
> > ```
> >
> > ... which occurs very early in my init file (just after bootstrapping 
> > package system and latest use-package).
> >
> > So, I've got (again) a working strategy. 
> >
> > I'm really wondering if all this is needlessly complex.
> 
> The above should be safe.
> Whatever straight.el does also work for me as long as I put Org loading
> early in my init.el.

Good to have confirmation here again.  Thanks Ihor!



Re: [DISCUSSION] Should we deprecate python-mode.el (alternative to built-in python.el) support in ob-python? (was: [BUG] ob-python: async session evaluation does not support python-mode.el [9.6-pre (

2022-11-03 Thread Jack Kamm
Ihor Radchenko  writes:

> However, supporting python-mode.el integration is difficult for Org
> team: neither the current ob-python maintainer nor the rest of Org team
> are familiar with python-mode.el.
>
> The bug discussed above already shows that parts of ob-python do not
> work properly with third-party python-mode.el.
>
> Should we deprecate the support altogether and not bother with the extra
> maintenance? Or maybe someone want to volunteer maintaining
> python-mode.el integration?

Thanks for this summary Ihor. In my experience, supporting both
python.el and python-mode.el adds a high maintenance burden to
ob-python. I think it would be better if ob-python could focus on
python.el only, and a separate ob-python-mode created if there is demand
for it.

One cause of the higher maintenance burden, is that a lot of
functionality needs to be implemented twice to support both modes. Or
alternatively, functions need to be written in a way that's agnostic to
the python mode -- but this also adds complexity, as working with comint
directly can be tricky and bug-prone.

Testing is another problem, as there isn't a way to use ob-python with
both python modes in the same emacs config. So a separate emacs setup
has to be maintained to test that python-mode works, which adds more
maintenance headache.

If python-mode support is removed, I'd be willing to help create a new
ob-python-mode package, so that python-mode users can keep using
Babel. However I don't normally use python-mode, so it would be best
if a python-mode user could volunteer to help with this as well.



Re: Org 9.6-pre and Bash sessions

2022-11-03 Thread Rudolf Adamkovič
Ihor Radchenko  writes:

> Feel free to change it in the patch together with tests.

Thank you for driving the discussion and for giving me the opportunity
to solve the problem (and not just temporarily, but with tests).  What
do you think about the attached patch?

Rudy

>From 7001ed80e5fd146f6acf586b3cf3ef20bbba04e7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rudolf=20Adamkovi=C4=8D?= 
Date: Wed, 26 Oct 2022 13:35:26 +0200
Subject: [PATCH] ob-shell: Never throw away standard error

* lisp/ob-eval.el (org-babel-eval-error-notify): Do not insert
superfluous whitespace.
* lisp/ob-eval.el (org-babel-eval): Show standard error even if the
command exits with a zero code.
* testing/lisp/test-ob-shell.el(
ob-shell/standard-output-after-success,
ob-shell/standard-output-after-failure,
ob-shell/error-output-after-success,
ob-shell/error-output-after-failure,
ob-shell/error-output-after-failure-multiple,
ob-shell/exit-code,
ob-shell/exit-code-multiple
): Add tests to avoid regressions.
---
 lisp/ob-eval.el   | 47 +++-
 testing/lisp/test-ob-shell.el | 82 +++
 2 files changed, 108 insertions(+), 21 deletions(-)

diff --git a/lisp/ob-eval.el b/lisp/ob-eval.el
index e1278bbad..af9283c0a 100644
--- a/lisp/ob-eval.el
+++ b/lisp/ob-eval.el
@@ -40,39 +40,44 @@
 (with-current-buffer buf
   (goto-char (point-max))
   (save-excursion
-(insert stderr)
 (unless (bolp) (insert "\n"))
-(insert (format "[ Babel evaluation exited with code %S ]\n" exit-code
+(insert stderr)
+(insert (format "[ Babel evaluation exited with code %S ]" exit-code
 (display-buffer buf))
   (message "Babel evaluation exited with code %S" exit-code))
 
 (defun org-babel-eval (command query)
   "Run COMMAND on QUERY.
+Return standard output produced by COMMAND.  If COMMAND exits
+with a non-zero code or produces error output, show it with
+`org-babel-eval-error-notify'.
+
 Writes QUERY into a temp-buffer that is processed with
-`org-babel--shell-command-on-region'.  If COMMAND succeeds then return
-its results, otherwise display STDERR with
-`org-babel-eval-error-notify'."
+`org-babel--shell-command-on-region'."
   (let ((error-buffer (get-buffer-create " *Org-Babel Error*")) exit-code)
 (with-current-buffer error-buffer (erase-buffer))
 (with-temp-buffer
   (insert query)
   (setq exit-code
-	(org-babel--shell-command-on-region
-	 command error-buffer))
-  (if (or (not (numberp exit-code)) (> exit-code 0))
-	  (progn
-	(with-current-buffer error-buffer
-	  (org-babel-eval-error-notify exit-code (buffer-string)))
-	(save-excursion
-	  (when (get-buffer org-babel-error-buffer-name)
-		(with-current-buffer org-babel-error-buffer-name
-		  (unless (derived-mode-p 'compilation-mode)
-		(compilation-mode))
-		  ;; Compilation-mode enforces read-only, but Babel expects the buffer modifiable.
-		  (setq buffer-read-only nil
-;; Return output, if any.
-	(buffer-string))
-	(buffer-string)
+(org-babel--shell-command-on-region
+ command error-buffer))
+  (let ((stderr (with-current-buffer error-buffer (buffer-string
+(if (or (not (numberp exit-code))
+(> exit-code 0)
+(not (string-empty-p stderr)))
+(progn
+  (org-babel-eval-error-notify exit-code stderr)
+  (save-excursion
+(when (get-buffer org-babel-error-buffer-name)
+  (with-current-buffer org-babel-error-buffer-name
+(unless (derived-mode-p 'compilation-mode)
+  (compilation-mode))
+;; Compilation-mode enforces read-only, but
+;; Babel expects the buffer modifiable.
+(setq buffer-read-only nil
+  ;; Return output, if any.
+  (buffer-string))
+  (buffer-string))
 
 (defun org-babel-eval-read-file (file)
   "Return the contents of FILE as a string."
diff --git a/testing/lisp/test-ob-shell.el b/testing/lisp/test-ob-shell.el
index 4c00faa49..7aa45cc8a 100644
--- a/testing/lisp/test-ob-shell.el
+++ b/testing/lisp/test-ob-shell.el
@@ -170,6 +170,88 @@ ob-comint.el, which was not previously tested."
 	  "#+BEGIN_SRC sh :results table\necho 'I \"want\" it all'\n#+END_SRC"
 	(org-babel-execute-src-block)
 
+;;; Standard output
+
+(ert-deftest ob-shell/standard-output-after-success ()
+  "Test standard output after exiting with a zero code."
+  (should (= 1
+ (org-babel-execute:sh
+  "echo 1" nil
+
+(ert-deftest ob-shell/standard-output-after-failure ()
+  "Test standard output after exiting with a non-zero code."
+  (should (= 1
+ (org-babel-execute:sh
+  "echo 1; exit 2" nil
+
+;;; Standard error
+
+(ert-deftest ob-shell/error-output-after-success ()
+  "Test that standard error shows in 

[BUG] ob-shell :stdin is broken on the main branch

2022-11-03 Thread Max Nikulin

Try the following source code blocks:

#+begin_src elisp
  (require 'ob-shell)
#+end_src

#+name: lbl
#+begin_example
line 1
line 2
#+end_example

#+begin_src bash :stdin lbl
  cat
#+end_src

Second one signals "Wrong number of arguments" at least in Emacs-26 with 
Org main HEAD.


Org bugfix branch works and yields

#+RESULTS:
| line | 1 |
| line | 2 |

I was going to suggest

#+begin_src bash :stdin lbl
  while read -r -a arr ; do
  echo "${arr[0]}"
  done
#+end_src
https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-shell.html

in response to Greg Minshall. processing a literal example line by line 
in a shell source block? Wed, 02 Nov 2022 11:17:25 -0700. 
https://list.orgmode.org/122789.1667413045@archlinux






[PATCH] Re: Maxima code blocks does not work in windows revisited

2022-11-03 Thread Leo Butler
On Thu, Nov 03 2022, Max Nikulin  wrote:

> On 03/11/2022 17:01, Fraga, Eric wrote:
>> On Thursday,  3 Nov 2022 at 09:35, Max Nikulin wrote:
>>> maxima --very-quiet -r "batchload(\"c:\\Temp\\maxima-XX.max\")"$
>> Should the $ not be within the quotes?
>
> Does "$" have any special meaning in cmd.exe? I do not mind that it
> should be inside `format' first argument.
>
> I do not have a Windows machine to test and not motivated enough to
> try Emacs in wine.

Max, a minor modification of the test you sent earlier shows that when
system-type is ms-dos, the placement does not matter (the command-line
is the same); but for gnu/linux, placement matters and Eric is right
(the command-lines are not the same and the dollar sign needs to be
escaped).

I have attached a patch that puts the dollar sign in the right place for
both. The existing tests pass when running 'make test'.

Leo

From 423340175a354463c82fac2b4b3a404391e67eb5 Mon Sep 17 00:00:00 2001
From: Leo Butler 
Date: Thu, 3 Nov 2022 10:39:28 -0500
Subject: [PATCH] lisp/ob-maxima.el: correct placement of $ in command string

* ob-maxima.el (org-babel-maxima:execute): Commit 6156b57bdf2b fixed a
quoting problem encountered on windows. However, the dollar sign ($)
is part of the maxima command string and needs to be escaped on
gnu/linux.

Reported by: Eric Fraga
Ref:
https://list.orgmode.org/950eb41c-1c8a-c891-af8d-276f6a452...@electrum-bikes.pl/T/#m4b5a54551604e5b3ec21f317c4a31b547ccada68

TINYCHANGE
---
 lisp/ob-maxima.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/ob-maxima.el b/lisp/ob-maxima.el
index dba12d7b6..e3dfbb668 100644
--- a/lisp/ob-maxima.el
+++ b/lisp/ob-maxima.el
@@ -81,10 +81,10 @@ This function is called by `org-babel-execute-src-block'."
 	(result
 	 (let* ((cmdline (or (cdr (assq :cmdline params)) ""))
 		(in-file (org-babel-temp-file "maxima-" ".max"))
-		(cmd (format "%s --very-quiet -r %s$ %s"
+		(cmd (format "%s --very-quiet -r %s %s"
 			 org-babel-maxima-command
  (shell-quote-argument
-  (format "batchload(%S)" in-file))
+  (format "batchload(%S)$" in-file))
  cmdline)))
 	   (with-temp-file in-file (insert (org-babel-maxima-expand body params)))
 	   (message cmd)
-- 
2.35.1



Can someone give an init.el wherein can start customize it?

2022-11-03 Thread Mati
Look at mine config, but it's dirty too so copy-pasting it is not a good 
idea. Here are things that can be copied from it:


- straight and use-package configuration

- orderless

- vertico

- doom-modeline

- three first lines with font, but you must install those two fonts if 
you want to use them


- variables at the beginning

- generally, whole beginning without maxima path and also you must 
correct some pathes


- dashboard, circadian, all-the-icons

- org-roam setup is harder so you can use my config but you need to read 
docs or watch tutorials first


- olivetti - must-have

- marginalia, all-the-icons completion, savehist

- that use-package emacs that I don't understand but was recommended 
with some minibuffer completion package or I don't remember


- I have strange meow setup with insert mode as default so you can 
experience sometimes both modes enabled with it (then you need to 
disable unwanted one, happens rarely) and my custom layout in layout map


- emojify

- minions for nice cog on modeline to set modes

- org-modern

- valign - great package for org tables

- some latex config I must clear and first of all learn latex :P



(add-to-list 'default-frame-alist '(font . "Liberation Serif-16" ))
(set-face-attribute 'default t :font "Liberation Serif-16")
(set-fontset-font t nil (font-spec :size 16 :name "Iosevka NF"))

(add-to-list 'load-path "~/.emacs.d/site-lisp/maxima/")

(setq gc-cons-threshold 1000)
;; Restore after startup
(add-hook 'after-init-hook
  (lambda ()
(setq gc-cons-threshold 100)
(message "gc-cons-threshold restored to %S"
 gc-cons-threshold)))

(setq delete-by-moving-to-trash t
  ;; Emacs has some awful scrolling by default. This gets rid of that.
  scroll-step 1 ; keyboard scroll one line at a time
;;  scroll-preserve-screen-position 'always
  scroll-conservatively 101
  next-screen-context-lines 5
  debugger-stack-frame-as-list t
  ;; Echo keystrokes a little faster
  echo-keystrokes 0.5
  ;; remove auditory clutter:
  ring-bell-function #'ignore
  preserve-screen-position t)

(fset 'yes-or-no-p 'y-or-n-p)
(prefer-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(setq default-buffer-file-coding-system 'utf-8)
(setq max-mini-window-height 0.15)
(delete-selection-mode 1)


(setq backup-directory-alist '(("." . "~/.emacs.d/backup"))
  backup-by-copying t; Don't delink hardlinks
  version-control t  ; Use version numbers on backups
  delete-old-versions t  ; Automatically delete excess backups
  kept-new-versions 20   ; how many of the newest versions to keep
  kept-old-versions 5; and how many of the old
)

(setq custom-file (make-temp-file "emacs-custom"))

(add-to-list 'load-path "~/.emacs.d/extensions/")

(setq org-directory "~/.emacs.d/brajan/")

(defun find-config ()
  "Edit config.el"
  (interactive)
  (find-file "~/.emacs.d/init.el"))

(global-set-key (kbd "C-c c") 'find-config)

;; Install straight.el
(defvar bootstrap-version)
(let ((bootstrap-file
   (expand-file-name "straight/repos/straight.el/bootstrap.el" 
user-emacs-directory))
  (bootstrap-version 5))
  (unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
 "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el";
 'silent 'inhibit-cookies)
  (goto-char (point-max))
  (eval-print-last-sexp)))
  (load bootstrap-file nil 'nomessage))

;; Install use-package
(straight-use-package 'use-package)

;; Configure use-package to use straight.el by default
(use-package straight
  :custom (straight-use-package-by-default t))

(use-package dashboard
  :ensure t
  :config
  (dashboard-setup-startup-hook))

(use-package ir-black-theme)
(use-package grandshell-theme)
(use-package cyberpunk-theme)
(use-package alect-themes)
(use-package hemera-theme :ensure :defer)
(use-package nyx-theme :ensure :defer)

(use-package circadian
  :custom
  ;;(calendar-latitude 50.0)
  ;;(calendar-longitude 20.0)
  (circadian-themes '(("7:00" . hemera)
  ("23:00" . nyx)))
  :config (circadian-setup))

(use-package all-the-icons
  :if (display-graphic-p))

;; (use-package svg-lib)

(use-package org-roam
;;  :after org
  :custom
  ((org-roam-directory (file-truename org-directory))
   (org-roam-index-file "~/.emacs.d/brajan/index.org"))
  :config
  (org-roam-db-autosync-mode 1)
;;  (org-roam-setup)
  :bind (("C-c n f" . org-roam-node-find)
 ("C-c n r" . org-roam-node-random)  
 (:map org-mode-map
   (("C-c n i" . org-roam-node-insert)
("C-c n o" . org-id-get-create)
("C-c n t" . org-roam-tag-add)
("C-c n a" . org-roam-alias-add)
("C-c n l" . org-roam-buffer-toggle)

(use-package org-roam-ui
  :straight
(:host github :repo "org-roam/org-roam-u

Re: Maxima code blocks does not work in windows revisited

2022-11-03 Thread Max Nikulin

On 03/11/2022 17:01, Fraga, Eric wrote:

On Thursday,  3 Nov 2022 at 09:35, Max Nikulin wrote:

maxima --very-quiet -r "batchload(\"c:\\Temp\\maxima-XX.max\")"$


Should the $ not be within the quotes?


Does "$" have any special meaning in cmd.exe? I do not mind that it 
should be inside `format' first argument.


I do not have a Windows machine to test and not motivated enough to try 
Emacs in wine.


P.S. To avoid tricky escaping I strongly prefer direct exec to shell 
commands. Unfortunately as soon as TRAMP is involved, shell is the only 
option. Ssh supports command strings only and passes them to shell.






Re: Line breaks and brackets in LaTeX export

2022-11-03 Thread Juan Manuel Macías
Max Nikulin writes:

> I have not managed to convince even the tabularray developer. And I
> have not tried to find a way to reach more LaTeX developers.

I think that people from the LaTeX team and the authors of the most
popular packages are often very active on tex.stackexchange.com

And the repo on GitHub for the LaTeX project: https://github.com/latex3




Re: Line breaks and brackets in LaTeX export

2022-11-03 Thread Max Nikulin

Ihor Radchenko writes:


These arguments mean that auto-cleaning \\[0pt] is not always safe and
may be a subject of surrounding LaTeX context.


I still believe that

something\\[0pt]%__ORG_EXPORT__

is quite safe to remove (depending on the following character) and 
unlikely harmful if remained for some reason. Even tabularray 
regexp-based parser ignores comments. To be perfect, 
"\\[0pt]%__ORG_EXPORT__" emitted by user code should be escaped to e.g. 
"\\[0pd]%__ORG_EXPORTORG_EXPORT__", but I have no idea if it can be 
implemented in a reliable way.


An alternative is a new export framework.

On 03/11/2022 22:00, Juan Manuel Macías wrote:


BTW, I also hope that one day this LaTeX problem, which has been there
for so many years, will be solved (because it should be considered a
LaTeX bug, or a LaTeX design flaw, as Maxim commented in another
message).


I have not managed to convince even the tabularray developer. And I have 
not tried to find a way to reach more LaTeX developers.







How to center an image directly in org-mode (without exporting)

2022-11-03 Thread Cletip Cletip
Hello to all,

My problem is quite simple to understand: when I activate
"org-toggle-inline-images", I would like my images to be centered. Indeed,
I tried this in a org-file

#+ATTR_ORG: :width 800 :center t

[[file:images/anImage.png]]


But it obviously doesn't work.

Does anyone have a tip?

(I'm thinking of creating a function that, each time the size of the window
changes, readjusts the number of spaces to put so that my image is
centered. It's not a very clean solution, but could it work?)

Thanks in advance


Re: Init.el need just for org-mode?

2022-11-03 Thread Max Nikulin

On 03/11/2022 00:31, Renato Pontefice wrote:

Init.el

Need just for org -mode? Not for emacs right?


No, in the init file you may adjust other Emacs settings as well
https://www.gnu.org/software/emacs/manual/html_node/emacs/Init-File.html

To avoid syntax errors you may use easy customization interface as much 
as possible. It is available from "Options" menu or from variable docs 
(C-h v). It is even possible to add comments explaining the purpose of 
changes.


Do not forget to regularly backup your init file.




Re: Line breaks and brackets in LaTeX export

2022-11-03 Thread Juan Manuel Macías
Ihor Radchenko writes:

> These arguments mean that auto-cleaning \\[0pt] is not always safe and
> may be a subject of surrounding LaTeX context. Moreover, there is no
> clear alternative to \\[0pt] that is guaranteed to work.
> Thus, the whole idea with cleaning up the generated LaTeX cannot be
> enabled by default, and I am not even sure if it is something we want to
> implement in the core.
>
> Juan, maybe you have some good alternative suggestions?

I'm afraid not. I've been trying to follow the thread these past few
days and frankly I can't think of anything beyond all the options that
have already been discussed.

I agree that the safest solution (or the least compromised, depending on
how we look at it) is to add [0pt] in all cases. I believe this should
not bring any unexpected consequences. At least I've tried all the
tabular environments related packages that I know of and there don't
seem to be any problems. And in the case of the verse package and verse
numberings, the solution is ad hoc with the patch that I have planned (I
hope to find a gap these days to finish it and test it...): The idea of
the patch is to replace the current separation between stanzas that Org
adds (\vspace) with a white line, and (only) in that case it would be
necessary to ensure that the last verse of the stanza ends in \\!.

On the other hand, if 'factory-cleaning' unnecessary instances of [0pt]
is going to be problematic, I also agree not to add that action to the
exporter. I think it would be better to leave these things up to the
users, depending on their use cases. After all, it is not difficult to
do it using a specific export filter. Maybe add some tips and examples
of basic filters in the documentation, especially for users who don't
have a lot of experience writing filters?

BTW, I also hope that one day this LaTeX problem, which has been there
for so many years, will be solved (because it should be considered a
LaTeX bug, or a LaTeX design flaw, as Maxim commented in another
message). 

Best regards,

Juan Manuel 



Re: Init.el need just for org-mode?

2022-11-03 Thread Quiliro Ordóñez
El 2022-11-02 12:31, Renato Pontefice escribió:
> I’m sorry for this simply question, but I’m starting using emacs and
> org-mode and I made some confusion.
> 
> Init.el
> 
> Need just for org -mode? Not for emacs right?

Did you read the Emacs manual `C-h r' or the Org manual `C-h i d m Org
Mode ' ?



Re: How to set appointment twice a week

2022-11-03 Thread Ihor Radchenko
Renato Pontefice  writes:

> I need to sign up my palestra appointment twice a week:
> On Monday from 16 to 17:30
> On Friday from 18 to 19:30
>
> For one day I use:
>
> **  Io palestra  <2022-10-03 Mon 18:00-19:30 +1w>
>
> But to add the second time? Do I add a line? Or can manipulate this one just 
> adding the second appointment?

** Io palestra
<2022-10-03 Mon 16:00-17:30 +1w>
<2022-10-07 Fri 18:00-19:30 +1w>

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



How to set appointment twice a week

2022-11-03 Thread Renato Pontefice
I need to sign up my palestra appointment twice a week:
On Monday from 16 to 17:30
On Friday from 18 to 19:30

For one day I use:

**  Io palestra  <2022-10-03 Mon 18:00-19:30 +1w>

But to add the second time? Do I add a line? Or can manipulate this one just 
adding the second appointment?

(I need this not just for palestra but for more things…)

Thank you

Renato


Re: [O] Maxima code blocks does not work in windows revisited

2022-11-03 Thread Mati




As Max pointed out, the latest main branch of Org should already handle
Windows cmd properly without any extra patches. Did you try it? May I
know the output of M-x org-version?


9.5.5-g5bc674, I just pulled it, rebuilt and works properly (without plots)




Re: Maxima code blocks does not work in windows revisited

2022-11-03 Thread Fraga, Eric
On Thursday,  3 Nov 2022 at 09:35, Max Nikulin wrote:
> maxima --very-quiet -r "batchload(\"c:\\Temp\\maxima-XX.max\")"$


Should the $ not be within the quotes?
-- 
: Eric S Fraga, with org release_9.5.5-853-g7b9d8e in Emacs 29.0.50


How to align all tables at once?

2022-11-03 Thread Jean Louis
I am using Org mode for presentation and would like to use it's tables
for presentation only.

In particular I need the function org-table-align to align the table
in presentation mode.

The Org buffer is updated with results of the below embedded
functions. I can't use Org mode directly as many various expenses are
connected to together.

If it is possible to "jump backwards to Org table" and invoke
org-table-align, I could do that with subsequent function, is it?

This is what is being processed:

- snippet

⟦ (ignore (setq my-total 0)) ⟧
⟦ (ignore (defun my-add (n) (setq my-total (+ my-total n)) n)) ⟧

** Monthly Expenses

| Description  | Value|
|--+--|
| Communications and Reporting Officer I/C | ⟦ (my-add 60) ⟧  |
| Prospecting Staff member | ⟦ (my-add 45) ⟧  |
| Prospecting Staff member | ⟦ (my-add 45) ⟧  |
| Food for workers on project  | ⟦ (my-add 90) ⟧  |
| Transport Expenses   | ⟦ (my-add 100) ⟧ |
| Rental   | ⟦ (my-add 30) ⟧  |
|--+--|
| TOTAL| ⟦ my-total ⟧ |

- snippet


This is what I get in presentation:

| Description  | Value|
|--+--|
| Communications and Reporting Officer I/C | 60  |
| Prospecting Staff member | 45  |
| Prospecting Staff member | 45  |
| Food for workers on project  | 90  |
| Transport Expenses   | 100 |
| Rental   | 30  |
|--+--|
| TOTAL| 370 |

other solution could be to iterate over Org tables to align them.

Anything that exists currently?

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



Re: [PATCH] ob-sql: Respect database param when using dbconnection

2022-11-03 Thread Bastien Guerry
Ihor Radchenko  writes:

> Bastien, could you please add Daniel as the maintainer of
> lisp/ob-sql.el?

Done in bd468136d.  Thanks Daniel!

-- 
 Bastien



RE: org-assert-version considered harmful

2022-11-03 Thread Ihor Radchenko
"Cook, Malcolm"  writes:

>> It should not be necessary and it does not happen on my side (as you can
>> imagine, I re-compile very often).
>
> Perhap's my issue stems from the particular versions of org I was upgrading 
> between and/or (earlier) poor management of multiple contending org versions 
> (e.g. git head v. melpa v. system).

That might be possible. Because Emacs does not properly update macro
definitions in the already compiled files.

See https://orgmode.org/list/jwvsfkv5s7l.fsf-monnier+em...@gnu.org

However, the current, more forgiving, version of org-assert-version
should only complain when upgrading to different Org version. make clean
is a good measure even during normal upgrades though. Because of the
Emacs limitation.

> ```
> cd ~/.emacs.d/org-mode && git pull && make clean && make autoloads && make 
> PERL5LIB=
> ```
>
> And then relaunch emacs, where it gets picked up due to:
>
> ```
> (use-package org ;org-plus-contrib; instead of org-mode
>   :pin manual 
>   :load-path "~/.emacs.d/org-mode/lisp"
> ...
> )
> ```
>
> ... which occurs very early in my init file (just after bootstrapping package 
> system and latest use-package).
>
> So, I've got (again) a working strategy.  
>
> I'm really wondering if all this is needlessly complex.

The above should be safe.
Whatever straight.el does also work for me as long as I put Org loading
early in my init.el.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: How to set monospace font face for org-agenda calendar?

2022-11-03 Thread Ihor Radchenko
Mati  writes:

> Hi. I tried to assign monospace font to calendar in org-agenda but it 
> looks it uses default face. How I can set it then?

Change the default face.
Or remap the default face only in that buffer (see
https://protesilaos.com/codelog/2022-01-08-emacs-face-remap-add-relative/)
Or, if you are using variable-pitch-mode, disable it.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: processing a literal example line by line in a shell source block?

2022-11-03 Thread Ihor Radchenko
Greg Minshall  writes:

> hi.  i have a text in a named #+begin_example ... #+end_example block.
> i would like to process this text line by line in a shell (bash, say)
> code block.  but, it appears that the individual lines are not
> separated, but passed as one long string to the source block.  (example
> below.)
>
> is there a magic incantation i can use to accomplish this?

Try

#+name: lbl
#+begin_example
line 1
line 2
#+end_example

#+begin_src bash :var input=lbl :results output
  echo "${input}"
#+end_src

#+RESULTS[719e61ee2f3fb87459530cf75b7bbef74b7d4337]:
: line 1
: line 2

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: Docstrings and literate programming (good practices?)

2022-11-03 Thread Ihor Radchenko
Juan Manuel Macías  writes:

>> Can you elaborate about "paragraph is exported as verbatim"?
>
> Sorry for the conciseness in my previous explanation. I meant something
> like this:
>
> : foo
>
> is exported to LaTeX as
>
> \begin{verbatim}
> foo
> \end{verbatim}
>
> (and what i want is for it to be exported as 'normal text').

You can just

#+name: foo
foo

that will be exported with all the markup.

> By the way, thinking about it, I don't know if a hypothetical header arg
> called :docstring would be ok, something like:
>
> #+NAME: foo
> #+begin_
> blah
> #+end_
>
> #+begin_src emacs-lisp :docstring foo
> (defun foo ()
> (message "hello world"))
> #+end_src
>
> And the docstring would be formatted and placed depending on the
> language and the code (https://en.wikipedia.org/wiki/Docstring).

That's asking for too much. Supporting :docstring header argument in
such form will require babel backends to parse the code, which may not
be trivial. Or consider odd cases with polymorphic functions with the
same name.

However, note one past feature request about escaping text in noweb
references:
 https://orgmode.org/list/82897e7d-f987-11f4-f7f5-fa1b8e462...@posteo.eu

Sébastien Miquel  (2021-05-03) (2021 
emacs-orgmode.gnu.org maillist nolist)
Subject: [Feature request] String escaped noweb expansion

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [PATCH] Improve Org Babel LaTeX + Inkscape

2022-11-03 Thread Ihor Radchenko
Rudolf Adamkovič  writes:

> The attached two patches improve Org Babel LaTeX export to SVG using
> Inkscape.  See the commit messages for more details.  Thank you.

Thanks!

Applied onto main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=aaccbb2f987e80190cfb7ca0cb87d2546455a468
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=17425599cf7e7a7ec311204851005e141f5ce89b

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: @string abbreviation in bib file not honored in (basic) org-cite

2022-11-03 Thread Ihor Radchenko
Joost Kremers  writes:

> On Sun, Oct 30 2022, Ihor Radchenko wrote:
>> May I know if there is any update on the copyright assignment situation?
>> If you need any help, we can provide it.
>
> I have signed the form and sent it in, and I have received the counter-signed
> form back from the FSF.

Thanks!

> Parsebib's Github page mentions 6 contributors, however, and I have no idea if
> they all have copyright assignments, or if their contributions are small 
> enough
> not to require one.

The rules are in 
https://www.gnu.org/prep/maintain/maintain.html#Legally-Significant

Shuguang Sun contributed TINYCHANGE (no need for copyright assignment;
   though he contributed ~15LOC and it is on the edge)
Martin R. Albrecht also contributed TINYCHANGE
Alex Branham -- TINYCHANGE
aikrahguzar -- TINYCHANGE
András Simonyi has copyright assignment (see
  https://orgmode.org/worg/contributors.html)
And you have the copyright assignment

> I could dive into that and see if we need more copyright assignments, or I 
> could
> ask for parsebib to be included in non-GNU Elpa, which would probably be 
> faster.
> Don't know if you have a preference.

I see no obstacles to go for ELPA, unless you have strong reasons to
avoid asking copyright assignment for future contributors.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [PATCH] ob-sql: Respect database param when using dbconnection

2022-11-03 Thread Ihor Radchenko
Daniel Kraus  writes:

>> P.S. ob-sql currently have no maintainer. Do you want to volunteer?
>
> Hmm, ob-sql is the the babel module I use most often.
> I don't think I'll have enough time to make bigger changes etc,
> but from what I know that's not necessary or expected.
> I'm certainly willing to look at patches, answer bug reports
> and join discussion about ob-sql.
>
> tl;dr you can add me as a maintainer ;)

Bastien, could you please add Daniel as the maintainer of lisp/ob-sql.el?

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [PATCH] Ignore flaky ob-python tests

2022-11-03 Thread Ihor Radchenko
Christian Köstlin  writes:

> With my patch the tests are still failing but the testsuite continues
> to run and returns
> with 0 as status code (one can see the failed test though).

FYI, I am using automated scripts to run make test locally on multiple
Emacs versions. 0 status code would do no good for my testing.

>> Maybe we can instead provide some variable that can turn-on ignoring
>> some problematic tests only during CI tests?
> Yes ... that would also be possible e.g. skip the test or test nothing
> if it's running on the ci.
> (I am talking only about the 3 tests!).

More like just 1 test with underscore :)
The 3 tests in the patch are real failures because ob-python does not
fully support python-mode.el.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



[DISCUSSION] Should we deprecate python-mode.el (alternative to built-in python.el) support in ob-python? (was: [BUG] ob-python: async session evaluation does not support python-mode.el [9.6-pre (rele

2022-11-03 Thread Ihor Radchenko
Jack Kamm  writes:

> I was actually planning to deprecate ob-python support for
> python-mode.el, because I don't think it's worth the extra complexity &
> burden to support 2 python modes. For users who prefer python-mode, I
> think it would be better to have a separate ob-python-mode, perhaps in
> org-contrib. There was a related discussion about this [1] a couple
> years ago.
> ...
> [1] https://list.orgmode.org/87d0a95eyz@bzg.fr/

Dear All,

We are currently supporting two possible python REPL backends in
ob-python: `org-babel-python-mode' can be either 'python or 'python-mode
for built-in python.el and third-party python-mode.el, respectively.

However, supporting python-mode.el integration is difficult for Org
team: neither the current ob-python maintainer nor the rest of Org team
are familiar with python-mode.el.

The bug discussed above already shows that parts of ob-python do not
work properly with third-party python-mode.el.

Should we deprecate the support altogether and not bother with the extra
maintenance? Or maybe someone want to volunteer maintaining
python-mode.el integration?

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at