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

2023-12-26 Thread Jack Kamm
Ihor Radchenko  writes:

> I think we have a misunderstanding here.
>
> Didn't we just discuss that C-c C-p in python is not equivalent to
> `org-babel-python-initiate-session'?

ob-python works fine with sessions started externally by `run-python'.
And I have preserved this functionality, as I enjoy the flexibility of
working this way.

In particular, ob-python will detect when it needs to run
`org-babel-python--setup-session', even if the session was started
externally by `run-python'.

`org-babel-python-initiate-session' might be misnamed, which may be
causing some confusion here. It is run whenever a Python block is
executed, even if the session already exists.



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

2023-12-26 Thread Jack Kamm
Liu Hui  writes:

> I just want to set 'python-shell-buffer-name' in the edit buffer
> according to the :session header and don't need to start the session
> even if the session doesn't exist.

Sorry that I missed this thread.

I agree that `python-shell-buffer-name' should be set according to the
:session header, and that Liu's patch fixes a problem in ob-python.

Is there any objection if I go ahead and apply it?

I think the question of what to do when a session doesn't exist is a
separate issue. Liu's patch doesn't change the status quo on this
matter (C-c C-c still tells you to call run-python either way). And
I'm not convinced there is a problem with the status quo anyways,
though additional customization could be nice.



Re: [PATCH] org-manual: Describe export process flow

2023-12-26 Thread Matt


  On Tue, 26 Dec 2023 22:56:00 +0100  Matt  wrote --- 
 
 > I tend leave the period of the last sentence of a list.

Typo.  I meant to write "I tend TO leave the period OFF the last sentence of a 
list."  That is, the item ends without a period.

--
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: [PATCH] org-manual: Describe export process flow

2023-12-26 Thread Matt
This looks useful.

My only understanding of the problem this addresses is what you wrote:

 > create a more clear picture on how various export hooks and filters
 > are used.

With this understanding, my first question was, "What hooks exist?"  I
see that 
[[https://www.gnu.org/software/emacs/manual/html_node/org/Advanced-Export-Configuration.html][Advanced
 Export Configuration]] gives only
~org-export-before-processing-hook~ and
~org-export-before-parsing-hook~.  The section below it gives a table
of filters.

Here are all the hooks and functions for org-export (via =C-h v
org-export--hooks TAB= and =C-h v org-export--function TAB=).  I see
59 of them.

| Hooks   | Manual (60f357e8b) | Patch |
|-++---|
| org-export-before-processing-hook (obsolete)| X  | X |
| org-export-before-parsing-hook  | X  | X |
| org-export-stack-mode-hook  ||   |
| org-export-filter-options-functions | X  | X |
| org-export-filter-parse-tree-functions  | X  | X |
| org-export-filter-body-functions| X  | X |
| org-export-filter-final-output-functions| X  | X |
| org-export-before-parsing-functions ||   |
| org-export-before-processing-functions  ||   |
| org-export-filter-babel-call-functions  | X  |   |
| org-export-filter-bold-functions| X  |   |
| org-export-filter-center-block-functions| X  |   |
| org-export-filter-clock-functions   | X  |   |
| org-export-filter-code-functions| X  |   |
| org-export-filter-diary-sexp-functions  | X  |   |
| org-export-filter-drawer-functions  | X  |   |
| org-export-filter-dynamic-block-functions   | X  |   |
| org-export-filter-entity-functions  | X  |   |
| org-export-filter-example-block-functions   | X  |   |
| org-export-filter-export-block-functions| X  |   |
| org-export-filter-export-snippet-functions  | X  |   |
| org-export-filter-fixed-width-functions | X  |   |
| org-export-filter-footnote-definition-functions | X  |   |
| org-export-filter-footnote-reference-functions  | X  |   |
| org-export-filter-headline-functions| X  |   |
| org-export-filter-horizontal-rule-functions | X  |   |
| org-export-filter-inline-babel-call-functions   | X  |   |
| org-export-filter-inline-src-block-functions| X  |   |
| org-export-filter-inlinetask-functions  | X  |   |
| org-export-filter-italic-functions  | X  |   |
| org-export-filter-item-functions| X  |   |
| org-export-filter-keyword-functions | X  |   |
| org-export-filter-latex-environment-functions   | X  |   |
| org-export-filter-latex-fragment-functions  | X  |   |
| org-export-filter-line-break-functions  | X  |   |
| org-export-filter-link-functions| X  |   |
| org-export-filter-node-property-functions   | X  |   |
| org-export-filter-paragraph-functions   | X  |   |
| org-export-filter-plain-list-functions  | X  |   |
| org-export-filter-plain-text-functions  | X  |   |
| org-export-filter-planning-functions| X  |   |
| org-export-filter-property-drawer-functions | X  |   |
| org-export-filter-quote-block-functions | X  |   |
| org-export-filter-radio-target-functions| X  |   |
| org-export-filter-section-functions | X  |   |
| org-export-filter-special-block-functions   | X  |   |
| org-export-filter-src-block-functions   | X  |   |
| org-export-filter-statistics-cookie-functions   | X  |   |
| org-export-filter-strike-through-functions  | X  |   |
| org-export-filter-subscript-functions   | X  |   |
| org-export-filter-superscript-functions | X  |   |
| org-export-filter-table-cell-functions 

