Re: org-mode: example blocks are no longer syntax highlighted in emacs

2024-02-25 Thread Rudi C
Thanks!

On Sun, Feb 25, 2024 at 1:30 PM Ihor Radchenko  wrote:

> Rudi C  writes:
>
> > After upgrading to emacs 29.2 and org 9.7, my example blocks are no
> longer
> > syntax highlighted in emacs. They used to be syntax highlighted when I
> > specified the block's language. Any ideas?
>
> This is an undocumented feature.
> Yet, there is no reason to remote it.
> I recovered example block fontification on main.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=9daad41cc
>
> Fixed.
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 
>


Re: [BUG] Newlines after links are fontified with the org-link face after an incremental search

2024-02-25 Thread Rohit Patnaik
Hello,

It seems like this fix regressed as a result of commit
5d186b499dde97f59a91dc11f4c4a15113d29f4d. After I updated to the latest version
of org-mode again, I noticed that the fontification of newlines was back. When I
created a branch that reverted 5d186b499dde97f59a91dc11f4c4a15113d29f4d, the
fontification behaving as it should.

Thanks,
Rohit Patnaik



Re: A question about local/experimental branches

2024-02-25 Thread Juan Manuel Macías
Ihor Radchenko writes:

> P.S. Juan, I will need some time to review previous discussions on
> inline special blocks before I can comment on your work in depth.

No problem, Ihor. These days I had enough free time to develop my idea,
translate it into code and get something usable from which it could be
discussed. As I mentioned, the export to HTML and LaTeX is complete and
works fine, but I'll probably stop there for a long time. I mean, I
won't go any further and I will dedicate myself to continuing testing
the code already written and fixing possible bugs. Partly because I
don't have enough knowledge of odt to work on this backend, which would
be the next step.

Thanks for the info!

-- 
Juan Manuel Macías -- Composición tipográfica, tratamiento de datos, diseño 
editorial y ortotipografía



Re: A question about local/experimental branches

2024-02-25 Thread Ihor Radchenko
Juan Manuel Macías  writes:

> I've noticed that the code for my implementation of the new
> 'inline-special-block' experimental element is growing. In addition, I
> introduce modifications and improvements daily. So I think it might be a
> good idea to make my local branch public, in case someone wants to try
> it or contribute to the project.
>
> My question is if there is any set of good practices to do this, or is
> it enough to publish the local branch 'as is'.

See https://orgmode.org/worg/org-contribute.html#orgfd0d3cb
You can just share the link to your branch.

I am not sure if experimental branches can go directly to our savannah,
like what Emacs does.
Bastien, WDYT?

P.S. Juan, I will need some time to review previous discussions on
inline special blocks before I can comment on your work in depth.

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



A question about local/experimental branches

2024-02-25 Thread Juan Manuel Macías
Hi,

I've noticed that the code for my implementation of the new
'inline-special-block' experimental element is growing. In addition, I
introduce modifications and improvements daily. So I think it might be a
good idea to make my local branch public, in case someone wants to try
it or contribute to the project.

My question is if there is any set of good practices to do this, or is
it enough to publish the local branch 'as is'.

Currently I have completed, and are perfectly usable, the export to
LaTeX and HTML. I have also improved the syntax. Now, if aliases are
used for group optional attributes, it is not necessary to put :alias
foo, but @foo@. Example:

  #+options: inline-special-block-aliases:(("latin" :lang "la" :color blue 
:prelatex "\\itshape " :html "style=\"font-style:italic;\""))

  This is an example of Latin text: &_[@latin@]{lorem ipsum dolor sit amet}.

  This is an example of Latin text with small caps: &_[@latin@ :smallcaps 
t]{lorem ipsum dolor sit amet}.

LaTeX ==>

  This is an example of Latin text: 
{\color{blue}\foreignlanguage{latin}{\itshape lorem ipsum dolor sit amet}}.

  This is an example of Latin text with small caps: 
{\scshape{}\color{blue}\foreignlanguage{latin}{\itshape lorem ipsum dolor sit 
amet}}

HTML ==>

  This is an example of Latin text: lorem ipsum dolor sit amet.

  This is an example of Latin text with small caps: lorem 
ipsum dolor sit amet.


Related: https://list.orgmode.org/87ttlyloyr@posteo.net/

Best regards,

Juan Manuel

-- 
Juan Manuel Macías -- Composición tipográfica, tratamiento de datos, diseño 
editorial y ortotipografía

https://juanmanuelmacias.com

https://lunotipia.juanmanuelmacias.com

