Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow copying text from the transient buffer #126

Closed
tarsius opened this issue Aug 7, 2021 · 5 comments
Closed

Allow copying text from the transient buffer #126

tarsius opened this issue Aug 7, 2021 · 5 comments
Labels
enhancement New feature or request

Comments

@tarsius
Copy link
Member

tarsius commented Aug 7, 2021

A lot of text in Emacs cannot be simply copied: margin, header-line, mode-line, menu, and echo area. The latter including partial key sequences. Despite that the fact that Transient also comes with UI text that cannot be copied is used as an argument why it strays from The Way of Emacs.

@pkryger
Copy link

pkryger commented Aug 7, 2021

FWIW I used to use an advice like this to copy a transient buffer contents. But I agree that it could be simpler.

@dalanicolai
Copy link

Probably you have some ideas already, but a simple suggestion would be to just bind drag-mouse as a suffix to copy the text. I don't know if there are more reasons to select text in a transient.

@dalanicolai
Copy link

dalanicolai commented Aug 17, 2021

Ah okay, that does not seem to work as expected 😁

(transient-define-prefix test-transient ()
  "Test"
  :transient-suffix     'transient--do-call
  :transient-non-suffix 'transient--do-stay
  ["Commands"
   [([drag-mouse-1] "Copy text"  copy-text)]]
  [("q" "Quit"           transient-quit-one)])

(transient-define-suffix copy-text (beg end)
  (interactive "r")
  (copy-region-as-kill beg end))

@dalanicolai
Copy link

For evil users I have found this, which works simple and effective.

@tarsius tarsius added the enhancement New feature or request label Sep 14, 2022
@tarsius
Copy link
Member Author

tarsius commented Mar 4, 2023

The easiest way is:

  (keymap-set transient-predicate-map
              "<mouse-set-region>"
              #'transient--do-stay)

I've just added a FAQ entry about that.

@tarsius tarsius closed this as completed Mar 4, 2023
tarsius added a commit that referenced this issue Mar 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants