[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phpinspect 99e628847c: Wrap buffer edit logic in `save-
From: |
ELPA Syncer |
Subject: |
[elpa] externals/phpinspect 99e628847c: Wrap buffer edit logic in `save-excursion' |
Date: |
Sat, 17 Aug 2024 16:01:00 -0400 (EDT) |
branch: externals/phpinspect
commit 99e628847cfd5591c3e9ace3ccaf6fe20cf26fe3
Author: Hugo Thunnissen <devel@hugot.nl>
Commit: Hugo Thunnissen <devel@hugot.nl>
Wrap buffer edit logic in `save-excursion'
---
phpinspect-imports.el | 29 +++++++++++++++--------------
1 file changed, 15 insertions(+), 14 deletions(-)
diff --git a/phpinspect-imports.el b/phpinspect-imports.el
index 805a955755..2704a66199 100644
--- a/phpinspect-imports.el
+++ b/phpinspect-imports.el
@@ -210,20 +210,21 @@ group."
;; Re-insert use statements
(with-current-buffer (phpinspect-buffer-buffer buffer)
- (goto-char start)
- (delete-region start end)
- (dolist (statement statements)
- (insert (format "use %s;%c" (car statement) ?\n)))
-
- (if (and (looking-at "[[:blank:]\n]+"))
- ;; Delete excess trailing whitespace (there's more than 2 between
the
- ;; last use statement and the next token)
- (when (< 1 (- (match-end 0) (match-beginning 0)))
- (delete-region (match-beginning 0) (match-end 0))
- (insert-char ?\n))
- ;; Insert an extra newline (there's only one between the last use
- ;; statement and the next token)
- (insert-char ?\n))))))
+ (save-excursion
+ (goto-char start)
+ (delete-region start end)
+ (dolist (statement statements)
+ (insert (format "use %s;%c" (car statement) ?\n)))
+
+ (if (and (looking-at "[[:blank:]\n]+"))
+ ;; Delete excess trailing whitespace (there's more than 2
between the
+ ;; last use statement and the next token)
+ (when (< 1 (- (match-end 0) (match-beginning 0)))
+ (delete-region (match-beginning 0) (match-end 0))
+ (insert-char ?\n))
+ ;; Insert an extra newline (there's only one between the last use
+ ;; statement and the next token)
+ (insert-char ?\n)))))))
(defun phpinspect-fix-imports ()
"Find types that are used in the current buffer and make sure
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/phpinspect 99e628847c: Wrap buffer edit logic in `save-excursion',
ELPA Syncer <=