;;; nimcoon.el -*- lexical-binding: t; -*-
;;;
+;;; Commentary
;;; Usage in Doom Emacs
;;; Place or symlink the file into ~/.doom.d/
;;; (load! "nimcoon")
"Search by QUERY and play in NimCoon."
(call-process "nimcoon" nil 0 nil args query))
+(defun nimcoon-search(args query)
+ "Search by QUERY with the given ARGS."
+ (with-output-to-temp-buffer "*NimCoon search results*"
+ (call-process "nimcoon" nil "*NimCoon search results*" t args query)
+ (with-current-buffer "*NimCoon search results*"
+ (org-mode))))
+
;;; Interactive functions
(defun nimcoon-feeling-lucky-music(query)
(interactive "sSearch query: ")
(defun nimcoon-search-video(query)
"Search for a video by QUERY."
(interactive "sSearch query: ")
- (with-output-to-temp-buffer "*NimCoon search results*"
- (call-process "nimcoon" nil "*NimCoon search results*" t "--non-interactive" query)
- (with-current-buffer "*NimCoon search results*"
- (org-mode))))
+ (nimcoon-search "-n" query))
(defun nimcoon-search-music(query)
"Search for a video by QUERY."
(interactive "sSearch query: ")
- (with-output-to-temp-buffer "*NimCoon search results*"
- (call-process "nimcoon" nil "*NimCoon search results*" t "--music" "--non-interactive" query)
- (with-current-buffer "*NimCoon search results*"
- (org-mode))))
+ (nimcoon-search "-nm" query))
;;; Keybindings
(map! :leader
(:prefix ("s" . "Search")
:desc "Video" "v" #'nimcoon-search-video
:desc "Music" "m" #'nimcoon-search-music)
- :desc "Kill" "k" #'nimcoon-kill-process
+ :desc "Kill" "k" #'nimcoon-kill-background-processes
:desc "Video" "v" #'nimcoon-feeling-lucky-video
:desc "Music" "m" #'nimcoon-feeling-lucky-music))
+
+;;; nimcoon.el ends here