Fix doom-temp-buffer-p & doom-real-buffer-p

A regression caused the former to error out (if the buffer name was less
than 2 characters long) and the latter to return t too eagerly (because
of an incorrect condition chain).
This commit is contained in:
Henrik Lissner 2018-06-17 02:30:02 +02:00
parent b731aeea8f
commit f3aadf6c77
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -80,7 +80,7 @@ If no project is active, return all buffers."
;;;###autoload
(defun doom-temp-buffer-p (buf)
"Returns non-nil if BUF is temporary."
(equal (substring (buffer-name buf) 0 2) " *"))
(equal (substring (buffer-name buf) 0 1) " "))
;;;###autoload
(defun doom-non-file-visiting-buffer-p (buf)
@ -111,10 +111,10 @@ The exact criteria for a real buffer is:
If BUFFER-OR-NAME is omitted or nil, the current buffer is tested."
(when-let* ((buf (ignore-errors (window-normalize-buffer buffer-or-name))))
(or (buffer-local-value 'doom-real-buffer-p buf)
(not (doom-temp-buffer-p buf))
(run-hook-with-args-until-success 'doom-real-buffer-functions buf)
(not (run-hook-with-args-until-success 'doom-unreal-buffer-functions buf)))))
(and (not (doom-temp-buffer-p buf))
(or (buffer-local-value 'doom-real-buffer-p buf)
(run-hook-with-args-until-success 'doom-real-buffer-functions buf)
(not (run-hook-with-args-until-success 'doom-unreal-buffer-functions buf))))))
;;;###autoload
(defun doom-buffers-in-mode (modes &optional buffer-list derived-p)