Detect dotted lists and don't walk them

This commit is contained in:
Vasilij Schneidermann
2017-11-23 09:06:34 +01:00
parent ddb3a7b061
commit 1b304141f3

View File

@ -252,13 +252,18 @@ This function keeps the sortedness intact."
"Returns a window config list appliable for SLOT." "Returns a window config list appliable for SLOT."
(list slot (window-state-get nil t) tag)) (list slot (window-state-get nil t) tag))
(defun eyebrowse--dotted-list-p (list)
"Non-nil if LIST is terminated by a non-nil value."
(cdr (last list)))
(defun eyebrowse--walk-window-config (window-config function) (defun eyebrowse--walk-window-config (window-config function)
"Walk through WINDOW-CONFIG and apply FUNCTION to each leaf." "Walk through WINDOW-CONFIG and apply FUNCTION to each leaf."
(dolist (item window-config) (dolist (item window-config)
(when (consp item) (when (consp item)
(when (symbolp (car item)) (when (symbolp (car item))
(funcall function item)) (funcall function item))
(when (consp (cdr item)) (when (and (consp (cdr item))
(not (eyebrowse--dotted-list-p (cdr item))))
(eyebrowse--walk-window-config (cdr item) function))))) (eyebrowse--walk-window-config (cdr item) function)))))
(defun eyebrowse--fixup-window-config (window-config) (defun eyebrowse--fixup-window-config (window-config)