summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2023-10-01 13:07:55 +0300
committerThanos Apollo <[email protected]>2023-10-01 13:51:04 +0300
commit8768ba4fc9c92227afd1a10bae8ab2bf5521aff6 (patch)
treea76aa3e45eb884bc35e6e90854d7bf49aed8cabc
parent5c83d8cfd92dd253a8a985f2e2cdece4e8ebc516 (diff)
[fix] remove interactive duplicate yeetube-mode
-rw-r--r--yeetube.el51
1 files changed, 22 insertions, 29 deletions
diff --git a/yeetube.el b/yeetube.el
index 76d5b8e..edb0011 100644
--- a/yeetube.el
+++ b/yeetube.el
@@ -85,26 +85,6 @@ Example Usage:
:safe #'booleanp
:group 'yeetube)
-(define-derived-mode yeetube-mode special-mode "Yeetube"
- "Yeetube mode."
- :init-value nil
- :interactive nil
- (abbrev-mode 0)
- (display-line-numbers-mode 0)
- :lighter " yeetube-mode"
- :keymap (let ((yeetube-mode-map (make-sparse-keymap)))
- (define-key yeetube-mode-map (kbd "RET") 'yeetube-play)
- (define-key yeetube-mode-map (kbd "d") 'yeetube-download-video)
- (define-key yeetube-mode-map (kbd "D") 'yeetube-change-download-directory)
- (define-key yeetube-mode-map (kbd "a") 'yeetube-change-download-audio-format)
- (define-key yeetube-mode-map (kbd "p") 'yeetube-mpv-toggle-pause)
- (define-key yeetube-mode-map (kbd "v") 'yeetube-mpv-toggle-video)
- (define-key yeetube-mode-map (kbd "V") 'yeetube-mpv-toggle-no-video-flag)
- (define-key yeetube-mode-map (kbd "s") 'yeetube-save-video)
- (define-key yeetube-mode-map (kbd "P") 'yeetube-play-saved-video)
- (define-key yeetube-mode-map (kbd "q") 'quit-window)
- yeetube-mode-map))
-
(defvar yeetube-yt-dlp (executable-find "yt-dlp"))
(defvar yeetube-content nil)
@@ -113,15 +93,6 @@ Example Usage:
(defvar yeetube-last-played nil)
-(defun yeetube-mode ()
- "Activate Yeetube Mode."
- (interactive)
- (kill-all-local-variables)
- (setq major-mode 'yeetube-mode)
- (setq mode-name "Yeetube Mode")
- (display-line-numbers-mode 0)
- (use-local-map yeetube-mode-map))
-
(defun yeetube-get-url ()
"Get url for subject in *yeetube* buffer at point."
(let ((video-url (concat "https://youtube.com/watch?v="
@@ -314,5 +285,27 @@ prompt blank to keep the default name."
(add-variable-watcher 'yeetube-saved-videos #'yeetube-update-saved-videos-list)
+;; Yeetube Mode
+(defvar-keymap yeetube-mode-map
+ :doc "Keymap for yeetube commands"
+ "RET" #'yeetube-play
+ "d" #'yeetube-download-video
+ "D" #'yeetube-change-download-directory
+ "a" #'yeetube-change-download-audio-format
+ "p" #'yeetube-mpv-toggle-pause
+ "v" #'yeetube-mpv-toggle-video
+ "V" #'yeetube-mpv-toggle-no-video-flag
+ "s" #'yeetube-save-video
+ "P" #'yeetube-play-saved-video
+ "q" #'quit-window)
+
+(define-derived-mode yeetube-mode special-mode "Yeetube"
+ "Yeetube mode."
+ :interactive t
+ (abbrev-mode 0)
+ (display-line-numbers-mode 0)
+ :lighter " yeetube-mode"
+ :keymap yeetube-mode-map)
+
(provide 'yeetube)
;;; yeetube.el ends here