syl20bnr / spacemacs

A community-driven Emacs distribution - The best editor is neither Emacs nor Vim, it's Emacs *and* Vim!
http://spacemacs.org
GNU General Public License v3.0
23.64k stars 4.89k forks source link

clj-refactor bug `Buffer is read-only: #<buffer *cljr-describe-refactoring*>` #11952

Open vendethiel opened 5 years ago

vendethiel commented 5 years ago

Description :octocat:

When trying to use clj-refactor's explain feature twice, the second time breaks.

Reproduction guide :beetle:

("ar" and "ef" are two refactorings, but it doesn't actually matter which one is used)

SPC m r ? a r SPC m r ? e f

Observed behaviour: :eyes: :broken_heart:

First time works fine. Second time gives:

funcall-interactively: Buffer is read-only: #<buffer *cljr-describe-refactoring*>

Expected behaviour: :heart: :smile:

It should connect to github, fetch the content, and replace the buffer's content with the new one.

System Info :computer:

Thanks!

github-actions[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!

vendethiel commented 4 years ago

Still broken on 0.2

duianto commented 4 years ago

Confirmed on 0.3 (develop) as well.

The issue occurs when the *cljr-describe-refactoring* buffer still is open the second time SPC m r ? is pressed.

Because the cljr-describe-refactoring command puts the buffer in view-mode:

Toggle View mode, a minor mode for viewing text but not editing it.

When View mode is enabled, commands that do not change the buffer contents are available as usual. Kill commands save text but do not delete it from the buffer. Most other commands beep and tell the user that the buffer is read-only.

The function seems to have been implemented in 2015: [Fix #138] Add cljr-describe-refactoring https://github.com/clojure-emacs/clj-refactor.el/pull/166

Since it still is an issue, maybe everyone closes the description buffer before calling the command again.

This should be reported upstream in the clj-refactor repository:

https://github.com/clojure-emacs/clj-refactor.el

A possible fix might be to turn off view-mode if it's enabled, before it tries to delete the buffers contents, here: https://github.com/clojure-emacs/clj-refactor.el/blob/92d372393a031e5fa73ef926447afe72b574cb45/clj-refactor.el#L3644


A separate issue I noticed, is if the image is shown last in the buffer, like it does for the cljr-add-missing-libspec command. Then the describe refactoring buffer looks empty, because the cursor is positioned below the image, but the cursor is at the top of the window.

When the cursor is moved up once, then the image scrolls into view and scrolling to the top of the buffer shows the description above the image.

github-actions[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!

vendethiel commented 3 years ago

Bump

github-actions[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!

vendethiel commented 2 years ago

Bump

lebensterben commented 2 years ago

@vendethiel Is it broken on develop branch?

github-actions[bot] commented 4 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!

vendethiel commented 4 months ago

Bump

smile13241324 commented 2 weeks ago

Still there??? I am putting it on my list