开发者

Emacs weird region-killing

开发者 https://www.devze.com 2023-03-22 22:06 出处:网络
emacs behaves a bit weird when killing regions with \'kill-region, i.e. it kills the region even if it\'s not really selected. it remembers somehow where the last selection was and if nothing is selec

emacs behaves a bit weird when killing regions with 'kill-region, i.e. it kills the region even if it's not really selected. it remembers somehow where the last selection was and if nothing is selected at the moment it kills previously remembered region.

that's really confusing because accidental C-w (with no selection) cuts somethi开发者_StackOverflow中文版ng that I definitely don't want to be cut.

is there any way to change this behaviour?


You can remap C-w to work only when selected region currently exists:

(define-key global-map (kbd "C-w")
  (lambda ()
    (interactive)
    (when mark-active
      (call-interactively 'kill-region))))
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号