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

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

[nongnu] elpa/dart-mode 9c9a63e 130/192: Fix dart-format


From: ELPA Syncer
Subject: [nongnu] elpa/dart-mode 9c9a63e 130/192: Fix dart-format
Date: Sun, 29 Aug 2021 11:02:04 -0400 (EDT)

branch: elpa/dart-mode
commit 9c9a63ed7bbf2b9d3521ead8c302489789552f9d
Author: Brady Trainor <mail@bradyt.com>
Commit: Brady Trainor <mail@bradyt.com>

    Fix dart-format
    
    Reverts removal of dart--delete-whole-line in commit 570e58c, which
    was originally added from go-mode.el in commit b380818.
    
    Fixes issues with dart-format, dealing with non-idempotency and
    changing code.
---
 dart-mode.el | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/dart-mode.el b/dart-mode.el
index 33ac4da..55a6823 100644
--- a/dart-mode.el
+++ b/dart-mode.el
@@ -131,6 +131,32 @@ true for positions before the start of the statement, but 
on its line."
          ((?} ?\;) t)
          ((?{) (dart-in-block-p (c-guess-basic-syntax))))))))
 
+(defun dart--delete-whole-line (&optional arg)
+  "Delete the current line without putting it in the `kill-ring'.
+Derived from function `kill-whole-line'.  ARG is defined as for that
+function."
+  (setq arg (or arg 1))
+  (if (and (> arg 0)
+           (eobp)
+           (save-excursion (forward-visible-line 0) (eobp)))
+      (signal 'end-of-buffer nil))
+  (if (and (< arg 0)
+           (bobp)
+           (save-excursion (end-of-visible-line) (bobp)))
+      (signal 'beginning-of-buffer nil))
+  (cond ((zerop arg)
+         (delete-region (progn (forward-visible-line 0) (point))
+                        (progn (end-of-visible-line) (point))))
+        ((< arg 0)
+         (delete-region (progn (end-of-visible-line) (point))
+                        (progn (forward-visible-line (1+ arg))
+                               (unless (bobp)
+                                 (backward-char))
+                               (point))))
+        (t
+         (delete-region (progn (forward-visible-line 0) (point))
+                        (progn (forward-visible-line arg) (point))))))
+
 (defconst dart--identifier-re
   "[a-zA-Z_$][a-zA-Z0-9_$]*"
   "A regular expression that matches keywords.")
@@ -1794,7 +1820,7 @@ this can be overridden by customizing
                 (goto-char (point-min))
                 (forward-line (- from line-offset 1))
                 (cl-incf line-offset len)
-                (let (kill-ring) (kill-whole-line len))))
+                (dart--delete-whole-line len)))
 
              (t
               (error "Invalid RCS patch or internal error in 
dart--apply-rcs-patch")))))))))



reply via email to

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