Hi,

The ESS manual communicates the philosophy that file-artifacts are the
ultimate definition
of the system and I agree. My first time using ESS, I found that the
setting 'ess-mode-silently-save'
was critical. Still wanting to have interactive evaluation, even used
primarily from persistent
file buffers, I wanted the file always to be in sync with what I'm doing in
the system itself.
With that goal in mind I added some advice.

; ------- SNIP --------- SNIP ---------
  (defun gcr/save-all-file-buffers ()
    "Saves every buffer associated with a file."
    (interactive)
    (dolist (buf (buffer-list))
      (with-current-buffer buf
        (when (and (buffer-file-name) (buffer-modified-p))
          (save-buffer)))))

(defadvice ess-eval-region-or-line-and-step (before
before-ess-eval-region-or-line-and-step activate)
  (gcr/save-all-file-buffers))

(defadvice ess-eval-region-or-function-or-paragraph (before
before-ess-eval-region-or-function-or-paragraph activate)
  (gcr/save-all-file-buffers))

(defadvice ess-eval-region-or-function-or-paragraph-and-step (before
before-ess-eval-region-or-function-or-paragraph-and-step activate)
  (gcr/save-all-file-buffers))

(defadvice ess-eval-line (before before-ess-eval-line activate)
  (gcr/save-all-file-buffers))

(defadvice ess-eval-line-and-go (before before-ess-eval-line-and-go
activate)
  (gcr/save-all-file-buffers))

(defadvice ess-eval-function (before before-ess-eval-function activate)
  (gcr/save-all-file-buffers))

(defadvice ess-eval-function-and-go (before before-ess-eval-function-and-go
activate)
  (gcr/save-all-file-buffers))

(defadvice ess-eval-region (before before-ess-eval-region activate)
  (gcr/save-all-file-buffers))

(defadvice ess-eval-region-and-go (before before-ess-eval-region-and-go
activate)
  (gcr/save-all-file-buffers))

(defadvice ess-eval-buffer (before before-ess-eval-buffer activate)
  (gcr/save-all-file-buffers))

(defadvice ess-eval-buffer-and-go (before before-ess-eval-buffer-and-go
activate)
  (gcr/save-all-file-buffers))
; ------- SNIP --------- SNIP ---------

Question: is there a setting to do this already? How are other people
achieving the same thing?

Regards,

Grant Rettke | AAAS, ACM, AMA, COG, FSF, IEEE, Sigma Xi
grettke@acm.org | http://www.wisdomandwonder.com/
“Wisdom begins in wonder.” --Socrates
((λ (x) (x x)) (λ (x) (x x)))
“Life has become immeasurably better since I have been forced to stop
taking it seriously.” --Thompson

	[[alternative HTML version deleted]]

