Re: [PATCH] Allow external libraries (org-roam) to supply org-id locations

2024-03-17 Thread Rick Lupton
Thanks, I hadn't understood the significance of named functions vs variables 
for advice.  But now I realise this is not solving the same problem as the 
original patch.

The point is that I was thinking org-roam should advise/modify/hook the 
specific function `org-id-find' [to find ids in its database] but NOT the more 
general `(org-link-get-parameter "id" :follow)' [because `org-id-open' has a 
lot of extra logic for search-strings, backwards compatibility, where to open 
the new location, which it would not be reasonable to duplicate].

Is there a way to do this using the approach you are suggesting?



Re: [BUG] [PATCH] ox-odt: Avoid warning when everything is fine [9.6.21 ( @ /nix/store/m6x04fr6nmhxk44qr0m8xsyr8vapppgr-emacs-packages-deps/share/emacs/site-lisp/elpa/org-9.6.21/)]

2024-03-17 Thread Damien Cassou
Ihor Radchenko  writes:
> It would be nice to attach the patch :)

I'm sorry. Here it is.

-- 
Damien Cassou

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill
>From 9dd17fcb7c774f148166d999fd1d021dae9fda3b Mon Sep 17 00:00:00 2001
From: Damien Cassou 
Date: Sun, 17 Mar 2024 20:24:59 +0100
Subject: [PATCH] ox-odt: Avoid warning when everything is fine

* lisp/ox-odt.el (org-odt--translate-latex-fragments): When
processing-type is already 'verbatim, no need to print any warning.
---
 lisp/ox-odt.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el