Re: [PATCH] org-manual: Describe export process flow

2023-12-26 Thread Karthik Chikmagalur
> The patch is attached.
> I'd appreciate feedback from people not familiar with ox.el.

- When exporting a sub-tree, at what stage of the export process is the
  buffer narrowed to the sub-tree?
- Are "inner" and "outer" templates described in the manual, and if they
  are could you add a link to those sections when mentioning them in
  this summary?  I only found references to the plist properties
  BEAMER_INNER_THEME etc.

Karthik



Re: [PATCH] org-manual: Describe export process flow

2023-12-26 Thread Thomas S. Dye

Aloha Ihor,

Ihor Radchenko  writes:


Hi,

I'd like to add a new section to Org mode manual.
The new section will describe all the steps performed by Org 
export
process. This should hopefully create a more clear picture on 
how

various export hooks and filters are used.

The patch is attached.
I'd appreciate feedback from people not familiar with ox.el.


I'm not too familiar with ox.el.

I edited mostly to use an active voice. I put author queries in 
parentheses.  I haven't paid attention to manual formatting 
conventions.


IMO, more links would likely be helpful.

* Suggested revision

Org mode export is a multi-step process that works on a temporary 
copy of the buffer as follows:
   1. Execute ~org-export-before-processing-hook~ (see 
   [[*Hooks]]);

   2. Expand =#+include= keywords;
   3. Remove commented headings; (author: clarify whether the 
   body is also removed?)

   4. Replace macros;
   5. Export source code blocks, conditional on 
   ~org-export-use-babel~ and, if
  necessary, the individual ~exports~ header arguments (see 
  [[*Exporting Code Blocks]]);
   6. Evaluate source code blocks (see [[*Evaluating Code 
   Blocks]]);

   7. Execute ~org-export-before-parsing-hook~ (see [[*Hooks]]);
   8. Calculate export option values according to in-buffer 
   keywords,
  =#+BIND= keywords, and buffer-local and global 
  customizations;
   9. Calculate (author: Determine instead of Calculate?) 
   bibliography file paths;

   10. Execute ~org-export-filter-options-functions~;
   11. Parse the temporary (author: is this correct?) buffer to 
   generate an

   abstract syntax tree (AST);
   12. Remove elements that will not be exported from the AST:
   1. Headings according to =SELECT_TAGS= and =EXCLUDE_TAGS= 
   export

  keywords, and =task=, =inline=, =arch= export options;
   2. Comments;
   3. Clocks, drawers, fixed-width environments, footnotes, 
   LaTeX environments and fragments, node properties, 
   planning lines, property drawers, statistics cookies, and 
   timestamps according to their corresponding export 
   options;
   4. Table rows containing [[*Column Width and 
   Alignment][width and alignment markers]];
   5. Table columns containing [[*Advanced features][recalc 
   marks]];
   13. Expand environment variables in file links according to 
   the =expand-links= export option (author: are we still 
   operating on AST here?);
   14. Execute ~org-export-filter-parse-tree-functions~ (author: 
   ditto);
   15. Create bibliography listing(s) from citation(s) (author: 
   ditto);
   16. Replace =+print_bibliography= keyword(s) with bibliography 
   listing(s) (author: ditto);
   17. Transcode the AST according to export backend using 
   recursive, depth-first search, and passing each transcoded 
   node as a string to the export filter (see [[*Filters]]):
   18. Format transcoded AST according to the backend's "inner" 
   template;
   19. Execute ~org-export-filter-body-functions~ on the 
   transcoded and formatted AST;
   20. Format the result according to the backend's "outer" 
   template;
   21. Finalize bibliography listing(s) (author: correct?) and 
   citation(s); and

   22. Execute ~org-export-filter-final-output-functions~.

