|
From: | gerard . vermeulen |
Subject: | Re: [BUG] defaults make it hard to edit Elisp blocks in org buffers |
Date: | Thu, 18 Jan 2024 18:11:23 +0000 |
On 18.01.2024 17:45, Sébastien Miquel wrote:
Ihor Radchenko writes:If I recall correctly, in order to fix this, in =org-indent-line=, before calling =TAB= in the native buffer, one should check the current line indentation and if it is less than =block-content-ind=, start by adding this much indentation to the current line. This could be a bit fragile, and in particular it assumes that therest of the block has this =block-content-ind=, which might not be thecase. One could possibly at least check that the first line of the block does have this much indentation. If it doesn't, just do whatever.What about a simpler approach - indent the line at point to block's expected indentation (if it is not yet there) and then rely upon the code block's major mode to do the right thing?I cannot think of any common use where the two approches differ, and it is indeed simpler. The possibility that the block does not have the common indentation still stands.
As far as I understand, the effect also occurs when the block has a common indentation. Below are the steps: With this settings: #+begin_src emacs-lisp -i :results silent (setopt org-adapt-indentation nil org-src-preserve-indentation nil org-edit-src-content-indentation 2) #+end_src And with POINT after "?" and typing ENTER (wait more than 1 second for automatic indenting of 2 spaces), I can type parentheses with some sort of common indentation like below: #+begin_src emacs-lisp ;; common indentation? (()) (()) (()) #+end_src When I place POINT in the middle of the lowest parentheses and type ENTER, then everything moves 2 spaces to the right like below: #+begin_src emacs-lisp ;; common indentation? (()) (()) (( )) #+end_src I think, this is different of what you are saying. Looking at the code, I inferred that I can kill this behavior with the `-i' switch, and that works. Regards -- Gerard
[Prev in Thread] | Current Thread | [Next in Thread] |