diff options
-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) |