Let me know if you have questions.

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



Rewording the biblatex documentation

2023-12-26 Thread Pedro Andres Aranda Gutierrez
Hi,

I slept over the comments and came up with a better wording. I hope it adds
more information and is therefore more helpful

Best wishes for 2024
/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 c2373712501805fb0a81d4c34c3127579c5b10c3 Mon Sep 17 00:00:00 2001
From: "Pedro A. Aranda" 
Date: Tue, 26 Dec 2023 19:00:50 +0100
Subject: [PATCH] Reword biblatex documentation

---
 doc/org-manual.org | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index 23f250fa7..ff1b9cffb 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -17348,13 +17348,15 @@ conformant to the Harvard style and the specification of the
 Wolkers-Kluwer publisher; since it relies on the ~bibtex~ processor of
 your LaTeX installation, it won't export to anything but PDF.
 
-: #+cite_export: biblatex backend=biber
+: #+cite_export: biblatex numeric,backend=bibtex
 
 #+texinfo: @noindent
-specifies the =biblatex= export processor, using the =biber= backend.
-More options can be specified. Consult the documentation of the
-~biblatex~ package. It will only export to PDF, since it relies on the
-~biblatex~ processor of your LaTeX installation;
+specifies the =biblatex= export processor with the default =numeric=
+style and the =bibtex= backend. Always define the style first and then
+the rest of load-time options for the =biblatex=
+package. Alternatively, use the ~org-cite-biblatex-options~ variable
+in your Emacs configuration. It will only export to PDF, since it
+relies on the ~biblatex~ processor of your LaTeX installation;
 
 ** Bibliography printing
 
-- 
2.34.1



Re: How can I use org-add-note with emacsclient?

