Re: [PATCH] ox-latex.el: Fix the case of latex-caption-above t

2024-01-16 Thread Mads Bach Villadsen
#+OPTIONS: html-postamble:nil H:5 num:nil ^:{} toc:nil author:nil 
 email:nil tex:dvipng d:nil
#+STARTUP: hidestars indent inlineimages
:PROPERTIES:
:reply-to: 
("/var/folders/b9/gky2rvnj4xxd0gl0x7n92j8rgn/T/mm-kl9uCr.html" 
"/var/folders/b9/gky2rvnj4xxd0gl0x7n92j8rgn/T/cidvUcUMz")
:attachment: nil
:alternatives: (utf-8 html)
:END:

My message seems to have been HTML-ified by mistake, so I'm 
sending it again.

The documentation for `org-latex-caption-above’ seems to imply 
that it can be set to a non-nil value to always place captions at 
the start of environments, instead of the end. However, with a 
non-nil value which is not a sequence, exporting something like 
the following from org causes an error:
\begin{align*}
x
\end{align*}

The issue is that in `org-latex-latex-environment’, in the 
expression
  (memq type (append (plist-get info :latex-caption-above) 
  ’(math)
the first argument to `append’ gets expanded to the value of 
`org-latex-caption-above’ (at least for this example), which may 
not be a sequence.

I think the attached patch fixes this, but I don’t write much 
lisp, so maybe there’s a better way to handle this.

Best,
Mads


>From f28da9e3c80f03d70a9a6eced5029e12fc75ab99 Mon Sep 17 00:00:00 
2001
From: Mads Bach Villadsen 
Date: Mon, 15 Jan 2024 15:37:29 -0500
Subject: [PATCH] ox-latex.el: Fix the case of latex-caption-above 
t

* lisp/ox-latex.el: (org-latex-latex-environment): Check whether 
  the property
`:latex-caption-above' is a sequence or not, and handle them 
separately.

Correctly handle the case where org-latex-caption-above is non-nil 
and
not a list of symbols. The documentation of 
org-latex-caption-above
implies that it can be set to a non-nil value to place captions at 
the
beginning of all environments.

TINYCHANGE
---
 lisp/ox-latex.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index b36c46f13..4f2a94a20 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -2682,7 +2682,9 @@ CONTENTS is nil.  INFO is a plist holding 
contextual information."
(org-latex--label latex-environment info nil t)
  (org-latex--caption/label-string latex-environment 
 info)))
   (caption-above-p
-   (memq type (append (plist-get info :latex-caption-above) 
 '(math)
+(let ((latex-caption-above (plist-get info 
:latex-caption-above)))
+  (if (sequencep latex-caption-above) (memq type 
(append latex-caption-above '(math)))
+latex-caption-above
   (if (not (or (org-element-property :name latex-environment)
   (org-element-property :caption latex-environment)))
  value
--
2.39.3 (Apple Git-145)



--citation follows this line (read-only)--
Mads Bach Villadsen  writes:

Hi,

The documentation for `org-latex-caption-above’ seems to imply 
that it can be set to a non-nil value to always place captions at 
the start of
environments, instead of the end. However, with a non-nil value 
which is not a sequence, exporting something like the following 
from org causes
an error:

latexpCfhTz_350451aa2511e1a6f5ea1cf164b4329f062726cb.png

The issue is that in `org-latex-latex-environment’, in the 
expression (memq type (append (plist-get info 
:latex-caption-above) ’(math) the first
argument to `append’ gets expanded to the value of 
`org-latex-caption-above’ (at least for this example), which may 
not be a sequence.

I think the attached patch fixes this, but I don’t write much 
lisp, so maybe there’s a better way to handle this.

Best, Mads

>From f28da9e3c80f03d70a9a6eced5029e12fc75ab99 Mon Sep 17 00:00:00 
2001 From: Mads Bach Villadsen  Date: Mon,
15 Jan 2024 15:37:29 -0500 Subject: [PATCH] ox-latex.el: Fix the 
case of latex-caption-above t

lisp/ox-latex.el: (org-latex-latex-environment): Check whether the 
property

`:latex-caption-above’ is a sequence or not, and handle them 
separately.

Correctly handle the case where org-latex-caption-above is non-nil 
and not a list of symbols. The documentation of 
org-latex-caption-above implies
that it can be set to a non-nil value to place captions at the 
beginning of all environments.

TINYCHANGE — lisp/ox-latex.el | 4 +- 1 file changed, 3 
insertions(+), 1 deletion(-)

diff –git a/lisp/ox-latex.el b/lisp/ox-latex.el index 
b36c46f13..4f2a94a20 100644 — a/lisp/ox-latex.el + 
b/lisp/ox-latex.el @@ -2682,7 +2682,9 @@
CONTENTS is nil. INFO is a plist holding contextual information.“ 
(org-latex–label latex-environment info nil t) 
(org-latex–caption/label-string
latex-environment info))) (caption-above-p

,* (memq type (append (plist-get info :latex-caption-above) 
’(math)
,* (let ((latex-caption-above (plist-get info 
:latex-caption-above)))
,* (if (sequencep latex-caption-above) (memq type (append 
latex-caption-above ’(math)))
,* latex-caption-above (if (not (or (org-element-property 
:name latex-environment) 

Developing Moodle resources/sites with Org Mode

2024-01-16 Thread Edward Doolittle
Hello everyone,

I'm new to Org Mode but I really enjoy working with it.

I have begun thinking about how I might use Org mode to improve the experience 
of developing resources for the open source Moodle LMS or even developing 
entire Moodle sites.  Currently I develop Moodle content for mathematics 
courses using their online editors which are quite basic.  I would like to be 
able to edit in Emacs and preview my work before uploading to Moodle.  Below 
are four potential use cases I see:

1) ​Development of HTML pages to upload to Moodle.  This can already be done 
with Org export to HTML/MathJax.  One nice bonus: it is possible to integrate 
diagrams and graphs into a Moodle HTML page using JSXgraph.  JSXgraph is just 
Javascript so is already supported in Org Mode.  A couple of small 
modifications to the js block will create a jsxgraph source block in Org mode 
which will enable immediate preview of static graphs in PNG format and preview 
of dynamic graphs by exporting to HTML.  Decent LaTeX versions of pages with 
static graphs could easily be exported.  I am very close to setting this up.  I 
have JSGgraphs producing PNG files on the command line with node.js and the 
jsxgraph.js library.  A few lines of elisp to wrap jsxgraph blocks in the 
appropriate incantations is all that is needed.

2) Development of Moodle glossaries. Glossaries can be uploaded to a Moodle 
site using an appropriate XML file.  Glossaries could be developed in Org mode, 
including JSXgraph diagrams and graphs, PNG images, and so on, and then Org 
mode converted to XML and the XML transformed to Moodle Glossary XML using 
XSLT.  (I don't really know those tools at all, so I don't know if that would 
be a good way to go about the process; exporting directly to Moodle Glossary 
was my first thought, but it is not a general export that is necessary or 
appropriate, rather an export of a specifically designed Org file.  XSLT seems 
old fashioned but there are tools around, and there is a project for exporting 
Org mode to XML.)

3) Development of Moodle quiz question databases.  I know less about the format 
but it is documented at some level on the Moodle help site.  From what I 
understand the same process for exporting a glossary would work for a question 
database (Org -> Org XML -> XSLT -> Moodle XML), but question database are 
rather more complicated than glossaries, with numerous different types of 
questions.  Still, it is mostly straightforward for simple question types.  
However, I am particularly interested in the STACK question type, which is a 
mixture of HTML, LaTeX (MathJax), and Maxima code, which can be used (for 
example) to randomize a question.  Maxima source code blocks already work well 
in Org mode.  Some work might need to be done connecting them to LaTeX in which 
{@maxima-variable@} can be used to refer to variables in a Maxima code block.  
Similarly JSXgraph blocks can refer to Maxima variables through the 
{#maxima-variable#} syntax.  This is somewhat complicated by there being 
multiple Maxima code blocks in one question (there is a main one that executes 
immediately and others that seem to execute when the student has provided 
answers).  An issue I foresee is that a Maxima session might be required to 
correctly represent state but currently there is no Maxima session available in 
Org mode.

I have already written a statistics exam with Org Mode and Maxima.  I can 
generate as many different versions of a question (and associated answer key 
and solution set) as I wish with almost no additional effort.  In order to 
facilitate import into Moodle STACK, I have had to restrict my access to Maxima 
variables using accessors also written in Maxima ... I import the Maxima block 
into the accessor with noweb.  I end up re-running the same chunk of Maxima 
code over and over, once for each variable access, because there is no Maxima 
session.  It is kind of stupid but I tossed it together in three days.  I 
suppose I could store the results of a Maxima run in a table and just do table 
lookups but I've got the spare compute cycles to run Maxima over and over until 
I sort this all out.  I think Maxima session is the right way to go but I'm 
inexperienced with all this and would appreciate guidance.

4) Development of whole sites: Sites are uploaded to a Moodle server as .tgz of 
XML files with directories of resources (PDF files, PNG files, possibly also 
control files for external applications like Zoom).  I see this as quite a 
challenge but definitely manageable for simple sites, adding features as users 
call for them.

What do people think?  Am I off the mark?  Are there better ways to do this?  
Maybe even setting up my own personal Moodle server and connecting Emacs to it 
as an external editor would work reasonably well and save me some of the pain?  
But it would be nice to export some things to formats other than Moodle: a 
glossary in LaTeX might be nice, for example, and quiz questions 

Re: [POLL] Change calling convention for when `org-link-file-path-type' is set to custom function (was: Enhancement Proposal for 'org-link-file-path-type' Behavior)

2024-01-16 Thread Christopher M. Miles

+1 for this propose.

I have one situation need this feature.

Assume a file structure like bellowing:

#+begin_example
`- folder-1
  `- file-1.org
  `- folder-1.2
` file-1.2.1.org
#+end_example

When I try to add link of "file-1.org" in "file-1.2.1.org", based on my
custom option `org-link-file-path-type' value `adaptive'. The link will
become a full-path link. But I want link to be relative to current Org
file path. The file link path should be [[file:../file-1.org]] instead
of [[file:folder-1/file-1.org]]. I hope I can use a custom function in
conditions to decide the file path.

Ihor Radchenko  writes:

> 西 顾  writes:
>
>> I'd like to suggest a small enhancement to the
>> 'org-link-file-path-type' option. When set to 'function', it currently
>> passes an absolute path to the user's custom function. This limits
>> flexibility as the original path input is not available to the
>> function.
>>
>> For better customization, I propose passing the raw path to the
>> function. Users needing an absolute path could use 'expand-file-name'
>> within their function.
>
> Thanks for the suggestion!
>
> This makes sense - the current approach with passing absolute path is
> indeed limiting the information passed to the custom function.
>
> The docstring is also quite ambiguous about what is passed as an
> argument:
>
> org-link-file-path-type is a customizable variable defined in ol.el.
> <...>
> Alternatively, users may supply a custom function that takes the
> full filename as an argument and returns the path.
>
> "full filename" may or may not mean "absolute filename".
>
> However, changing the absolute path to "as is" path will technically be
> breaking.
>
> I cannot find any actual uses of custom function value for
> `org-link-file-path-type' in the wild, so I am leaning towards going
> ahead with this (minor) breaking change.
>
> Yet, I am starting a poll to give users who may be affected a chance to
> chime in.


-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


[DONE] Re: org-agenda + [a] generated many duplicated task entries

2024-01-16 Thread Christopher M. Miles

Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
>> When I execute command "org-agenda" with key "[a]" to generate
>> org-agenda day view. Many task entries are duplicated.
>
> Maybe you have something in
> `org-agenda-skip-scheduled-if-deadline-is-shown' or similar customization.
>
>> I tried many methods trying to figure out the problem reason.
>>
>> - [X] Emacs init bisect
>> - [X] Emacs minimal init testing -> no problem
>
> These two mean that you missed something during bisection.

I reproduced the problem with `emacs -Q` and `emacs-minimal-init`.
Then I tried to Edebug on the command function `org-agenda` -> 
`org-agenda-list`.
I suddenly brain come up with checking out the variable `org-agenda-files` 
value.
I found it contains duplicated filenames in list.
Then I added `delete-dups` function around my `org-agenda-files` value list 
generating.
Then the problem solved.

This is really a hard reason to find out which costed lot of time. :(

Anyway, thanks Ihor as always.

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: org-agenda + [a] generated many duplicated task entries

2024-01-16 Thread Christopher M. Miles

@Ihor, Thanks for your help.

Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
>> When I execute command "org-agenda" with key "[a]" to generate
>> org-agenda day view. Many task entries are duplicated.
>
> Maybe you have something in
> `org-agenda-skip-scheduled-if-deadline-is-shown' or similar customization.
>

I customized `org-agenda-skip-scheduled-if-deadline-is-shown' to `t' in my 
Emacs init.

After your hints, I tested this option with different values:
`nil', `t', `not-today', `repeated-after-deadline'.

None of those value fixed my problem. So should not related to my problem.

I have customized options in my Emacs init:

#+begin_src emacs-lisp
(setq org-agenda-skip-timestamp-if-done t
  org-agenda-skip-deadline-if-done t
  org-agenda-skip-deadline-prewarning-if-scheduled t
  org-agenda-skip-scheduled-if-done t
  org-agenda-skip-scheduled-delay-if-deadline 'post-deadline
  org-agenda-skip-scheduled-if-deadline-is-shown t
  org-agenda-skip-timestamp-if-deadline-is-shown t
  org-agenda-skip-additional-timestamps-same-entry nil
  org-deadline-warning-days 14
  org-agenda-tags-todo-honor-ignore-options t)

(setq org-agenda-todo-ignore-timestamp 'all
  org-agenda-todo-ignore-with-date nil
  org-agenda-todo-ignore-scheduled 'future
  org-agenda-todo-ignore-deadlines 'near)
#+end_src

But I tested by comment out those options still have same problem.

>> I tried many methods trying to figure out the problem reason.
>>
>> - [X] Emacs init bisect
>> - [X] Emacs minimal init testing -> no problem
>
> These two mean that you missed something during bisection.

Yes, this is why I post email here for asking help. Because I can't find
out reason between Emacs init bisect & Emacs minimal init testing.

I will try more times and other methods.

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: [PATCH] Highlight ANSI sequences in the whole buffer (was [PATCH] ANSI color on example blocks and fixed width elements)

2024-01-16 Thread Nathaniel Nicandro

Ihor Radchenko  writes:

Hello, attached is another updated patch with the following changes:

- Made it possible to add headlines or inline tasks
  to `org-ansi-highlightable-elements', these are added by default now.

- To tackle the issue discussed previously about highlights spanning
  multiple lines (or elements) being removed when a line is modified I
  went ahead and used the font-lock-multiline property (see
  font-lock-extend-region-multiline and
  font-lock-extend-region-functions) across those regions so that on
  any edit of one of the lines, the region including all of the ANSI
  sequences that affect that line will be re-fontified.  This was the
  easier solution, but the downside is that it can cause large regions
  to be re-fontified when really all we want to do is apply the
  highlighting face to a small line change, for example.  An
  alternative solution would, when no ANSI sequences are being edited
  in the region being fontified and assuming a previous fontification
  cycle has applied highlights due to ANSI sequences already, only
  apply the highlighting face to the edited region instead of
  expanding the region before fontification.  The expansion
  unnecessarily wastes the fontification cycle on a region larger than
  what it needs to be since the information needed for highlighting
  the region according to ANSI sequences has already been computed on
  a previous fontification cycle.  In practice I don't think this
  inefficiency will matter much since I would assume most of these
  ANSI sequences will be inserted due to the results of code block
  execution or inserted by users who want to highlight small regions
  of the document so I would consider this problem solved by using
  font-lock-multiline for the time being.  WDYT?

- To tackle the issue of editing around the invisible ANSI sequences I
  left it up to the font-lock process to catch the invisible edits.
  Whenever an edit deletes a character of the sequence that renders
  the sequence invalid, the font-lock process will reveal the partial
  sequence.  But I had to limit what was considered a valid ANSI
  sequence to get it working in a somewhat acceptable way.

  The problem that I found was that if the buffer contains something
  like
  
  ^[[43mfoo
  
  (where ^[ is the ESC character and can be inserted with "C-q ESC" and
  the whole sequence ^[[43m is the ANSI sequence) what was happening was
  that deleting into the hidden sequence would leave the region in the
  state
  
  ^[[43foo
  
  and because the end byte of the ANSI sequence can be any character
  in the ASCII range [@A-Z[\]^_`a–z{|}~], ^[[43f would still be a
  valid ANSI sequence and would be hidden during the fontification
  process after the edit.  Since `ansi-color-apply-on-region' only
  really handles the sequences that end in an m byte, just rendering
  all other ones invisible, I limited the ANSI sequences handled by
  this patch to be only those sequences that end in m.  This way,
  after deleting into the sequence like in the above example the
  fontification process would not recognize the region as containing
  any sequence.  The downside to this solution is that sequences that
  end in any other end byte won't get conveniently hidden and the
  problem still persists if you have text that starts with an m and
  you delete into a hidden sequence.
  
  An alternative solution that doesn't constrain the end byte could be
  to add in some extra invisible character like a zero width space and
  then use something like the `modification-hooks' text property on
  the character to signify that a deletion at the boundary between the
  sequence and the text should really delete part of the sequence
  instead of the zero width space.  I haven't really worked out the
  details of this, for example how would it be detected which
  direction a deletion is coming from, the front or behind, but I'm
  throwing it out there to see if there are any other solutions other
  people might be aware of for a similar problem.
  
- Finally, code has been added to delete the overlays on the hidden
  sequences in `org-unfontify-region' so that multiple overlays are not
  created on re-fontifying regions containing those sequences.

Other than that, the code is the same as the last patch.

> P.S. I am not yet commenting on the details in the code.

Please let me know what you think of this patch and where I should be
focusing my efforts moving forward to get this submitted to Org.

One thing I would like to start doing is writing some tests for this
feature.  It would be great if someone could point me to some tests
that I can peruse so that I can get an idea of how I can go about
writing some of my own.  Also, are there any procedures or things I
should be aware of when trying to write my own tests?

>From 506e8c1e5a177b797a541b1541ea98c95668d5e1 Mon Sep 17 00:00:00 2001
From: Nathaniel Nicandro 
Date: Tue, 9 May 2023 19:58:11 -0500
Subject: [PATCH] Highlight ANSI 

Re: [BUG] with org-agenda not loading properly after the diff command

2024-01-16 Thread Ihor Radchenko
rameik...@posteo.net writes:

> In Emacs, display org-agenda then press key n to show TODOs and agenda. 
> Now execute M-x diff between an Org file file.org and file.org~
>
> Then do M-x org-agenda and press n again.
> ...
> Obtained result:
>
> Search failed: "\\]+\\)>" and the agenda stays 
> empty.

I am unable to reproduce.
May you please provide more detailed instructions starting from
emacs -Q? See https://orgmode.org/manual/Feedback.html#Feedback

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



[BUG] with org-agenda not loading properly after the diff command

2024-01-16 Thread rameiko87
In Emacs, display org-agenda then press key n to show TODOs and agenda. 
Now execute M-x diff between an Org file file.org and file.org~


Then do M-x org-agenda and press n again.



Expected result:

Your agenda!



Obtained result:

Search failed: "\\]+\\)>" and the agenda stays 
empty.




Re: Should org-link-parser add type "file" when link has no "file:" prefix?

2024-01-16 Thread Joseph Turner
Ihor Radchenko  writes:

> Joseph Turner  writes:
>
 I'd like for users to be able to take an existing directory of Org mode
 documents and copy them all into a hyperdrive.  I think the least
 surprising behavior is for the links between those files to continue
 working.  Perhaps the best option is for hyperdrive.el to make all "file"
 type links, explicit or not, point to other files inside the hyperdrive?

 In that case, there would be no way for Org mode files in a hyperdrive
 to point to the local filesystem.  Similarly, when Org documents are
 exported to HTML, there's no way to export .
>>>
>>> May you please elaborate? How is hyperdrive directory different from
>>> local directory?
>>
>> On disk, hyperdrive data is stored by hash prefixes like so:
>>
>> /home/joseph/.local/share/hyper-gateway-nodejs/cores/
>> └── 00
>> ...
>> This is similar to the way .git/objects/ directories are structured.
>> ...
>> Does that answer your question?
>
> Not really.
> May you please provide an example with an Org file containing file links
> and how you envision to transform them? Will they be transformed
> depending on the directory the Org file is located in?

I don't want to transform the file links.  The idea is that an Org file
"foo.org" could be copied into a hyperdrive, and [[./bar.org]] would
point to a file called "bar.org" in the same folder in the hyperdrive.

That way, you could copy both "foo.org" and "bar.org" from your local
directory into a hyperdrive, the links between them would work as-is.

Pseudo-code for a hyperdrive.el :follow function for file: links:

(defun hyperdrive--org-file-link-follow (url  _prefix _link)
  (when hyperdrive-mode
(hyperdrive-open
  (hyperdrive-convert-path-to-hyper-url url option)) ;; Turns "/foo" into 
"hyper://PUBLIC-KEY/foo"
t))

(org-link-set-parameters "file" :follow #'hyperdrive--org-file-link-follow)

 (org-element-property :search-option link)
>>>
>>> :follow functions are passed both path and search option.
>>
>> How is the search option passed in?
>>
>> IIUC in org-link-open, the path argument passed in has no search option:
>>
>> (funcall (org-link-get-parameter type :follow) path arg)
>
> You are right.
> What we can do then is pass an extra argument to :follow function - the
> link object. That way, :follow function can get all the information it
> needs.

I like this idea!  Would this change break existing :follow functions
which only expect max two args?

>> By the way, I think this minor improvement could be made at the bottom
>> of org-link-open:
>>
>> From 0c83446f16441df39618e43f964e18f672205d55 Mon Sep 17 00:00:00 2001
>> From: Joseph Turner 
>> Date: Mon, 15 Jan 2024 00:24:30 -0800
>> Subject: [PATCH] lisp/ol.el (org-link-open): Use let-bound :follow function
>
> Thanks!
> Applied, onto main; I added TINYCHANGE cookie to the commit message.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=0254854ee

Thanks!

Joseph



Re: [PATCH] Fix org-agenda-skip-scheduled-if-deadline-is-shown bug

2024-01-16 Thread Morgan Smith
Ihor Radchenko  writes:

> Morgan Smith  writes:
>
>> Ihor Radchenko  writes:
>>
>>> But then `org-agenda-skip-scheduled-if-deadline-is-shown' does not look
>>> like the right place for this customization. It would make more sense to
>>> have a dedicated custom variable for this. WDYT?
>>> ..
>> I can't quite remember at this point but I'm pretty sure some
>> permutations are impossible with the current setup (like ignoring both
>> things that are scheduled today and in the future when the deadline is
>> today).
>
> Your statement does not look like something related to my question about
> moving 'repeated-after-deadline value to some other (existing or new)
> customization.
>
By adding another variable to control the 'repeated-after-deadline'
behavior, we would allow the user to combine this behavior with the
other behaviors of 'org-agenda-skip-scheduled-if-deadline-is-shown'.
This would allow for more permutations.  This is a point in favor of
adding a dedicated custom variable.
>
> Or did you mean to provide a generic suggestion about adding more agenda
> customizations?
>
Maybe we could create some data-structure that represents an agenda and
allow the user to manipulate that directly.  I'm not really a fan of
having a ton of variables controlling the agenda.  Although I imagine I
might gain some respect for it if I tried to implement this feature.
>
> Nothing is stagnated. I am just waiting for Bastien to chime in, if he
> decides to. He is the person who can provide important context.
> We allow up to one month for people to reply on the mailing list.
> See https://orgmode.org/worg/org-mailing-list.html#org474747a
>
I was unaware of the one month policy.  Thank you for letting me know.
Due to that lack of a bug tracking system I have a fear that things on
the mailing list would get lost.  Maybe this fear is unfounded?



Re: #+LATEX_HEADER: \usepackage[greek,german]{babel} ??

2024-01-16 Thread Juan Manuel Macías
Horst Leps writes:

> % Created 2024-01-16 Tue 20:00
> % Intended LaTeX compiler: pdflatex
> \documentclass{scrartcl}
> \usepackage[utf8]{inputenc}
> \usepackage[T1]{fontenc}
> \usepackage{graphicx}
> \usepackage{grffile}
> \usepackage{longtable}
> \usepackage{wrapfig}
> \usepackage{rotating}
> \usepackage[normalem]{ulem}
> \usepackage{amsmath}
> \usepackage{textcomp}
> \usepackage{amssymb}
> \usepackage{capt-of}
> \usepackage{hyperref}
> \usepackage[germanb]{babel}
> \usepackage[utf8]{inputenc}
> \usepackage[LGR,T1]{fontenc}
> \usepackage[greek,german]{babel}
> \author{HL}

The document loads babel twice:

\usepackage[germanb]{babel} <==
\usepackage[utf8]{inputenc}
\usepackage[LGR,T1]{fontenc}
\usepackage[greek,german]{babel} <==

Hence the 'option class for package babel' error. You have loaded babel
in your org document with the [greek,german] option and (probably, in
the class you are loading) babel is already loaded as well.

Try:

#+LaTeX_Header: \PassOptionsToPackage{greek,german}{babel}

Best regards,

Juan Manuel 



Re: [possible patch] Remove the '\\[0pt]' string from the last line of a verse block in LaTeX export

2024-01-16 Thread Juan Manuel Macías
Ihor Radchenko writes:

> The very reason we use \\[0pt] is because it supposed to prevent
> interpreting [...] at the new line/transcoded element as argument.
>
> You demonstrated that it is yet not always safe enough.
>
> May it be better to use something like
>
> \newcommand\nothing{}
> \newcommand{\safenewline}{\\\nothing}
>
> And then use \safenewline instead of \\[0pt]
>
> In my tests,
>
> \begin{center}
> \begin{tabular}{ll}
> [t] & s\safenewline
> [I] & A\safenewline
> [m] & kg\safenewline
> \end{tabular}
> \end{center}
>
> Does not suffer from misinterpreting new line as argument.

I remember the thread where these issues were discussed and the long
discussion where many alternatives were proposed. After all, the \\[0pt]
solution still seems the safest to me. It seems that the problem is
located only in the verse environment, probably due to some particular
redefinition of the \\ macro that makes that environment.

In any case, square brackets are a problematic character in LaTeX
(think, e.g., of some environment that takes an optional argument). I
think pandoc chooses to always export them as {[}{]}:

#+begin_src sh :results latex
str="[hello world] [foo] [bar]"
pandoc -f org -t latex <<< $str
#+end_src

#+RESULTS:
#+begin_export latex
{[}hello world{]} {[}foo{]} {[}bar{]}
#+end_export

We could do the same, but I'm afraid it's too late if
org-latex-line-break-safe already exists... I don't remember if
something similar was proposed in that discussion, and it was rejected
for some reason.

> `org-latex-verse-block' already has a giant regexp replacement:
>
>   ;; In a verse environment, add a line break to each newline
>   ;; character and change each white space at beginning of a line
>   ;; into a normal space, calculated with `\fontdimen2\font'.  One
>   ;; or more blank lines between lines are exported as a single
>   ;; blank line.  If the `:lines' attribute is used, the last
>   ;; verse of each stanza ends with the string `\\!', according to
>   ;; the syntax of the `verse' package. The separation between
>   ;; stanzas can be controlled with the length `\stanzaskip', of
>   ;; the aforementioned package.  If the `:literal' attribute is
>   ;; used, all blank lines are preserved and exported as
>   ;; `\vspace*{\baselineskip}', including the blank lines before
>   ;; or after CONTENTS.
>
> We may as well strip the trailing \\[0pt] there.

I think it would be best to remove the last \\[0pt] in the verse block.
I can prepare a patch, but I'm afraid that org-latex-verse-block is
becoming an homage to replace-regexp-in-string...

Best regards,

Juan Manuel 





Re: #+LATEX_HEADER: \usepackage[greek,german]{babel} ??

2024-01-16 Thread Ihor Radchenko
Horst Leps  writes:

> #+latex_class: koma-article

This is non-standard.
What is your value of org-latex-classes?

> Makes:
> ...
> \usepackage[germanb]{babel}
> ...
> \usepackage[greek,german]{babel}
> ...
> ---
>
> ! LaTeX Error: Option clash for package babel.
> ---
>
> Only one latex run. Tableofconts Table remains empty.
>
> Supposition:
>
> 1. The Latex source contains {babel} twice, but only once is allowed.

ox-latex tries hard to not duplicate babel. I am unable to reproduce
duplication with your file (but with #+latex_class: koma-article removed)

> 2. There is an error in my Orgmode code because it exports {babel} once 
> too many

Does the problem persist without #+latex_class: koma-article?

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



#+LATEX_HEADER: \usepackage[greek,german]{babel} ??

2024-01-16 Thread Horst Leps

Hi,

--
#+latex_class: koma-article
#+TITLE: Zu einer aktuellen A
#+SUBTITLE: Der Klassiker und einige moderne und aktuelle Texte
#+DATE: \today
#+AUTHOR: HL


#+LATEX_HEADER: \usepackage[utf8]{inputenc}
#+LATEX_HEADER: \usepackage[LGR,T1]{fontenc}
#+LATEX_HEADER: \usepackage[greek,german]{babel}


#+latex: \newpage

 Ach, unsere Freunde die Griechen:


* Otto

Abc

* Emil

Ganz links

-

Makes:

-

% Created 2024-01-16 Tue 20:00
% Intended LaTeX compiler: pdflatex
\documentclass{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{grffile}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage{amssymb}
\usepackage{capt-of}
\usepackage{hyperref}
\usepackage[germanb]{babel}
\usepackage[utf8]{inputenc}
\usepackage[LGR,T1]{fontenc}
\usepackage[greek,german]{babel}
\author{HL}
\date{\today}
\title{Zu einer aktuellen A\\\medskip
\large Der Klassiker und einige moderne und aktuelle Texte}
\hypersetup{
 pdfauthor={HL},
 pdftitle={Zu einer aktuellen A},
 pdfkeywords={},
 pdfsubject={},
 pdfcreator={Emacs 25.3.50.1 (Org mode 9.3.6)},
 pdflang={Germanb}}
\begin{document}

\maketitle
\tableofcontents

\newpage

Ach, unsere Freunde die Griechen:


\section{Otto}
\label{sec:orge3c9696}

Abc

\section{Emil}
\label{sec:org283cbcf}

Ganz links
\end{document}

---

makes:

---

! LaTeX Error: Option clash for package babel.
---

Only one latex run. Tableofconts Table remains empty.

Supposition:

1. The Latex source contains {babel} twice, but only once is allowed.
2. There is an error in my Orgmode code because it exports {babel} once 
too many


Horst



Re: [WORG] Status of "Annotated Bibliography Template" page

2024-01-16 Thread Ihor Radchenko
"Thomas S. Dye"  writes:

>> Thomas, are you still using the described approach or did you 
>> update it
>> to use Org mode's citations? 
>
> Done.

Thanks!

> ... When I pushed my change to the Worg repo, I got an error new 
> to me:
>
> remote: Error submitting build job: A paid account is required to 
> submit builds
> To git.sr.ht:~bzg/worg
>c6d51f7c..c864fe68  master -> master
>
> Let me know if there is anything to do on my side.

This is known - sourcehut now does not trigger WORG build script unless
Bastien or people explicitly granted permission push a new commit.
(We are still investigating the details of this new "feature")

You don't need to do anything.

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



Re: [PATCH] Fix org-agenda-skip-scheduled-if-deadline-is-shown bug

2024-01-16 Thread Ihor Radchenko
Morgan Smith  writes:

> Ihor Radchenko  writes:
>
>> But then `org-agenda-skip-scheduled-if-deadline-is-shown' does not look
>> like the right place for this customization. It would make more sense to
>> have a dedicated custom variable for this. WDYT?
>> ..
> I can't quite remember at this point but I'm pretty sure some
> permutations are impossible with the current setup (like ignoring both
> things that are scheduled today and in the future when the deadline is
> today).

Your statement does not look like something related to my question about
moving 'repeated-after-deadline value to some other (existing or new)
customization.

Or did you mean to provide a generic suggestion about adding more agenda
customizations?

> Regardless, I would like to say: perfect is the enemy of good.  It's a
> little disheartening to see my work to stagnate over this.

Nothing is stagnated. I am just waiting for Bastien to chime in, if he
decides to. He is the person who can provide important context.
We allow up to one month for people to reply on the mailing list.
See https://orgmode.org/worg/org-mailing-list.html#org474747a

> ... If we want
> to rename stuff, great, lets do that.  Otherwise I would appreciate it
> if this work got incorporated.  If nothing else, I would at least like
> to see my test accepted as I believe it is a good regression test.  If
> you would like I can even remove the 'repeated-after-deadline' stuff and
> resubmit it.

I first need to decide what to do and I'd like to gather as much
information as possible (from Bastien or other interested users) before
making the decision. There is no rush to make changes ASAP.

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



Re: [WORG] Status of "Annotated Bibliography Template" page

2024-01-16 Thread Thomas S. Dye

Aloha Ihor,

Ihor Radchenko  writes:

The page 
https://orgmode.org/worg/exporters/anno-bib-template-worg.html

dates back before Org mode had built-in citation support.

Thomas, are you still using the described approach or did you 
update it
to use Org mode's citations? 


Done. When I pushed my change to the Worg repo, I got an error new 
to me:


remote: Error submitting build job: A paid account is required to 
submit builds

To git.sr.ht:~bzg/worg
  c6d51f7c..c864fe68  master -> master

Let me know if there is anything to do on my side.

All the best,
Tom
--
Thomas S. Dye
https://tsdye.online/tsdye



Re: back-end - access to :mode attribute for section and symbol-name

2024-01-16 Thread Ihor Radchenko
Garulfo  writes:

> For "ox-mycontext-section", I try to access the attribute ":mode" of the 
> section
> in order to make the difference between "first-section" and "section".
>
> I had to use "symbol-name" :
>
>     (let*
>    ((section_mode (symbol-name (org-element-property :mode section
>
> Questions :
> 1/ Is it the "org-mode" way to do ?

:mode is an internal property set by the parser. I do not recommend
using it in your code.

Instead, you can check if a section is the first section like

(if (eq 'org-data (org-element-type (org-element-property :parent section)))
  "First section"
 "Ordinary section inside a heading")

or shorter (on the development version of Org mode)

(if (org-element-type-p (org-element-parent section) 'org-data)
  "First section"
 "Ordinary section inside a heading")

> 2/ What should I read to understand why "symbol-name" is needed, whereas 
> usually "org-element-property" just return the appropriate string.

:mode property is set to the parser mode used to parse a given syntax
node. Its value is not a string but a symbol.

>(section_mode (symbol-name (org-element-property :mode section
> (pcase section_mode
>   ("first-section" (concat "%\n% FIRST SECTION\n%\n"))

'first-section symbol is not equal to "first-section" string. You would
need

('first-section ...)

to match symbol without converting it to string manually.

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



Re: [POLL] Any users setting `org-agenda-use-tag-inheritance' to nil or other non-default value?

2024-01-16 Thread Daniel Clemente
> 1. If you customized it to speed up agendas, are agendas still slow on
the latest main?

I disabled org-agenda-use-tag-inheritance but I can't provide a lot of
feedback because I don't use many tag filters:

1. I disabled it in a batch script that exports my agenda, though it
doesn't actually speed up the agenda (even with org-element-use-cache
disabled); I guess it's because the agenda view I'm exporting doesn't do
any filter (in particular, filter by tag).

2. I disabled it in my .emacs, but I guess it has no effect because I also
disabled org-use-tag-inheritance, because I've never needed tag inheritance.

I temporarily enabled org-use-tag-inheritance
and org-agenda-use-tag-inheritance and opened an agenda that filters by tag
(it combines 4 one-tag filters), it seems to run almost as fast; 25 to 26
seconds with tag inheritance enabled, whereas with tag inheritance disabled
it takes around 24 seconds. These are manual measurements which may be 1 or
2 seconds off, so you may want to measure it more precisely; they may take
the same time. Anyway I don't see slowness due to tag inheritance in agenda.


On Thu, 4 Jan 2024 at 17:28, Ihor Radchenko  wrote:

> Hello,
>
> We have a customization `org-agenda-use-tag-inheritance' that controls
> whether agenda searches should use tag inheritance or not.
>
> One of the main motivations to introduce it was that agenda searches
> could become really slow when resolving inherited tags. However,
> inherited tags can now be retrieved very fast, after org-element-cache
> has been enabled by default. At least, it is the theory.
>
> I'd like to hear from the users who customized
> `org-agenda-use-tag-inheritance':
>
> 1. If you customized it to speed up agendas, are agendas still slow on
>the latest main?
>
> 2. If you customized it for other reasons, may you please explain your
>use case?
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 
>
>


Re: [PATCH] Fix org-agenda-skip-scheduled-if-deadline-is-shown bug

2024-01-16 Thread Morgan Smith
Ihor Radchenko  writes:

> But then `org-agenda-skip-scheduled-if-deadline-is-shown' does not look
> like the right place for this customization. It would make more sense to
> have a dedicated custom variable for this. WDYT?
>
> I am adding Bastien to the loop - he authored the original feature
> implementation.

I can't quite remember at this point but I'm pretty sure some
permutations are impossible with the current setup (like ignoring both
things that are scheduled today and in the future when the deadline is
today).

Regardless, I would like to say: perfect is the enemy of good.  It's a
little disheartening to see my work to stagnate over this.  If we want
to rename stuff, great, lets do that.  Otherwise I would appreciate it
if this work got incorporated.  If nothing else, I would at least like
to see my test accepted as I believe it is a good regression test.  If
you would like I can even remove the 'repeated-after-deadline' stuff and
resubmit it.



Re: problem with https://orgmode.org/manual/Results-of-Evaluation.html

2024-01-16 Thread Ihor Radchenko
Uwe Brauer via "General discussions about Org-mode."
 writes:

> Ok understood, but then, who can I add hlines to table that does not
> possess any?

#+name: test
| 1 | 2 |
| 3 | 4 |

#+name: add-hlines
#+begin_src emacs-lisp :var table='(1 2) :results value
(let (result)
  (when table
(unless (eq 'hline (car table)) (push 'hline result))
(while table
  (push (pop table) result)
  (unless (eq 'hline (car result))
(push 'hline result)))
(nreverse result)))
#+end_src


#+begin_src python :var table=test :post add-hlines(table=*this*)
return [[1+x for x in row] for row in table]
#+end_src

#+RESULTS[63f00119cafb9b4a9e762f7f19db5d5c0b215d2d]:
|---+---|
| 2 | 3 |
|---+---|
| 4 | 5 |
|---+---|


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



Re: problem with https://orgmode.org/manual/Results-of-Evaluation.html

2024-01-16 Thread General discussions about Org-mode.
>>> "IR" == Ihor Radchenko  writes:

> Uwe Brauer via "General discussions about Org-mode."
>  writes:

>> #+NAME: many-cols
>> | a | b | c |
>> | d | e | f |
>> | g | h | i |
>> 
>> #+NAME: hline-please
>> #+BEGIN_SRC python :var tab=many-cols :hlines yes
>> return tab
>> #+END_SRC
>> 
>> #+RESULTS: hline-please
>> | a | b | c |
>> | d | e | f |
>> | g | h | i |
>> 
>> Works, but I also hoped that I could use python to add hlines to table
>> without hline, but alas it does not work!

> :hlines controls filtering  from input. It does nothing about code
> block output.

> More specifically, ":hlines no" takes care about removing hlines from
> the input. ":hlines yes" does not perform any filtering.

Ok understood, but then, who can I add hlines to table that does not
possess any?
-- 
I strongly condemn Hamas heinous despicable pogroms/atrocities on Israel
I strongly condemn Putin's war of aggression against Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the EU and NATO membership of Ukraine. 



smime.p7s
Description: S/MIME cryptographic signature


Re: [PATCH] Set Python shell in Org edit buffer

2024-01-16 Thread Jack Kamm
Ihor Radchenko  writes:

>> My concern is that advising `ess-request-a-process' would cause
>> maintenance burden on ob-R. It would require some knowledge about the
>> ESS internals to maintain properly.
>
> Not really. I only meant writing an advice iff our request is accepted
> by ESS devs. Then, all we need is to advice the earlier versions of ESS
> and remove the advice after the new ESS release (we only support the
> latest release of the optional third-party packages:
> https://orgmode.org/worg/org-maintenance.html#emacs-compatibility). No
> changes to advice will be needed in future.
>
> I plan to propose a patch for ESS soon and see if it is going to be
> accepted.

In that case, this sounds great. Hope the ESS devs are receptive!



[POLL] Change calling convention for when `org-link-file-path-type' is set to custom function (was: Enhancement Proposal for 'org-link-file-path-type' Behavior)

2024-01-16 Thread Ihor Radchenko
西 顾  writes:

> I'd like to suggest a small enhancement to the
> 'org-link-file-path-type' option. When set to 'function', it currently
> passes an absolute path to the user's custom function. This limits
> flexibility as the original path input is not available to the
> function.
>
> For better customization, I propose passing the raw path to the
> function. Users needing an absolute path could use 'expand-file-name'
> within their function.

Thanks for the suggestion!

This makes sense - the current approach with passing absolute path is
indeed limiting the information passed to the custom function.

The docstring is also quite ambiguous about what is passed as an
argument:

org-link-file-path-type is a customizable variable defined in ol.el.
<...>
Alternatively, users may supply a custom function that takes the
full filename as an argument and returns the path.

"full filename" may or may not mean "absolute filename".

However, changing the absolute path to "as is" path will technically be
breaking.

I cannot find any actual uses of custom function value for
`org-link-file-path-type' in the wild, so I am leaning towards going
ahead with this (minor) breaking change.

Yet, I am starting a poll to give users who may be affected a chance to
chime in.

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



Re: [FR] 'org-columns-next-allowed-value' for 'summary-checkbox'es functions should have 'intermediate state' '[-]'

2024-01-16 Thread Ihor Radchenko
Ihor Radchenko  writes:

>> What do you think?
>
> I think that your use-case is not necessarily common enough to change
> the defaults. But we can introduce a defcustom here. Patches welcome!

Sławomir, would you be interested to submit a patch here?

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



Re: Suggestion for org-agenda-list: pre-open org-agenda-files

2024-01-16 Thread Ihor Radchenko
Ihor Radchenko  writes:

> So, may you dig a bit further and check why `org-agenda-prepare' is not
> opening the agenda files?

A gentle ping :)

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



Re: [possible patch] Remove the '\\[0pt]' string from the last line of a verse block in LaTeX export

2024-01-16 Thread Ihor Radchenko
Juan Manuel Macías  writes:

>>> If I'm not mistaken, in TeX '\\' can only be used in horizontal mode:
>>> that is, within a paragraph. At the end of an environment like verse
>>> (\end{verse}) you are forced to enter vertical mode, and a new paragraph
>>> starts.
>>
>> Is it true for any environment? Or just some?
>
> In principle, nothing prevents one from defining an environment for use
> in horizontal mode (within the paragraph). E.g.:
> ...
> But the usual thing is that the beginning/end of an environment changes to
> vertical mode, with \par or something more elaborate.

This is annoying.
ox-latex has some transcoders that unconditionally add \\ at the
end: clocks and planning lines. If they happen to be at the end of an
environment, it can be problematic.

> hmm... I don't know if this should be considered a bug. We may think
> that \\[0pt] should never do anything, but we must keep in mind that the
> end of the verse environment is the end of a paragraph, and it changes
> to vertical mode. And the end of a paragraph is an illogical place to
> put that command. But it seems that it also alters things when it is at
> that point. Check out this reply from David Carlisle
> (https://tex.stackexchange.com/a/82666):

The very reason we use \\[0pt] is because it supposed to prevent
interpreting [...] at the new line/transcoded element as argument.

You demonstrated that it is yet not always safe enough.

May it be better to use something like

\newcommand\nothing{}
\newcommand{\safenewline}{\\\nothing}

And then use \safenewline instead of \\[0pt]

In my tests,

\begin{center}
\begin{tabular}{ll}
[t] & s\safenewline
[I] & A\safenewline
[m] & kg\safenewline
\end{tabular}
\end{center}

Does not suffer from misinterpreting new line as argument.

> If there are environments that redefine \\, such as verse or tabular,
> probably putting the optional argument of \\ with a value of 0pt at the
> end of verse alters the calculation of the normal space after the
> environment, making it shorter. I think that here we would not have a
> LaTeX bug, because the syntax of the verse environment itself says that
> the last line should not carry any \\ mark. 

AFAIU, \safenewline should still use re-defined version of \\ according
to the context.

> At the end of the tables I have not noticed any side effects. But in the
> export of the verse block, I would be in favor of somehow eliminating
> that last \\[0pt].

`org-latex-verse-block' already has a giant regexp replacement:

  ;; In a verse environment, add a line break to each newline
  ;; character and change each white space at beginning of a line
  ;; into a normal space, calculated with `\fontdimen2\font'.  One
  ;; or more blank lines between lines are exported as a single
  ;; blank line.  If the `:lines' attribute is used, the last
  ;; verse of each stanza ends with the string `\\!', according to
  ;; the syntax of the `verse' package. The separation between
  ;; stanzas can be controlled with the length `\stanzaskip', of
  ;; the aforementioned package.  If the `:literal' attribute is
  ;; used, all blank lines are preserved and exported as
  ;; `\vspace*{\baselineskip}', including the blank lines before
  ;; or after CONTENTS.

We may as well strip the trailing \\[0pt] there.

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



Re: [PATCH] Set Python shell in Org edit buffer

2024-01-16 Thread Ihor Radchenko
Jack Kamm  writes:

>>> Currently I lean towards a combination of #1 and #3, but am not sure,
>>> and happy to go with whatever you think is best.
>>
>> We can also advice `ess-request-a-process' as a temporary workaround.
>
> My concern is that advising `ess-request-a-process' would cause
> maintenance burden on ob-R. It would require some knowledge about the
> ESS internals to maintain properly.

Not really. I only meant writing an advice iff our request is accepted
by ESS devs. Then, all we need is to advice the earlier versions of ESS
and remove the advice after the new ESS release (we only support the
latest release of the optional third-party packages:
https://orgmode.org/worg/org-maintenance.html#emacs-compatibility). No
changes to advice will be needed in future.

I plan to propose a patch for ESS soon and see if it is going to be
accepted.

> Reading through `ess-request-a-process' is rather daunting, and it
> doesn't look straightforward to patch it to behave as we want. I think
> the reason is because ESS allows you to call `rename-buffer' on the
> inferior R session, and still have it remain associated with its editing
> buffers. Which is quite a different model than the way python.el works.

We can simply let-bind `ess-process-name-list' to alter what
`ess-request-a-process' returns. I do not see major problems here.

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



Re: [PATCH] testing: Delete duplicate tests

2024-01-16 Thread Ihor Radchenko
Ilya Chernyshov  writes:

> There's a lot of tests to change before merging. I'll handle them and
> submit a new patch if you have no questions about the code.

It has been a while since the last update in this thread.
Ilya, do you need any help with the patch?

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



Re: Should org-link-parser add type "file" when link has no "file:" prefix?

2024-01-16 Thread Ihor Radchenko
Joseph Turner  writes:

>>> I'd like for users to be able to take an existing directory of Org mode
>>> documents and copy them all into a hyperdrive.  I think the least
>>> surprising behavior is for the links between those files to continue
>>> working.  Perhaps the best option is for hyperdrive.el to make all "file"
>>> type links, explicit or not, point to other files inside the hyperdrive?
>>>
>>> In that case, there would be no way for Org mode files in a hyperdrive
>>> to point to the local filesystem.  Similarly, when Org documents are
>>> exported to HTML, there's no way to export .
>>
>> May you please elaborate? How is hyperdrive directory different from
>> local directory?
>
> On disk, hyperdrive data is stored by hash prefixes like so:
>
> /home/joseph/.local/share/hyper-gateway-nodejs/cores/
> └── 00
> ...
> This is similar to the way .git/objects/ directories are structured.
> ...
> Does that answer your question?

Not really.
May you please provide an example with an Org file containing file links
and how you envision to transform them? Will they be transformed
depending on the directory the Org file is located in?

>>> (org-element-property :search-option link)
>>
>> :follow functions are passed both path and search option.
>
> How is the search option passed in?
>
> IIUC in org-link-open, the path argument passed in has no search option:
>
> (funcall (org-link-get-parameter type :follow) path arg)

You are right.
What we can do then is pass an extra argument to :follow function - the
link object. That way, :follow function can get all the information it
needs.

> By the way, I think this minor improvement could be made at the bottom
> of org-link-open:
>
> From 0c83446f16441df39618e43f964e18f672205d55 Mon Sep 17 00:00:00 2001
> From: Joseph Turner 
> Date: Mon, 15 Jan 2024 00:24:30 -0800
> Subject: [PATCH] lisp/ol.el (org-link-open): Use let-bound :follow function

Thanks!
Applied, onto main; I added TINYCHANGE cookie to the commit message.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=0254854ee

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



Re: [PATCH] org-babel-demarcate-block: split using element API

2024-01-16 Thread Ihor Radchenko
gerard.vermeu...@posteo.net writes:

>>> 1 unexpected results:
>>>FAILED  test-ob/demarcate-block  ((should (string= region-text
>>> (org-trim (nth 1 info :form (string= "mark this line as region"
>>> "") :value nil :explanation (arrays-of-different-length 24 0 "mark
>>> this line as region" "" first-mismatch-at 0))
>> 
>> This is a tough lesson: the tests pass always on my system.
>> 
>> I think the failure you see is related to a problem marking a region
>> in my test code (wish: support in `org-test-with-temp-text' for
>> "" besides "", but maybe that depends on ERT), else
>> the problem would have shown up while testing the patch interactively.
>> 
>> I think that I have improved my region marking code by using ""
>> in the temp-text as a start. Then, I only have to find where to set 
>> mark,
>> and eventually exchange point and mark.

Still failing on my side (when running tests non-interactively from
command line). To fix the problem, please use the approach from
`test-org-list/indent-item':

(transient-mark-mode 1)
(push-mark (point) t t)

Instead of (set-mark-command nil)


> +  ;; Map positions to columns for white-space padding.
> +  (setq pads (mapcar (lambda (p) (save-excursion
> +   (goto-char p)
> +   (current-column)))
> + pads))

This will break when the region does not start near the beginning of
line or does not end there:

#+begin_src emacs-lisp
  '(1 2 3)
  '(1 2 3)
#+end_src

Also, the indentation of source code inside src block should not be used
to indent the whole block. This is because it may be additionally
indented according to `org-edit-src-content-indentation'. If you want to
preserve the original indentation, just use
`org-current-text-indentation' at the beginning of the src block.

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



Re: [PATCH] ob-shell: consistent prefix

2024-01-16 Thread Ihor Radchenko
Matt  writes:

> The attached patch makes names in ob-shell.el use the same prefix
> "org-babel-shell-" (along with a few similar minor consistency
> updates).
>
> Without the patch, three naming conventions exist:
>
> - org-babel-shell
> - org-babel-sh
> - ob-shell <- that's my fault :)
> ...
> The  current "sh" names are generic and not specific to "/bin/sh" or
> something like the Bourne Shell.  The patch updates all "sh" names
> to "shell".

I do not mind changing the names, except that we must not break
backwards compatibility. In particular, the non-private function and
variable names that were present in the latest Org stable release must
be either supplied with an alias or declared obsolete. Otherwise, the
third-party code using the old names will be broken.

It is ok to change the variable names when the variables are introduced
within current main branch and not yet released.

Further, some function names are not arbitrary, but are instead dictated
by the rules ob-core.el demands from the babel backends. The following
variable and function names are special and must be named specifically
by babel backends:

- org-babel-default-header-args:
- org-babel-execute:
- org-babel-expand-body:
- org-babel-variable-assignments:
- org-babel-header-args:
- org-babel-load-session:
- org-babel--initiate-session
- org-babel-prep-session:
- org-babel-edit-prep:
- org-babel--associate-session

> -(defun org-babel-variable-assignments:shell (params)
> +(defun org-babel-shell-variable-assignments:shell (params)

This will break ob-shell as we change the expected function name from
the above list.

> -(defun org-babel-sh-initiate-session ( session _params)
> +(defun org-babel-shell-initiate-session ( session _params)

In theory, this should still work because `org-babel-shell-initialize'
create aliases to define multiple babel backends, for each shell name in
`org-babel-shell-names'. However, no alias is created for
`org-babel--initiate-session' in particular, which is probably a
bug.

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



Re: Basic citations: bugs with citation objects with multiple keys, prefixes, suffixes

2024-01-16 Thread Ihor Radchenko


William Denton  writes:
> I'm figuring out complex citation objects with prefixes and suffixes and 
> multiple keys, and found that not all styles export properly (from what I 
> understand).  Here's an Org file that runs through all the citation styles 
> (the Basic.bib is below).  Each citation object has a global prefix 
> ("Citing") and global suffix ("is duplication") and the second citation has a 
> local prefix ("and") and local suffix ("also").
> ...
> Export that and you will see some bugs.  Default, nocite and numeric look 
> correct, but author and noauthor are missing all the surrounding text (I 
> don't see anything in oc-basic.el about why it shouldn't be there), and in 
> note and text "also" should be outside the brackets.

Fixed, on main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=e6e8f0933
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=87da1ff15

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



Enhancement Proposal for 'org-link-file-path-type' Behavior

2024-01-16 Thread 西 顾
Dear Org mode maintainers,

I'd like to suggest a small enhancement to the 'org-link-file-path-type' 
option. When set to 'function', it currently passes an absolute path to the 
user's custom function. This limits flexibility as the original path input is 
not available to the function.

For better customization, I propose passing the raw path to the function. Users 
needing an absolute path could use 'expand-file-name' within their function.

Thank you for your time and consideration.

Best,
Ref


Re: [PATCH] ox-latex.el: Fix the case of latex-caption-above t

2024-01-16 Thread Ihor Radchenko
Mads Bach Villadsen  writes:

> The documentation for `org-latex-caption-above’ seems to imply that it can be 
> set to a non-nil value to always place captions at the start of environments, 
> instead of the end. However, with a non-nil value which is not a sequence, 
> exporting something like the following from org causes an error:

Thanks for reporting!
Fixed, on main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=d51723102
I used a different approach to fix the problem.
Canceled; (patch)

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