index 666d5da1a..3f1f1a5a8 100644
--- a/lisp/ox-odt.el
+++ b/lisp/ox-odt.el
@@ -3728,6 +3728,7 @@ (defun org-odt--translate-latex-fragments (tree _backend info)
 		 (if (eq processing-type 'dvipng) "dvipng" "convert") "" t))
 	 (setq warning "`org-odt-with-latex': LaTeX to PNG converter not available.  Falling back to verbatim.")
 	 (setq processing-type 'verbatim)))
+  (verbatim) ;; nothing to do
   (otherwise
(setq warning "`org-odt-with-latex': Unknown LaTeX option.  Forcing verbatim.")
(setq processing-type 'verbatim)))
-- 
2.43.2



Re: Org-attach risks

2024-03-17 Thread Kepa

Kepa  writes:

>/Each time I change the DIR property for attachments, I have to answer /
>/correctly two questions: if I want to move every file to the new 
path, and if /

>/I want to delete the old folder./
>
>/Is it possible to not receive these questions?/
>/For me, it's a big risk I don't want to take every time./

May you elaborate on what other behavior you would prefer to see?

--
Ihor Radchenko // yantar92,

Hi Ihor.

It would be enough to have the option to not having those prompt.

If I could set it to don't offer to copy files, and the option to don't 
offer to delete old folder, it would be enough.


Best regards,

Kepa




bug? org-babel-comint-with-output return value type

2024-03-17 Thread Matt
Looking at the last patch of 
https://list.orgmode.org/18e4deaa1bd.ff0f87fa694858.5955779335024266...@excalamus.com/,
 I would expect a reaction of something like, "WTF is all that weird org-trim 
string-join stuff on the prompt filter?"

---
 lisp/ob-comint.el | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lisp/ob-comint.el b/lisp/ob-comint.el
index d13aa..f2251892a 100644
--- a/lisp/ob-comint.el
+++ b/lisp/ob-comint.el
@@ -325,9 +325,10 @@ STRING contains the output originally inserted into the 
comint buffer."
  until (and (equal (match-string 1) "start")
 (equal (match-string 2) uuid))
  finally return (+ 1 (match-end 0)
-  ;; Apply callback to clean up the result
-  (res-str (funcall org-babel-comint-async-chunk-callback
- res-str-raw)))
+   ;; Remove prompt
+   (res-promptless (org-trim (string-join (mapcar #'org-trim 
(org-babel-comint--prompt-filter res-str-raw)) "\n") "\n"))
+  ;; Apply user callback
+  (res-str (funcall org-babel-comint-async-chunk-callback 
res-promptless)))
  ;; Search for uuid in associated org-buffers to insert results
  (cl-loop for buf in org-buffers
   until (with-current-buffer buf
-- 
2.41.0

The reason is that the current result of =org-babel-comint-with-output= is a 
list because the final expression is =delete=: 
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/tree/lisp/ob-comint.el?id=46909a54e1a2ce0d948e94e0e19ff64af1a39eb9#n164

Why =org-babel-comint-with-output= returns a list is unclear to me.  The 
docstring for =org-babel-comint-with-output= says it should "return all process 
output".  AFAIK, process output is a string, always has been, always will be, 
and Babel has always gotten a substring of the process buffer (for that code 
path).  Yet for some reason, it was decided to have 
=org-babel-comint-with-output= return a list.  This goes back to the beginning, 
in 2009, when the final expression used =split-string= instead of =delete=: 
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/lisp/org-babel-comint.el?id=dd0392a4f23b40fae7491c55aa44a2324248c103

You might ask, "But wouldn't returning a list require you to then convert it 
back into a string since =org-babel-comint-with-output= is really just a 
sentinel on process output?"  The answer is, "Yes, that's exactly what you'd 
need to do."

Call grep on =org-babel-comint-with-output= and you'll see in every case except 
the Ruby ':results value' results and Lua the ':results value' results, that 
indeed the return value of =org-babel-comint-with-output= is concatenated or 
the first string element taken.

| file  | line | result modified? | result used? | comment  
|
|---+--+--+--+--|
| ob-ruby.el|  263 | no   | no   | used to send 
eoe-string  |
|   |  272 | yes, mapconcat   | yes  | as returned 
value (for :results output)  |
|   |  281 | no   | yes  | as returned 
value (for :results value)   |
|---+--+--+--+--|
| ob-js.el  |  111 | yes, nth 1   | yes  | as returned 
value (for the default :results) |
|---+--+--+--+--|
| ob-shell.el   |  357 | yes, mapconcat   | yes  | as returned 
value (for session results of all types) |
|---+--+--+--+--|
| ob-julia.el   |  327 | yes,  mapconcat  | yes  | as returned 
value (for :results output)  |
|---+--+--+--+--|
| ob-lua.el |  391 | yes, mapconcat   | yes  | as returned 
value (for :results output)  |
|   |  400 | no   | yes  | as returned 
value (for :results value)   |

Re: [BUG] Prompt appears in async shell results

2024-03-17 Thread Matt

  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? :)

2. Legacy code woes

I'll start another thread to rant, er, discuss.

--
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: [BUG] [PATCH] ox-odt: Avoid warning when everything is fine [9.6.21 ( @ /nix/store/m6x04fr6nmhxk44qr0m8xsyr8vapppgr-emacs-packages-deps/share/emacs/site-lisp/elpa/org-9.6.21/)]

2024-03-17 Thread Ihor Radchenko
Damien Cassou  writes:

> In my unit tests, I don't want to see any LaTeX-related warnings because
> they don't use that. I thus changed my unit-tests to force :with-latex
> to be 'verbatim. But this still requires this patch.

It would be nice to attach the patch :)

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



Re: Things got very slow: profiler output

2024-03-17 Thread Ihor Radchenko
William Denton  writes:

> On Saturday, March 16th, 2024 at 14:56, Ihor Radchenko  
> wrote:
>
>> Did you try setting org-highlight-latex-and-related to nil?
>
> That did it!  Thank you!  Org is back to normal, fast and responsive.  What 
> do you make of all this?  Was it just something about my individual setup?

> (In fact I now have it set to '(script entities).  Both 'latex and 'native 
> gave me the problems, but this works.)

That's because `org-latex-regexps' is a bit too complex for Emacs regexp
engine in some cases. For some unfortunate Org files, these regexps may
trigger stack overflow while matching.

Eventually, we will switch to parser-based fontification, and the
problem will be solved.

For now, I have no clue how to simplify the problematic regexps without
risking regressions.

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



[BUG] [PATCH] ox-odt: Avoid warning when everything is fine [9.6.21 ( @ /nix/store/m6x04fr6nmhxk44qr0m8xsyr8vapppgr-emacs-packages-deps/share/emacs/site-lisp/elpa/org-9.6.21/)]

2024-03-17 Thread Damien Cassou



Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

 https://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org mailing list.


In my unit tests, I don't want to see any LaTeX-related warnings because
they don't use that. I thus changed my unit-tests to force :with-latex
to be 'verbatim. But this still requires this patch.

Emacs  : GNU Emacs 29.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.41, 
cairo version 1.18.0)
Package: Org mode version 9.6.21 ( @ 
/nix/store/m6x04fr6nmhxk44qr0m8xsyr8vapppgr-emacs-packages-deps/share/emacs/site-lisp/elpa/org-9.6.21/)
-- 
Damien Cassou

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill



Re: How do I link to a specific line in an org-babel block?

2024-03-17 Thread Ihor Radchenko
Rudi C  writes:

> Thanks, that works great. Can these work with ID links, too?
> (`[[id:9bbb6468-2907-4e74-a4d1-2e391e33e0fe::...]]`)

Yes, on the latest main, where we support search strings in id: links.

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



Re: Things got very slow: profiler output

2024-03-17 Thread William Denton
On Saturday, March 16th, 2024 at 14:56, Ihor Radchenko  
wrote:

> Did you try setting org-highlight-latex-and-related to nil?

That did it!  Thank you!  Org is back to normal, fast and responsive.  What do 
you make of all this?  Was it just something about my individual setup?

(In fact I now have it set to '(script entities).  Both 'latex and 'native gave 
me the problems, but this works.)


Thanks again,

Bill

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




Re: Subject: cannot export asynchronously because of org-fold-core--update-buffer-folds

2024-03-17 Thread Nasser Alkmim
Alan Schmitt  writes:

>
> The document header was not the problem, as it happened with any
> file. The core of the issue is that the org version used to initiate the
> export must be the same than the org version run in the asynchronous
> export process, as bytecode from org is passed between them (and in my
> case this bytecode was mentioning a recently introduced org function
> that is not available in the org shipped with emacs). Making sure the
> async init file loaded the same org version than the one I use everyday
> solved the problem.
>
> Alan
>

Hi Alan, how did you effectively solve the problem?

I'm experiencing the same.
I tried to add the recent org folder that I use to the load-path after loading 
'ox, but it does not work.


-- 
Nasser Alkmim 
 +43 677 6408 9171



Re: Subject: cannot export asynchronously because of org-fold-core--update-buffer-folds

2024-03-17 Thread Nasser Alkmim
Alan Schmitt  writes:

>
> The document header was not the problem, as it happened with any
> file. The core of the issue is that the org version used to initiate the
> export must be the same than the org version run in the asynchronous
> export process, as bytecode from org is passed between them (and in my
> case this bytecode was mentioning a recently introduced org function
> that is not available in the org shipped with emacs). Making sure the
> async init file loaded the same org version than the one I use everyday
> solved the problem.
>
> Alan
>

Hi Alan, how did you effectively solve the problem?

I'm experiencing the same.
I tried to add the recent org folder that I use to the load-path after loading 
'ox, but it does not work.


-- 
Nasser Alkmim 
 +43 677 6408 9171



Re: How do I link to a specific line in an org-babel block?

2024-03-17 Thread Rudi C
Thanks, that works great. Can these work with ID links, too?
(`[[id:9bbb6468-2907-4e74-a4d1-2e391e33e0fe::...]]`)

On Sun, Mar 17, 2024 at 4:47 PM Ihor Radchenko  wrote:

> Rudi C  writes:
>
> > How do I link to a specific line in an org-babel block?
>
> a.org:
>
> #+begin_src emacs-lisp
> (message "Hello world!")
> (message "Hello other worlds!!!") ; (ref:greetworlds)
> #+end_src
>
> b:org
> [[./a.org::(greetworlds)]]
>
> See https://orgmode.org/manual/Literal-Examples.html
>
> > I tried using [[file:.../my.org::search-term]] , but this only works for
> > jumping to a heading, not an arbitrary line. (It does work for non-org
> > files.)
>
> That's because "search-term" is used for fuzzy search, which is limited
> to headings by default. You can customize
> `org-link-search-must-match-exact-headline' to change this.
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 
>


Re: How to properly attribute authorship with Git (was Re: [PATCH] lisp/ob-shell.el: Also override explicit-shell-file-name)

2024-03-17 Thread Matt


  On Sun, 17 Mar 2024 17:26:48 +0100  Max Nikulin  wrote --- 
 > On 17/03/2024 20:42, Matt wrote:
 > >    On Sun, 17 Mar 2024 11:31:00 +0100  Ihor Radchenko  wrote ---
 > >   >
 > >   > (1) revert the commit; (2) re-apply the
 > >   > commit version with the correct author attribution.
 > > 
 > > Done.
 > > 
 > > 1. git revert 
 > > 2. make changes (e.g. emacs  followed by *type-type-type* or some 
 > > incantation of 'git apply' or 'git am')
 > > 3. git commit --author "Arthur Author "
 > 
 > In this particular case "git am" works fine and no explicit "git commit" 
 > is necessary.

Thank you for taking the time to verify the patch formatting.  Sounds like a 
PEBKAC.  I'll look into fixing it :)

--
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





Re: How to properly attribute authorship with Git (was Re: [PATCH] lisp/ob-shell.el: Also override explicit-shell-file-name)

2024-03-17 Thread Max Nikulin

On 17/03/2024 20:42, Matt wrote:

   On Sun, 17 Mar 2024 11:31:00 +0100  Ihor Radchenko  wrote ---
  >
  > (1) revert the commit; (2) re-apply the
  > commit version with the correct author attribution.

Done.

1. git revert 
2. make changes (e.g. emacs  followed by 
*type-type-type* or some incantation of 'git apply' or 'git am')
3. git commit --author "Arthur Author "


In this particular case "git am" works fine and no explicit "git commit" 
is necessary.






Re: How to properly attribute authorship with Git (was Re: [PATCH] lisp/ob-shell.el: Also override explicit-shell-file-name)

2024-03-17 Thread Ihor Radchenko
Matt  writes:

>  > We should avoid force pushing unless something is terribly broken.
>  > What you may do instead is (1) revert the commit; (2) re-apply the
>  > commit version with the correct author attribution.
>
> Done.
> ...
> I added a little section within copyright: 
> https://git.sr.ht/~bzg/worg/commit/80152bee771b755aedfbe488497c5e4d0e7457c2

Thanks!

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



Re: [BUG] Re: The orgframe construct in the Beamer exporter as a default needs a rethink

2024-03-17 Thread Ihor Radchenko
Leo Butler  writes:

> Attached is the updated patch. In addition, I have written three
> regression tests that are attached in a separate patch.

Thanks!
Applied, onto main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=80615195c
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=46909a54e

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



Re: [BUG] [PATCH] org-babel-execute-buffer: Prevent executing non-code blocks [9.6.20 ( @ /home/cassou/.emacs.d/lib/org/lisp/)]

2024-03-17 Thread Ihor Radchenko
Gerard Vermeulen  writes:

>> (setq org-babel-default-header-args:text '((:eval . "no")))
>> 
>> to your config.
>
> Is it possible to make org-lint recognize those settings?
>
> I have the kludge
>
> (defun org-babel-execute:text (_body _params)
>"NO-OP to silence warnings." nil)
>
> in my config to silence "Unknown source block language" warnings.

You can hide all the warnings from a certain checker by pressing "i" in
the org-lint report.

If necessary, we may add some customizations to org-lint that will allow
customizing which checkers to use.

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



Re: Reproducible work with natively compiled Emacs

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

> Bluntly speaking, yes. There is this instance not too long ago where we had 
> the slow down and I was trying to isolate the source. One of my possible 
> suspects was that I might not have the right version of the eln file, because 
> the creation timestamp was seeing with ls-l really made me doubt and I needed 
> a state I could understand.

Many things could cause it. For example, I sometimes get very bad
slowdowns unless I do make bootstrap on my Emacs master build.

I conclude that cleaning .eln files, especially outside the Org git repo
folder, is not something we need. (until there is an evidence that we do
need such a cleanup)

I think that we can still keep make native exclusively for the purposes
of testing native compilation in case if it behaves funnily.

Canceled.
I only committed the changes to make help output.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=67a8117ca

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



Re: Things got very slow: profiler output

2024-03-17 Thread Ihor Radchenko
Bruno Cardoso  writes:

>> It is a few times faster. And the profiler shows no slowdown, AFAIU.
>> Is the problem solved?
>>
>
> Hi Ihor. I accidentally cut out part of my last reply, sorry.
>
> Yes, it looks like the situation greatly improved on latest main. I guess the 
> problem is solved on my side. Thank you very much!

Good to hear.
Then, back to William's problem :)

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



Re: Table column formula with remote reference

2024-03-17 Thread Ihor Radchenko
Wu Ming  writes:

> Very clear now. Thank you. But I was mostly confounded by references
> $0 and #0 versus the @@# (and $$#) you just described the processing
> of. Don’t want to abuse your time. I can figure it out when needed.
> But if you feel inclined to unravel this little detail of the manual
> as well I would clearly appreciate the effort.

The main difference is that @# always refer to the original table, while
$0 may refer to other tables as well.

(Generally, reference expansion process is not well documented,
unfortunately; it would be nice if somebody wrote a documentation
explaining the process - things can get tricky in some edge cases)

>> Normally, if you use org-table-* commands, the formulas get updated when
>> you move the columns.
>
> One side effect of using remote formulas is re-organizing columns doesn’t 
> update them automatically. I should find the balance of readability and 
> formulas maintenance cost. But you may have suggested the solution below 
> already with named columns.

In theory, we might try to update such remote references at least in
current buffer. Contributions welcome.

>> To make things more readable, you can also assign names to columns:
>> 
>> | ! | | P1 | P2 | P3 |   Tot |  |
>> |   | Maximum | 10 | 15 | 25 |50 | 10.0 |
>> 
>> Then, you can write $P1 = ... instead of $3 = ...
>> See "3.5.10 Advanced features" section of the manual.
>
> Clever. And we are at the “Advanced“ features already. Are advanced-advanced 
> in the realm of Calc? 

> Asking because was also wondering how to optimize parameters (“solver”) and 
> deal with locales (“,” vs “.” separators). For the latter I could possibly 
> ‘tr’ them before sharing the output. But will possibly mess the alignment. 
> Happened while trialling groff’s tbl.

AFAIK, GNU calc does not support comma as decimal point as _input_. For
output, I am not sure.

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



Re: How to properly attribute authorship with Git (was Re: [PATCH] lisp/ob-shell.el: Also override explicit-shell-file-name)

2024-03-17 Thread Matt


  On Sun, 17 Mar 2024 11:31:00 +0100  Ihor Radchenko  wrote --- 
 > Matt m...@excalamus.com> writes:
 >
 > > First, would you like me to update the commit?  If so, I will need 
 > > guidance.  The correct procedure to change the author after committing to 
 > > remote is unclear to me.  I would think it's something like sync my local 
 > > copy with the latest remote version, update the author locally, and force 
 > > push the change.  I would then expect that the next time someone pulls, it 
 > > would update their local with the author change.  It would, however, cause 
 > > a conflict, I think, for someone in the middle of making a change who has 
 > > not synced with the forced push version and is trying to push their change.
 > 
 > We should avoid force pushing unless something is terribly broken.
 > What you may do instead is (1) revert the commit; (2) re-apply the
 > commit version with the correct author attribution.

Done.

For the benefit of future me or anyone else who cares, I did:

1. git revert 
2. make changes (e.g. emacs  followed by 
*type-type-type* or some incantation of 'git apply' or 'git am')
3. git commit --author "Arthur Author "
4. git push

'git revert', in this case, basically swaps the plus and minus signs in the 
diff for the specified commit and submits that as a new set of changes.  After 
applying those changes, it's possible, in this case, to proceed with "what you 
should have done in the first place".

 > > Second, I can update Worg with an explanation that it's important to 
 > > credit authors using git's author field and how to do this.  Unless I 
 > > missed it, worg/org-contribute makes no mention of the author field.  The 
 > > version of git packaged by my distro is 2.41.0 and, AFAICT, has no -A flag 
 > > for 'git' or 'git commit'.  However, the following works on my machine 
 > > and, I guess, is the long option form:
 > >
 > > git commit --author "Arthur Override "
 > 
 > You are right. Looks like -A is just Magit shortcut.
 > 
 > As for crediting authors, we may document it in 
 > https://orgmode.org/worg/org-maintenance.html#copyright
 > Although, it is under "core maintainer" section. Maybe we can make a
 > dedicated section for maintainers on how to deal with patch submissions.

I added a little section within copyright: 
https://git.sr.ht/~bzg/worg/commit/80152bee771b755aedfbe488497c5e4d0e7457c2

--
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





Re: [BUG] Re: The orgframe construct in the Beamer exporter as a default needs a rethink

2024-03-17 Thread Leo Butler
On Sun, Mar 17 2024, Ihor Radchenko  wrote:

> Leo Butler  writes:
>
 I'd prefer to keep this information in the INFO channel.
 It will be more consistent.
>>
>> Apologies, I messed up the patch in the previous email.
>>
>> Attached is a patch that compiles cleanly and uses INFO.
>
> Thanks!
>
>> + (frame (let ((selection
>> +   (or (and fragilep
>> +(or (string-search "\\begin{frame}" 
>> contents)
>> +(string-search "\\end{frame}" contents))
>
> Please use `string-match-p'. `string-search' is not available in Emacs
> 27, which we still support.

Done.

>
>> +org-beamer-frame-environment)
>> +   "frame")))
>> +  (unless (string= selection "frame")
>> +(setq info (plist-put info :define-frame t)))
>
> Let's use "beamer" prefix to indicate that this plist entry is
> beamer backend-specific. Something like :beamer-define-frame.

