v 0. Pasted by Anonymous as lisp at 2011-10-21 01:25:19 MSK and set expiration to never.

Paste will expire never.

  1. (defun kill-region-or-word (arg)
  2.   "Call `kill-region' or `backward-kill-word' depending on whether or not a region is selected.
  3. With number ARG pass those as argument to `backward-kill-word'.
  4. With non-nil non-number ARG make `kill-region' even if region is not selected."
  5.   (interactive "P")
  6.   (cond
  7.     ((or (and transient-mark-mode mark-active) (and arg (listp arg)))
  8.       (kill-region (point) (mark)))
  9.     ((numberp arg) (backward-kill-word arg))
  10.     ((eq arg '-) (backward-kill-word -1))
  11.     (t (backward-kill-word 1))))
  13. (global-set-key "\C-w" 'kill-region-or-word)