branch: main
commit cd681bd2a38a1699c2d37e3068066dc033d67eac
Author: Paul Nelson <ultr...@gmail.com>
Commit: Paul Nelson <ultr...@gmail.com>

    LaTeX--strip-labels: delete any emptied lines
    
    * latex.el (LaTeX--strip-labels): Delete any empty lines created
    as a result of removing labels.
---
 latex.el | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/latex.el b/latex.el
index 4e56a3b0..af7c8ee6 100644
--- a/latex.el
+++ b/latex.el
@@ -9566,7 +9566,12 @@ no caption key is found, an error is issued.  See also 
the docstring of
              "\\)")))
     (save-excursion
       (while (re-search-forward re nil t)
-        (replace-match "")))))
+        (replace-match "")
+        (when (save-excursion (beginning-of-line)
+                              (looking-at "[ \t]*$"))
+          ;; Delete current line if it is empty.
+          (beginning-of-line)
+          (delete-region (point) (progn (forward-line 1) (point))))))))
 
 (defun LaTeX--modify-math-1 (open close inline new-open new-close new-inline 
pos)
   "Helper function for `LaTeX-modify-math'.

Reply via email to