emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/lua-mode dccda19 336/468: Wrap lua--fill-paragraph in save


From: Philip Kaludercic
Subject: [nongnu] elpa/lua-mode dccda19 336/468: Wrap lua--fill-paragraph in save-excursion
Date: Thu, 5 Aug 2021 04:59:04 -0400 (EDT)

branch: elpa/lua-mode
commit dccda192043037e9fc93babd4bec3ed4831dfc78
Author: Joram Schrijver <i@joram.io>
Commit: Joram Schrijver <i@joram.io>

    Wrap lua--fill-paragraph in save-excursion
    
    The internals of the function should not change the location of point.
    This also matches how the native fill-paragraph functionality works.
---
 lua-mode.el | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/lua-mode.el b/lua-mode.el
index 8137619..8f236af 100644
--- a/lua-mode.el
+++ b/lua-mode.el
@@ -810,12 +810,13 @@ Groups 6-9 can be used in any of argument regexps."
   ;; does not find a comment at the beginning of the empty line before the
   ;; comment and falls back to text-based filling ignoring comment-start and
   ;; spilling the comment into the code.
-  (while (and (not (eobp))
-              (progn (move-to-left-margin)
-                     (looking-at paragraph-separate)))
-    (forward-line 1))
-  (let ((fill-paragraph-handle-comment t))
-    (fill-paragraph justify region)))
+  (save-excursion
+    (while (and (not (eobp))
+                (progn (move-to-left-margin)
+                       (looking-at paragraph-separate)))
+      (forward-line 1))
+    (let ((fill-paragraph-handle-comment t))
+      (fill-paragraph justify region))))
 
 
 (defun lua-prefix-key-update-bindings ()



reply via email to

[Prev in Thread] Current Thread [Next in Thread]