Commit 77187e6f authored by Juanma Barranquero's avatar Juanma Barranquero

Move frameset-to-register stuff from register.el to frameset.el.

lisp/register.el (frameset-frame-id, frameset-frame-with-id, frameset-p)
(frameset-restore, frameset-save, frameset-session-filter-alist):
Remove declarations.
(register-alist): Doc fix.
(frameset-to-register): Move to frameset.el.
(jump-to-register, describe-register-1): Remove frameset-specific code.

lisp/frameset.el (frameset-p): Add autoload cookie.
(frameset--jump-to-register): New function, based on code moved from
register.el.
(frameset-to-register): Move from register.el.  Adapt to `registerv'.
parent 9d3aa82c
2013-08-09 Juanma Barranquero <lekktu@gmail.com>
* frameset.el (frameset-p): Add autoload cookie.
(frameset--jump-to-register): New function, based on code moved from
register.el.
(frameset-to-register): Move from register.el. Adapt to `registerv'.
* register.el (frameset-frame-id, frameset-frame-with-id, frameset-p)
(frameset-restore, frameset-save, frameset-session-filter-alist):
Remove declarations.
(register-alist): Doc fix.
(frameset-to-register): Move to frameset.el.
(jump-to-register, describe-register-1): Remove frameset-specific code.
2013-08-08 Juanma Barranquero <lekktu@gmail.com>
* allout-widgets.el (allout-widgets-pre-command-business)
......
......@@ -129,6 +129,9 @@ root window of the frame.\n
IMPORTANT: Modifying this slot may cause frameset functions to fail,
unless the type constraints defined above are respected.\n\n(fn FRAMESET)")
;;;###autoload (autoload 'frameset-p "frameset"
;;;###autoload "Return non-nil if OBJECT is a frameset, nil otherwise." nil)
(defun frameset-copy (frameset)
"Return a deep copy of FRAMESET.
FRAMESET is copied with `copy-tree'."
......@@ -1184,6 +1187,41 @@ All keyword parameters default to nil."
(unless (or (daemonp) (visible-frame-list))
(make-frame-visible (car (frame-list))))))
;; Register support
(defun frameset--jump-to-register (data)
"Restore frameset from DATA stored in register.
Called from `jump-to-register'. Internal use only."
(let* ((delete (and current-prefix-arg t))
(iconify-list (if delete nil (frame-list))))
(frameset-restore (aref data 0)
:filters frameset-session-filter-alist
:reuse-frames (if delete t :keep))
(mapc #'iconify-frame iconify-list)
(let ((frame (frameset-frame-with-id (aref data 1))))
(when frame
(select-frame-set-input-focus frame)
(goto-char (aref data 2))))))
;;;###autoload
(defun frameset-to-register (register &optional _arg)
"Store the current frameset in register REGISTER.
Use \\[jump-to-register] to restore the frameset.
Argument is a character, naming the register."
(interactive "cFrameset to register: \nP")
(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 (lambda (_data) (princ "a frameset."))
:jump-func #'frameset--jump-to-register)))
(provide 'frameset)
;;; frameset.el ends here
......@@ -31,12 +31,6 @@
(eval-when-compile (require 'cl-lib))
(declare-function frameset-frame-id "frameset" (frame))
(declare-function frameset-frame-with-id "frameset" (id &optional frame-list))
(declare-function frameset-p "frameset" (frameset))
(declare-function frameset-restore "frameset" (frameset &rest keys) t)
(declare-function frameset-save "frameset" (frame-list &rest keys) t)
;;; Code:
(cl-defstruct
......@@ -77,9 +71,7 @@ A list of the form (file-query FILE-NAME POSITION) represents
A list of the form (WINDOW-CONFIGURATION POSITION)
represents a saved window configuration plus a saved value of point.
A list of the form (FRAME-CONFIGURATION POSITION)
represents a saved frame configuration plus a saved value of point.
A list of the form (FRAMESET FRAME-ID POSITION)
represents a saved frameset plus the value of point in frame FRAME-ID.")
represents a saved frame configuration plus a saved value of point.")
(defgroup register nil
"Register commands."
......@@ -140,22 +132,6 @@ Argument is a character, naming the register."
;; of point in the current buffer, so record that separately.
(set-register register (list (current-frame-configuration) (point-marker))))
(defvar frameset-session-filter-alist)
(defun frameset-to-register (register &optional _arg)
"Store the current frameset in register REGISTER.
Use \\[jump-to-register] to restore the frameset.
Argument is a character, naming the register."
(interactive "cFrameset to register: \nP")
(set-register register
(list (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))))
(defalias 'register-to-point 'jump-to-register)
(defun jump-to-register (register &optional delete)
"Move point to location stored in a register.
......@@ -181,16 +157,6 @@ delete any existing frames that the frameset doesn't mention.
((and (consp val) (window-configuration-p (car val)))
(set-window-configuration (car val))
(goto-char (cadr val)))
((and (consp val) (frameset-p (car val)))
(let ((iconify-list (if delete nil (frame-list)))
frame)
(frameset-restore (car val)
:filters frameset-session-filter-alist
:reuse-frames (if delete t :keep))
(mapc #'iconify-frame iconify-list)
(when (setq frame (frameset-frame-with-id (cadr val)))
(select-frame-set-input-focus frame)
(goto-char (nth 2 val)))))
((markerp val)
(or (marker-buffer val)
(error "That register's buffer no longer exists"))
......@@ -303,9 +269,6 @@ The Lisp value REGISTER is a character."
((and (consp val) (frame-configuration-p (car val)))
(princ "a frame configuration."))
((and (consp val) (frameset-p (car val)))
(princ "a frameset."))
((and (consp val) (eq (car val) 'file))
(princ "the file ")
(prin1 (cdr val))
......
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