Closed MarcoIeni closed 2 years ago
This seems to be unrelated to Spacemacs, because it happens with:
emacs -Q
(require 'package)
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
(not (gnutls-available-p))))
(proto (if no-ssl "http" "https")))
(when no-ssl
(warn "\
Your version of Emacs does not support SSL connections,
which is unsafe because it allows man-in-the-middle attacks.
There are two things you can do about this warning:
1. Install an Emacs version that does support SSL and be safe.
2. Remove this warning from your init file so you won't see it again."))
;; Comment/uncomment these two lines to enable/disable MELPA and MELPA Stable as desired
(add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t)
;;(add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t)
(when (< emacs-major-version 24)
;; For important compatibility libraries like cl-lib
(add-to-list 'package-archives (cons "gnu" (concat proto "://elpa.gnu.org/packages/")))))
(package-initialize)
M-x
eval-buffer
M-x
package-install
helm
when it's done installing, follow this issues reproduction steps, the entry gets pasted before the cursor.If delete-selection-mode is enabled then it works as expected. Do you think it is a good idea to create a spacemacs function that enables this mode before calling helm-show-kill-ring and before exiting the function disables the mode again if it was not enabled at the beginning?
There seems to be an issue when the selection end is at the end of a line.
With this example:
(defun spacemacs/helm-show-kill-ring ()
(interactive)
(let ((delete-selection-mode t))
(helm-show-kill-ring)))
(spacemacs||set-helm-key "ry" spacemacs/helm-show-kill-ring)
After evaluating the code above.
Type: abc
Delete it to the kill-ring: diw
Type: 123
Select the 3
with v
After inserting from the helm kill-ring SPC r y
with RET
it ends up with: 1abc2
The cursor seems to move back one character before inserting the kill-ring item.
Because with 23
selected it ends up with abc1
.
(autohotkey emacs-lisp git helm markdown multiple-cursors
(org :variables org-enable-org-journal-support t)
spell-checking treemacs version-control)
Yes, I was able to reproduce your behavior. Of course this also happens if you don't evaluate yuor function and you just use helm-show-kill-ring with delete-selection-mode enabled.
I think we should open an issue on https://github.com/emacs-helm/helm.
I also noticed that the selection is not replaced also if from the menu bar you go to Edit -> Paste from Kill menu
.
While if you use Edit -> Paste
the text is replaced.
This is not helm related I think.
Edit: I just tried this with emacs -Q
and the behavior is the same, so it is just how emacs works I guess :/
It might just be an issue in Spacemacs, because it works as expected when starting emacs -q
with evil and helm loaded.
The issue also occurs without Spacemacs when helm-show-kill-ring
is called from a key binding, but it works when it's called from M-x
.
delete-selection-mode
is enabled.Then both of the following commands work: 12abc
M-x helm-show-kill-ring
M-x spacemacs/helm-show-kill-ring
But calling them from a key binding doesn't work: 1abc2
(global-set-key (kbd "<f8>") 'helm-show-kill-ring)
(global-set-key (kbd "<f9>") 'spacemacs/helm-show-kill-ring)
delete-selection-mode
is disabled.M-x helm-show-kill-ring
and f8
behaves as expected: 123abc
and just inserts the kill-ring item after the cursor.
M-x spacemacs/helm-show-kill-ring
works 12abc
but f9
doesn't work: 1abc2
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!
I did some testing and there are still issues with helm-show-kill-ring
I just tested on latest develop branch. And I'm not able to reproduce the bug.
First, start a new buffer, for example a scratch buff with SPC b s
.
Then, insert some text, e.g.
foo
bar
baz
I deleted the third line with dd
, then it looks like
foo
bar
With delete-selection-mode
enabled. Selecting the first line, i.e. foo
, and then press SPC r y
to run lazy-helm/helm-show-kill-ring
and select the entry containing baz
, it works as expected. ( it added a trailing new line because dd
implicitly deleted a newline)
baz
bar
@MarcoIeni Please verify whether this is still an issue.
@MarcoIeni I know that you were able to reproduce it before. But the question is are you still able to reproduce it now.
Yes, sorry, that's what I meant. I just reproduced the issues yesterday again.
@MarcoIeni Can you repeat what I did here https://github.com/syl20bnr/spacemacs/issues/12328#issuecomment-920360214
And let me know from which step things doesn't work properly.
What you did works for me. But the comments I linked are still valid.
Ok, we can close this if you want. Or we can keep it opened to track when the upstream issue will be solved.
Description :octocat:
helm-show-kill-ring does not replace current selection
Reproduction guide :beetle:
Observed behaviour: :eyes: :broken_heart: selected text is not replaced, but the entry from the kill ring is simply pasted after the cursor
Expected behaviour: :heart: :smile: selected text is replaced with the entry from the kill ring
System Info :computer: