tecosaur / emacs-everywhere

Mirror of https://git.tecosaur.net/tec/emacs-everywhere
GNU General Public License v3.0
551 stars 56 forks source link

Support for major mode change #22

Open corrafig opened 3 years ago

corrafig commented 3 years ago

My use case:

  1. Have JSON in browser
  2. Select JSON and trigger emacs-everywhere
  3. Change major mode to json-mode
  4. Modify JSON in Emacs
  5. Finish emacs-everywhere and replace text in browser

Is there any way to success in the last step? C-c C-c is not bound anymore to emacs-everywhere, calling emacs-everywhere-finish-or-ctrl-c-ctrl-c neither works.

tecosaur commented 3 years ago

This is definitely possible, and probably wouldn't be too hard even. Unfortunately I'm fairly tight on time at the moment, so the quickest way you could see this would be via a PR :slightly_smiling_face:

eatse21 commented 2 years ago

Hi,

If you do M-x emacs-everywhere-mode once you’re done with your edit in another mode, you should be able to C-c C-c normally

tecosaur commented 2 years ago

I've played around a bit with change-mode-hooks, after-change-mode-hooks, and 'permenant-local, but I haven't been able to get anything to work.

If anybody has ideas, I'd be keen to hear them.

timacs commented 2 years ago

Could the functions major-mode-suspend and major-mode-restore be of help here? I mean I'd call major-mode-suspend in step 3 and major-mode-restore before step 5.

Haven't tested that suggestion, sorry. I'm just going to install emacs-everywhere.

ronisbr commented 1 year ago

I could do something like this by:

  1. Enabling the new mode (in my case julia-mode).
  2. Do whatever I need.
  3. Enable org-mode.
  4. Enable emacs-everywhere-mode.
  5. C-c C-c