Ignore errors if display-buffer ALIST is malformed

The gud.el library uses display-buffer incorrectly, by passing a list of
functions as its second argument, instead of as a nested list.

CORRECT:
  (display-buffer buffer
    '((display-buffer-reuse-window
       display-buffer-in-previous-window
       display-buffer-same-window display-buffer-pop-up-window)))

INCORRECT (how gud does it):
  (display-buffer buffer
    '(display-buffer-reuse-window
      display-buffer-in-previous-window
      display-buffer-same-window display-buffer-pop-up-window))

This causes "wrong-type-argument: listp
display-buffer-in-previous-window" error. However, it appears Emacs
handles malformed alists by just ignoring them, so Doom will do the
same.

Reported by @maskray
This commit is contained in:
Henrik Lissner 2018-07-04 21:42:33 +02:00
parent 57020cdfdb
commit a406b2d0c8
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -99,12 +99,12 @@ and enables `+popup-buffer-mode'."
(let ((alist ; handle defaults
(cl-remove-duplicates
(append alist +popup-default-alist)
:key #'car :from-end t))
:key #'car-safe :from-end t))
(parameters
(cl-remove-duplicates
(append (cdr (assq 'window-parameters alist))
+popup-default-parameters)
:key #'car :from-end t)))
:key #'car-safe :from-end t)))
;; handle `size'
(when-let* ((size (cdr (assq 'size alist)))
(side (or (cdr (assq 'side alist)) 'bottom))