Commit 02530987 authored by Juanma Barranquero's avatar Juanma Barranquero

lisp/desktop.el: Rename internal "desktop-X" frame params to "desktop--X".

(desktop-filter-parameters-alist, desktop--filter-restore-desktop-parm)
(desktop--filter-save-desktop-parm, desktop--process-minibuffer-frames)
(desktop--select-frame, desktop--sort-states, desktop-restore-frames):
Change accordingly.
parent b6806029
2013-07-25 Juanma Barranquero <lekktu@gmail.com>
* desktop.el: Rename internal "desktop-X" frame params to "desktop--X".
(desktop-filter-parameters-alist, desktop--filter-restore-desktop-parm)
(desktop--filter-save-desktop-parm, desktop--process-minibuffer-frames)
(desktop--select-frame, desktop--sort-states, desktop-restore-frames):
Change accordingly.
2013-07-25 Glenn Morris <rgm@gnu.org> 2013-07-25 Glenn Morris <rgm@gnu.org>
* dired-x.el (dired-mark-extension): Convert comment to doc string. * dired-x.el (dired-mark-extension): Convert comment to doc string.
......
...@@ -878,30 +878,30 @@ DIRNAME must be the directory in which the desktop file will be saved." ...@@ -878,30 +878,30 @@ DIRNAME must be the directory in which the desktop file will be saved."
;; ---------------------------------------------------------------------------- ;; ----------------------------------------------------------------------------
(defvar desktop-filter-parameters-alist (defvar desktop-filter-parameters-alist
'((background-color . desktop--filter-*-color) '((background-color . desktop--filter-*-color)
(buffer-list . t) (buffer-list . t)
(buffer-predicate . t) (buffer-predicate . t)
(buried-buffer-list . t) (buried-buffer-list . t)
(desktop-font . desktop--filter-restore-desktop-parm) (desktop--font . desktop--filter-restore-desktop-parm)
(desktop-fullscreen . desktop--filter-restore-desktop-parm) (desktop--fullscreen . desktop--filter-restore-desktop-parm)
(desktop-height . desktop--filter-restore-desktop-parm) (desktop--height . desktop--filter-restore-desktop-parm)
(desktop-width . desktop--filter-restore-desktop-parm) (desktop--width . desktop--filter-restore-desktop-parm)
(font . desktop--filter-save-desktop-parm) (font . desktop--filter-save-desktop-parm)
(font-backend . t) (font-backend . t)
(foreground-color . desktop--filter-*-color) (foreground-color . desktop--filter-*-color)
(fullscreen . desktop--filter-save-desktop-parm) (fullscreen . desktop--filter-save-desktop-parm)
(height . desktop--filter-save-desktop-parm) (height . desktop--filter-save-desktop-parm)
(left . desktop--filter-iconified-position) (left . desktop--filter-iconified-position)
(minibuffer . desktop--filter-minibuffer) (minibuffer . desktop--filter-minibuffer)
(name . t) (name . t)
(outer-window-id . t) (outer-window-id . t)
(parent-id . t) (parent-id . t)
(top . desktop--filter-iconified-position) (top . desktop--filter-iconified-position)
(tty . desktop--filter-tty*) (tty . desktop--filter-tty*)
(tty-type . desktop--filter-tty*) (tty-type . desktop--filter-tty*)
(width . desktop--filter-save-desktop-parm) (width . desktop--filter-save-desktop-parm)
(window-id . t) (window-id . t)
(window-system . t)) (window-system . t))
"Alist of frame parameters and filtering functions. "Alist of frame parameters and filtering functions.
Each element is a cons (PARAM . FILTER), where PARAM is a parameter Each element is a cons (PARAM . FILTER), where PARAM is a parameter
...@@ -972,27 +972,27 @@ Only meaningful when called from a filtering function in ...@@ -972,27 +972,27 @@ Only meaningful when called from a filtering function in
t))) t)))
(defun desktop--filter-restore-desktop-parm (current parameters saving) (defun desktop--filter-restore-desktop-parm (current parameters saving)
;; When switching to a GUI frame, convert desktop-XXX parameter to XXX ;; When switching to a GUI frame, convert desktop--XXX parameter to XXX
(or saving (or saving
(not (desktop-switch-to-gui-p parameters)) (not (desktop-switch-to-gui-p parameters))
(let ((val (cdr current))) (let ((val (cdr current)))
(if (eq val :desktop-processed) (if (eq val :desktop-processed)
nil nil
(cons (intern (substring (symbol-name (car current)) (cons (intern (substring (symbol-name (car current))
8)) ;; (length "desktop-") 9)) ;; (length "desktop--")
val))))) val)))))
(defun desktop--filter-save-desktop-parm (current parameters saving) (defun desktop--filter-save-desktop-parm (current parameters saving)
;; When switching to a tty frame, save parameter XXX as desktop-XXX so it ;; When switching to a tty frame, save parameter XXX as desktop--XXX so it
;; can be restored in a subsequent GUI session, unless it already exists. ;; can be restored in a subsequent GUI session, unless it already exists.
(cond (saving t) (cond (saving t)
((desktop-switch-to-tty-p parameters) ((desktop-switch-to-tty-p parameters)
(let ((sym (intern (format "desktop-%s" (car current))))) (let ((sym (intern (format "desktop--%s" (car current)))))
(if (assq sym parameters) (if (assq sym parameters)
nil nil
(cons sym (cdr current))))) (cons sym (cdr current)))))
((desktop-switch-to-gui-p parameters) ((desktop-switch-to-gui-p parameters)
(let* ((dtp (assq (intern (format "desktop-%s" (car current))) (let* ((dtp (assq (intern (format "desktop--%s" (car current)))
parameters)) parameters))
(val (cdr dtp))) (val (cdr dtp)))
(if (eq val :desktop-processed) (if (eq val :desktop-processed)
...@@ -1047,34 +1047,34 @@ Internal use only." ...@@ -1047,34 +1047,34 @@ Internal use only."
filtered)) filtered))
(defun desktop--process-minibuffer-frames (frames) (defun desktop--process-minibuffer-frames (frames)
;; Adds a desktop-mini parameter to frames ;; Adds a desktop--mini parameter to frames
;; desktop-mini is a list (MINIBUFFER NUMBER DEFAULT?) where ;; desktop--mini is a list (MINIBUFFER NUMBER DEFAULT?) where
;; MINIBUFFER t if the frame (including minibuffer-only) owns a minibuffer ;; MINIBUFFER t if the frame (including minibuffer-only) owns a minibuffer
;; NUMBER if MINIBUFFER = t, an ID for the frame; if nil, the ID of ;; NUMBER if MINIBUFFER = t, an ID for the frame; if nil, the ID of
;; the frame containing the minibuffer used by this frame ;; the frame containing the minibuffer used by this frame
;; DEFAULT? if t, this frame is the value of default-minibuffer-frame ;; DEFAULT? if t, this frame is the value of default-minibuffer-frame
(let ((count 0)) (let ((count 0))
;; Reset desktop-mini for all frames ;; Reset desktop--mini for all frames
(dolist (frame (frame-list)) (dolist (frame (frame-list))
(set-frame-parameter frame 'desktop-mini nil)) (set-frame-parameter frame 'desktop--mini nil))
;; Number all frames with its own minibuffer ;; Number all frames with its own minibuffer
(dolist (frame (minibuffer-frame-list)) (dolist (frame (minibuffer-frame-list))
(set-frame-parameter frame 'desktop-mini (set-frame-parameter frame 'desktop--mini
(list t (list t
(cl-incf count) (cl-incf count)
(eq frame default-minibuffer-frame)))) (eq frame default-minibuffer-frame))))
;; Now link minibufferless frames with their minibuffer frames ;; Now link minibufferless frames with their minibuffer frames
(dolist (frame frames) (dolist (frame frames)
(unless (frame-parameter frame 'desktop-mini) (unless (frame-parameter frame 'desktop--mini)
(let ((mb-frame (window-frame (minibuffer-window frame)))) (let ((mb-frame (window-frame (minibuffer-window frame))))
;; Frames whose minibuffer frame has been filtered out will have ;; Frames whose minibuffer frame has been filtered out will have
;; desktop-mini = nil, so desktop-restore-frames will restore them ;; desktop--mini = nil, so desktop-restore-frames will restore them
;; according to their minibuffer parameter. Set up desktop-mini ;; according to their minibuffer parameter. Set up desktop--mini
;; for the rest. ;; for the rest.
(when (memq mb-frame frames) (when (memq mb-frame frames)
(set-frame-parameter frame 'desktop-mini (set-frame-parameter frame 'desktop--mini
(list nil (list nil
(cl-second (frame-parameter mb-frame 'desktop-mini)) (cl-second (frame-parameter mb-frame 'desktop--mini))
nil)))))))) nil))))))))
(defun desktop-save-frames () (defun desktop-save-frames ()
...@@ -1234,23 +1234,23 @@ is the parameter list of the frame being restored. Internal use only." ...@@ -1234,23 +1234,23 @@ is the parameter list of the frame being restored. Internal use only."
(;; If the frame has its own minibuffer, let's see whether (;; If the frame has its own minibuffer, let's see whether
;; that frame has already been loaded (which can happen after ;; that frame has already been loaded (which can happen after
;; M-x desktop-read). ;; M-x desktop-read).
(car (setq mini (cdr (assq 'desktop-mini frame-cfg)))) (car (setq mini (cdr (assq 'desktop--mini frame-cfg))))
(setq frame (or (desktop--find-frame (setq frame (or (desktop--find-frame
(lambda (f m) (lambda (f m)
(equal (frame-parameter f 'desktop-mini) m)) (equal (frame-parameter f 'desktop--mini) m))
display mini)))) display mini))))
(;; For minibufferless frames, check whether they already exist, (;; For minibufferless frames, check whether they already exist,
;; and that they are linked to the right minibuffer frame. ;; and that they are linked to the right minibuffer frame.
mini mini
(setq frame (desktop--find-frame (setq frame (desktop--find-frame
(lambda (f n) (lambda (f n)
(let ((m (frame-parameter f 'desktop-mini))) (let ((m (frame-parameter f 'desktop--mini)))
(and m (and m
(null (cl-first m)) (null (cl-first m))
(= (cl-second m) n) (= (cl-second m) n)
(equal (cl-second (frame-parameter (equal (cl-second (frame-parameter
(window-frame (minibuffer-window f)) (window-frame (minibuffer-window f))
'desktop-mini)) 'desktop--mini))
n)))) n))))
display (cl-second mini)))) display (cl-second mini))))
(;; Default to just finding a frame in the same display. (;; Default to just finding a frame in the same display.
...@@ -1320,8 +1320,8 @@ its window state. Internal use only." ...@@ -1320,8 +1320,8 @@ its window state. Internal use only."
;; Order: default minibuffer frame ;; Order: default minibuffer frame
;; other frames with minibuffer, ascending ID ;; other frames with minibuffer, ascending ID
;; minibufferless frames, ascending ID ;; minibufferless frames, ascending ID
(let ((dm1 (cdr (assq 'desktop-mini (car state1)))) (let ((dm1 (cdr (assq 'desktop--mini (car state1))))
(dm2 (cdr (assq 'desktop-mini (car state2))))) (dm2 (cdr (assq 'desktop--mini (car state2)))))
(cond ((cl-third dm1) t) (cond ((cl-third dm1) t)
((cl-third dm2) nil) ((cl-third dm2) nil)
((eq (cl-first dm1) (cl-first dm2)) ((eq (cl-first dm1) (cl-first dm2))
...@@ -1355,7 +1355,7 @@ being set (usually, by reading it from the desktop)." ...@@ -1355,7 +1355,7 @@ being set (usually, by reading it from the desktop)."
(condition-case err (condition-case err
(let* ((frame-cfg (car state)) (let* ((frame-cfg (car state))
(window-cfg (cdr state)) (window-cfg (cdr state))
(d-mini (cdr (assq 'desktop-mini frame-cfg))) (d-mini (cdr (assq 'desktop--mini frame-cfg)))
num frame to-tty) num frame to-tty)
;; Only set target if forcing displays and the target display is different. ;; Only set target if forcing displays and the target display is different.
(if (or (not forcing) (if (or (not forcing)
...@@ -1377,7 +1377,7 @@ being set (usually, by reading it from the desktop)." ...@@ -1377,7 +1377,7 @@ being set (usually, by reading it from the desktop)."
;; global state; it's best to do it here than add a bunch of global ;; global state; it's best to do it here than add a bunch of global
;; variables to pass info back-and-forth to/from the filter function. ;; variables to pass info back-and-forth to/from the filter function.
(cond (cond
((null d-mini)) ;; No desktop-mini. Process as normal frame. ((null d-mini)) ;; No desktop--mini. Process as normal frame.
(to-tty) ;; Ignore minibuffer stuff and process as normal frame. (to-tty) ;; Ignore minibuffer stuff and process as normal frame.
((cl-first d-mini) ;; Frame has minibuffer (or it is minibuffer-only). ((cl-first d-mini) ;; Frame has minibuffer (or it is minibuffer-only).
(setq num (cl-second d-mini)) (setq num (cl-second d-mini))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment