summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.emacs15
1 files changed, 15 insertions, 0 deletions
diff --git a/.emacs b/.emacs
index ab0e3e1..2142c31 100644
--- a/.emacs
+++ b/.emacs
@@ -40,6 +40,8 @@
(global-set-key (kbd "C-c c") 'compile)
(global-set-key (kbd "C-c f") 'auto-fill-mode)
+(global-set-key (kbd "C-c k f") 'my/kill-ring-filename)
+(global-set-key (kbd "C-c k |") 'my/kill-ring-pipe-region)
(global-set-key (kbd "C-c m") 'man)
(global-set-key (kbd "C-c p") 'electric-pair-mode)
(global-set-key (kbd "C-c t") 'toggle-truncate-lines)
@@ -200,6 +202,19 @@
(set-variable 'tab-width new-width)
(message "changed from %s to %s" old-width new-width)))
+(defun my/kill-ring-filename ()
+ (interactive)
+ (kill-new (or (buffer-file-name) default-directory)))
+
+(defun my/kill-ring-pipe-region (command)
+ (interactive (list (read-shell-command "Shell command on region: ")))
+ (let ((input (funcall region-extract-function nil)))
+ (with-temp-buffer
+ (insert input)
+ (call-process-region (point-min) (point-max) shell-file-name
+ t t nil shell-command-switch command)
+ (kill-new (buffer-string)))))
+
(defun my/froggify ()
(ispell-change-dictionary "fr")
(setq-local colon-double-space nil)