From 71e7a746c7d39b88038060c5b035f1c9e6f35b13 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 ac201da44..13b7f7e20 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--indent-current-empty-line nil) +(put 'org-src--indent-current-empty-line 'permanent-local t) (defun org-src--construct-edit-buffer-name (org-buffer-name lang) "Construct the buffer name for a source editing buffer. @@ -472,7 +472,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--indent-current-empty-line) marker indent-str) (setq indent-str (with-temp-buffer @@ -494,7 +494,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))) ;; Apply WRITE-BACK function on edit buffer contents. @@ -554,8 +554,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) @@ -605,7 +603,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--indent-current-empty-line (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