Done.

Attached is the updated patch. In addition, I have written three
regression tests that are attached in a separate patch.

Leo

From 3b10e0013ba98cbc2b441507da359996e3d8701c Mon Sep 17 00:00:00 2001
From: Leo Butler 
Date: Tue, 12 Mar 2024 15:11:27 -0500
Subject: [PATCH 1/2] lisp/ox-beamer.el: constrain use of
 org-beamer-frame-environment

* lisp/ox-beamer.el (org-beamer--format-frame, org-beamer-template):
Only use `org-beamer-frame-environment' when a frame is marked as
fragile and the frame's contents include either \begin{frame} or
\end{frame}.  When `org-beamer-frame-environment' is used and not
equal to "frame", add the property :beamer-define-frame to INFO and
set it to t.  When that property is t, `org-beamer-template' emits a
definition of the alternative frame environment.

Refs: https://list.orgmode.org/orgmode/87bk7jeik8.fsf@localhost/
https://list.orgmode.org/87a5nux3zr@t14.reltub.ca/T/
---
 lisp/ox-beamer.el | 21 +
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/lisp/ox-beamer.el b/lisp/ox-beamer.el
index 4fad37b59..8bae93c11 100644
--- a/lisp/ox-beamer.el
+++ b/lisp/ox-beamer.el
@@ -429,8 +429,21 @@ used as a communication channel."
 	  ;; among `org-beamer-verbatim-elements'.
 	  (org-element-map headline org-beamer-verbatim-elements 'identity
 			   info 'first-match))
- (frame (or (and fragilep org-beamer-frame-environment)
-"frame")))
+ ;; If FRAGILEP is non-nil and CONTENTS contains an occurrence
+ ;; of \begin{frame} or \end{frame}, then set the FRAME
+ ;; environment to be `org-beamer-frame-environment';
+ ;; otherwise, use "frame". If the selected environment is not
+ ;; "frame", then add the property :beamer-define-frame to
+ ;; INFO and set it to t.
+ (frame (let ((selection
+   (or (and fragilep
+(or (string-match-p "begin{frame}" contents)
+(string-match-p "end{frame}" contents))
+org-beamer-frame-environment)
+   "frame")))
+  (unless (string= selection "frame")
+(setq info (plist-put info :beamer-define-frame t)))
+  selection)))
 (concat "\\begin{" frame "}"
 	;; Overlay specification, if any. When surrounded by
 	;; square brackets, consider it as a default
@@ -851,8 +864,8 @@ holding export options."
  (org-latex--insert-compiler info)
  ;; Document class and packages.
  (org-latex-make-preamble info)
- ;; Define the alternative frame environment.
- (unless (equal "frame" org-beamer-frame-environment)
+ ;; Define the alternative frame environment, if needed.
+ (when (plist-get info :beamer-define-frame)
(format "\\newenvironment<>{%s}[1][]{\\begin{frame}#2[environment=%1$s,#1]}{\\end{frame}}\n"
org-beamer-frame-environment))
  ;; Insert themes.
-- 
2.43.0

From 4377c4a55d1fe879b92f268edebcf03d72821703 Mon Sep 17 00:00:00 2001
From: Leo Butler 
Date: Sun, 17 Mar 2024 08:14:54 -0500
Subject: [PATCH 2/2] testing/lisp/test-ox-beamer.el: New regression tests for
 ox-beamer.

* testing/lisp/test-ox-beamer.el (ox-beamer/orgframe,
ox-beamer/orgframe-in-example, ox-beamer/orgframe-in-one-example): New
file.  Regression tests for ox-beamer.  Test that the
`org-beamer-frame-environment' is defined only when used.
---
 testing/lisp/test-ox-beamer.el | 110 +
 1 file changed, 110 insertions(+)
 create mode 100644 testing/lisp/test-ox-beamer.el

