grastello / ytel

Youtube "front-end" for Emacs
GNU General Public License v3.0
48 stars 10 forks source link

Use display-buffer instead of switch-to-buffer #18

Open karthink opened 3 years ago

karthink commented 3 years ago

Thank you for ytel, this is an excellent piece of piping. Together with RSS feeds of youtube channels I'm subscribed to, I rarely need to visit youtube any more.

This is about the window creation method for ytel:

(defun ytel ()
  "Enter ytel."
  (interactive)
  (switch-to-buffer (ytel-buffer))
  (unless (eq major-mode 'ytel-mode)
    (ytel-mode))
  (when (seq-empty-p ytel-search-term)
    (call-interactively #'ytel-search)))

Consider using display-buffer or pop-to-buffer instead of switch-to-buffer here? The former two are configurable by the user through display-buffer-alist or using a package like shackle.el, so that they can, for instance, have ytel launch in a side window or a new frame always. Or indeed, choose the window used for displaying ytel based on an arbitrary predicate and from the full complement of window types emacs supports. switch-to-buffer pre-dates the display-buffer functionality and is completely inflexible.