>From cbd00fa84a1e0d2c4b64f7fe18ed184937b45017 Mon Sep 17 00:00:00 2001 From: Morgan Veyret Date: Sun, 15 Jun 2008 02:55:33 +0200 Subject: [PATCH] Splitted define-frame-preference CREATE-OR-RESTORE options into two. If create is T: creation if no matching group and restoration if dump file found. If restore is T: restore from file even if the group already exists. --- primitives.lisp | 4 ++-- window.lisp | 16 ++++++++++------ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/primitives.lisp b/primitives.lisp index edc991a..ffc120b 100644 --- a/primitives.lisp +++ b/primitives.lisp @@ -915,11 +915,11 @@ add rules") (let ((x (gensym "X"))) `(dolist (,x ',frames) ;; verify the correct structure - (destructuring-bind (frame-number raise lock restore-or-create + (destructuring-bind (frame-number raise lock create restore &rest keys &key (dump-name ,group) class instance type role title) ,x - (push (list* ,group frame-number raise lock restore-or-create + (push (list* ,group frame-number raise lock create restore (concat *group-dump-dir* dump-name) ;; FIXME: there's probably something better (remove-if (lambda (item) diff --git a/window.lisp b/window.lisp index 3c0356f..13238be 100644 --- a/window.lisp +++ b/window.lisp @@ -735,10 +735,10 @@ than the root window's width and height." (defun window-matches-rule-p (w rule) "Returns T if window matches rule" - (destructuring-bind (group-name frame raise lock restore-or-create + (destructuring-bind (group-name frame raise lock create restore dump-name &rest props) rule - (declare (ignore frame raise restore-or-create dump-name)) + (declare (ignore frame raise create restore dump-name)) (if (or lock (equal group-name (group-name (or (window-group w) (current-group))))) (apply 'window-matches-properties-p w props)))) @@ -755,13 +755,17 @@ than the root window's width and height." (let ((match (rule-matching-window window))) (if match (destructuring-bind (group-name frame raise lock - restore-or-create dump-name + create restore dump-name &rest props) match (declare (ignore lock props)) (let ((group (find-group screen group-name))) (if group - (values group (frame-by-number group frame) raise) - (if restore-or-create + (progn (when restore + (message "Restoring group \"^b~a^B\" from \"^b~a^B\"." group-name dump-name) + (restore-group group + (read-dump-from-file dump-name))) + (values group (frame-by-number group frame) raise)) + (if create (let ((new-group (add-group (current-screen) group-name))) (if (and new-group (probe-file dump-name)) @@ -770,7 +774,7 @@ than the root window's width and height." (values new-group (frame-by-number new-group frame) raise)) - (progn (message "^B^1*Error restoring group \"^b~a^B\" from \"^b~a^B\"." new-group group-dump-file) + (progn (message "^B^1*Error restoring group \"^b~a^B\" from \"^b~a^B\"." new-group dump-name) (values new-group (frame-by-number new-group frame) raise)))) -- 1.5.5.1