emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: org-edit-special indents inline latex [9.5 (nil @ /home/david/.emacs.d/.local/straight/build-27.2/org-mode/)]
@ 2021-04-28 13:37 Dávid Jakab
  2021-08-28 13:11 ` Ihor Radchenko
  2022-07-04 12:35 ` Sébastien Miquel
  0 siblings, 2 replies; 11+ messages in thread
From: Dávid Jakab @ 2021-04-28 13:37 UTC (permalink / raw)
  To: emacs-orgmode

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


Emacs  : GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 
3.24.27, cairo version 1.17.4)
  of 2021-03-26
Package: Org mode version 9.5 (nil @ 
/home/david/.emacs.d/.local/straight/build-27.2/org-mode/)


When using org-edit-special to edit inline latex, i.e., equations 
between \( and \), in an org-mode buffer, a number of
spaces may get inserted before \( after the latex editing minibuffer is 
closed. It seems like the number of extra spaces
defaults to the indentation of the line in which the inline math is 
located. This behavior makes complete sense for code
blocks and latex environments, but I can't see a use case in which it 
should be applied to inline math. It looks like
the option to edit inline math with org-edit-special was added only 
recently, so this could be a bug that noone
noticed yet.
I looked at the code that does things and it seems the variable that 
controls the indentation of the parts edited in the
minibuffer is a buffer-local variable org-src--preserve-indentation. 
Setting a default value to it has no effect because
it gets overwritten internally in the function org-src--edit-element. 
There is a variable with a similar name
org-src-preserve-indentation that is supposed to set by the user, but it 
has no effect specifically in the case of latex
fragments because org-src--edit-element contains the code:
   (let* (...
          (preserve-ind
           (and (memq type '(example-block src-block))
            (or (org-element-property :preserve-indent datum)
                org-src-preserve-indentation))) ...)
  ...

(setq org-src--preserve-indentation preserve-ind)

So the user is only allowed to turn off org-edit-special messing with 
the indentation if he is an an example-block or
src-block. I hacked in a fix modifying org-src--edit-element by 
replacing (memq type '(example-block src-block)) with
(memq type '(example-block src-block latex-fragment)) and setting 
org-src-preserve-indentation. This seems to have
solved the issue, but I believe the function shouldn't even be trying to 
indent inline math in the first place.



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-07-07  9:09 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-28 13:37 Bug: org-edit-special indents inline latex [9.5 (nil @ /home/david/.emacs.d/.local/straight/build-27.2/org-mode/)] Dávid Jakab
2021-08-28 13:11 ` Ihor Radchenko
2021-08-31 15:13   ` [PATCH] " Sébastien Miquel
2021-09-27 11:01     ` Bastien
2021-09-29 21:01       ` Dávid Jakab
2021-09-30 12:07       ` Sébastien Miquel
2021-09-30 13:50         ` Ihor Radchenko
2021-09-30 15:42         ` Bastien
2022-07-04 14:48   ` Sébastien Miquel
2022-07-07  9:05     ` Ihor Radchenko
2022-07-04 12:35 ` Sébastien Miquel

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).