]> njoseph.me Git - nimcoon.git/blobdiff - nimcoon.el
update TODO list
[nimcoon.git] / nimcoon.el
index c238fc144a1345d69c02e87db31796ce7e16d49f..5f01750cb2812a002f406a36b7035f3c7a0e75c6 100644 (file)
@@ -1,24 +1,32 @@
 ;;; nimcoon.el -*- lexical-binding: t; -*-
 ;;;
+;;; Commentary
 ;;; Usage in Doom Emacs
 ;;; Place or symlink the file into ~/.doom.d/
 ;;; (load! "nimcoon")
 
 ;;; Non-interactive functions to respond to URL clicks
 (defun nimcoon-play-url (url &rest args)
-  "Play given URL in NimCoon."
+  "Play given URL in Nimcoon."
   (start-process "nimcoon" nil "nimcoon" url))
 
-;; Play all YouTube URLs in NimCoon
+;; Play all YouTube URLs in Nimcoon
 (setq browse-url-browser-function
       (quote
        (("youtu\\.?be" . nimcoon-play-url)
         ("." . browse-url-default-browser))))
 
 (defun run-nimcoon(args query)
-  "Search by QUERY and play in 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: ")
   (interactive "sSearch query: ")
   (run-nimcoon "-dlm" query))
 
-;; Assumes only one process exists. Must capture the pid of the running NimCoon process and only kill it.
+;; Assumes only one process exists. Must capture the pid of the running Nimcoon process and only kill it.
 (defun nimcoon-kill-background-processes()
-  "Kill NimCoon process running in the background. Useful for stopping background music."
+  "Kill Nimcoon process running in the background. Useful for stopping background music."
   (interactive)
   (shell-command "kill `pgrep nimcoon` `pgrep mpv` `pgrep vlc`"))
 
-(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))))
-
 (defun nimcoon-search-video(query)
   "Search for a video by QUERY."
   (interactive "sSearch query: ")
@@ -61,8 +62,8 @@
 
 ;;; Keybindings
 (map! :leader
-      ;;; <leader> N --- NimCoon
-      (:prefix-map ("N" . "NimCoon")
+      ;;; <leader> N --- Nimcoon
+      (:prefix-map ("N" . "Nimcoon")
        (:prefix ("d" . "Download")
         :desc "Video" "v" #'nimcoon-download-video
         :desc "Music" "m" #'nimcoon-download-music)
@@ -72,3 +73,5 @@
        :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