From cb7e3fb59109d2e3ea4fab72ae2cd69f5b1efa08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Miquel?= Date: Sat, 17 Jun 2023 17:10:53 +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-blank-line'. It is used to decide whether we should indent the current blank line after a special edit. --- lisp/org-src.el | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lisp/org-src.el b/lisp/org-src.el index f15ba8e99..f0982ea12 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-blank-line nil) +(put 'org-src--indent-current-blank-line '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-blank-line org-src--indent-current-blank-line) marker) (with-current-buffer write-back-buf ;; Reproduce indentation parameters from source buffer. @@ -493,7 +493,7 @@ Assume point is in the corresponding edit buffer." (skip-chars-forward " \t") (when (or (not (eolp)) ; not a blank line (and (eq (point) (marker-position marker)) ; current line - preserve-blank-line)) + indent-current-blank-line)) (let ((i (current-column))) (delete-region (line-beginning-position) (point)) (indent-to (+ i indentation-offset)))) @@ -552,8 +552,9 @@ 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)))) + (indent-current-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) @@ -603,7 +604,7 @@ 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-blank-line indent-current-blank-line) ;; Start minor mode. (org-src-mode) ;; Clear undo information so we cannot undo back to the -- 2.41.0