Skip to content

Instantly share code, notes, and snippets.

@aont
Last active May 15, 2016 14:22
Show Gist options
  • Select an option

  • Save aont/5b60a7521b5cad12690f4142a4122202 to your computer and use it in GitHub Desktop.

Select an option

Save aont/5b60a7521b5cad12690f4142a4122202 to your computer and use it in GitHub Desktop.
kill-region only when any region is selected
(global-set-key
"\C-w"
(lambda ()
(interactive)
(if (region-active-p)
(kill-region (region-beginning) (region-end) )
(message "Please set region")
)
)
)
(global-set-key
"\M-w"
(lambda ()
(interactive)
(when (region-active-p)
(kill-new (buffer-substring-no-properties (region-beginning) (region-end)))
(message "kill")
)
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment