diff options
author | Franck Cuny <franck.cuny@gmail.com> | 2016-10-26 15:44:37 -0700 |
---|---|---|
committer | Franck Cuny <franck.cuny@gmail.com> | 2016-10-26 15:44:37 -0700 |
commit | 9061e2cd8857c25d494a83ed3fa0aa9f5b9b7e61 (patch) | |
tree | 81dba3928a22a6f191d8e01a7ca14d1c09937abe | |
parent | [tmux] Add again tmux. (diff) | |
download | emacs.d-9061e2cd8857c25d494a83ed3fa0aa9f5b9b7e61.tar.gz |
[emacs] add a couple of functions to open temp files
One of the function is to create a temp file locally, while the second one is to create it on nest. Remove the function to find the wiki pages (they are stored in Keep and Drive now).
-rw-r--r-- | emacs.d/lib/my-functions.el | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/emacs.d/lib/my-functions.el b/emacs.d/lib/my-functions.el index 962a362..1281be3 100644 --- a/emacs.d/lib/my-functions.el +++ b/emacs.d/lib/my-functions.el @@ -33,17 +33,21 @@ (set-buffer-modified-p nil) (message "File '%s' successfully renamed to '%s'" name (file-name-nondirectory new-name)))))))) -;; find a wiki page -(defun fc/find-wiki-page () - "Finds wiki page." - (interactive) - (let ((collection - (delete-dups - (append (directory-files fc/wiki-dir-location))))) - (ivy-read "wiki pages:" collection - :action (lambda (x) (find-file (concat fc/wiki-dir-location x))) - :caller 'fc/find-wiki-page))) +;; create temporary files +(defun fc/start--file (path) + "Create a file at PATH, creating any containing directories as necessary. +Visit the file after creation." + (make-directory (file-name-directory path) t) + (find-file path)) + +(defun fc/start-tmp-file (file-name) + "Create a file in /tmp for the given file name." + (interactive "sName of temporary file: ") + (fc/start--file (expand-file-name (format "/tmp/%s" file-name)))) -(global-set-key (kbd "C-c w") 'fc/find-wiki-page) +(defun fc/start-nest-tmp-file (file-name) + "Create a file in ~/tmp on nest for the give file name." + (interactive "sName of the temporary file: ") + (fc/start--file (expand-file-name (format "/nest:~/tmp/%s" file-name)))) (provide 'my-functions) |