https://gnutas.juanmanuelmacias.com




Re: [BUG] wrong side of point error in org-element-cache [9.6.15 (release_9.6.15 @ /Applications/Emacs.app/Contents/Resources/lisp/org/)]

2024-02-25 Thread Ihor Radchenko
Rob Place  writes:

>> May you try the development version of Org mode and let us know if you
>> still see the warning?
>
> I managed to fix the issue but I can honestly not remember what had been
> causing it, I was in the midst of a number of changes in my init file
> and looking back at the git commit I can't recall which one actually
> fixed the issue. If the issue pops up again I will try and capture some
> more information.

Thanks for the update!
Canceled.

-- 
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-02-25 Thread Ihor Radchenko
gerard.vermeu...@posteo.net writes:

> I added the caveat:
> This patch is incompatible with `org-babel-edit-prep:' functions
> that signal `user-error's.
> to the commit message and cleaned it up a bit.

You may wrap `org-indent-block' into `condition-case' to catch
user-errors.

-- 
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-02-25 Thread gerard . vermeulen



On 23.02.2024 14:43, Ihor Radchenko wrote:

gerard.vermeu...@posteo.net writes:


[...]


I rewrote my `org-babel-edit-prep:python' to get rid of user-errors 
but

then I bumped on the user-error coming from
`org-src--make-source-overlay'.


This is strange. `org-src--make-source-overlay' does not use
`org-element' API. I cannot see how you are getting such warnings from 
there.


I am using since a few days a clone of the mailed 
`org-babel-edit-prep:python'
function (an irrelevant fix for setting point) and it works without 
glitches.


I have no explanation of what happened.

I added the caveat:
This patch is incompatible with `org-babel-edit-prep:' functions
that signal `user-error's.
to the commit message and cleaned it up a bit.

I also removed the scaffolding from the tests that checks where mark and 
point are.

The tests pass with make test.

Patch attached.

Regards -- Gerard

0001-org-babel-demarcate-block-split-using-element-API.patch
Description: Binary data


Re: [PATCH] org-table-to-lisp enhanced

2024-02-25 Thread Ihor Radchenko
tbanelwebmin  writes:

> Here is a new version of `org-table-to-lisp'. Why a new version?
> ...
> I ran all the standard unit tests of Org Mode as of [2024-02-24]. All 
> went as expected.

Thanks!
Applied, onto main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=407a55c1c

-- 
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-02-25 Thread Ihor Radchenko
Bastien Guerry  writes:

> A complementary suggestion: let's activate the "Blog" tab on Woof (at
> https://tracker.orgmode.org) so that when people send an email to the
> list prefixed with [BLOG], it is referenced on this tab. Then, a RSS
> feed is available from https://tracker.orgmode.org/blog.rss that we
> can parse on orgmode.org.
>
> Let me know if activating the detection of BLOG posts on the mailing
> list sounds useful.

That does sound useful.
And we may trivially add the recent BLOG posts using something like
#+INCLUDE: "https://tracker.orgmode.org/index.org; :lines 1-10

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



Re: [FR] Org mode sr.ht project page: add familiar links for newcomers

2024-02-25 Thread Ihor Radchenko
Bastien Guerry  writes:

