cp/playlist - display error when no file at point

This commit is contained in:
John Doe 2017-10-12 12:51:49 +05:30
parent 52aaea092b
commit 4e68780573
1 changed files with 14 additions and 2 deletions

View File

@ -26,17 +26,29 @@
(while (not (= (line-number-at-pos) b))
(launch-file (plm/file-at-point))
(forward-line))))
;; TODO - if
((null arg)
(launch-file (plm/file-at-point)))
;; ;; old code, just plays the file at point
(let ((f (plm/file-at-point)))
(pcase f
("" (message "plm/launch-file: No file here."))
(t (launch-file (plm/file-at-point))))))
;; (async-shell-command (concat "smplayer -actions \"" "\"" (buffer-file-name)))
((or (numberp arg)
(= 1 arg))
(launch-file (buffer-file-name)))
(t (call-interactively 'launch-file))))
(t
(call-interactively 'launch-file))))
(define-derived-mode playlist-mode text-mode "Playlist"
"Major mode for editing playlists."
;; TODO - investigate why this doesn't work. (auto-fill-mode -1) is
;; what actually works, unlike what the docstring suggests -
;; (auto-fill-mode nil). Try with -q/-Q
(auto-fill-mode -1)
(setq truncate-lines 1)
(turn-off-smartparens-mode)
(define-key playlist-mode-map (kbd "C-k") 'whole-line-or-region-kill-region)
(define-key playlist-mode-map (kbd "C-S-k") 'kill-line)
(define-key playlist-mode-map (kbd "s-l") 'plm/launch-file)