2023-12-26 Thread equal . moon0346
On Mon, Dec 25, 2023, at 14:35, Ihor Radchenko wrote:
> equal.moon0...@fastmail.com writes:
>
>> I'm trying to figure out how to start a note (C-c C-z) on the currently 
>> clocked task from emacsclient. Here's what I have so far:
>> ...
>> emacsclient -s test -nw --eval '(progn (org-clock-goto) (org-add-note))'
>>
>> This seems to have no effect. Oddly, if I paste this into M-:, it works 
>> fine. I've tried a number of things with e.g. plain capture templates that 
>> run the above code :after-finalize, using call-interactively, etc. After a 
>> cursory reading through the info manual on interactivity I find I'm still a 
>> bit lost. Can anyone explain what I'm doing wrong and hopefully point me to 
>> the right manual page to read on this?
>
> `org-add-note' is implemented a bit awkwardly using post-command-hook,
> which makes it work only interactively.
> The hook does not trigger when you use --eval. That's why you are not
> seeing the note buffer after running the above shell command.
>
> What you can do is manually call the function used to raise the note
> buffer:
>
> emacsclient -nw --eval '(progn (org-clock-goto) (org-add-note) 
> (org-add-log-note))'

Thanks, this works! I'm curious as to why though. Shouldn't something like 
call-interactively solve this problem too? I'm thinking it has something to do 
with how the command loop works that I don't understand.



Re: [BUG] org-contrib: org-eldoc has an autload, but is incompatible with modern emacs. [9.6.8 (release_9.6.8-3-g21171d @ /usr/share/emacs/30.0.50/lisp/org/)]

2023-12-26 Thread Vladimir Nikishkin
Yeah, but it's still getting funky when some init files load the
built-in version.

But nevertheless, I don't seem to see this problem any more.

This bug can be closed.

On Tue, 26 Dec 2023 at 22:30, Ihor Radchenko  wrote:
>
> Vladimir Nikishkin  writes:
>
> > :\ that patch doesn't cleanly apply on top of emacs' master by itself.
> >
> > And I don't know how to merge org's master into Emacs gracefully.
> >
> > I will try with melpa's org, but it's likely to produce a mess with the 
> > configs.
> > Let me see what I can do.
>
> See 
> https://orgmode.org/manual/Installation.html#Using-Org_0027s-git-repository-1
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 



-- 
Yours sincerely, Vladimir Nikishkin
(Sent from GMail web interface.)



Re: custom function for org-babel src block export

2023-12-26 Thread David Bremner
Rudolf Adamkovič  writes:

> How about:
>
> (defvar stacker-base
>   "\href{https://www.example.com/stacker/?program=%s}{execute on stacker}")
>
> (defun org-babel-execute:stacker (body params)
>   (format stacker-base 
>   (org-link-encode body '(?? ?  ?( ?) ?\n
>

Thanks, that's a definite improvement on my version. I feel less like
I'm fighting org-mode now ;). It just needs the same ":results value
latex" to insert properly into the beamer export.



Re: [BUG] org-contrib: org-eldoc has an autload, but is incompatible with modern emacs. [9.6.8 (release_9.6.8-3-g21171d @ /usr/share/emacs/30.0.50/lisp/org/)]

2023-12-26 Thread Ihor Radchenko
Vladimir Nikishkin  writes:

> :\ that patch doesn't cleanly apply on top of emacs' master by itself.
>
> And I don't know how to merge org's master into Emacs gracefully.
>
> I will try with melpa's org, but it's likely to produce a mess with the 
> configs.
> Let me see what I can do.

See 
https://orgmode.org/manual/Installation.html#Using-Org_0027s-git-repository-1

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



[PATCH] org-manual: Describe export process flow

2023-12-26 Thread Ihor Radchenko
Hi,

I'd like to add a new section to Org mode manual.
The new section will describe all the steps performed by Org export
process. This should hopefully create a more clear picture on how
various export hooks and filters are used.

The patch is attached.
I'd appreciate feedback from people not familiar with ox.el.

>From 57d290b710c85e0411855937e224d2cecdbd52da Mon Sep 17 00:00:00 2001
Message-ID: <57d290b710c85e0411855937e224d2cecdbd52da.1703600243.git.yanta...@posteo.net>
From: Ihor Radchenko 
Date: Tue, 26 Dec 2023 15:15:23 +0100
Subject: [PATCH] doc/org-manual.org: Describe export flow

* doc/org-manual.org (Summary of the export process): Explain how the
export process is handled in Org mode.
---
 doc/org-manual.org | 54 ++
 1 file changed, 54 insertions(+)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index 7db69cbb6..1a9432b4d 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -16391,6 +16391,60 @@ ** Advanced Export Configuration
 :DESCRIPTION: Fine-tuning the export output.
 :END:
 
+*** Summary of the export process
+
+During export, Org mode processes the source Org buffer in multiple
+steps:
+
+1. The source Org mode buffer is copied into temporary throwaway
+   buffer that can be edited by export hooks
+2. ~org-export-before-processing-hook~ is executed (see [[*Export hooks]])
+3. All the =#+include= keywords are expanded
+4. All the commented headings are removed
+5. All the macros are replaced in buffer
+6. When ~org-export-use-babel~ is non-nil (default), all the src
+   blocks and babel calls that are not inside archived headings are
+   processed
+7. ~org-export-before-parsing-hook~ is executed (see [[*Export hooks]])
+8. Export option values are calculated, according to in-buffer
+   keywords, =#+BIND= keywords, buffer-local and global
+   customizations.
+9. Files contributing to bibliography are calculated
+10. ~org-export-filter-options-functions~ is executed
+11. The buffer is parsed, generating abstract syntax tree (AST)
+12. The AST is cleaned from buffer elements that should not be
+exported:
+- Heading are removed according to =SELECT_TAGS= and
+  =EXCLUDE_TAGS= export keywords; =task=, =inline=, =arch= export
+  options
+- All the comments are removed
+- Clocks, drawers, fixed-width environments, footnotes, latex
+  environments and fragments, node properties, planning lines,
+  property drawers, statistics cookies, and timestamps are removed
+  or kept according to the corresponding export options
+- Table rows containing [[*Column Width and Alignment][width and alignment markers]] are removed
+- Table columns containing [[*Advanced features][recalc marks]] are removed
+13. Environment variables are expanded in all the file links when
+=expand-links= export option is set
+14. ~org-export-filter-parse-tree-functions~ is executed
+15. All the citations are processed according to the chosen citation
+backend
+16. =#+print_bibliography= keywords are replaced with bibliography
+listings
+17. AST is transcoded according to the chosen export backend
+- The export happens recursively, depth-first
+- Each transcoded AST node, as a string, is passed to the
+  corresponding export filter (see [[*Filters]])
+18. The transcoded AST body is formatted according to backend's
+"inner" template
+19. The resulting body is passed to
+~org-export-filter-body-functions~
+20. The filtered body is formatted according to backend's outer
+template
+21. The resulting output is processed by citation backend finalizer
+22. ~org-export-filter-final-output-functions~ are applied to the
+final output
+
 *** Export hooks
 :PROPERTIES:
 :UNNUMBERED: notoc
-- 
2.42.0



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


Re: [BUG] org-contrib: org-eldoc has an autload, but is incompatible with modern emacs. [9.6.8 (release_9.6.8-3-g21171d @ /usr/share/emacs/30.0.50/lisp/org/)]

2023-12-26 Thread Vladimir Nikishkin
:\ that patch doesn't cleanly apply on top of emacs' master by itself.

And I don't know how to merge org's master into Emacs gracefully.

I will try with melpa's org, but it's likely to produce a mess with the configs.
Let me see what I can do.


On Tue, 26 Dec 2023 at 21:27, Ihor Radchenko  wrote:
>
> Vladimir Nikishkin  writes:
>
> > org-version variable returns 9.6.13
> > (org-version) function call also returns 9.6.13
> >
> > The test.org file itself has the org version stamp.
>
> I see. What about the latest development version of Org mode (main branch)?
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 



-- 
Yours sincerely, Vladimir Nikishkin
(Sent from GMail web interface.)



Re: [BUG] org-contrib: org-eldoc has an autload, but is incompatible with modern emacs. [9.6.8 (release_9.6.8-3-g21171d @ /usr/share/emacs/30.0.50/lisp/org/)]

2023-12-26 Thread Ihor Radchenko
Vladimir Nikishkin  writes:

> org-version variable returns 9.6.13
> (org-version) function call also returns 9.6.13
>
> The test.org file itself has the org version stamp.

I see. What about the latest development version of Org mode (main branch)?

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



Re: [BUG] org-contrib: org-eldoc has an autload, but is incompatible with modern emacs. [9.6.8 (release_9.6.8-3-g21171d @ /usr/share/emacs/30.0.50/lisp/org/)]

2023-12-26 Thread Vladimir Nikishkin
org-version variable returns 9.6.13
(org-version) function call also returns 9.6.13

The test.org file itself has the org version stamp.

On Tue, 26 Dec 2023 at 21:19, Ihor Radchenko  wrote:
>
> Vladimir Nikishkin  writes:
>
> > Logs attached, the file is very simple, also attached:
>
> Looks like a bug fixed in Org 9.6.10:
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=37d6bde27
>
> And you seems to be using Org 9.6.8.
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 



-- 
Yours sincerely, Vladimir Nikishkin
(Sent from GMail web interface.)



Re: [BUG] org-contrib: org-eldoc has an autload, but is incompatible with modern emacs. [9.6.8 (release_9.6.8-3-g21171d @ /usr/share/emacs/30.0.50/lisp/org/)]

2023-12-26 Thread Ihor Radchenko
Vladimir Nikishkin  writes:

> Logs attached, the file is very simple, also attached:

Looks like a bug fixed in Org 9.6.10:
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=37d6bde27

And you seems to be using Org 9.6.8.

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



Re: custom function for org-babel src block export

2023-12-26 Thread Rudolf Adamkovič
How about:

(defvar stacker-base
  "\href{https://www.example.com/stacker/?program=%s}{execute on stacker}")

(defun org-babel-execute:stacker (body params)
  (format stacker-base 
  (org-link-encode body '(?? ?  ?( ?) ?\n

It works with noweb too:

#+NAME: last
#+BEGIN_SRC stacker :eval no
(f)
#+END_SRC

#+BEGIN_SRC stacker :noweb yes
(defvar x 1)
(deffun (f)
  (defvar y 2)
  (deffun (h)
(+ x y))
  (h))
<>
#+END_SRC

#+RESULTS:
: 
href{https://www.example.com/stacker/?program=%28defvar%20x%201%29%0A%28deffun%20%28f%29%0A%20%20%28defvar%20y%202%29%0A%20%20%28deffun%20%28h%29%0A%20%20%20%20%28+%20x%20y%29%29%0A%20%20%28h%29%29%0A%28f%29}{execute
 on stacker}

Rudy
-- 
"Genius is 1% inspiration and 99% perspiration."
--- Thomas Alva Edison, 1932

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



Re: [BUG] org-contrib: org-eldoc has an autload, but is incompatible with modern emacs. [9.6.8 (release_9.6.8-3-g21171d @ /usr/share/emacs/30.0.50/lisp/org/)]

2023-12-26 Thread Vladimir Nikishkin
On Tue, 26 Dec 2023 at 20:20, Ihor Radchenko  wrote:
>
> Vladimir Nikishkin  writes:
>
> >> If you are using the latest main, you can set `debug-on-error' to t.
> >> Then, you will see the backtrace of the error that you can share.
> >
> > Did that, but it's not very useful:
> >
> > #+begin_src elisp
> > Debugger entered--Lisp error: (error "Invalid search bound (wrong side of 
> > point)")
> >   org-element-paragraph-parser(23 (23))
>
> Then, you can disable debug-on-error, and add the following to your config:
> (setq org-element--cache-self-verify 'backtrace)
> (setq org-element--cache-self-verify-frequency 1.0)
>
> This will make Org mode produce the detailed parser logs, which you can
> share. (Note that the log may contain parts of your Org file, so you
> may consider sharing privately or obfuscating the logs)
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 

In which buffer?

-- 
Yours sincerely, Vladimir Nikishkin
(Sent from GMail web interface.)



Re: [BUG] org-contrib: org-eldoc has an autload, but is incompatible with modern emacs. [9.6.8 (release_9.6.8-3-g21171d @ /usr/share/emacs/30.0.50/lisp/org/)]

2023-12-26 Thread Ihor Radchenko
Vladimir Nikishkin  writes:

>> If you are using the latest main, you can set `debug-on-error' to t.
>> Then, you will see the backtrace of the error that you can share.
>
> Did that, but it's not very useful:
>
> #+begin_src elisp
> Debugger entered--Lisp error: (error "Invalid search bound (wrong side of 
> point)")
>   org-element-paragraph-parser(23 (23))

Then, you can disable debug-on-error, and add the following to your config:
(setq org-element--cache-self-verify 'backtrace)
(setq org-element--cache-self-verify-frequency 1.0)

This will make Org mode produce the detailed parser logs, which you can
share. (Note that the log may contain parts of your Org file, so you
may consider sharing privately or obfuscating the logs)

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



Re: [BUG] org-contrib: org-eldoc has an autload, but is incompatible with modern emacs. [9.6.8 (release_9.6.8-3-g21171d @ /usr/share/emacs/30.0.50/lisp/org/)]

2023-12-26 Thread Vladimir Nikishkin


Ihor Radchenko  writes:

> Vladimir Nikishkin  writes:
>
>> So, this might not actually be the case.
>> I am getting a lot of org-element-cache errors recently, and I don't
>> seem to be able to find what triggers them to appear.
>> The error message is always the same,
>> "Invalid search bound (wrong side of point)"
>>
>> Any ideas on how to debug this?
>
> If you are using the latest main, you can set `debug-on-error' to t.
> Then, you will see the backtrace of the error that you can share.

Did that, but it's not very useful:

#+begin_src elisp
Debugger entered--Lisp error: (error "Invalid search bound (wrong side of 
point)")
  org-element-paragraph-parser(23 (23))
  org-element--current-element(23 element nil nil)
  org-element--parse-to(573 nil nil)
  org-element--cache-process-request([552 552 3010 22 nil 1] nil 3010 nil nil 
nil)
  org-element--cache-sync(# 3010)
  org-element-at-point()
  org-eldoc-get-src-lang()
  org-eldoc-documentation-function(#f(compiled-function (string  plist) 
#))
  eldoc-documentation-default()
  eldoc--invoke-strategy(nil)
  eldoc-print-current-symbol-info()
  #()
  apply(# nil)
  timer-event-handler([t 0 0 50 nil # nil idle 0 nil])
#+end_src

The beginning of the call stack may be different, but the deep levels,
with "org-element--parse-to" are always more or less the same, and
produce the same error.

-- 
Your sincerely,
Vladimir Nikishkin (MiEr, lockywolf)
(Laptop)



Re: [BUG] org-contrib: org-eldoc has an autload, but is incompatible with modern emacs. [9.6.8 (release_9.6.8-3-g21171d @ /usr/share/emacs/30.0.50/lisp/org/)]

2023-12-26 Thread Ihor Radchenko
Vladimir Nikishkin  writes:

> So, this might not actually be the case.
> I am getting a lot of org-element-cache errors recently, and I don't
> seem to be able to find what triggers them to appear.
> The error message is always the same,
> "Invalid search bound (wrong side of point)"
>
> Any ideas on how to debug this?

If you are using the latest main, you can set `debug-on-error' to t.
Then, you will see the backtrace of the error that you can share.

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



Documentation Results of Evaluation (was Re: Documentation of hline symbol in source blocks results)

2023-12-26 Thread Matt
Thanks for your message, Tim!  You make many good points and I can
only respond to a few of them.

I'm also pleased to see you've got FSF Assignment:
https://orgmode.org/worg/contributors.html

Do you have time to work together on this?

I have four goals:
1. Understand your perspective
2. Remove confusion
3. Detail specific problems to solve
4. Suggest, or commit, specific changes to the manual which resolve
the specific problems

This email focuses on the first three.  I'll first respond to you, try
to understand your perspective, remove confusion, and highlight
specific problems to solve.  I'll then give some comments on the
specific problems.  My hope is that after several exchanges, we'll
have a list of specific problems that the mailing list can then
discuss for solutions.

  On Mon, 25 Dec 2023 17:37:41 +0100  Tim Landscheidt  wrote ---

 > the documentation reads like users having had an issue...and then
 > someone feeling the need to document the solution right then and
 > there.

What you say likely happened.

 > IMNSHO this leads to documentation that is not very usable
 > for the general audience.

Agreed!

 > Just for further inspiration how the documentation could be
 > rewritten, consider the current wording of "Results of Eval-
 > uation/Collection/value":
 >
 > |  Default for most Babel libraries(1).  Functional mode.  Org gets
 > |  the value by wrapping the code in a function definition in the
 > |  language of the source block.  That is why when using ‘:results
 > |  value’, code should execute like a function and return a value.
 > |  For languages like Python, an explicit ‘return’ statement is
 > |  mandatory when using ‘:results value’.  Result is the value
 > |  returned by the last statement in the code block.
 >
 > |  When evaluating the code block in a session (see *note Environment
 > |  of a Code Block::), Org passes the code to an interpreter running
 > |  as an interactive Emacs inferior process.  Org gets the value from
 > |  the source code interpreter’s last statement output.  Org has to
 > |  use language-specific methods to obtain the value.  For example,
 > |  from the variable ‘_’ in Ruby, and the value of ‘.Last.value’ in R.
 >
 > Wrapping the code?

When you write

#+begin_src C
printf("hello, world!\n");
#+end_src

The code that's executed is actually:

int main() {
printf("hello, world!\n");
return 0;
}

When you write

#+begin_src python
print("hello, world!")
#+end_src

The code that's executed is actually (brace for it...):

def __org_babel_python_format_value(result, result_file, result_params):
with open(result_file, 'w') as f:
if 'graphics' in result_params:
result.savefig(result_file)
elif 'pp' in result_params:
import pprint
f.write(pprint.pformat(result))
elif 'list' in result_params and isinstance(result, dict):
f.write(str(['{} :: {}'.format(k, v) for k, v in result.items()]))
else:
if not set(result_params).intersection(['scalar', 'verbatim', 
'raw']):
def dict2table(res):
if isinstance(res, dict):
return [(k, dict2table(v)) for k, v in res.items()]
elif isinstance(res, list) or isinstance(res, tuple):
return [dict2table(x) for x in res]
else:
return res
if 'table' in result_params:
result = dict2table(result)
try:
import pandas
except ImportError:
pass
else:
if isinstance(result, pandas.DataFrame) and 'table' in 
result_params:
result = [[result.index.name or ''] + 
list(result.columns)] + [None] + [[i] + list(row) for i, row in 
result.iterrows()]
elif isinstance(result, pandas.Series) and 'table' in 
result_params:
result = list(result.items())
try:
import numpy
except ImportError:
pass
else:
if isinstance(result, numpy.ndarray):
if 'table' in result_params:
result = result.tolist()
else:
result = repr(result)
f.write(str(result))
def main():
print("hello, world!")

__org_babel_python_format_value(main(), '/tmp/babel-7Zq1c7/python-e7IyhX', 
["replace"])

However, not every language is wrapped.

For bash, when you write

#+begin_src bash
echo "hello, world!"
#+end_src

Something like this is passed to a bash process:

echo "hello, world!"

PROBLEM: "wrapping" is inaccurate

 > "Code /should/"?

I agree, this can improve.  "Should" in this context reads as
"probably" and is non-committal.  Documentation has a duty to be

Re: [BUG] org-contrib: org-eldoc has an autload, but is incompatible with modern emacs. [9.6.8 (release_9.6.8-3-g21171d @ /usr/share/emacs/30.0.50/lisp/org/)]

2023-12-26 Thread Vladimir Nikishkin


Vladimir Nikishkin  writes:

> Ihor Radchenko  writes:
>
>> Vladimir Nikishkin  writes:
>>
 May you elaborate about incompatibility?

>>>
>>> Yes. With org-eldoc loaded, and having a property '#+date: unpublished'
>>> in an org file, I am having the '*Messages*' buffer filled with
>>> #+begin_src elisp
>>> ⛔ Warning (org-element-cache): org-element--cache: Org parser error in 
>>> 2015_Passwords.org.rclignore::53653. Resetting.
>>>  The error was: (error "Invalid search bound (wrong side of point)")
>>>  Backtrace:
>>> "  backtrace-to-string(nil)
>>>   org-element-at-point()
>>
>> This has nothing to do with eldoc.
>> If you can reproduce this problem consistently, may you create a minimal
>> example as described in https://orgmode.org/manual/Feedback.html#Feedback ?
>
> I found and fixed this problem.
> It was actually unrelated to bare org, it was due to my experiments with
> org-ts-mode. Sorry for the confusion.

So, this might not actually be the case.
I am getting a lot of org-element-cache errors recently, and I don't
seem to be able to find what triggers them to appear.
The error message is always the same,
"Invalid search bound (wrong side of point)"

Any ideas on how to debug this?

-- 
Your sincerely,
Vladimir Nikishkin (MiEr, lockywolf)
(Laptop)