Re: figures not exported properly by ox-latex

2024-07-11 Thread Karthik Chikmagalur
> it might've been fixed for figures as its been a while, but shouldnt > latex environments with #+caption: and #+name: above them be exported > as figures? because currently the user has to write \begin{figure} and > \end{figure} explicitly which would work This is not the case. The LaTeX

Re: figures not exported properly by ox-latex

2024-07-09 Thread Karthik Chikmagalur
> im on tecosaur's dev branch (version 9.7-pre) > i have the following in an org file: > ```org > #+name: fig-switching-circuit-1 > #+caption: implementation of \(p\) > [[attachment:circuit.svg]] > ``` > it gets turned into this > ``` >

Re: [Pre-PATCH] Overhaul of the LaTeX preview system

2024-06-26 Thread Karthik Chikmagalur
I don't see anything wrong in the diagnostic information you've provided. Here are some more questions for you. 1. What is your org-latex-compiler set to? 2. Could you try to use dvisvgm to generate previews, and when it fails, check the contents of the buffer "*Org Preview Convert Output*"?

Re: [PATCH] Fix regex for determining image width from attribute

2024-05-06 Thread Karthik Chikmagalur
> 1. #+attr_org is prioritised > 2. Docstrings are updated > > Handled, on main. > https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=fede1c990 Just a note that we already prioritize #+attr_org when aligning/centering images. So this change makes sense. Karthik

Re: [BUG] Attachments not resolved correctly from symlinked Org files

2024-05-01 Thread Karthik Chikmagalur
> I can see the problem. > But what would you expect to happen if there was no attachment in the > original directory? Should the attachment be created relative to the > original file? To the symlink? I don't know. I would expect the attachment to always be created relative to the original file,

[BUG] Attachments not resolved correctly from symlinked Org files

2024-04-28 Thread Karthik Chikmagalur
Attachment paths are not resolved correctly when the Org file is symlinked elsewhere. This may or may not be a bug, but I think it's undesired behavior: 1. Create an Org file somewhere, say ~/Desktop/test.org. 2. In test.org, create an attachment: `C-c C-a m' as a file. Either the "copy" or

Re: Using org-latex-preview in other major modes

2024-04-21 Thread Karthik Chikmagalur
> Anyways, before I put this off for much longer, there is some more code > attached. Live previews (and general environments) work now, and besides > the above mentioned points there were no new surprises waiting—at least > for getting the basic functionality to work. Thank you for the update!

Re: [Pre-PATCH] Overhaul of the LaTeX preview system

2024-04-18 Thread Karthik Chikmagalur
> I hope I understand correctly how to use this mail-thread. Thank you > very much for such a great enhancement of Org-mode LaTeX preview > capabilities. I am on macOS Big Sur and have some troubles with > dvisvgm preview in your particular fork. Everything works just fine in > stable release of

Re: [Pre-PATCH] Overhaul of the LaTeX preview system

2024-04-17 Thread Karthik Chikmagalur
> I've got problem when I use this version of org-latex preview: > > RUNNING: dvisvgm --page=1- --optimize --clipjoin --relative --no-fonts > --bbox=preview -o c\:/Users/artsi0m/AppData/Local/Temp/org-tex-DAJVTr-%9p.svg > c\:/Users/artsi0m/AppData/Local/Temp/org-tex-DAJVTr.dvi > > ERROR: can't

org-persist-write slowing down kill-buffer

2024-04-17 Thread Karthik Chikmagalur
Hi, I've been noticing that kill-buffer blocks Emacs for a noticeable period when killing org buffers. Here are elp results obtained by instrumenting org-persist-* and kill-buffer: | Function name | Call count | Elapsed time | Average time |

Re: [Q] startup hook: How do I detect if the current buffer has been opened programmatically?

2024-04-09 Thread Karthik Chikmagalur
>> Org-mode occasionally opens files automatically, for instance, when >> inserting or opening ID links, or during certain searches. I need to >> determine if a buffer was opened programmatically or manually by the user >> within the startup hooks. This distinction is important because, e.g., I >>

Re: Using org-latex-preview in other major modes

2024-04-08 Thread Karthik Chikmagalur
> Thanks for taking a look! It indeed seems that caching will be the most > work to properly implement. However, I'm quite happy to not care about > numbers for now and make sure the other stuff works correctly first > before tackling this. Sure, this is a disproportionate amount of work for a

