Publish draft moved
This commit is contained in:
@@ -449,6 +449,7 @@ only the description"
|
|||||||
(require 'qwan-blog)
|
(require 'qwan-blog)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;; org-roam v1 port to v2, insert node without opening buffer
|
;; org-roam v1 port to v2, insert node without opening buffer
|
||||||
(map!
|
(map!
|
||||||
:leader
|
:leader
|
||||||
|
|||||||
+15
-1
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
|
|
||||||
(defun qwan/copy-filename ()
|
(defun qwan/copy-filename ()
|
||||||
"Push the file name of the currently visited buffer to the kill ring."
|
"Push the file name of the currently visited buffer to the kill ring. Useful for markdown links"
|
||||||
(interactive)
|
(interactive)
|
||||||
(unless buffer-file-name
|
(unless buffer-file-name
|
||||||
(error "The current buffer doesn't visit a file"))
|
(error "The current buffer doesn't visit a file"))
|
||||||
@@ -13,3 +13,17 @@
|
|||||||
(kill-new buffer-file-name)
|
(kill-new buffer-file-name)
|
||||||
(message "Copied %s" buffer-file-name))
|
(message "Copied %s" buffer-file-name))
|
||||||
|
|
||||||
|
(defun qwan/publish-draft ()
|
||||||
|
"Publish this in the _posts folder"
|
||||||
|
(interactive)
|
||||||
|
(let* ((dest-dir "../_posts")
|
||||||
|
(current-file (buffer-file-name))
|
||||||
|
(blogpost-name (file-name-nondirectory current-file))
|
||||||
|
(current-date (format-time-string "%Y-%m-%d"))
|
||||||
|
(new-filename (concat current-date "-" blogpost-name))
|
||||||
|
(source-path current-file)
|
||||||
|
(dest-path (concat dest-dir "/" new-filename)))
|
||||||
|
(rename-file source-path dest-path)
|
||||||
|
(set-visited-file-name dest-path)
|
||||||
|
(set-buffer-modified-p nil)
|
||||||
|
(message "Successfully moved %s to %s" source-path dest-path)))
|
||||||
|
|||||||
Reference in New Issue
Block a user