[BUG] org-clock-sum: Wrong type argument: fixnump, nil [9.7-pre (release_9.6.22-1309-g8507ef @ /home/grfz/src/org-mode/lisp/)]

2024-03-23 Thread Gregor Zattler
Dear org-mode developers, Ihor, 

the following is with GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, cairo 
version 1.16.0)
 of 2024-02-27

with point on the following frame for a clock table:

#+BEGIN: clocktable :scope ("/home/absolute/path/file.org_archive")
#+END:

org-clock-report with

emacs -Q

(that is, with Org mode version 9.6.15 (release_9.6.15 @ 
/home//src/emacs-master--32b4f9d21b14190f1ed1611515751abe4b90fa68--2024-02-27T09-36+01-00/lisp/org/)

produces a nice clock report table.

If instead I use a very fresh org-mode from main, specifically

Org mode version 9.7-pre (release_9.6.22-1309-g8507ef @ 
/home//src/org-mode/lisp/)

like so:

emacs -L ~/src/org-mode/lisp -L ~/src/org-mode/contrib/lisp -Q

org-clock-report

with point on said frame of a clock table produces

Updating dynamic block ‘clocktable’ at line 13...
org-clock-sum: Wrong type argument: fixnump, nil


file.org_archive has 2376 clock lines.

The problem does not occur with file.org which has
only 86 clock lines.  I especially archive the nodes
with clock lines, because or performance reasons.


Doing a git bisect produced:

2e901ed23667b04642847701bae2070862b8ee6e is the first bad commit
commit 2e901ed23667b04642847701bae2070862b8ee6e
Author: Ihor Radchenko 
Date:   Fri Feb 3 15:08:18 2023 +0300

org-clock-sum: Optimize performance

* lisp/org-clock.el (org-clock-sum): Do not re-parse the timestamps,
reusing already-parser element.

 lisp/org-clock.el | 29 +
 1 file changed, 21 insertions(+), 8 deletions(-)


I cannot disclose said file, because it contains loads
of sensitive data.  I extracted the clock lines only,
but a single node with a LOGBOOK drawer filled with
this clock lines does not trigger the bug.  But I would
be happy to test a patch on my file.org to test it (or
help otherwise).


HTH, Gregor



Re: Presenting Hyperorg version 0.1.0: The Org to HTML Converter

2024-03-23 Thread c.buhtz
On 2024-03-23 13:58 Ihor Radchenko  wrote:
> Although I am actually more interested in other questions -
> why custom parser and what is tailored for zettelkasten.

What do you mean by "custom parser"?

Zettelkasten? Hyperorg handles the links between nodes out of the box
including the backlinks. It also creates an index (nodes sorted by
title, tags, etc pp).

Of course with Emacs is everything possible even Coffee making. But the
difference are the resources you have to invest into configure it. This
is much even if you know Lisp.




Re: [DISCUSSION] Add "Recent News" to orgmode.org

2024-03-23 Thread Bastien Guerry
Ihor Radchenko  writes:

> It looks like there is some problem with publishing index.org in
> particular. I made several changes, but none of them is visible on
> orgmode.org. At the same time, my changes to tools.org page are
> visible.

Yes -- perhaps this error has something to do with this:
https://builds.sr.ht/~bzg/job/1176324#task-build-41

-- 
 Bastien Guerry



Re: [bug] Smart quotes: confusion of apostrophe with second level quotes

2024-03-23 Thread Juan Manuel Macías
Ihor Radchenko writes:

> We may introduce \apostrophe entity.
>
> "two articles: 'my friends\apostrophe party' and 'the students\apostrophe 
> papers'"
>
> "A Greek folk song says: \apostrophe{}να \apostrophe{}ρθώ το βράδυ'"

It's not a bad idea to use entities. I just discovered that an \rsquo
entity already exists. Right single quotation mark is the Unicode
recommended character for the apostrophe, and it is also the character
used in org-export-smart-quotes-alist[1].

Anyway, I think a) your patch could be a major improvement; b) perhaps a
brief note in the manual (I can send a tiny patch) should be added to
warn of possible ambiguities, and possible solutions.

[1] Although there are arguments against this Unicode recommendation,
see: https://en.wikipedia.org/wiki/Right_single_quotation_mark



Re: [Worg] CSS improvements

2024-03-23 Thread Ihor Radchenko
Adam Porter  writes:

> (@media all .org-center): Actually style this so that "#+begin_center"
> blocks are centered and fit with the rest of the theme, allowing these
> blocks to be used to make certain text stand out.

I am not sure if centered text should stand out.
AFAIU, you want to add this style for the sole purpose of highlighting

#+begin_center
"Should I use one big Org file or many small ones?"
#+end_center

FYI, we usually do

: "Should I use one big Org file or many small ones?"

to make text stand out.

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



Re: [PATCH] Run latex more than once for LaTeX src block evaluation

2024-03-23 Thread Ihor Radchenko
Michael  writes:

>> May you please describe a use case when it is necessary to run 
>> latex
>> multiple times for previews?
> ...
> Oh-- and it's not just previews (sorry if I gave that
> impression)-- it's also required for "evaluating" LaTeX source
> blocks.

