[ESS] Thoughts on auto-saving all file buffers before any eval?

Vitalie Spinu spinuvit at gmail.com
Sat Apr 26 20:13:57 CEST 2014



It's in ess-inf.el. No need to grep: C-h v ess-presend-filter-functions.

 Vitalie
 
 >>> Grant Rettke on Sat, 26 Apr 2014 10:10:30 -0500 wrote:

 > Dumb question: when I grep for that hook in the release off MELPA, it
 > doesn't show up.

 > Is that hook released yet?
 > Grant Rettke | AAAS, ACM, ASA, FSF, IEEE, SIAM, Sigma Xi
 > grettke at 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

 > On Sat, Apr 12, 2014 at 8:34 PM, Grant Rettke <gcr at wisdomandwonder.com> wrote:
 >> Vialie,
 >> 
 >> Understood. Thank you.
 >> 
 >> I'll watch for that to filter into the MELPA release.
 >> 
 >> Grant Rettke | AAAS, ACM, AMA, COG, FSF, IEEE, Sigma Xi
 >> grettke at 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
 >> 
 >> 
 >> On Sat, Apr 12, 2014 at 11:28 AM, Vitalie Spinu <spinuvit at gmail.com> wrote:
 >>> 
 >>> 
 >>> Hi Grant,
 >>> 
 >>> You don't need to advice all ESS eval functions. Use
 >>> ess-presend-filter-functions or comint-input-filter-functions. They are
 >>> called before each evaluation.
 >>> 
 >>> Vitalie
 >>> 
 >>> >>> Grant Rettke on Sat, 12 Apr 2014 11:12:33 -0500 wrote:
 >>> 
 >>> > 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
 >> 
 >> 



More information about the ESS-help mailing list