From: gerard.vermeulen@posteo.net
To: Emacs orgmode <emacs-orgmode@gnu.org>,
Ihor Radchenko <yantar92@posteo.net>
Subject: [BUG] defaults make it hard to edit Elisp blocks in org buffers
Date: Wed, 17 Jan 2024 18:34:20 +0000 [thread overview]
Message-ID: <c3cc4ff1fcfb3bc741df89a3f45be30e@posteo.net> (raw)
* Why I do (setopt org-src-preserve-indention t)
Sometimes, I want to do small Elisp edits without calling
org-edit-source-code. Below, I describe a long standing bug
(several years) that is also present in main.
I use smartparens, but it reproduces also in a clean
environment (minimal init.el) using main.
#+begin_src emacs-lisp :results silent
(setopt org-edit-src-content-indentation 4 ;; to amplify the effect
org-src-preserve-indentation nil)
#+end_src
Place point after the first open parenthesis below and type return.
#+begin_src emacs-lisp
(())
#+end_src
This moves the code 4 spaces to the right. Place point after the first
open parenthesis of the lowest line below and type return.
#+begin_src emacs-lisp
(
(
))
#+end_src
This moves the code again 4 spaces to the right. It does not matter
whether the the parentheses contain for instance a function definition.
* Therefore, I work with those settings breaking the default.
#+begin_src emacs-lisp :results silent
(setopt org-edit-src-content-indentation 2
org-src-preserve-indentation t)
#+end_src
Place point after the first open parenthesis below and type return.
#+begin_src emacs-lisp
(())
#+end_src
The parentheses remain left-shifted. Place point after the first
open parenthis of the lowest line below and type return.
#+begin_src emacs-lisp
(
())
#+end_src
Again, the parentheses remain left-shifted.
#+begin_src emacs-lisp
(
(
))
#+end_src
The parentheses remain left-shifted. I prefer this over the default.
I have only seen it with Elisp blocks.
Regards -- Gerard
next reply other threads:[~2024-01-17 18:35 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-17 18:34 gerard.vermeulen [this message]
2024-01-17 20:04 ` [BUG] defaults make it hard to edit Elisp blocks in org buffers Sébastien Miquel
2024-01-18 12:35 ` Ihor Radchenko
2024-01-18 16:45 ` Sébastien Miquel
2024-01-18 18:11 ` gerard.vermeulen
2024-01-18 18:19 ` Ihor Radchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c3cc4ff1fcfb3bc741df89a3f45be30e@posteo.net \
--to=gerard.vermeulen@posteo.net \
--cc=emacs-orgmode@gnu.org \
--cc=yantar92@posteo.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).