This makes more sense. I hardly imagine previews that will require
running latex multiple times. Such previews would be broken anyway,
because they have no access to the document context.

May you please add a code comment explaining why multiple invocations
are needed, referring to ob-latex? Also, please link to this thread form
the commit message. Finally, you may need to add TINYCHANGE cookie at
the bottom of the commit message if you do not have FSF copyright
assignment (see https://orgmode.org/worg/org-contribute.html#first-patch)

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



[Worg] CSS improvements

2024-03-23 Thread Adam Porter

Hi Bastien, et al,

Please see the attached patch which makes some minor improvements to 
Worg's CSS.  I thought I should get your approval before pushing it.


Thanks,
AdamFrom ab068940b5e63189dae3eddae84aaa2b03d6b6ef Mon Sep 17 00:00:00 2001
From: Adam Porter 
Date: Sat, 23 Mar 2024 09:31:18 -0500
Subject: [PATCH] * style/worg.css: Minor improvements

(@media all body .title): Specify font size in ems.

(@media all h1): Slightly reduce bottom margin so as not to leave a
large space between the title and subtitle.

(@media all .subtitle): Actually style this (apparently few pages use
subtitles yet).

(@media all .org-center): Actually style this so that "#+begin_center"
blocks are centered and fit with the rest of the theme, allowing these
blocks to be used to make certain text stand out.
---
 style/worg.css | 16 ++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/style/worg.css b/style/worg.css
index 30cadb1b..a675ac5b 100644
--- a/style/worg.css
+++ b/style/worg.css
@@ -61,7 +61,7 @@
 
 body .title {
 	margin-left: 0px;
-	font-size: 22pt;
+	font-size: 2.5em;
 }
 
 #org-div-home-and-up{
@@ -120,7 +120,7 @@
 }
 
 h1 {
-	margin-bottom: 1.5em;
+	margin-bottom: 1em;
 	margin-right: 7%;
 }
 
@@ -315,6 +315,10 @@
 	/* font-lock-string-face */
 	color: #ccc79a;
 }
+.subtitle {
+	font-size: 1.5em;
+	font-style: italic;
+}
 .todo-comment {
 	/* todo-comment-face */
 	color: #ff;
@@ -422,6 +426,14 @@
 	/* calendar-today */
 	text-decoration: underline;
 }
