Use relative file names when updating playlist

This is the documented behavior, the previous usage of absolute file names was a
Daniel Borchmann 2021-02-24 13:58:43 +01:00
parent 1df794ebf2
commit f982f37d69
No known key found for this signature in database
GPG Key ID: 1C7071A75BB72D64
1 changed files with 12 additions and 1 deletions

View File

@ -201,7 +201,18 @@ OVERWRITE is non-nil."
;; the current playlist, as otherwise `emms-playlist-save' will
;; ask for confirmation.
(emms-playlist-save 'm3u file)))
(kill-buffer emms-temp-playlist-buffer)))))))
(kill-buffer emms-temp-playlist-buffer)
;; Convert absolute file names to relative file names
(with-current-buffer (or (find-buffer-visiting file)
(find-file-noselect file))
;; Make sure the current buffer is up to date with the file on
;; disk, in case it had been visited before
(revert-buffer 'ignore-auto 'noconfirm)
(goto-char (point-min))
(while (re-search-forward "^.+$" nil 'noerror)
(replace-match (file-relative-name (match-string 0))))
(defun db/update-playlist-files ()
"Update personal playlist files."