summaryrefslogtreecommitdiff
path: root/lisp/km-files.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/km-files.el')
-rw-r--r--lisp/km-files.el15
1 files changed, 12 insertions, 3 deletions
diff --git a/lisp/km-files.el b/lisp/km-files.el
index 9bd9280..5ec4a06 100644
--- a/lisp/km-files.el
+++ b/lisp/km-files.el
@@ -1,6 +1,6 @@
;;; km-files.el --- File-related extensions
-;; Copyright (C) 2012-2020 Kyle Meyer <kyle@kyleam.com>
+;; Copyright Kyle Meyer <kyle@kyleam.com>
;; Author: Kyle Meyer <kyle@kyleam.com>
;; URL: https://git.kyleam.com/emacs.d
@@ -99,6 +99,14 @@ Use the current file name as initial input of prompt."
(defun km/read-recent-file ()
(completing-read "Choose recent file: " recentf-list nil t))
+;;;###autoload
+(defun km/find-file-with-denote-naming (file)
+ (interactive "F")
+ (find-file
+ (concat (file-name-directory file)
+ (format-time-string "%Y%m%dT%H%M%S--")
+ (file-name-nondirectory file))))
+
;;; Scratch files
@@ -125,7 +133,7 @@ Prompt with characters from `km/find-scratch-buffers' to
determine the extension of the scratch file.
With prefix argument PWD, find the scratch file in
-`default-directory' instead of /tmp."
+`default-directory' instead of `temporary-file-directory'."
(interactive "P")
(switch-to-buffer (km/scratch--find-file-no-select pwd)))
@@ -142,7 +150,8 @@ With prefix argument PWD, find the scratch file in
(let* ((choices (mapcar #'car km/find-scratch-buffers))
(ch (read-char-choice (concat "[" choices "]") choices))
(ext (cadr (assq ch km/find-scratch-buffers))))
- (concat (if pwd default-directory "/tmp/") "scratch" ext)))
+ (expand-file-name (concat "scratch" ext)
+ (if pwd default-directory temporary-file-directory))))
(provide 'km-files)
;;; km-files.el ends here