]> Cypherpunks repositories - gostls13.git/commitdiff
misc/emacs: stop go-mode from spuriously marking the buffer modified when it loads
authorRyan Barrett <ryanb@google.com>
Fri, 1 Jun 2012 20:55:03 +0000 (16:55 -0400)
committerSameer Ajmani <sameer@golang.org>
Fri, 1 Jun 2012 20:55:03 +0000 (16:55 -0400)
R=golang-dev, sameer, bradfitz
CC=golang-dev, jba
https://golang.org/cl/6213056

misc/emacs/go-mode.el

index 0e7e2184393e0879efbadbecb6cab96f3e89e929..2f20415010f608ce5a91a857778fd12287e15590 100644 (file)
@@ -706,8 +706,12 @@ functions, and some types.  It also provides indentation that is
   ;; Remove stale text properties
   (save-restriction
     (widen)
-    (remove-text-properties 1 (point-max)
-                            '(go-mode-cs nil go-mode-nesting nil)))
+    (let ((modified (buffer-modified-p)))
+      (remove-text-properties 1 (point-max)
+                              '(go-mode-cs nil go-mode-nesting nil))
+      ;; remove-text-properties marks the buffer modified. undo that if it
+      ;; wasn't originally marked modified.
+      (set-buffer-modified-p modified)))
 
   ;; Reset the syntax mark caches
   (setq go-mode-mark-cs-end      1