summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorAlan Mackenzie <acm@muc.de>2020-11-15 13:23:15 +0000
committerAlan Mackenzie <acm@muc.de>2020-11-15 13:23:15 +0000
commit4ec740866a65761fa1318400f299b2d591b05acf (patch)
tree8c552b7dbd6db2f7ed559d1d69b373a7ba730a55 /lisp
parent66bcec8838ab05b5690d7f530851ecf594c5d877 (diff)
downloademacs-4ec740866a65761fa1318400f299b2d591b05acf.tar.gz
Make the invocation of combine-change-calls in comment-region valid
This fixes bug #44581. The problem was that whitespace outside of the (BEG END) region was being deleted, and this made the invocation of combine-change-calls with (BEG END) invalid. * lisp/newcomment.el (comment-region-default): Amend the second argument to combine-change-calls.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/newcomment.el10
1 files changed, 9 insertions, 1 deletions
diff --git a/lisp/newcomment.el b/lisp/newcomment.el
index e111ae8e225..3eb158dc2c8 100644
--- a/lisp/newcomment.el
+++ b/lisp/newcomment.el
@@ -1292,7 +1292,15 @@ changed with `comment-style'."
(defun comment-region-default (beg end &optional arg)
(if comment-combine-change-calls
- (combine-change-calls beg end (comment-region-default-1 beg end arg))
+ (combine-change-calls beg
+ ;; A new line might get inserted and whitespace deleted
+ ;; after END for line comments. Ensure the next argument is
+ ;; after any and all changes.
+ (save-excursion
+ (goto-char end)
+ (forward-line)
+ (point))
+ (comment-region-default-1 beg end arg))
(comment-region-default-1 beg end arg)))
;;;###autoload