summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2015-02-27 20:27:38 -0500
committerKyle Meyer <kyle@kyleam.com>2015-02-28 00:29:50 -0500
commitad0adeac1e820d04ec91ca927dc197c0bff240a2 (patch)
tree2bc56f77c9836c95888d6ec3059aef7483c267b0 /lisp
parent3acc40be3a0076fed1ddfc76c04eaf46b88c9fd2 (diff)
downloademacs.d-ad0adeac1e820d04ec91ca927dc197c0bff240a2.tar.gz
Add write-file variant
Diffstat (limited to 'lisp')
-rw-r--r--lisp/init-files.el11
1 files changed, 11 insertions, 0 deletions
diff --git a/lisp/init-files.el b/lisp/init-files.el
index 514cdcc..64d30f9 100644
--- a/lisp/init-files.el
+++ b/lisp/init-files.el
@@ -39,8 +39,19 @@
(setq file (concat "/sudo:root@localhost:" file)))
(find-file file)))
+(defun km/write-file ()
+ "Run `write-file'.
+Use the current file name as initial input of prompt."
+ (interactive)
+ (let* ((init-file (and buffer-file-name
+ (file-name-nondirectory buffer-file-name)))
+ (new-file (read-file-name "Write file: " nil nil nil
+ init-file)))
+ (write-file new-file t)))
+
(global-set-key (kbd "C-x C-r") 'km/rename-current-buffer-file)
(global-set-key (kbd "C-x F") 'km/find-file-as-root)
+(global-set-key (kbd "C-x C-w") 'km/write-file)
(key-chord-define-global "jc" 'find-file)