diff --git a/testing/lisp/test-ox-beamer.el b/testing/lisp/test-ox-beamer.el
new file mode 100644
index 0..be83b12e0
--- /dev/null
+++ b/testing/lisp/test-ox-beamer.el
@@ -0,0 +1,110 @@
+;;; test-ox-beamer.el --- tests for ox-beamer.el   -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2024  Leo 

Re: How do I link to a specific line in an org-babel block?

2024-03-17 Thread Ihor Radchenko
Rudi C  writes:

> How do I link to a specific line in an org-babel block?

a.org:

#+begin_src emacs-lisp
(message "Hello world!")
(message "Hello other worlds!!!") ; (ref:greetworlds)
#+end_src

b:org
[[./a.org::(greetworlds)]]

See https://orgmode.org/manual/Literal-Examples.html

> I tried using [[file:.../my.org::search-term]] , but this only works for
> jumping to a heading, not an arbitrary line. (It does work for non-org
> files.)

That's because "search-term" is used for fuzzy search, which is limited
to headings by default. You can customize
`org-link-search-must-match-exact-headline' to change this.

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



Re: Things got very slow: profiler output

2024-03-17 Thread Bruno Cardoso



On 2024-03-16, 21:14 +, Ihor Radchenko  wrote:
>
> It is a few times faster. And the profiler shows no slowdown, AFAIU.
> Is the problem solved?
>

Hi Ihor. I accidentally cut out part of my last reply, sorry.

Yes, it looks like the situation greatly improved on latest main. I guess the 
problem is solved on my side. Thank you very much!

Best,

Bruno.




Re: [BUG] [PATCH] org-babel-execute-buffer: Prevent executing non-code blocks [9.6.20 ( @ /home/cassou/.emacs.d/lib/org/lisp/)]

2024-03-17 Thread Gerard Vermeulen




On 16.03.2024 12:48, Ihor Radchenko wrote:


Yes. You can add

#+property: header-args:text :eval no

on top of your Org file or add

(setq org-babel-default-header-args:text '((:eval . "no")))

to your config.


Is it possible to make org-lint recognize those settings?

I have the kludge

(defun org-babel-execute:text (_body _params)
  "NO-OP to silence warnings." nil)

in my config to silence "Unknown source block language" warnings.

Regards -- Gerard




Re: How to properly attribute authorship with Git (was Re: [PATCH] lisp/ob-shell.el: Also override explicit-shell-file-name)

2024-03-17 Thread Ihor Radchenko
Matt  writes:

>  > For future, we prefer keeping the original commit author in the "author"
>  > field of the commits - this is important to keep track of the number of
>  > changed lines for contributors without FSF copyright assignment.
>  
> Thank you for letting me know this is an issue.
>
> First, would you like me to update the commit?  If so, I will need guidance.  
> The correct procedure to change the author after committing to remote is 
> unclear to me.  I would think it's something like sync my local copy with the 
> latest remote version, update the author locally, and force push the change.  
> I would then expect that the next time someone pulls, it would update their 
> local with the author change.  It would, however, cause a conflict, I think, 
> for someone in the middle of making a change who has not synced with the 
> forced push version and is trying to push their change.

We should avoid force pushing unless something is terribly broken.
What you may do instead is (1) revert the commit; (2) re-apply the
commit version with the correct author attribution.

> Second, I can update Worg with an explanation that it's important to credit 
> authors using git's author field and how to do this.  Unless I missed it, 
> worg/org-contribute makes no mention of the author field.  The version of git 
> packaged by my distro is 2.41.0 and, AFAICT, has no -A flag for 'git' or 'git 
> commit'.  However, the following works on my machine and, I guess, is the 
> long option form:
>
> git commit --author "Arthur Override "

You are right. Looks like -A is just Magit shortcut.

As for crediting authors, we may document it in 
https://orgmode.org/worg/org-maintenance.html#copyright
Although, it is under "core maintainer" section. Maybe we can make a
dedicated section for maintainers on how to deal with patch submissions.

> Third, this is at least the second time I've had issues working with a 
> diff/patch.  The reason I submitted the change the way I did is that I could 
> not get 'git apply ' to work.  I only got a useless error like 
> "error: corrupt patch at line 10".  It's not clear to me if this is an error 
> on my end or if the patch is indeed ill-formatted.  Can you confirm that the 
> submitted patch is well-formatted?

There are several types of patches that may need to be applied
differently. Plain "diff" patches can be applied using git apply, while
maildir/.patch patches can be applied using git am.

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



Re: Reproducible work with natively compiled Emacs

2024-03-17 Thread Pedro Andres Aranda Gutierrez
Hi

Bluntly speaking, yes. There is this instance not too long ago where we had the 
slow down and I was trying to isolate the source. One of my possible suspects 
was that I might not have the right version of the eln file, because the 
creation timestamp was seeing with ls-l really made me doubt and I needed a 
state I could understand.

Best,/PA

Enviado desde mi iPhone

> El 17 mar 2024, a las 11:16, Ihor Radchenko  escribió:
> 
> Pedro Andres Aranda Gutierrez  writes:
> 
>> In practice, I was not able to delete the .eln files from a make native.
> 
> I am wondering why you wanted to run make native.
> When I added that target, it was mostly to test inconsistencies between
> make single and make native. However, AFAIU, there should be no
> inconsistencies in practice. So, maybe we can instead just delete make
> native target? Or is there any value in ahead of time native-compilation
> when working with Org git repo?
> 
>> In order to have a more controlled environment, I delete them _before_
>> I refresh my local org-mode/main directory, and then do a make native
>> after refreshing my local copy.
>> 
>> Same happened when testing modifications. When testing a modification
>> I always make cleaneln; make native to test it
>> 
>> Maybe I'm a bit too 'meticulous' but that's me ;-)
> 
> "more controlled environment" does not sound like a real concern caused
> by something breaking. I am joining Max's question on whether you
> encountered any real issue with native compilation.
> 
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 



Re: [PATCH] Allow external libraries (org-roam) to supply org-id locations

2024-03-17 Thread Ihor Radchenko
"Rick Lupton"  writes:

> On Wed, 13 Mar 2024, at 12:30 PM, Ihor Radchenko wrote:
>> I think that we can do it simpler. [...]
>> The idea is to use Emacs' advice machinery to allow third-party code
>> alter the functions stored in link parameters.
>
> I was avoiding this because I thought it was only recommended (in the elisp 
> manual) to use advice directly by users, not in libraries (like, I assume, 
> org-roam):
>
>> If you are writing code for release, for others to use, try to avoid 
>> including advice in it. If the function you want to advise has no hook to do 
>> the job, please talk with the Emacs developers about adding a suitable hook. 
>> Especially, Emacs’s own source files should not put advice on functions in 
>> Emacs. (There are currently a few exceptions to this convention, but we aim 
>> to correct them.) It is generally cleaner to create a new hook in foo, and 
>> make bar use the hook, than to have bar put advice in foo.
>
> (https://www.gnu.org/software/emacs/manual/html_node/elisp/Advising-Named-Functions.html)

This is absolutely right, but only when advising named functions. What
we are talking about is advising the link property value. In my previous
discussions with Emacs devs, I was told that it superior to use advice
system when a library wants to modify a function stored as a value of a
variable - see
https://yhetil.org/emacs-devel/sj0pr10mb548885b715c9875726f70f61f3...@sj0pr10mb5488.namprd10.prod.outlook.com/

> But I don't mind either way.  I agree your approach is simpler if it's a 
> reasonable way for a third party library like org-roam to extend the org id 
> functions.

I added the setter on main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=d545ad606

We may also want to document the `add-function' approach in the manual.
Maybe in a new section "Modifying Hyperlink Types", right after "Adding
Hyperlink Types".

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



