From 48dc4dd4dab5a23e12f4e3f62564dc9e2924c43a Mon Sep 17 00:00:00 2001 From: James Pearce Date: Thu, 27 Aug 2015 21:22:49 -0700 Subject: [PATCH] Don't save to existing location if not modified Holding down cmd-S too long will cause multiple synchronous saves which can be expensive if there is heavyweight linter activity listening for the save events. This simply debounces it (in a sense) by not saving it the file if it is known not to have changed. Also this has no effect on saving new files for the first time. --- src/text-buffer.coffee | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/text-buffer.coffee b/src/text-buffer.coffee index 896b9f4a0e..5d0d395290 100644 --- a/src/text-buffer.coffee +++ b/src/text-buffer.coffee @@ -1218,6 +1218,8 @@ class TextBuffer # Public: Save the buffer. save: (options) -> + return unless @isModified() + @saveAs(@getPath(), options) # Public: Save the buffer at a specific path.