unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Juanma Barranquero <lekktu@gmail.com>
To: Emacs developers <emacs-devel@gnu.org>
Subject: Re: frameset-to-register
Date: Mon, 5 Aug 2013 15:11:13 +0200	[thread overview]
Message-ID: <CAAeL0STtoi3-VEGiC1MZHZ3n+-=ZDe5HxvdyH653UWnU2TYK5g@mail.gmail.com> (raw)
In-Reply-To: <CAAeL0ST0SHZh+J=nNhkJpkk3+pi2Ob-re+cLGZ9=XePDThBNGg@mail.gmail.com>

On Mon, Aug 5, 2013 at 7:12 AM, Juanma Barranquero <lekktu@gmail.com> wrote:

> This code adds a new frameset-to-register command.

Or, a bit cleaner:

=== modified file 'lisp/register.el'
--- lisp/register.el    2013-03-26 02:49:05 +0000
+++ lisp/register.el    2013-08-05 12:50:18 +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.
+                     (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.
@@ -157,6 +171,14 @@
      ((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)
+      (let ((frame (frameset-locate-frame-id (cadr val))))
+       (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 +291,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))



  reply	other threads:[~2013-08-05 13:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-05  5:12 frameset-to-register Juanma Barranquero
2013-08-05 13:11 ` Juanma Barranquero [this message]
2013-08-05 20:35 ` frameset-to-register Drew Adams
2013-08-05 20:49   ` frameset-to-register Juanma Barranquero
2013-08-06 21:11     ` frameset-to-register Stefan Monnier
2013-08-08  0:49       ` frameset-to-register Juanma Barranquero
  -- strict thread matches above, loose matches on Subject: below --
2014-02-12 22:59 frameset-to-register Juanma Barranquero
2014-02-13  0:34 ` frameset-to-register Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAAeL0STtoi3-VEGiC1MZHZ3n+-=ZDe5HxvdyH653UWnU2TYK5g@mail.gmail.com' \
    --to=lekktu@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).