Skip to content

Commit

Permalink
Improve performance for saving buffers in quiet mode
Browse files Browse the repository at this point in the history
  • Loading branch information
elim committed Jun 22, 2012
1 parent 37576aa commit b5f71c4
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions auto-save-buffers-enhanced.el
Expand Up @@ -238,19 +238,20 @@ the directories under VCS."
;;;; -------------------------------------------------------------------------

(defun auto-save-buffers-enhanced-saver-buffer (&optional scratch-p)
(if (or scratch-p
auto-save-buffers-enhanced-quiet-save-p)
(let
((content (buffer-string))
(file-name (if scratch-p
auto-save-buffers-enhanced-file-related-with-scratch-buffer
buffer-file-name)))
(progn
(with-temp-file file-name
(insert content))
(set-buffer-modified-p nil)
(set-visited-file-modtime (current-time))))
(save-buffer)))
(cond
(auto-save-buffers-enhanced-quiet-save-p
(progn
(write-region nil nil buffer-file-name nil -1)
(set-buffer-modified-p nil)
(set-visited-file-modtime (current-time))))
(scratch-p
(let
((content (buffer-string)))
(with-temp-file
auto-save-buffers-enhanced-file-related-with-scratch-buffer
(insert content))
(set-buffer-modified-p nil)))
(t (save-buffer))))

(defun auto-save-buffers-enhanced-regexps-match-p (regexps string)
(catch 'matched
Expand Down

0 comments on commit b5f71c4

Please sign in to comment.