emacs_chrome icon indicating copy to clipboard operation
emacs_chrome copied to clipboard

c-x c-s pops a double window

Open anarcat opened this issue 9 years ago • 4 comments

when i hit c-x c-s, instead of saving the file somewhere (the expected), it seems the file gets sent to the browser, the frame closed, reopened, and a second frame is reopened. it's a little weird.

i didn't loose any data (so i guess #44 is fixed) and it seems the connexion keeps going (so I can't reproduce #70), but it's still a major wtf.

i would have expected c-x c-s to be left alone, to be honest: just save in whatever tempfile you assign the buffer to (it's in a tmpfile, right??), don't try to be smart. :)

this is:

GNU Emacs 24.4.1 (x86_64-pc-linux-gnu, GTK+ Version 3.14.5)
 of 2014-12-09 on gaia, modified by Debian

and edit-server 20141231.1358.

anarcat avatar Feb 05 '15 21:02 anarcat

a workaround:

(when (require 'edit-server nil t)
  (edit-server-start)
  (define-key edit-server-edit-mode-map (kbd "C-x C-s") 'save-buffer))

anarcat avatar Feb 05 '15 21:02 anarcat

The save loop is a little weird. It's an unfortunate side effect of the RESTful nature of the API from the extension to Emacs. This could probably be made neater on the Emacs side to maintain existing frames during the sequence.

Now that web-sockets are available it might be worth adding a web socket version of the edit server (with support in the extension) for a more bi-directional communication between the two.

stsquad avatar Feb 05 '15 21:02 stsquad

that does seem a little weird.

how about at least having a backing tmpfile to that buffer so that c-x c-s can be logically bound to save-buffer again? as things stand, the keybinding pretty unusable, or at least really scary. :)

maybe at least setting a filename for the buffer (set-visited-file-name) and using a temporary file (make-temp-file)?

that's how you use emacs as an editor in a mail client (like mutt) for example... it would make sense here for me.

anarcat avatar Feb 05 '15 21:02 anarcat

There is no reason you couldn't use the hooks to achieve this but I'd welcome patches to the core code to make it less scary.

I still think it's important to send the data back to the browser though so the progress can also be "saved" in the form your editing. I guess if we create a tmp file we'd need logic to detect and old one in case there has been a browser crash and we want to restore a session.

stsquad avatar Feb 06 '15 10:02 stsquad