summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorJuri Linkov <juri@linkov.net>2019-11-03 23:44:44 +0200
committerJuri Linkov <juri@linkov.net>2019-11-03 23:44:44 +0200
commitc472df8ad30741a9585fb591db3189812b66e8c9 (patch)
tree6930b251ef9c05821393f213535d89ccfb1b4289 /lisp
parent84a3793b194efe92e2eb80cd0f625f3324bf4cae (diff)
downloademacs-c472df8ad30741a9585fb591db3189812b66e8c9.tar.gz
* lisp/tab-bar.el: Filter out non-persistent tab parameters from frameset.
* lisp/tab-bar.el (frameset-filter-tabs): New function added to 'frameset-filter-alist' for frame parameter 'tabs'. (tab-bar--tab): Remove ws-bl/ws-bbl that are not needed because frameset doesn't save frame buffer-list to desktop anyway. (tab-bar-select-tab): Remove ws-bl/ws-bbl related code. * lisp/emacs-lisp/seq.el (seq-reduce): Add autoload cookie.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/emacs-lisp/seq.el1
-rw-r--r--lisp/tab-bar.el36
2 files changed, 24 insertions, 13 deletions
diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el
index 810b4792b2b..2fd735617ba 100644
--- a/lisp/emacs-lisp/seq.el
+++ b/lisp/emacs-lisp/seq.el
@@ -323,6 +323,7 @@ list."
(seq-filter (lambda (elt) (not (funcall pred elt)))
sequence))
+;;;###autoload
(cl-defgeneric seq-reduce (function sequence initial-value)
"Reduce the function FUNCTION across SEQUENCE, starting with INITIAL-VALUE.
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index ef58e9060b4..1a0ac26f687 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -436,6 +436,25 @@ Return its existing value or a new value."
:help "New tab"))))))
+;; Some window-configuration parameters don't need to be persistent.
+;; Don't save to the desktop file such tab parameters that are saved
+;; as "Unprintable entity" so can't be used after restoring the desktop.
+;; Actually tab-bar-select-tab already can handle unprintable entities,
+;; but it's better not to waste the desktop file with useless data.
+(defun frameset-filter-tabs (current _filtered _parameters saving)
+ (if saving
+ (mapcar (lambda (current)
+ (if (consp current)
+ (seq-reduce (lambda (current param)
+ (assq-delete-all param current))
+ '(wc wc-point wc-bl wc-bbl wc-history-back wc-history-forward)
+ (copy-sequence current))
+ current))
+ current)
+ current))
+
+(push '(tabs . frameset-filter-tabs) frameset-filter-alist)
+
(defun tab-bar--tab ()
(let* ((tab (assq 'current-tab (frame-parameter nil 'tabs)))
(tab-explicit-name (cdr (assq 'explicit-name tab)))
@@ -447,16 +466,14 @@ Return its existing value or a new value."
(funcall tab-bar-tab-name-function)))
(explicit-name . ,tab-explicit-name)
(time . ,(time-convert nil 'integer))
+ (ws . ,(window-state-get
+ (frame-root-window (selected-frame)) 'writable))
(wc . ,(current-window-configuration))
(wc-point . ,(point-marker))
(wc-bl . ,bl)
(wc-bbl . ,bbl)
(wc-history-back . ,(gethash (selected-frame) tab-bar-history-back))
- (wc-history-forward . ,(gethash (selected-frame) tab-bar-history-forward))
- (ws . ,(window-state-get
- (frame-root-window (selected-frame)) 'writable))
- (ws-bl . ,(mapcar #'buffer-name bl))
- (ws-bbl . ,(mapcar #'buffer-name bbl)))))
+ (wc-history-forward . ,(gethash (selected-frame) tab-bar-history-forward)))))
(defun tab-bar--current-tab (&optional tab)
;; `tab` here is an argument meaning 'use tab as template'. This is
@@ -555,14 +572,7 @@ to the numeric argument. ARG counts from 1."
tab-bar-history-forward)))
(ws
- (window-state-put ws (frame-root-window (selected-frame)) 'safe)
-
- (let ((ws-bl (seq-filter #'buffer-live-p
- (mapcar #'get-buffer (cdr (assq 'ws-bl to-tab)))))
- (ws-bbl (seq-filter #'buffer-live-p
- (mapcar #'get-buffer (cdr (assq 'ws-bbl to-tab))))))
- (when ws-bl (set-frame-parameter nil 'buffer-list ws-bl))
- (when ws-bbl (set-frame-parameter nil 'buried-buffer-list ws-bbl)))))
+ (window-state-put ws (frame-root-window (selected-frame)) 'safe)))
(setq tab-bar-history-omit t)