mirror of
https://github.com/SqrtMinusOne/dotfiles.git
synced 2025-12-10 19:23:03 +03:00
fix(emacs): reverse transclusion, review & emms-player-mpd formats
This commit is contained in:
parent
803ab24b1e
commit
b7896679f5
2 changed files with 57 additions and 35 deletions
|
|
@ -2955,9 +2955,13 @@ Returns (<buffer> . <workspace-index>) or nil."
|
|||
(line-number-at-pos)
|
||||
;; Hardcoded for now
|
||||
1
|
||||
(save-excursion
|
||||
(org-back-to-heading)
|
||||
(org-element-property :title (org-element-at-point)))))))
|
||||
(let ((title
|
||||
(save-excursion
|
||||
(org-back-to-heading)
|
||||
(org-element-property :title (org-element-at-point)))))
|
||||
(if (stringp title)
|
||||
title
|
||||
(substring-no-properties (car title))))))))
|
||||
|
||||
(defun my/org-roam-node-insert-log ()
|
||||
(interactive)
|
||||
|
|
@ -3300,19 +3304,26 @@ Returns (<buffer> . <workspace-index>) or nil."
|
|||
(setq my/org-review-directory "review")
|
||||
|
||||
(defun my/get-last-review-date ()
|
||||
(substring
|
||||
(or
|
||||
(-max-by
|
||||
'string-greaterp
|
||||
(-filter
|
||||
(lambda (f) (not (or (string-equal f ".") (string-equal f ".."))))
|
||||
(directory-files (f-join org-roam-directory my/org-review-directory))))
|
||||
(format-time-string
|
||||
"%Y-%m-%d"
|
||||
(time-subtract
|
||||
(current-time)
|
||||
(seconds-to-time (* 60 60 24 14)))))
|
||||
0 10))
|
||||
(->
|
||||
(substring
|
||||
(or
|
||||
(-max-by
|
||||
'string-greaterp
|
||||
(-filter
|
||||
(lambda (f) (not (or (string-equal f ".") (string-equal f ".."))))
|
||||
(directory-files (f-join org-roam-directory my/org-review-directory))))
|
||||
(format-time-string
|
||||
"%Y-%m-%d"
|
||||
(time-subtract
|
||||
(current-time)
|
||||
(seconds-to-time (* 60 60 24 14)))))
|
||||
0 10)
|
||||
(concat "T00:00:00-00:00")
|
||||
parse-time-string
|
||||
encode-time
|
||||
(time-add (seconds-to-time (* 60 60 24)))
|
||||
((lambda (time)
|
||||
(format-time-string "%Y-%m-%d" time)))))
|
||||
|
||||
(setq my/org-review-capture-template
|
||||
`("r" "Review" plain
|
||||
|
|
@ -4119,7 +4130,7 @@ Returns (<buffer> . <workspace-index>) or nil."
|
|||
(+ (? (or "https://" "http://"))
|
||||
(* nonl)
|
||||
(regexp (eval (emms-player-simple-regexp
|
||||
"m3u" "ogg" "flac" "mp3" "wav" "mod" "au" "aiff")))))))
|
||||
"m3u" "ogg" "flac" "mp3" "wav" "mod" "au" "aiff" "m4a")))))))
|
||||
;; MPV setup
|
||||
(add-to-list 'emms-player-list 'emms-player-mpv)
|
||||
(emms-player-set emms-player-mpv
|
||||
|
|
|
|||
47
Emacs.org
47
Emacs.org
|
|
@ -4301,9 +4301,13 @@ So, first, we have to extract all such links from the daily file. The function b
|
|||
(line-number-at-pos)
|
||||
;; Hardcoded for now
|
||||
1
|
||||
(save-excursion
|
||||
(org-back-to-heading)
|
||||
(org-element-property :title (org-element-at-point)))))))
|
||||
(let ((title
|
||||
(save-excursion
|
||||
(org-back-to-heading)
|
||||
(org-element-property :title (org-element-at-point)))))
|
||||
(if (stringp title)
|
||||
title
|
||||
(substring-no-properties (car title))))))))
|
||||
#+end_src
|
||||
|
||||
And this is a good point to introduce a function that inserts a link which can be found by the function above:
|
||||
|
|
@ -4746,25 +4750,32 @@ Now, we have to put all this together and define a capture template for the revi
|
|||
|
||||
+I'll use a separate directory for the review files, just like for org-journal and org-roam.+ I'll store the review files in org-roam. Time will tell if that's a good idea. The filename will have a format =YYYY-MM-DD.org=, which will also free me from the effort of storing the last review date somewhere.
|
||||
|
||||
If somehow there are no files in the folder, fallback to the current date minus one week.
|
||||
If somehow there are no files in the folder, fallback to the current date minus one two week. Also featuring the most awkward date transformation I've ever done just to add one date.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(setq my/org-review-directory "review")
|
||||
|
||||
(defun my/get-last-review-date ()
|
||||
(substring
|
||||
(or
|
||||
(-max-by
|
||||
'string-greaterp
|
||||
(-filter
|
||||
(lambda (f) (not (or (string-equal f ".") (string-equal f ".."))))
|
||||
(directory-files (f-join org-roam-directory my/org-review-directory))))
|
||||
(format-time-string
|
||||
"%Y-%m-%d"
|
||||
(time-subtract
|
||||
(current-time)
|
||||
(seconds-to-time (* 60 60 24 14)))))
|
||||
0 10))
|
||||
(->
|
||||
(substring
|
||||
(or
|
||||
(-max-by
|
||||
'string-greaterp
|
||||
(-filter
|
||||
(lambda (f) (not (or (string-equal f ".") (string-equal f ".."))))
|
||||
(directory-files (f-join org-roam-directory my/org-review-directory))))
|
||||
(format-time-string
|
||||
"%Y-%m-%d"
|
||||
(time-subtract
|
||||
(current-time)
|
||||
(seconds-to-time (* 60 60 24 14)))))
|
||||
0 10)
|
||||
(concat "T00:00:00-00:00")
|
||||
parse-time-string
|
||||
encode-time
|
||||
(time-add (seconds-to-time (* 60 60 24)))
|
||||
((lambda (time)
|
||||
(format-time-string "%Y-%m-%d" time)))))
|
||||
#+end_src
|
||||
|
||||
A template looks like this:
|
||||
|
|
@ -5990,7 +6001,7 @@ Set a custom regex for MPD. EMMS sets up the default one from MPD's diagnostic o
|
|||
(+ (? (or "https://" "http://"))
|
||||
(* nonl)
|
||||
(regexp (eval (emms-player-simple-regexp
|
||||
"m3u" "ogg" "flac" "mp3" "wav" "mod" "au" "aiff")))))))
|
||||
"m3u" "ogg" "flac" "mp3" "wav" "mod" "au" "aiff" "m4a")))))))
|
||||
#+end_src
|
||||
|
||||
After all this is done, run =M-x emms-cache-set-from-mpd-all= to set cache from MPD. If everything is correct, EMMS browser will be populated with MPD database.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue