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

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

[nongnu] elpa/dart-mode caa7a19 124/192: Don't error out with revert-buf


From: ELPA Syncer
Subject: [nongnu] elpa/dart-mode caa7a19 124/192: Don't error out with revert-buffer
Date: Sun, 29 Aug 2021 11:02:03 -0400 (EDT)

branch: elpa/dart-mode
commit caa7a19a8719dc2adfd952a84776c2f88ee3776f
Author: Natalie Weizenbaum <nweiz@google.com>
Commit: Natalie Weizenbaum <nweiz@google.com>

    Don't error out with revert-buffer
---
 dart-mode.el | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/dart-mode.el b/dart-mode.el
index 832d241..4584d94 100644
--- a/dart-mode.el
+++ b/dart-mode.el
@@ -833,13 +833,16 @@ Initializes analysis server support for all `dart-mode' 
buffers."
 The Dart analysis server allows clients to 'overlay' file contents with
 a client-supplied string.  This is needed because we want Emacs to report
 errors for the current contents of the buffer, not whatever is saved to disk."
-  (dart--analysis-server-send
-   "analysis.updateContent"
-   `((files .
-            ((,buffer-file-name . ((type . "add")
-                                   (content . ,(save-restriction
-                                                 (widen)
-                                                 (buffer-string))))))))))
+  ;; buffer-file-name can be nil within revert-buffer, but in that case the
+  ;; buffer is just being reverted to its format on disk anyway.
+  (when buffer-file-name
+    (dart--analysis-server-send
+     "analysis.updateContent"
+     `((files .
+              ((,buffer-file-name . ((type . "add")
+                                     (content . ,(save-restriction
+                                                   (widen)
+                                                   (buffer-string)))))))))))
 
 (defun dart-change-analysis-overlay
     (change-begin change-end change-before-length)



reply via email to

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