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

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

[elpa] externals/phps-mode 738adb2eca 3/9: Work on indentation errors Em


From: Christian Johansson
Subject: [elpa] externals/phps-mode 738adb2eca 3/9: Work on indentation errors Emacs 29.1
Date: Mon, 15 Jan 2024 08:24:59 -0500 (EST)

branch: externals/phps-mode
commit 738adb2eca2b35b01ab929c246ddc3e5fa0f51a8
Author: Christian Johansson <christian@cvj.se>
Commit: Christian Johansson <christian@cvj.se>

    Work on indentation errors Emacs 29.1
---
 test/phps-mode-test-indent.el | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/test/phps-mode-test-indent.el b/test/phps-mode-test-indent.el
index 4af199d2db..f20ea2f876 100644
--- a/test/phps-mode-test-indent.el
+++ b/test/phps-mode-test-indent.el
@@ -23,12 +23,15 @@
   (execute-kbd-macro (kbd "TAB"))
   (while (search-forward "\n" nil t nil)
     ;; Go to random point on line
-    (let ((line-min-position (line-beginning-position))
-          (line-max-position (line-end-position)))
-      (goto-char
-       (+
-        line-min-position
-        (random (- line-max-position line-min-position)))))
+    (let* ((line-min-position (line-beginning-position))
+           (line-max-position (line-end-position))
+           (line-diff (- line-max-position line-min-position)))
+      (if (> line-diff 0)
+        (goto-char
+         (+
+          line-min-position
+          (random line-diff)))
+        (goto-char line-min-position)))
     (execute-kbd-macro (kbd "TAB"))))
 
 (defun phps-mode-test-indent--should-equal (string name &optional new-string)



reply via email to

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