|
|
@@ -613,6 +613,13 @@ into markdown files.
|
|
|
Now I'll just enjoy the blog writing from a [[https://gohugo.io][Hugo]]-powered blog git repo. The v4
|
|
|
is out for a few weeks now and I feel content with the workflow I'm having with
|
|
|
it right now. But /we can do better/.
|
|
|
+** Run Hugo in current project
|
|
|
+#+begin_src emacs-lisp
|
|
|
+(defun chicken/run-hugo-in-project ()
|
|
|
+ (interactive)
|
|
|
+ (let ((default-directory (projectile-project-root)))
|
|
|
+ (start-process "Hugo" "+hugo+" "hugo" "serve" "-D")))
|
|
|
+#+end_src
|
|
|
** Draft jump list
|
|
|
Hugo has a few utilities, notably listing draft posts. I wrote a while ago a
|
|
|
function to list drafts and feed them to helm. Doom Emacs seems to use ivy as
|
|
|
@@ -624,11 +631,15 @@ project's directory.
|
|
|
(defun chicken/list-hugo-drafts ()
|
|
|
"Fetches the current drafts in a hugo project when available.
|
|
|
Assumes the current project is a Hugo one."
|
|
|
- (let
|
|
|
- ((root (projectile-project-root)))
|
|
|
- (counsel--split-string
|
|
|
- (counsel--call
|
|
|
- (list "hugo" "-s" root "list" "drafts")))))
|
|
|
+(let* ((root (projectile-project-root))
|
|
|
+ (stdout
|
|
|
+ (with-temp-buffer
|
|
|
+ (call-process "hugo" nil t nil "-s" root "list" "drafts")
|
|
|
+ (buffer-string)))
|
|
|
+ (lines (string-lines stdout))
|
|
|
+ (entries (cdr lines)) ; Remove Hugo's table header
|
|
|
+ (filenames (mapcar #'(lambda (str) (car (string-split str ","))) entries)))
|
|
|
+ filenames))
|
|
|
#+END_SRC
|
|
|
|
|
|
Then I have an interactive function I can call that will process the list given
|