aboutsummaryrefslogtreecommitdiffstats
path: root/yeetube-buffer.el
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2023-09-28 11:04:33 +0300
committerThanos Apollo <[email protected]>2023-09-28 11:04:33 +0300
commitbc15e23c3f558bbf204111453abd5c92406ef2d2 (patch)
tree0c9cbab165defcdff1644eaa3576267bc09225c8 /yeetube-buffer.el
parent18409bb32c0050527ff46295839f3afb22d66631 (diff)
[Commentary] Update commentary & code format
Diffstat (limited to 'yeetube-buffer.el')
-rw-r--r--yeetube-buffer.el28
1 files changed, 14 insertions, 14 deletions
diff --git a/yeetube-buffer.el b/yeetube-buffer.el
index ed57809..c1cc431 100644
--- a/yeetube-buffer.el
+++ b/yeetube-buffer.el
@@ -24,7 +24,8 @@
;;; Commentary:
-;; This package provides yeetube-buffer functionality
+;; This package is an extension for yeetube, to create a custom
+;; *yeetube* buffer.
;;; Code:
@@ -58,7 +59,7 @@
(setf result (concat "," result))))
result))
-;; Formatting inspired from ytel
+;;; Formatting inspired from ytel
(defun yeetube-buffer--format-header-title (query)
"Format header for QUERY."
(let* ((n (string-width query))
@@ -68,20 +69,10 @@
(concat query
(make-string (abs extra-chars) ?\ )
" ")
- (concat (seq-subseq query 0 53)
+ (concat (seq-subseq query 0 50)
"... " ))))
(propertize formatted-string 'face 'yeetube-face-header-query)))
-(defun yeetube-buffer--format-header (query)
- "Render header for *yeetube* buffer for QUERY."
- (setf header-line-format
- (concat
- (concat
- "Search: " (yeetube-buffer--format-header-title query)
- (yeetube-buffer--format-view-count "Views")
- (yeetube-buffer--format-video-duration "Duration")
- (yeetube-buffer--format-channel "Channel")))))
-
(defun yeetube-buffer--format-title (title)
"Format a video TITLE to be inserted in the *yeetube* buffer."
(let* ((n (string-width title))
@@ -145,6 +136,16 @@
"... " ))))
(propertize formatted-string 'face 'yeetube-face-channel)))
+(defun yeetube-buffer--format-header (query)
+ "Render header for *yeetube* buffer for QUERY."
+ (setf header-line-format
+ (concat
+ (concat
+ "Search: " (yeetube-buffer--format-header-title query)
+ (yeetube-buffer--format-view-count "Views")
+ (yeetube-buffer--format-video-duration "Duration")
+ (yeetube-buffer--format-channel "Channel")))))
+
(defun yeetube-buffer-create (query content buffer-mode)
"Create *yeetube* buffer with BUFFER-MODE for QUERY, displaying CONTENT."
(with-current-buffer
@@ -171,6 +172,5 @@
(yeetube-buffer--format-channel channel-name)
"\n")))))
-(add-hook #'yeetube-buffer-create #'yeetube-mode)
(provide 'yeetube-buffer)
;;; yeetube-buffer.el ends here