From bb16c48b8482104d9ea409e4260076ae08f42dc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Miquel?= Date: Thu, 29 Jun 2023 14:37:09 +0200 Subject: [PATCH] org-src.el: Rename internal variable for clarity * lisp/org-src.el (org-src--contents-for-write-back): (org-src--edit-element): Rename `preserve-blank-line' to `indent-current-empty-line'. It is used to decide whether we should indent the current empty line after a special edit. --- lisp/org-src.el | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lisp/org-src.el b/lisp/org-src.el index 9e6031016..6fbb0b1c2 100644 --- a/lisp/org-src.el +++ b/lisp/org-src.el @@ -318,8 +318,8 @@ is 0.") "File name associated to Org source buffer, or nil.") (put 'org-src-source-file-name 'permanent-local t) -(defvar-local org-src--preserve-blank-line nil) -(put 'org-src--preserve-blank-line 'permanent-local t) +(defvar-local org-src--curr-line-blank-indented nil) +(put 'org-src--curr-line-blank-indented 'permanent-local t) (defun org-src--construct-edit-buffer-name (org-buffer-name lang) "Construct the buffer name for a source editing buffer. @@ -473,7 +473,7 @@ Assume point is in the corresponding edit buffer." (list (buffer-substring (point-min) eol) (buffer-substring eol (point-max)))))) (write-back org-src--allow-write-back) - (preserve-blank-line org-src--preserve-blank-line) + (indent-current-empty-line org-src--curr-line-blank-indented) marker indent-str) (setq indent-str (with-temp-buffer @@ -500,7 +500,7 @@ Assume point is in the corresponding edit buffer." ;; If the current line is empty, we may ;; want to indent it. (and (eq (point) (marker-position marker)) - preserve-blank-line)) + indent-current-empty-line)) (insert indent-str)) (forward-line))) (set-marker marker nil)))) @@ -557,8 +557,6 @@ Leave point in edit buffer." (blank-line (save-excursion (beginning-of-line) (looking-at-p "^[[:space:]]*$"))) (empty-line (and blank-line (looking-at-p "^$"))) - (preserve-blank-line (or (and blank-line (not empty-line)) - (and empty-line (= (+ block-ind content-ind) 0)))) (preserve-ind (and (memq type '(example-block src-block)) (or (org-element-property :preserve-indent datum) @@ -608,7 +606,8 @@ Leave point in edit buffer." (setq org-src--overlay overlay) (setq org-src--allow-write-back write-back) (setq org-src-source-file-name source-file-name) - (setq org-src--preserve-blank-line preserve-blank-line) + (setq org-src--curr-line-blank-indented (and blank-line + (not empty-line))) ;; Start minor mode. (org-src-mode) ;; Clear undo information so we cannot undo back to the -- 2.41.0