1

I'm using Edit with Emacs to edit Stack Overflow and Stack Exchange sites.
Currently I'm doing it with this message ;-)

When I click on the button under the text area of Chrome browser, I get a new file opened on Emacs. Current file is named emacs.stackexchange.com/questions/ask. When I press save the file: C-x C-s, the text gets updated in the browser.

Is the file saved somewhere in the filesystem, so I can recover it locally, just in case I kill the current buffer?

3
  • 1
    Not an answer, but you may want to check out the excellent sx.el (github.com/vermiculus/sx.el) which provides a StackExchange client in Emacs.
    – glucas
    Sep 11, 2015 at 16:30
  • Wow, this sx.el is great! I'm writing this comment from it... ;-) Thanks a lot!
    – nephewtom
    Sep 12, 2015 at 8:50
  • Mmm, is it possible in sx.el to refresh on the browser (visit) while I'm answering or asking?
    – nephewtom
    Sep 12, 2015 at 8:54

1 Answer 1

4

Looking at the code it does not seem that edit server save the contents to a file. However it does provide a hook edit-server-done-hook which running every time you do edit-server-save (C-xC-s) or edit-server-done (C-cC-c) you might add a function to the hook to save the current contents to a file.

A not-so-well-tested example is given below

(defvar my-edit-with-emacs-backups-dir (locate-user-emacs-file "edit-with-emacs-saves"))

(unless (file-exists-p my-edit-with-emacs-backups-dir)
  (make-directory my-edit-with-emacs-backups-dir))

(defun my-backup-edit-with-emacs-contents ()
  (let ((backup-directory-alist (list (cons "." my-edit-with-emacs-backups-dir))))
    (save-excursion
      (write-region nil nil (car (find-backup-file-name (buffer-name))) nil 0))))

(add-hook 'edit-server-done-hook #'my-backup-edit-with-emacs-contents)

With the above the you edit-with-buffer contents will be backed up in ~/.emacs.d/edit-with-emacs-saves directory whenever you do edit-server-save (C-xC-s) or edit-server-done (C-cC-c)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.