osx - Shift-selection and emacs 24 -
i use emacs 24 (osx) , have problem shift-selection. if select region mouse, text highlighted , automaticaly saved on kill ring (i can yank immediately). shift-selection, text highlighted have manualy save text (m-w
) able yank it. there way shift-selection hightlights text , saves onto kill ring ?
selecting text mouse not place onto kill ring default (it copies x clipboard).
there various ways in can customise how emacs interacts clipboard. see:
c-hig (emacs) cut , paste
ret
is there way shift-selection hightlights text , saves onto kill ring ?
i'm not sure there's way detect you've stopped selecting things, perhaps advise handle-shift-selection
set temporary post-command-hook
run custom function place region in clipboard (and remove post-command-hook).
edit: hang on, describe happens me in emacs 24.1 on ubuntu.
if shift-select text in emacs , middle-click mouse in application, paste selected text.
try testing when running emacs -q
edit 2: ah, didn't mean mouse, did you?
how this?
(defvar my-shift-selection-in-progress nil) (make-variable-buffer-local 'my-shift-selection-in-progress) (defadvice handle-shift-selection (before my-shift-selection-to-kill-ring-advice) "automatically copy shift-selected text kill ring. if `interprogram-cut-function' non-nil, save text window system cut , paste. see `my-shift-selection-to-kill-ring'." (when (and shift-select-mode this-command-keys-shift-translated (not my-shift-selection-in-progress)) (add-hook 'post-command-hook 'my-shift-selection-to-kill-ring nil t))) (ad-activate 'handle-shift-selection) (defun my-shift-selection-to-kill-ring () "post-command callback my-shift-selection-to-kill-ring-advice." (if this-command-keys-shift-translated (kill-new (filter-buffer-substring (region-beginning) (region-end)) my-shift-selection-in-progress) (remove-hook 'post-command-hook 'my-shift-selection-to-kill-ring t)) (setq my-shift-selection-in-progress this-command-keys-shift-translated))
Comments
Post a Comment