emacs_chrome icon indicating copy to clipboard operation
emacs_chrome copied to clipboard

[Feature request] Support Github edit code functionality

Open zw963 opened this issue 7 years ago • 12 comments

Following is a image to describe what i means.

DeepinScreenshot_select-area_20181014150620.png

I think if we can edit github file directly with emacs, that will make create a PR very simple.

Thanks

zw963 avatar Oct 14 '18 07:10 zw963

This requires the extension to be able to interact with the custom javascript for github as it's not presented as a plain text area.

stsquad avatar Oct 14 '18 10:10 stsquad

The functionality for github seems to be provided by CodeMirror. I believe there is an API for client side extensions to interact with CodeMirror but it would be a fair amount of work. I can certainly help with reviewing code and giving pointers if you want to give it a go.

stsquad avatar Oct 14 '18 10:10 stsquad

I thought i have no enough skill to do this, sorry.

when i want to contribute some code to another project, i suddenly realized i can edit code on github directly. if this process can be done in emacs frame, it is awesome.

this is all my original intention.

anyway, thanks, you can close this issue as you like.

zw963 avatar Oct 15 '18 17:10 zw963

You can leave feature requests open so people can find it.

stsquad avatar Oct 15 '18 20:10 stsquad

This is also a duplicate of #125 which essentially needs the same thing.

stsquad avatar Oct 16 '18 11:10 stsquad

Is this the same reason why it doesn't work for sqlzoo.net?

et2010 avatar Oct 27 '18 15:10 et2010

@et2010 that seems to be something else:

<div class="ans mw-highlight mw-content-ltr" dir="ltr">

Which isn't an editable div as I understand it so JavaScript must be doing something behind the scenes.

stsquad avatar Oct 28 '18 07:10 stsquad

No my mistake, there is a textarea in there, not sure why it wasn't tagged.

stsquad avatar Oct 28 '18 07:10 stsquad

Codemirror has a documented API: https://codemirror.net/doc/manual.html#api

It doesn't seem like the features needed for editserver would be too hard to implement, a combination of doc.getRange() for pulling and doc.replaceRange() for pushing? But with my meager javascript knowledge, it would take a disproportionately long amount of time to patch things together.

ThibautVerron avatar Mar 28 '19 15:03 ThibautVerron

@ThibautVerron you are assuming that anyone else has greater knowledge and time than you do. Most of the features that have been added to Edit with Emacs over the years have been a result of drive by contributions. So if you want this feature the best way to get it is to have a go at implementing it. Discussion and review of a working proof of concept will beat wishes any day.

stsquad avatar Mar 28 '19 16:03 stsquad

I can't say any about time, but I'm certain that some people do have more knowledge of javascript or of the code of this extension than I do. I did not mean to imply that anything more than that, or to request that somebody invest time into this if they don't care about the feature.

My point was only to add relevant information for the passer-by who would be interested in the feature and have the necessary knowledge at hand.

Given how many platforms nowadays use CodeMirror (Github, Overleaf, CoCalc, Jupyter...), I have good hope that such a user will eventually come by.

And if I ever learn more javascript and it hasn't happened by then, this issue stays on my todo list.

ThibautVerron avatar Mar 28 '19 17:03 ThibautVerron

FWIW, GhostText tries to support editing CodeMirror (and Ace editors). It has its own problems/bugs, of course.

dsedivec avatar Sep 21 '19 21:09 dsedivec