From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juanma Barranquero Newsgroups: gmane.emacs.devel Subject: frameset-to-register Date: Mon, 5 Aug 2013 07:12:23 +0200 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1375679590 21037 80.91.229.3 (5 Aug 2013 05:13:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 5 Aug 2013 05:13:10 +0000 (UTC) To: Emacs developers Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Aug 05 07:13:13 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1V6D6U-00022M-I6 for ged-emacs-devel@m.gmane.org; Mon, 05 Aug 2013 07:13:10 +0200 Original-Received: from localhost ([::1]:54913 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V6D6T-0004fK-UC for ged-emacs-devel@m.gmane.org; Mon, 05 Aug 2013 01:13:09 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53400) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V6D6P-0004f3-Lr for emacs-devel@gnu.org; Mon, 05 Aug 2013 01:13:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V6D6O-0001Gy-Im for emacs-devel@gnu.org; Mon, 05 Aug 2013 01:13:05 -0400 Original-Received: from mail-ea0-x22f.google.com ([2a00:1450:4013:c01::22f]:40395) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V6D6O-0001Gc-Ck for emacs-devel@gnu.org; Mon, 05 Aug 2013 01:13:04 -0400 Original-Received: by mail-ea0-f175.google.com with SMTP id m14so1354373eaj.20 for ; Sun, 04 Aug 2013 22:13:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=Tm/fHvXM+7LvS5+Dr3ELBa1yaYGSEpcDuzlMXZW7dAs=; b=sMJnQjx9ZdqN7M/+lEFqj1FxriC9nIcXMSnaHMzIABdkyVhTtI83K4b15zPm9O4pxL Mb8dlOYRHwqw7zwFzkbiwZ2U+t52sovA+WouSh986SPlTC53Uemenen9NHVerZao5vVD GIJ/rpLsrFxtbHlCtz10YPV5OzuiV1rsMRFROGoxTrDAXxZwbHHvrEkTSX6XSMM9RWKB fEv9exTiic87hN8vAFuZSzHYqM4e9xQsd8v4mLDSpZdAmVl6Dm6wvdvBe1/ioqpt8s3a GGGNvg2QsQbBplGEPJCJnHsFixWClWOfyo9z9DMh+9zKvndn3Tb8GBzNydsdJpo/TLIe xTqA== X-Received: by 10.14.224.6 with SMTP id w6mr15044324eep.99.1375679583346; Sun, 04 Aug 2013 22:13:03 -0700 (PDT) Original-Received: by 10.14.133.15 with HTTP; Sun, 4 Aug 2013 22:12:23 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4013:c01::22f X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:162426 Archived-At: This code adds a new frameset-to-register command. Assuming that it is OK to install it, keybindings in the C-x r space are scarce. I propose to bind it to C-x r F, which is already co-opted by frame-configuration-to-register (via C-x r f) and seems mnemonic enough. Juanma === modified file 'lisp/register.el' --- lisp/register.el 2013-03-26 02:49:05 +0000 +++ lisp/register.el 2013-08-05 05:07:08 +0000 @@ -132,6 +132,20 @@ ;; of point in the current buffer, so record that separately. (set-register register (list (current-frame-configuration) (point-marker)))) +(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 + :filters frameset-live-filter-alist + :properties '(:app register)) + ;; frameset-save does not include the value of point + ;; in the current buffer, so record that separately. + (frame-parameter nil 'frameset--id) + (point-marker)))) + (defalias 'register-to-point 'jump-to-register) (defun jump-to-register (register &optional delete) "Move point to location stored in a register. @@ -157,6 +171,18 @@ ((and (consp val) (window-configuration-p (car val))) (set-window-configuration (car val)) (goto-char (cadr val))) + ((and (consp val) (frameset-p (car val))) + (frameset-restore (car val) + :filters frameset-live-filter-alist + :reuse-frames t) + ;; At this point, cl-lib is loaded via frameset.el + (let ((frame (cl-find-if (lambda (f) + (string= (frame-parameter f 'frameset--id) + (cadr val))) + (frame-list)))) + (when frame + (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")) @@ -269,6 +295,9 @@ ((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))