stsquad / emacs_chrome

A Chromium/Firefox "clone" of It's All Text for spawning an editor to edit text areas in browsers. Based on David Hilley's original Chromium extension.
https://chrome.google.com/extensions/detail/ljobjlafonikaiipfkggjbhkghgicgoh
GNU General Public License v3.0
514 stars 91 forks source link

[Feature request] open editserver popup buffer for EXWM #147

Closed ghost closed 6 years ago

ghost commented 6 years ago

Sorry if this comes off a little vague. I actually meant to make this issue a few months ago, but I made a little hack that fixed my problem, and I just got lazy.

So the issue here is that edit server, depending on whether edit-server-new-frame is toggled, will open the edit-server buffer in a new frame or the same buffer you're currently in. The former is excellent if you're using a floating WM, like most GNU Emacs users are, and the latter is useful if you're using a tiling WM, because Emacs will probably pop up in an already-opened Emacs instance, which is great, but it's very cumbersome if you're using EXWM, since edit-server will always open up in the very same buffer you have your browser in.

I guess to clarify if you don't know what EXWM is, it's a window manager written for Emacs that will embed X windows into Emacs like they're Emacs buffers, so when you open edit-server via Firefox or Chromium, edit-server will always get in the way of your browser buffer.

My solution was this: I redefined edit-server-done and commented out ((unless edit-server-new-frame (delete-window)), and edit-server would open on the other buffer I have open. Simple but obviously not in good taste and part of the reason I regrettably have never showed off edit-server to any of my other EXWM-using friends.

So it would be wonderful to have a behaviour that opens edit-server in a buffer to the right or left and restore the previous window arrangement upon closing. Another idea is to split the window vertically.

dakra commented 6 years ago

I use exwm with Firefox and edit-server opens a new buffer in a new window for me. Are you sure edit-server-new-frame is set to nil? Maybe we have some other different settings somewhere?

But closing the edit-server buffer leaves the window open, so that's not too nice.

I didn't bother trying to fix it as @stsquad himself blogged about the Emacs package atomic-chrome which I would like to use with GhostText for Firefox, but that doesn't allow invocation via Keybinding yet.

stsquad commented 6 years ago

Certainly edit-server-new-frame to nil works for me. It is problematic if there is no frame currently visible though. The editing (emacs) window is displayed via pop-to-buffer which can be customised via the various display-buffer customisations.

ghost commented 6 years ago

Thank you stsquad and dakra. As you suggested, edit-server is dictated by pop-to-buffer, so I was able to make the buffer pop up by setting split-height-threshold to nil.

I realized after I made the issue that what I was actually trying to do by removing ((unless edit-server-new-frame (delete-window)) was telling edit server not to destroy that window upon closing, which makes me feel very silly.