github-review icon indicating copy to clipboard operation
github-review copied to clipboard

Edit comments i gfm-mode

Open xendk opened this issue 3 years ago • 2 comments

It would be nice if one could edit comments in gfm-mode (provided by markdown-mode). Then you could leverage markdown-modes support for Github Flavoured Markup.

As multiple modes in the same buffer is tricky, a simple(-ish) solution would be to open an indirect buffer narrowed to the comment in question.

It would require a minor mode for the diff buffer, a new way to mark comments (delimiters rather than prefixing each line with #) and would change the workflow somewhat (opening a new buffer for each comment), but I think having full gfm support is worth it. It would also closer mimic the click-a-line-get-a-textfield experience of Github.

xendk avatar Aug 21 '20 23:08 xendk

So kind of like when you have a code block in org-babel and narrow to it to use the major mode of the language?

charignon avatar Aug 22 '20 01:08 charignon

Yeah, basically, but you get two buffers, so you can show them both.

But I just discovered that font-lock isn't independent, so that kind of defeats the purpose.

An alternative that mimics it would be to make the diff buffer read only, and when pressing return somewhere, it would open a temporary buffer for a comment at that place (or if it's an existing comment, copy that to the new buffer). The usual C-c C-c would then write back the contents of that buffer at the given place, comment formatted (this wouldn't require a new comment syntax). Would have the nice side effect that the return binding could check if it's really a valid place for a comment before opening the buffer.

xendk avatar Aug 23 '20 14:08 xendk