>> I suggest doing the same, with the following mapping:
>>
>> [[orgmode.org/][Home page]]
>> [[https://tracker.orgmode.org/][Issues]]
>> [[mailto:emacs-orgmode@gnu.org][New issue]]
>> [[https://tracker.orgmode.org/patches][Pull requests]]
>> [[https://list.orgmode.org/][Discussions]]
>> [[https://orgmode.org/worg/][Wiki]]
>
> Done here: https://git.sr.ht/~bzg/org/commit/b6234e0
>
> Feel free to enhance it!

We may also add icons, similar to what forges use.
For example, using https://primer.style/foundations/icons (MIT License)

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



Re: Warn about shell-expansion in the docstring of org-latex-to-html-convert-command

2024-02-25 Thread Max Nikulin

On 23/02/2024 19:46, Ihor Radchenko wrote:

Max Nikulin  writes:


On 19/02/2024 02:36, Martin Edström wrote:

+Since this is a shell-command, remember to use single-quotes
+around \\='%i\\=', not double-quotes!  Else a math fragment such
+as \"$y = 200$\" gets butchered into only \" = 200\"."


I am afraid, the code, not the docstring must be fixed. I have not tried
it, but I expect an issue with

  Test \(f' = df/dx\)

So `shell-quote-argument' is necessary and quotes around %i must be
stripped similar to %s in mailcap entries in `org-open-file'.


That would be backwards-incompatible.
What about introducing %e replacement that will be shell-escaped?


Ihor, it is just a bug and its manifestation depends on content of .org 
files more than on user configuration. Do you really want to allow part 
of equations be executed as shell commands for the sake of miracle 
backward compatibility?


To minimize user annoyance my suggestion is to strip quotes in words like
- '%i'
- "%i"
- 'something%i'
- "something%i"
- something='%i'
- something="%i"
before calling `format-spec' with `shell-quote-argument' result.

Please, revert the commit that added a misleading recommendation.

By the way, single quotes have no special meaning in cmd.exe on windows.

Example of silent error resulting in incorrect equation:

(let ((org-latex-to-html-convert-command
   "printf '%%s' '%i'"))
  (org-format-latex-as-html "$f'' = df/dx$"))
"$f = df/dx$"

Random parts of math becomes part of shell command:

(let ((org-latex-to-html-convert-command
   "printf '%%s' '%i'"))
  (org-format-latex-as-html "$f' = df/dx$"))
"/bin/bash: -c: line 1: unexpected EOF while looking for matching `''
"

Something weird may be executed in the case of sufficiently complex 
equations.


It should be more reliable to pass fragment to command stdin. It can be 
done if %i is missed in `org-latex-to-html-convert-command'.




[PATCH] org-table-to-lisp enhanced

2024-02-25 Thread tbanelwebmin

Here is a new version of `org-table-to-lisp'. Why a new version?

- Because it is more than 3x faster than the current one.
  Bench-marked on a 3822 rows by 16 columns Org table
  - current: 0.405 seconds
  - new one: 0.122 seconds
  on Emacs 30.0.50 with native compilation
  The speedup is achieved with or without native compilation.

- Because it does not use regexps anymore.
  It uses `following-char'
  instead of `re-search-forward'
  Therefore the global regexp state is no longer clobbered.

- Because after a 120x speedup in May 2020
  (by Nicolas Goaziou and myself)
  it is funny to discover yet another way to a 3x speedup.

- Because org-table-to-lisp is a basic
  building block of Org Mode, used in
  - table alignment
  - table export
  - Babel
  - plotting
  - table transposition

- Because this version is a drop-in replacement.
  The overall algorithm does not changed.

I ran all the standard unit tests of Org Mode as of [2024-02-24]. All 
went as expected.


Have fun
Thierry
From 21b3e325e73d4a7332631eeed93cb2a025e024fd Mon Sep 17 00:00:00 2001
From: Thierry Banel 
Date: Sat, 24 Feb 2024 17:31:46 +0100
Subject: [PATCH] org-table.el: Enhanced table parsing

* lisp/org-table.el (org-table-to-lisp): Refactored.
* etc/ORG-NEWS: Document changes.

`org-table-to-lisp' is significantly faster.
It no longer uses regexps, nor clobbers the global regexp state.
---
 etc/ORG-NEWS  |  6 ++
 lisp/org-table.el | 37 -
 2 files changed, 30 insertions(+), 13 deletions(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index b79f275c4..a40a0f226 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -1275,6 +1275,12 @@ For symmetry with =\S= and =\sect= for the section symbol, =\P= has
 been added as an another form for the pilcrow symbol currently
 available as =\para=.
 
+*** ~org-table-to-lisp~ no longer clobbers the regexp global state
+
+It does no longer use regexps.
+
+It is also faster. Large tables can be read quickly.
+
 * Version 9.6
 
 ** Important announcements and breaking changes
diff --git a/lisp/org-table.el b/lisp/org-table.el
index c6e16c1fd..67fffc23e 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -5494,25 +5494,36 @@ for a horizontal separator line, or a list of field values as strings.
 The table is taken from the parameter TXT, or from the buffer at point."
   (if txt
   (with-temp-buffer
+	(buffer-disable-undo)
 (insert txt)
 (goto-char (point-min))
 (org-table-to-lisp))
 (save-excursion
   (goto-char (org-table-begin))
-  (let ((table nil))
-(while (re-search-forward "\\=[ \t]*|" nil t)
-	  (let ((row nil))
-	(if (looking-at "-")
-		(push 'hline table)
-	  (while (not (progn (skip-chars-forward " \t") (eolp)))
-		(push (buffer-substring
-		   (point)
-		   (progn (re-search-forward "[ \t]*\\(|\\|$\\)")
-			  (match-beginning 0)))
-		  row))
-	  (push (nreverse row) table)))
+  (let (table)
+(while (progn (skip-chars-forward " \t")
+  (eq (following-char) ?|))
+	  (forward-char)
+	  (push
+	   (if (eq (following-char) ?-)
+	   'hline
+	 (let (row)
+	   (while (progn
+(skip-chars-forward " \t")
+(not (eolp)))
+ (let ((q (point)))
+   (skip-chars-forward "^|\n")
+   (goto-char
+(prog1
+(let ((p (point)))
+  (unless (eolp) (setq p (1+ p)))
+  p)
+	  (skip-chars-backward " \t" q)
+	  (push (buffer-substring-no-properties q (point)) row)
+	   (nreverse row)))
+	   table)
 	  (forward-line))
-(nreverse table)
+	(nreverse table)
 
 (defun org-table-collapse-header (table  separator max-header-lines)
   "Collapse the lines before `hline' into a single header.
-- 
2.34.1



Re: Ada/SPARK support in Babel

2024-02-25 Thread Ihor Radchenko
Francesc Rocher  writes:

> If you still want to include it into the mainstream org-mode repository,
> then I'll be more than happy
> to contribute. If so, let me know what are the next steps and what kind of
> test do you expect.

Yes, we are interested to have Ada support in Org mode repository.

Here is what you need to do:

1. Check our contributor instructions at
   https://orgmode.org/worg/org-contribute.html#first-patch
   In particular, pay attention to the ChangeLog entry format.
   You also need FSF copyright assignment.
   Don't worry to make mistakes - we will guide you through once you
   submit patches.

2. https://github.com/rocher/ob-ada-spark/blob/main/ob-ada-spark.el
   should go to lisp/ directory of Org repository.
   Make sure to update the file header, updating the licence and stating
   that it is now a part of Emacs.

3. You need to get rid of any external library dependencies (f.el)

4. https://github.com/rocher/ob-ada-spark/blob/main/ob-doc-Ada-SPARK.org
   should go to
   https://orgmode.org/worg/org-contrib/babel/languages/index.html
   You will need to make a patch against https://git.sr.ht/~bzg/worg
   Also, make sure to follow
   https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-template.org

5. You need to add tests to testing/lisp in Org repository.
   You may use
   
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/tree/testing/lisp/test-ob-java.el
   as a reference.

6. It will be best if you continue maintaining ob-ada within Org mode
   repository. If you are willing to, we will also give you write access
   to the Org mode repository on savannah. We will provide instructions
   later, when we reach this stage.
   Note that we use Org mailing list to track bugs and discuss the
   development. You do not have to be subscribed, we can forward
   relevant email threads to your email inbox.

If you have any questions, feel free to ask us.

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



Re: [BUG] "Not enough arguments for format string" from failed fuzzy search containing % [9.6.19]

2024-02-25 Thread Ihor Radchenko
"Corwin Kerr"  writes:

> When a search link with a fuzzy expression contains the % character
> and is not found in the file, the error message is burried by format
> error. This affects ~org-link-search~, ~org-open-file~, etc.
>
> Expected message:
> : No match for fuzzy expression: % search bad
> Actual message:
> : Not enough arguments for format string
> ...
> * Minimal reproduction

Thanks for reporting!
Fixed, on main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=af9100382

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



Re: org-mode: example blocks are no longer syntax highlighted in emacs

2024-02-25 Thread Ihor Radchenko
Rudi C  writes:

> After upgrading to emacs 29.2 and org 9.7, my example blocks are no longer
> syntax highlighted in emacs. They used to be syntax highlighted when I
> specified the block's language. Any ideas?

This is an undocumented feature.
Yet, there is no reason to remote it.
I recovered example block fontification on main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=9daad41cc

Fixed.

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



Re: [PATCH] org-bibtex-yank: Allow to populate existing item

2024-02-25 Thread Ihor Radchenko
Martin Kampas  writes:

> Subject: [PATCH] org-bibtex-yank: Allow to populate existing item

Applied, onto main, with amendments.
I changed the argument name from NONEW to UPDATE-HEADING and updated the
commit message.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=37e468cf1

Thanks for your contribution!

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



Re: [BUG] org :extend property bugfix does not work [9.7 (9.7-??-388ba5b @ /home/st/.config/emacs/.local/straight/build-30.0.50/org/)]

2024-02-25 Thread Ihor Radchenko
StrawberryTea  writes:

> Sure. Just evaluate the following code after starting Emacs with `emacs -Q`:

Thanks!
Fixed, on main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=5d186b499

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