;; that frame has already been loaded (which can happen after
;; M-x desktop-read).
(setq frame (frameset--find-frame-if
- (lambda (f id)
- (frameset-frame-id-equal-p f id))
+ #'frameset-frame-id-equal-p
display (frameset-cfg-id parameters)))
;; If it has not been loaded, and it is not a minibuffer-only frame,
;; let's look for an existing non-minibuffer-only frame to reuse.
\f
;; Register support
-;;;###autoload
-(defun frameset--jump-to-register (data)
- "Restore frameset from DATA stored in register.
-Called from `jump-to-register'. Internal use only."
+(cl-defstruct (frameset-register
+ (:constructor nil)
+ (:constructor frameset-make-register (frameset frame-id point)))
+ frameset frame-id point)
+
+(cl-defmethod register-val-jump-to ((data frameset-register) arg)
(frameset-restore
- (aref data 0)
+ (frameset-register-frameset data)
:filters frameset-session-filter-alist
- :reuse-frames (if current-prefix-arg t 'match)
- :cleanup-frames (if current-prefix-arg
+ :reuse-frames (if arg t 'match)
+ :cleanup-frames (if arg
;; delete frames
nil
;; iconify frames
('ignored (delete-frame frame))))))
;; Restore selected frame, buffer and point.
- (let ((frame (frameset-frame-with-id (aref data 1)))
+ (let ((frame (frameset-frame-with-id (frameset-register-frame-id data)))
+ (marker (frameset-register-point data))
buffer window)
(when frame
(select-frame-set-input-focus frame)
- (when (and (buffer-live-p (setq buffer (marker-buffer (aref data 2))))
+ (when (and (buffer-live-p
+ (setq buffer (marker-buffer marker)))
(window-live-p (setq window (get-buffer-window buffer frame))))
(set-frame-selected-window frame window)
- (with-current-buffer buffer (goto-char (aref data 2)))))))
+ (with-current-buffer buffer (goto-char marker))))))
-;;;###autoload
-(defun frameset--print-register (data)
+(cl-defmethod register-val-describe ((data frameset-register) _verbose)
"Print basic info about frameset stored in DATA.
Called from `list-registers' and `view-register'. Internal use only."
- (let* ((fs (aref data 0))
+ (let* ((fs (frameset-register-frameset data))
(ns (length (frameset-states fs))))
(princ (format "a frameset (%d frame%s, saved on %s)."
ns
Interactively, reads the register using `register-read-with-preview'."
(interactive (list (register-read-with-preview "Frameset to register: ")))
(set-register register
- (registerv-make
- (vector (frameset-save nil
- :app 'register
- :filters frameset-session-filter-alist)
- ;; frameset-save does not include the value of point
- ;; in the current buffer, so record that separately.
- (frameset-frame-id nil)
- (point-marker))
- :print-func #'frameset--print-register
- :jump-func #'frameset--jump-to-register)))
+ (frameset-make-register
+ (frameset-save nil
+ :app 'register
+ :filters frameset-session-filter-alist)
+ ;; frameset-save does not include the value of point
+ ;; in the current buffer, so record that separately.
+ (frameset-frame-id nil)
+ (point-marker))))
(provide 'frameset)