Skip to content

Instantly share code, notes, and snippets.

@sriramster
Created June 3, 2014 10:03
Show Gist options
  • Save sriramster/ed0cefc299da6276416e to your computer and use it in GitHub Desktop.
Save sriramster/ed0cefc299da6276416e to your computer and use it in GitHub Desktop.
Disable Yanking
;; No need to set arg's & optional's args to nil. Just doing it, #debug purpose
(defadvice kill-whole-line (around screwdriver-kill-wl (&optional arg))
(setq arg nil)
(message "disable kill-whole-line"))
(defadvice kill-rectangle (around screwdriver-kill-rectangle (start end &optional fill))
(setq start nil)
(setq end nil)
(message "disable kill-rectangle"))
(defadvice kill-word (around screwdriver-kill-word (arg))
(setq arg nil)
(message "disable kill-word"))
(defadvice kill-ring-save (around screwdriver-kill-rs (beg end))
(setq beg nil)
(setq end nil)
(message "disable kill-ring-save")
(defadvice kill-new (around screwdriver-kill-new (string &optional replace yank-handler))
(setq string nil)
(message "Not appending to kill-ring"))
(defadvice kill-append (around screwdriver-kill-new (string before-p &optional yank-handler))
(setq string nil)
(message "Not appending to kill-ring")))
(defadvice kill-paragraph (around screwdriver-kill-p (arg))
(setq arg nil)
(message "disable kill-paragraph"))
(defadvice kill-backward-chars (around screwdriver-kill-bc (arg))
(setq arg nil)
(message "disable kill-backward-chars"))
(defadvice kill-some-buffers (around screwdriver-sb (&optional list))
(setq list nil)
(message "disable kill-some-buffers"))
(defun deactivate-yanks()
(interactive)
(ad-activate-regexp "[screwdriver-A-Za-z0-9]+"))
(defun activate-yanks()
(interactive)
(ad-deactivate-regexp "[screwdriver-A-Za-z0-9]+"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment