emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Sébastien Miquel" <sebastien.miquel@posteo.eu>
To: Bastien <bzg@gnu.org>
Cc: emacs-orgmode@gnu.org
Subject: Re: begin_src Indentation in org 9.4.4, 9.4.5
Date: Tue, 18 May 2021 13:43:16 +0000	[thread overview]
Message-ID: <f634703a-96ff-27cb-0ee1-d5fe38582b00@posteo.eu> (raw)
In-Reply-To: <87lf8ca6p4.fsf@bzg.fr>

[-- Attachment #1: Type: text/plain, Size: 710 bytes --]

Hi Bastien,

Bastien writes:
> Before I revert the commit and try your suggestion, can you share a
> patch that add both changes (the revert and your fix) manually so I
> can test it?  If this fixes the original issue while preserving
> electric indentation, I'm okay with it.
Here's such a patch.

> Also, do you want to become the maintainer for org-src.el?  We need
> more people taking charge of specific areas in Org's code.
I do intend to keep monitoring this list and help around for the
foreseeable future, and I would certainly agree to whatever sort of
maintainer position eventually, but I hold no particular interest (or
deep understanding) in this specific file.

Regards,

-- 
Sébastien Miquel


[-- Attachment #2: 0001-org.el-org-src-contents-for-write-back-Indent-blank-.patch --]
[-- Type: text/x-patch, Size: 2585 bytes --]

From 1be7fa790e68d1fc2d198eee81c0d3bb72156d08 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Miquel?= <sebastien.miquel@posteo.eu>
Date: Tue, 18 May 2021 14:39:33 +0200
Subject: [PATCH] org.el (org-src--contents-for-write-back): Indent blank lines

* lisp/org.el (org-src--contents-for-write-back): Indent blank lines.
* lisp/org-src.el (org-return): Revert part of commit bfda3cc7df.
---
 lisp/org-src.el | 9 ++++-----
 lisp/org.el     | 6 +-----
 2 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/lisp/org-src.el b/lisp/org-src.el
index 5604e6568..79f002e56 100644
--- a/lisp/org-src.el
+++ b/lisp/org-src.el
@@ -453,15 +453,14 @@ Assume point is in the corresponding edit buffer."
       (insert (org-no-properties contents))
       (goto-char (point-min))
       (when (functionp write-back) (save-excursion (funcall write-back)))
-      ;; Add INDENTATION-OFFSET to every non-empty line in buffer,
+      ;; Add INDENTATION-OFFSET to every line in buffer,
       ;; unless indentation is meant to be preserved.
       (when (> indentation-offset 0)
 	(while (not (eobp))
 	  (skip-chars-forward " \t")
-	  (unless (eolp)		;ignore blank lines
-	    (let ((i (current-column)))
-	      (delete-region (line-beginning-position) (point))
-	      (indent-to (+ i indentation-offset))))
+	  (let ((i (current-column)))
+	    (delete-region (line-beginning-position) (point))
+	    (indent-to (+ i indentation-offset)))
 	  (forward-line))))))
 
 (defun org-src--edit-element
diff --git a/lisp/org.el b/lisp/org.el
index ae09f3e99..0add9bc2e 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -18018,10 +18018,6 @@ object (e.g., within a comment).  In these case, you need to use
 	     (delete-and-extract-region (point) (line-end-position))))
 	(org--newline indent arg interactive)
 	(save-excursion (insert trailing-data))))
-     ;; FIXME: In a source block, don't try to indent as it may result
-     ;; in weird results due to `electric-indent-mode' being `t'.
-     ((eq element-type 'src-block)
-      (org--newline nil nil nil))
      (t
       ;; Do not auto-fill when point is in an Org property drawer.
       (let ((auto-fill-function (and (not (org-at-property-p))
@@ -19167,7 +19163,7 @@ Also align node properties according to `org-property-format'."
 		       (line-beginning-position 2))))
 	     nil)
 	    ((and (eq type 'src-block)
-                  org-src-tab-acts-natively
+		  org-src-tab-acts-natively
 		  (> (line-beginning-position)
 		     (org-element-property :post-affiliated element))
 		  (< (line-beginning-position)
-- 
2.31.1


  reply	other threads:[~2021-05-18 13:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-07 21:01 begin_src Indentation in org 9.4.4, 9.4.5 Nathaniel W Griswold
2021-05-07 21:03 ` Nathaniel W Griswold
2021-05-07 22:14   ` Nathaniel W Griswold
2021-05-08  2:22     ` Ihor Radchenko
2021-05-15 11:50       ` Bastien
2021-05-15 11:51         ` Nathaniel W Griswold
2021-05-17  9:02         ` Sébastien Miquel
2021-05-18  6:37           ` Bastien
2021-05-18 13:43             ` Sébastien Miquel [this message]
2021-05-18 14:08               ` Bastien

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=f634703a-96ff-27cb-0ee1-d5fe38582b00@posteo.eu \
    --to=sebastien.miquel@posteo.eu \
    --cc=bzg@gnu.org \
    --cc=emacs-orgmode@gnu.org \
    /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).