+.org-center {
+	text-align: center;
+	margin-top: 1em;
+	margin-bottom: 1em;
+	background: #587e7226;
+	padding-top: 0.2em;
+	padding-bottom: 0.2em;
+}
 .org-comment {
 	/* font-lock-comment-face */
 	color: #b2;
-- 
2.30.2



Re: Small patch: add \usepackage{iftex} when exporting to LaTeX

2024-03-23 Thread Ihor Radchenko
Pedro Andres Aranda Gutierrez  writes:

> attached is a small patch to include package iftex to latex exports. Since
> we support several
> compilers, it is useful to have this package to detect the compiler in
> included latex files.

May you please explain why it is necessary to include iftex in _all_
latex exports? AFAIK, none of the commands provided by this package are
used by ox-latex.

> +*** Added package ~iftex~ when exporting LaTeX documents
> +
> +When exporting LaTeX documents, add =\usepackage{iftex}= at the
> +beginning. Since we support several compilers, the user might
> +need to detect which one if active in supporting personal TeX
> +customisation code.

We generally do not add packages unless they are strictly necessary for
the export.

Also, iftex is not compatible with scrbase, so the proposed change can
be harmful.

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



Re: [DISCUSSION] Add "Recent News" to orgmode.org

2024-03-23 Thread Ihor Radchenko
Bastien Guerry  writes:

>> Also, what do you think about the following ideas:
>>
>> 1. Adding a header before the recent news list. Maybe something like
>>"Project heartbeat".
>>
>> 2. Moving recent news after features/install/quickstart/contribute
>>buttons.
>
> Yes, please go as you see fit.

It looks like there is some problem with publishing index.org in
particular. I made several changes, but none of them is visible on
orgmode.org. At the same time, my changes to tools.org page are visible.

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



Re: [PATCH][DOC]: Add footnote on how to enable described functionality

2024-03-23 Thread Ihor Radchenko
Nick Dokos  writes:

> But there is still a doc bug: since the default value of
> `org-html-head-include-scripts' was changed to `nil' in Org 9.5, the
> functionality described in the `Literal Examples' section of the manual
> is no longer enabled by default. The attached patch adds a footnote to
> describe how to enable that functionality. Thanks to user @JeanPierre on
> Emacs SE for the original question and the push for the doc patch:

Thanks!
Applied, onto bugfix, after fixing minor formatting issues with the
commit message.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=01b540e21

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



Re: [BUG] Prompt appears in async shell results

2024-03-23 Thread Ihor Radchenko
Matt  writes:

> I saw no comments on the patch part of my previous message and fear it may 
> have been missed due to my inclusion of the lengthy and separate topic, "bug? 
> org-babel-comint-with-output return value type".
>
> The patches fix the prompt appearing in async shell results and are ready to 
> go, barring the concern I have about being unable to test how the fix may 
> affect non-shell languages.

Yup. Tests are passing on my side as well, and I had no comments.
So, we are waiting for other interested users to test.
For at least a week, so that people who check the mailing list on
weekend have a chance to see the request.

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



Re: [Worg] Keep table of contents visible in wide viewports?

2024-03-23 Thread Ihor Radchenko
Adam Porter  writes:

> Looking at Worg now, it occurred to me that, when my browser window is 
> maximized, there's plenty of room for the table of contents to remain 
> visible alongside the content.  But it's hidden automatically, and 
> remains hidden until the user interacts with it, which seems suboptimal 
> for an intra-page table of contents.
>
> Could we modify it to keep the ToC visible when the window is wide 
> enough?  I think that would be a big usability improvement.  WDYT?

The current TOC style is indeed not ideal.
See https://list.orgmode.org/orgmode/87mteh4d0b.fsf@localhost/
If you can work towards improving TOC in Worg, it would be welcome.

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



Re: Presenting Hyperorg version 0.1.0: The Org to HTML Converter

2024-03-23 Thread Ihor Radchenko
 writes:

> On 2024-03-20 13:09 Ihor Radchenko  wrote:
>> May you outline the benefits
>
> Now I added a section about that topic. Of course I am open for
> discussion and feedback.
>
> https://codeberg.org/buhtz/hyperorg#benefits-compared-to-similar-tools

Thanks! Although I am actually more interested in other questions - why
custom parser and what is tailored for zettelkasten.

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



[Worg] Keep table of contents visible in wide viewports?

2024-03-23 Thread Adam Porter

Hi,

Looking at Worg now, it occurred to me that, when my browser window is 
maximized, there's plenty of room for the table of contents to remain 
visible alongside the content.  But it's hidden automatically, and 
remains hidden until the user interacts with it, which seems suboptimal 
for an intra-page table of contents.


Could we modify it to keep the ToC visible when the window is wide 
enough?  I think that would be a big usability improvement.  WDYT?


--Adam



Re: Worg build status?

2024-03-23 Thread Adam Porter

Hi Bastien,

On 3/22/24 16:13, Bastien Guerry wrote:

Ihor Radchenko  writes:


This is still a problem. Likely on Sourcehut side.


Yes, I haven't received an answer from sr.ht yet, too bad.


For now, only Bastien can trigger the builds.


In the meantime, I've set up a cron job to publish Worg every 12
hours, this is not entirely satisfactory, just a bit better.


Thanks, that's a big improvement.  Happy to see the new page I added 
published so I can link to it on r/orgmode.  :)


--Adam



Re: Presenting Hyperorg version 0.1.0: The Org to HTML Converter

2024-03-23 Thread c.buhtz
On 2024-03-20 13:09 Ihor Radchenko  wrote:
> May you outline the benefits

Now I added a section about that topic. Of course I am open for
discussion and feedback.

https://codeberg.org/buhtz/hyperorg#benefits-compared-to-similar-tools



Re: [bug] Smart quotes: confusion of apostrophe with second level quotes

2024-03-23 Thread Ihor Radchenko
Juan Manuel Macías  writes:

> The patch works fine, and I think it can prevent a lot of cases. But
> false positives can still appear. Consider (second level quotes open
> after the colon):
>
> "two articles: 'my friends' party' and 'the students' papers'"
>
> "A Greek folk song says: 'να 'ρθώ το βράδυ'"
>
> ==>
>
> \guillemotleft{}two articles: ``my friends'' party' and ``the students'' 
> papers'\guillemotright{}
>
> \guillemotleft{}A Greek folk song says: 'να ``ρθώ το βράδυ''\guillemotright{}

These are not false-positives, but ambiguity. There is no deterministic
way in this scenario to distinguish between apostrophe and smart quotes.

> I think the only solution here would be to introduce a Unicode
> apostrophe (’). Or allow an optional, alternative character for
> second-level quotes:
>
> "... `my friends' party` ..."

We may introduce \apostrophe entity.

"two articles: 'my friends\apostrophe party' and 'the students\apostrophe 
papers'"

"A Greek folk song says: \apostrophe{}να \apostrophe{}ρθώ το βράδυ'"

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



Re: [bug] Smart quotes: confusion of apostrophe with second level quotes

2024-03-23 Thread Juan Manuel Macías
Ihor Radchenko writes:

> Juan Manuel Macías  writes:
>
>>   ━━━
>>   #+OPTIONS: ':t
>>   #+language:es
>>
>>   "my friends' party and the students' papers"
>>   ━━━
>>
>> the above produces in LaTeX:
>>
>>   \guillemotleft{}my friends'' party and the students'' 
>> papers\guillemotright{}
>> ...
>> Perhaps a possible solution would be to allow the use of a specific,
>> customizable character, other than an apostrophe, for second-level
>> quotes. Or at least add some brief warning in the manual: in certain
>> contexts it is safer to use a explicit Unicode character for the
>> apostrophe.
>
> I think that we can address examples like this simply by not replacing
> unbalanced quotes. There is already some effort in the code towards such
> treatment, but it is not complete.
>
> Can you try the attached patch?

Hi, Ihor,

The patch works fine, and I think it can prevent a lot of cases. But
false positives can still appear. Consider (second level quotes open
after the colon):

"two articles: 'my friends' party' and 'the students' papers'"

"A Greek folk song says: 'να 'ρθώ το βράδυ'"

==>

\guillemotleft{}two articles: ``my friends'' party' and ``the students'' 
papers'\guillemotright{}

\guillemotleft{}A Greek folk song says: 'να ``ρθώ το βράδυ''\guillemotright{}

I think the only solution here would be to introduce a Unicode
apostrophe (’). Or allow an optional, alternative character for
second-level quotes:

"... `my friends' party` ..."


Re: [bug] Smart quotes: confusion of apostrophe with second level quotes

2024-03-23 Thread Ihor Radchenko
Juan Manuel Macías  writes:

>   ━━━
>   #+OPTIONS: ':t
>   #+language:es
>
>   "my friends' party and the students' papers"
>   ━━━
>
> the above produces in LaTeX:
>
>   \guillemotleft{}my friends'' party and the students'' 
> papers\guillemotright{}
> ...
> Perhaps a possible solution would be to allow the use of a specific,
> customizable character, other than an apostrophe, for second-level
> quotes. Or at least add some brief warning in the manual: in certain
> contexts it is safer to use a explicit Unicode character for the
> apostrophe.

I think that we can address examples like this simply by not replacing
unbalanced quotes. There is already some effort in the code towards such
treatment, but it is not complete.

Can you try the attached patch?

>From 4a034fbb0029ca7e635f629810a6179df4ca24d9 Mon Sep 17 00:00:00 2001
Message-ID: <4a034fbb0029ca7e635f629810a6179df4ca24d9.1711193777.git.yanta...@posteo.net>
From: Ihor Radchenko 
Date: Sat, 23 Mar 2024 14:34:06 +0300
Subject: [PATCH] org-export: Do not treat unpaired ' and " as smart quotes
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* lisp/ox.el (org-export--smart-quote-status): When quotes are not
balanced, treat " literally and ' as apostrophes.
* testing/lisp/test-ox.el (test-org-export/activate-smart-quotes): Fix
test with unbalanced " and add new tests for unbalanced quotes.

Reported-by: Juan Manuel Macías 
Link: https://list.orgmode.org/orgmode/875xxfqdpt@posteo.net/
---
 lisp/ox.el  | 45 +
 testing/lisp/test-ox.el | 29 --
 2 files changed, 72 insertions(+), 2 deletions(-)

diff --git a/lisp/ox.el b/lisp/ox.el
index 929b306dc..539d31d9d 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -5942,6 +5942,51 @@ (defun org-export--smart-quote-status (s info)
 	  (when current-status
 		(push (cons text (nreverse current-status)) full-status
 	  info nil org-element-recursive-objects)
+;; When quotes are not balanced, threat them as apostrophes.
+(setq full-status (nreverse full-status))
+(let (primary-openings secondary-openings)
+  (dolist (substatus full-status)
+(let ((status (cdr substatus)))
+  (while status
+(pcase (car status)
+  (`apostrophe nil)
+  (`primary-opening
+   (push status primary-openings))
+  (`secondary-opening
+   (push status secondary-openings))
+  (`secondary-closing
+   (if secondary-openings
+   ;; Remove matched opening.
+   (pop secondary-openings)
+ ;; No matching openings for a given closing.  Replace
+ ;; it with apostrophe.
+ (setcar status 'apostrophe)))
+  (`primary-closing
+   (when secondary-openings
+ ;; Some secondary opening quotes are not closed
+ ;; within "...".  Replace them all with apostrophes.
+ (dolist (opening secondary-openings)
+   (setcar opening 'apostrophe))
+ (setq secondary-openings nil))
+   (if primary-openings
+   ;; Remove matched opening.
+   (pop primary-openings)
+ ;; No matching openings for a given closing.
+ (error "This should no happen"
+(setq status (cdr status)
+  (when primary-openings
+;; Trailing unclosed "
+(unless (= 1 (length primary-openings))
+  (error "This should not happen"))
+;; Mark for not replacing.
+(setcar (car primary-openings) nil)
+;; Mark all the secondary openings and closings after
+;; trailing unclosed " as apostrophes.
+(let ((tail (car primary-openings)))
+  (while tail
+(when (memq (car tail) '(secondary-opening secondary-closing))
+  (setcar tail 'apostrophe))
+(setq tail (cdr tail))
 	(puthash (cons parent (org-element-secondary-p s)) full-status cache)
 	(cdr (assq s full-status))
 
diff --git a/testing/lisp/test-ox.el b/testing/lisp/test-ox.el
index 01e082c9b..16e81c64b 100644
--- a/testing/lisp/test-ox.el
+++ b/testing/lisp/test-ox.el
@@ -4134,9 +4134,9 @@ (ert-deftest test-org-export/activate-smart-quotes ()
   ;; Opening quotes: at the beginning of a paragraph.
   (should
(equal
-'("begin")
+'("begin")
 (let ((org-export-default-language "en"))
-  (org-test-with-parsed-data "\"begin"
+  (org-test-with-parsed-data "\"begin\""
 	(org-element-map tree 'plain-text
 	  (lambda (s) (org-export-activate-smart-quotes s 

Re: [BUG] Prompt appears in async shell results

2024-03-23 Thread Matt
Friendly bump.

I saw no comments on the patch part of my previous message and fear it may have 
been missed due to my inclusion of the lengthy and separate topic, "bug? 
org-babel-comint-with-output return value type".

The patches fix the prompt appearing in async shell results and are ready to 
go, barring the concern I have about being unable to test how the fix may 
affect non-shell languages.

>   On Mon, 19 Feb 2024 12:07:55 +0100  Ihor Radchenko  wrote ---
>  > Matt m...@excalamus.com> writes:
>  >
>  > > - Split prompt filtering and input echoing into two filters
>  > >   + this seems to imply a =-hook= or =-functions= type implementation
>  >
>  > Not necessarily. You may just split the filter into (1) prompt
>  > remover; (2) body remover. The filter does not need to interact with
>  > comint buffer and may simply be provided a regexp/string to be removed.
>  > Then, the caller will be responsible to supply prompt regexp/body.
> 
> Attached are patches which split the prompt and echo filtering into separate 
> functions.  These are then used to refactor =org-babel-comint-with-output= 
> and to remove the prompt from async results.  I also wrote tests, one for the 
> reported bug and two for the filter functions.  Tests for the filter 
> functions are in a new file, 'test-ob-comint.el'.
> 
> Two thoughts:
> 
> 1. Can people please test that the changes to =org-babel-comint-with-output= 
> haven't broken other languages?
> 
> The filter, which I extracted from =org-babel-comint-with-output=, works 
> according to the test I wrote.  The test is based on ob-shell output.  
> However, =org-babel-comint-with-output= is used by other languages.  I wasn't 
> sure if echoes showed up for other languages and I had no examples from other 
> languages to work from.  The filter is untested for anything but shell, aside 
> from running 'make test' (which returns no unexpected errors).  If no echo 
> argument is given, the filter simply returns the string it would otherwise 
> try to remove the echo from.  So, I suspect the worst outcome would be that 
> echoes might start showing up in output.  But when have my predictions ever 
> been right? :)

--
Matt Trzcinski
Emacs Org contributor (ob-shell)
Learn more about Org mode at https://orgmode.org
Support Org development at https://liberapay.com/org-mode



0001-testing-lisp-test-ob-comint.el-Make-test-for-prompt-.patch
Description: Binary data


0002-lisp-ob-comint.el-Create-comint-prompt-filter.patch
Description: Binary data


0003-testing-lisp-test-ob-comint.el-Make-test-for-echo-fi.patch
Description: Binary data


0004-lisp-ob-comint.el-Create-comint-echo-filter.patch
Description: Binary data


0005-lisp-ob-comint.el-Refactor-org-babel-comint-with-out.patch
Description: Binary data


0006-testing-lisp-test-ob-shell.el-Test-async-prompt-remo.patch
Description: Binary data


0007-lisp-ob-comint.el-Fix-prompt-appearing-in-async-shel.patch
Description: Binary data


Re: check.sh setup.sh, nohup.out

2024-03-23 Thread Matt



  On Tue, 19 Mar 2024 21:41:05 +0100  Ihor Radchenko  wrote --- 
 > Matt m...@excalamus.com> writes:
 >
 > > Should I do as before and use 'git revert'?  Or, do we want to remove them 
 > > completely from the history?
 > 
 > Yes, git revert.

Reverted https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/

Thank you for your patience and guidance :)

--
Matt Trzcinski
Emacs Org contributor (ob-shell)
Learn more about Org mode at https://orgmode.org
Support Org development at https://liberapay.com/org-mode





Small patch: add \usepackage{iftex} when exporting to LaTeX

2024-03-23 Thread Pedro Andres Aranda Gutierrez
Hi

attached is a small patch to include package iftex to latex exports. Since
we support several
compilers, it is useful to have this package to detect the compiler in
included latex files.

Best, /PA

-- 
Fragen sind nicht da, um beantwortet zu werden,
Fragen sind da um gestellt zu werden
Georg Kreisler

Headaches with a Juju log:
unit-basic-16: 09:17:36 WARNING juju.worker.uniter.operation we should run
a leader-deposed hook here, but we can't yet
From f2d2e3abeb47cebaecec010493939d64a7ac2fd4 Mon Sep 17 00:00:00 2001
From: "Pedro A. Aranda" 
Date: Sat, 23 Mar 2024 08:13:46 +0100
Subject: [PATCH] Add iftex package when ixporting to LaTeX

---

* org.el: Add package iftex to LaTeX preamble. This is useful to detect
  the compiler in customisation LaTeX code included by the user.

etc/ORG-NEWS |  7 +++
 lisp/org.el  | 11 ++-
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index ca744b932..de0c208da 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -945,6 +945,13 @@ even though it does not have its own ID.  By giving files top-level id
 properties, links to headlines in the file can also be made more
 robust by using the file id instead of the file path.

+*** Added package ~iftex~ when exporting LaTeX documents
+
+When exporting LaTeX documents, add =\usepackage{iftex}= at the
+beginning. Since we support several compilers, the user might
+need to detect which one if active in supporting personal TeX
+customisation code.
+
 ** New features
 *** =ob-tangle.el=: New flag to remove tangle targets before writing

diff --git a/lisp/org.el b/lisp/org.el
index 909ce0024..8ac7340c5 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -3445,7 +3445,8 @@ header, or they will be appended."
 	  (default-value var)))

 (defcustom org-latex-default-packages-alist
-  '(;; amsmath before fontspec for lualatex and xetex
+  '(("" "iftex" nil) ;; include iftex when generating documents
+;; amsmath before fontspec for lualatex and xetex
 ("" "amsmath"   t ("lualatex" "xetex"))
 ;; fontspec ASAP for lualatex and xetex
 ("" "fontspec"  t ("lualatex" "xetex"))
@@ -15319,20 +15320,20 @@ INCREMENT-STEP divisor."
 	(setq hour (mod hour 24))
 	(setq pos-match-group 1
   new (format "-%02d:%02d" hour minute)))
-
+
((org-pos-in-match-range pos 6) ;; POS on "dmwy" repeater char.
 	(setq pos-match-group 6
   new (car (rassoc (+ nincrements (cdr (assoc (match-string 6 ts-string) idx))) idx
-
+
((org-pos-in-match-range pos 5) ;; POS on X in "Xd" repeater.
 	(setq pos-match-group 5
   ;; Never drop below X=1.
   new (format "%d" (max 1 (+ nincrements (string-to-number (match-string 5 ts-string)))
-
+
((org-pos-in-match-range pos 9) ;; POS on "dmwy" repeater in warning interval.
 	(setq pos-match-group 9
   new (car (rassoc (+ nincrements (cdr (assoc (match-string 9 ts-string) idx))) idx
-
+
((org-pos-in-match-range pos 8) ;; POS on X in "Xd" in warning interval.
 	(setq pos-match-group 8
   ;; Never drop below X=0.
--
2.34.1