diff options
author | Thanos Apollo <[email protected]> | 2023-10-02 05:36:06 +0300 |
---|---|---|
committer | Thanos Apollo <[email protected]> | 2023-10-02 05:36:06 +0300 |
commit | 0ce1cfae7aebd2e1c46e52aebd488c735b3ccc20 (patch) | |
tree | 101a0a01ff4d8086a1b7097e94c70b9013f32d75 | |
parent | ca8d5c847f2469e3f4bb9aa16a461a97f595f79b (diff) |
[fix] yeetube-buffer: Update yeetube-buffer-create
- Require cl-lib
- Update documentation
- Remove obsolete check for view-count length
- Replace interactive function 'beginning-of-buffer' for (goto-char (point-min))
-rw-r--r-- | yeetube-buffer.el | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/yeetube-buffer.el b/yeetube-buffer.el index 76de024..1c3939f 100644 --- a/yeetube-buffer.el +++ b/yeetube-buffer.el @@ -29,6 +29,8 @@ ;;; Code: +(require 'cl-lib) + (defcustom yeetube-buffer-display-emojis nil "Display video title's emojis. @@ -170,7 +172,7 @@ Emojis cause formatting issues, this should be off by default." ;;;###autoload (defun yeetube-buffer-create (query content buffer-mode) - "Create *yeetube* buffer with BUFFER-MODE for QUERY, displaying CONTENT." + "Create *yeetube* buffer with BUFFER-MODE for search QUERY, displaying CONTENT." (with-current-buffer (switch-to-buffer (get-buffer-create "*yeetube*")) (funcall buffer-mode) @@ -179,16 +181,14 @@ Emojis cause formatting issues, this should be off by default." (yeetube-buffer--format-header query) (dolist (info (reverse content)) (let ((title (yeetube-buffer-fix-title (car info))) - (view-count (caddr info)) - (video-duration (cadddr info)) + (view-count (nth 2 info)) + (video-duration (nth 3 info)) (channel-name (nth 4 info))) (insert (yeetube-buffer--format-title title) (yeetube-buffer--format-view-count - (if (< (length view-count) 20) - (yeetube-buffer-view-count-add-commas - (yeetube-buffer-fix-view-count view-count)) - "nil")) + (yeetube-buffer-view-count-add-commas + (yeetube-buffer-fix-view-count view-count))) (yeetube-buffer--format-video-duration (if (string-match-p "^[0-9:]+$" video-duration) video-duration @@ -196,8 +196,7 @@ Emojis cause formatting issues, this should be off by default." (yeetube-buffer--format-channel channel-name) "\n"))) (backward-delete-char 1) ;; Delete extra line - (setf buffer-read-only nil) - (beginning-of-buffer))) + (goto-char (point-min)))) (provide 'yeetube-buffer) ;;; yeetube-buffer.el ends here |