Re: Using org-latex-preview in other major modes

2024-04-07 Thread Karthik Chikmagalur
> Abstracting away previews is certainly welcome. > RMS explicitly asked Org mode team to work towards this goal: > https://list.orgmode.org/e1kikxv-0007iy...@fencepost.gnu.org/ I agree with RMS about this, and this was on our minds when we wrote org-latex-preview. The basic previewing process

Re: Using org-latex-preview in other major modes

2024-04-07 Thread Karthik Chikmagalur
Hi Tony, Just tried it out, it's very promising! Thanks for taking the initiative on this. > I've prodded the code a little bit and, mostly just following [1], > managed to implement basic previews in a relatively straightforward > fashion. Attached is a proof-of-concept—aptly named >

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

2024-04-05 Thread Karthik Chikmagalur
>> Thanks for the patch! >> May you please describe a use case when it is necessary to run >> latex >> multiple times for previews? > > Sure: it's required whenever you have LaTeX that refers to > other document elements whose positions are only known after > they've been typeset. This often

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

Re: [PATCH] Justify/align image previews in org-mode

2023-12-19 Thread Karthik Chikmagalur
e ":align[[:space:]]+nil") >> +(keyword-string (mapconcat >> + (lambda (attr) >> + (or (car-safe (org-element-property attr p)) >> "")) >> + '(:attr_org :att

Re: [PATCH] Justify/align image previews in org-mode

2023-12-18 Thread Karthik Chikmagalur
. - Unspecified behaviors: + The behavior of `:center nil` is undefined + #+attr_html vs #+attr_latex - Include a commit message in the patch. The included patch is based on the main branch. Karthik >From eb1b287c009c2f7eb83e7e31d64980ba79f44527 Mon Sep 17 00:00:00 2001 From: Kart

Re: [PATCH] Justify/align image previews in org-mode

2023-12-18 Thread Karthik Chikmagalur
> I can only suggest something like > > (equal (org-element-begin link) > (save-excursion > (goto-char (org-element-contents-begin paragraph)) > (skip-chars-forward "\t ") > (point))) > > (equal (org-element-end link) > (save-excursion > (goto-char (org-element-contents-end paragraph)) >

Re: [PATCH] Justify/align image previews in org-mode

2023-12-18 Thread Karthik Chikmagalur
> It would make sense to allow 'left value as well (same as nil). Done. > I do not think that we need to consider 'justify value at this point. > Maybe in future, when (or if) we add proper justification support to > text. But not now. Removed support for 'justify. > This will not work when

Re: [PATCH] Justify/align image previews in org-mode

2023-12-18 Thread Karthik Chikmagalur
Please ignore the previous patch and use this one instead. I've fixed a bug and a couple of formatting errors. Karthik diff --git a/lisp/org.el b/lisp/org.el index 30a4e7aef..ad2ad2332 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -15673,6 +15673,25 @@ cache Display remote images, and open

[PATCH] Justify/align image previews in org-mode

2023-12-17 Thread Karthik Chikmagalur
Hi, This patch allows image link previews in Org to be left-aligned, centered or right-aligned in the Emacs window. "Inline" images that are surrounded by text are unaffected. Here is an example of what this looks like: Image: https://abode.karthinks.com/share/org-image-align.png The

Re: What is the purpose of \\ in org-add-note?

2023-10-29 Thread Karthik Chikmagalur
> It ensures a line break (say, when the document is exported). From the > [[info:org#Paragraphs][org#Paragraphs]] section in the manual: > > #+begin_quote > Paragraphs are separated by at least one empty line. If you need to > enforce a line break within a paragraph, use ‘\\’ at the end of a

What is the purpose of \\ in org-add-note?

2023-10-29 Thread Karthik Chikmagalur
When I add a note to an entry (from Org agenda, say), it adds a \\ at the end of the note line heading. Example: - Note taken on [2021-03-01 Mon 20:44] \\ Done. Check =ffmpeg-dispatch-load= and =ffmpeg-dispatch-save=. The addition of this suffix is hardcoded in `org-store-log-note'. What is

Re: [Pre-PATCH] Overhaul of the LaTeX preview system

2023-08-21 Thread Karthik Chikmagalur
> I have lualatex installed as part of another texlive package but I am > not sure if org uses it however. If you haven't changed `org-latex-compiler' (globally or in the Org buffer using a keyword), it's using pdflatex. >> 3. If no, do you mind sharing this file (or a stripped down version >>

Re: [Pre-PATCH] Overhaul of the LaTeX preview system

2023-08-21 Thread Karthik Chikmagalur
> It worked well all around except for three things: > > 1. I had to set org-latex-preview-precompile to nil to produce the >preview for ~2000 snippets. I got errors in process filters such >as arg-out-of-range, and Emacs completely blocked itself. I can >confirm that

Re: keep intermediary tex from latex preview

2023-08-12 Thread Karthik Chikmagalur
>> By the way, using Ihor's suggestion, I was able to debug the issue. >> There is nothing wrong with my configuration. The issue is that the >> font cannot deal with that symbol, and LaTeX just skips it. Still, it >> would be convenient not to have to create a separate .tex to debug >> the

Re: [Pre-PATCH] Overhaul of the LaTeX preview system

2023-05-08 Thread Karthik Chikmagalur
> Yeah, it kinda works ok now. It is kinda slow, but it probably takes > the same time as the normal previews. May the fact that I use > `lualatex' be the culprit? This checks out. I tested previews with lualatex for a bit, and it's about 8-10x slower than pdflatex. One big chunk of this gap is

Re: [Pre-PATCH] Overhaul of the LaTeX preview system

2023-05-05 Thread Karthik Chikmagalur
> The preview now works as stated, although I find it kinda slow to > regenerate, even if I set `org-latex-preview-throttle' to 0.2. They shouldn't be any slower than when you manually call `org-latex-preview' on a fragment. To be sure, you could try (setq org-latex-preview-debounce 0.3

Re: [Pre-PATCH] Overhaul of the LaTeX preview system

2023-05-05 Thread Karthik Chikmagalur
> 1. Use TEC's org-mode =dev= branch, up to the =---NOPUSH PERSONAL >DIVIDER---= commit. > 2. Set some config options, which can be in the above link. > 3. Test the new features. > 4. When a latex fragment contained an error, its color would turn red, >but no popup would appear on hover,

Re: [Pre-PATCH] Overhaul of the LaTeX preview system

2023-05-05 Thread Karthik Chikmagalur
>From your diagnostic report, it looks like you're using lualatex + precompilation. This can cause some issues, but not the ones you report above so this is interesting. > 1. When a snippet contains a mistake, it correctly turns red, but no > error message is shown when I hover my mouse over

Re: Recommended way to work on main without upgrading Org?

2022-12-21 Thread Karthik Chikmagalur
I can get it to work with emacs -Q as well, and this is good for testing, thank you. But I'm looking for a way to retain the rest of my configuration and swap out Org as required. Otherwise I can't do any interactive development. Another alternative is to set up a completely different init

Recommended way to work on main without upgrading Org?

2022-12-21 Thread Karthik Chikmagalur
Hi, I'm trying to work on the main branch of Org, with the intent of creating a patch. However, I need to continue using Org 9.5 for everyday work in a separate Emacs session as I can't have things breaking. Is there a recommended way to run two simultaneous instances of Emacs using two

Re: [PATCH] LSP support in org-src buffers

2022-10-11 Thread Karthik Chikmagalur
> This is not limited to Eglot support. M-x compile, eglot, project.el, > xrefs, and similar tools all assume that current code buffer is > associated with a real file in a real project folder, possibly > containing all kinds of hints like .gitignore, .dir-locals.el, etc. I hadn't considered

[PATCH] LSP support in org-src buffers

2022-10-07 Thread Karthik Chikmagalur
src buffer, and the past state of tangled versions of other code blocks. Still, I've found this to be a big improvement over having no LSP support for Org code blocks. Please let me know if you have any feedback. Karthik >From 2798a292d293f1d0aeed34bd0014c6bb97079491 Mon Sep 17 00:00:00 2001 From

Bug: Org-babel output malformed for MATLAB source blocks running in a session [9.3 (release_9.3 @ /usr/share/emacs/27.1/lisp/org/)]

2020-11-23 Thread Karthik Chikmagalur
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.

Org-babel Matlab (session) output is malformed

2020-04-10 Thread Karthik Chikmagalur
I'm trying to evaluate some Matlab code using org-babel in a session: #+BEGIN_SRC matlab :session :results output a = 4; b = a + 3 c = a - 3 #+END_SRC And following the org-babel documentation, (something like) this is the output I expect: #+RESULTS: #+begin_example b = 7 c = 1