Re: Reproducible work with natively compiled Emacs

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

> In practice, I was not able to delete the .eln files from a make native.

I am wondering why you wanted to run make native.
When I added that target, it was mostly to test inconsistencies between
make single and make native. However, AFAIU, there should be no
inconsistencies in practice. So, maybe we can instead just delete make
native target? Or is there any value in ahead of time native-compilation
when working with Org git repo?

> In order to have a more controlled environment, I delete them _before_
> I refresh my local org-mode/main directory, and then do a make native
> after refreshing my local copy.
>
> Same happened when testing modifications. When testing a modification
> I always make cleaneln; make native to test it
>
> Maybe I'm a bit too 'meticulous' but that's me ;-)

"more controlled environment" does not sound like a real concern caused
by something breaking. I am joining Max's question on whether you
encountered any real issue with native compilation.

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



Re: [BUG] Re: The orgframe construct in the Beamer exporter as a default needs a rethink

2024-03-17 Thread Ihor Radchenko
Leo Butler  writes:

>>> I'd prefer to keep this information in the INFO channel.
>>> It will be more consistent.
>
> Apologies, I messed up the patch in the previous email.
>
> Attached is a patch that compiles cleanly and uses INFO.

Thanks!

> + (frame (let ((selection
> +   (or (and fragilep
> +(or (string-search "\\begin{frame}" contents)
> +(string-search "\\end{frame}" contents))

Please use `string-match-p'. `string-search' is not available in Emacs
27, which we still support.

> +org-beamer-frame-environment)
> +   "frame")))
> +  (unless (string= selection "frame")
> +(setq info (plist-put info :define-frame t)))

Let's use "beamer" prefix to indicate that this plist entry is
beamer backend-specific. Something like :beamer-define-frame.

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



How do I link to a specific line in an org-babel block?

2024-03-17 Thread Rudi C
How do I link to a specific line in an org-babel block?

I tried using [[file:.../my.org::search-term]] , but this only works for
jumping to a heading, not an arbitrary line. (It does work for non-org
files.)

PS: Please use Reply to All.


How to properly attribute authorship with Git (was Re: [PATCH] lisp/ob-shell.el: Also override explicit-shell-file-name)

2024-03-17 Thread Matt
  On Sat, 16 Mar 2024 11:11:38 +0100  Ihor Radchenko  wrote --- 

 > I notice that you changed the commit author and only referenced Aaron in
 > Submitted By: metadata.
 > 
 > For future, we prefer keeping the original commit author in the "author"
 > field of the commits - this is important to keep track of the number of
 > changed lines for contributors without FSF copyright assignment.
 
Thank you for letting me know this is an issue.

First, would you like me to update the commit?  If so, I will need guidance.  
The correct procedure to change the author after committing to remote is 
unclear to me.  I would think it's something like sync my local copy with the 
latest remote version, update the author locally, and force push the change.  I 
would then expect that the next time someone pulls, it would update their local 
with the author change.  It would, however, cause a conflict, I think, for 
someone in the middle of making a change who has not synced with the forced 
push version and is trying to push their change.

Second, I can update Worg with an explanation that it's important to credit 
authors using git's author field and how to do this.  Unless I missed it, 
worg/org-contribute makes no mention of the author field.  The version of git 
packaged by my distro is 2.41.0 and, AFAICT, has no -A flag for 'git' or 'git 
commit'.  However, the following works on my machine and, I guess, is the long 
option form:

git commit --author "Arthur Override "

Third, this is at least the second time I've had issues working with a 
diff/patch.  The reason I submitted the change the way I did is that I could 
not get 'git apply ' to work.  I only got a useless error like 
"error: corrupt patch at line 10".  It's not clear to me if this is an error on 
my end or if the patch is indeed ill-formatted.  Can you confirm that the 
submitted patch is well-formatted?

--
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





Re: Reproducible work with natively compiled Emacs

2024-03-17 Thread Max Nikulin

On 17/03/2024 13:13, Pedro Andres Aranda Gutierrez wrote:


In practice, I was not able to delete the .eln files from a make native.

In order to have a more controlled environment, I delete them _before_
I refresh my local org-mode/main directory, and then do a make native
after refreshing my local copy.

Same happened when testing modifications. When testing a modification
I always make cleaneln; make native to test it


In the past I read a couple of threads on native compilation on 
emacs-devel and maybe a couple of bug reports. My impression that the 
position of developers in response to requests to give more control on 
native compilation is "it should just work and users should not bother".


Do you know a reproducible way leading to errors when .eln files are not 
removed?





Re: Reproducible work with natively compiled Emacs

2024-03-17 Thread Pedro Andres Aranda Gutierrez
Hi Ihor.

In practice, I was not able to delete the .eln files from a make native.

In order to have a more controlled environment, I delete them _before_
I refresh my local org-mode/main directory, and then do a make native
after refreshing my local copy.

Same happened when testing modifications. When testing a modification
I always make cleaneln; make native to test it

Maybe I'm a bit too 'meticulous' but that's me ;-)

Best, /PA

On Sat, 16 Mar 2024 at 11:20, Ihor Radchenko  wrote:

> Pedro Andres Aranda Gutierrez  writes:
>
> >> Do I understand correctly that the reason you implemented cleaneln make
> >> target is working around issues with make test/make repro?
> >>
> > Yes, that's one of the reasons. And, also because when I set
> > native.comp-eln-cache-path,
> > anything that is not part of the Emacs distribution gets compiled into
> that
> > directory. For example,
> > the clone of org-mode main as well as the packages from
> elpa/melpa/nungnu.
>
> Sorry, but I do not fully understand.
> May you please explain in more details what kind of problems you
> encountered in practice?
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 
>


-- 
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