summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2016-03-20 22:27:07 -0400
committerKyle Meyer <kyle@kyleam.com>2016-03-20 22:27:07 -0400
commitecb95568a82da5dbe97be0aba3b45b56efd0b75f (patch)
tree9a3dba3bb1f60df92aee30d700ec958d62b8416f
parent8228c37d3e319d50de92270c4574142eee83da5d (diff)
downloademacs.d-ecb95568a82da5dbe97be0aba3b45b56efd0b75f.tar.gz
Add dired-copy-last-mtime-as-kill command
-rw-r--r--init.el2
-rw-r--r--lisp/km-dired.el10
2 files changed, 12 insertions, 0 deletions
diff --git a/init.el b/init.el
index 8d20af2..8666235 100644
--- a/init.el
+++ b/init.el
@@ -1301,6 +1301,8 @@
(define-key km/dired-copy-filename-map "w"
#'dired-copy-filename-as-kill)
+ (define-key km/dired-prefix-map "t" #'km/dired-copy-last-mtime-as-kill)
+
(after 'dired
(define-key dired-mode-map "N" #'km/dired-touch-deref)
;; This overrides the default binding for `dired-copy-filename-as-kill'.
diff --git a/lisp/km-dired.el b/lisp/km-dired.el
index 148d376..69787d0 100644
--- a/lisp/km-dired.el
+++ b/lisp/km-dired.el
@@ -84,6 +84,16 @@
(--when-let (dired-get-marked-files nil arg)
(apply #'call-process "touch" nil nil nil "-h" it)))
+;;;###autoload
+(defun km/dired-copy-last-mtime-as-kill ()
+ "Copy last modification time for file at point."
+ (interactive)
+ (setq arg (and current-prefix-arg arg))
+ (--when-let (dired-get-filename nil 'noerror)
+ (kill-new (message "%s" (format-time-string
+ "%Y%m%d%H%M.%S"
+ (nth 5 (file-attributes it)))))))
+
;;; Copying file names