unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Kelly Dean <kelly@prtime.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: [PATCH] Desktop mode saves mark-ring too verbosely
Date: Thu, 22 Jan 2015 05:43:47 +0000	[thread overview]
Message-ID: <tHs2sJr0e2Gzp3ZnKllZVwFMbqABlBPugC3PJmzSpcR@local> (raw)
In-Reply-To: <jwvppa8ch57.fsf-monnier+emacs@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 277 bytes --]

Stefan Monnier wrote:
>> +	   (mapcar (lambda (p)
>> +		     (set-marker (make-marker) p))
>> +		   bmr))))
>
> Aka (mapcar #'copy-marker bmr)

I forgot copy-marker existed. Updated patch attached.

FYI I'm not a committer, so I'm only sending my patches to the mailing list.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: desktop-mark-ring-tablized-1.patch --]
[-- Type: text/x-diff, Size: 2395 bytes --]

--- emacs-24.4/lisp/desktop.el
+++ emacs-24.4/lisp/desktop.el
@@ -135,7 +135,7 @@
 (require 'cl-lib)
 (require 'frameset)
 
-(defvar desktop-file-version "206"
+(defvar desktop-file-version "208"
   "Version number of desktop file format.
 Written into the desktop file and used at desktop read to provide
 backward compatibility.")
@@ -628,6 +628,18 @@
   "When the desktop file was last modified to the knowledge of this Emacs.
 Used to detect desktop file conflicts.")
 
+(defvar desktop-var-serdes-funs
+  (list (list
+	 'mark-ring
+	 (lambda (mr)
+	   (mapcar #'marker-position mr))
+	 (lambda (mr)
+	   (mapcar #'copy-marker mr))))
+  "Table of serdes functions for variables.
+Each record is a list of form: (var serializer deserializer).
+These records can be freely reordered, deleted, or new ones added.
+However, for compatibility, don't modify the functions for existing records.")
+
 (defun desktop-owner (&optional dirname)
   "Return the PID of the Emacs process that owns the desktop file in DIRNAME.
 Return nil if no desktop file found or no Emacs process is using it.
@@ -779,7 +791,12 @@
 		(push here ll))
 	       ((member local loclist)
 		(push local ll)))))
-     ll)))
+     ll)
+   (mapcar (lambda (record)
+	     (let ((var (car record)))
+	       (list var
+		     (funcall (cadr record) (symbol-value var)))))
+	   desktop-var-serdes-funs)))
 
 ;; ----------------------------------------------------------------------------
 (defun desktop--v2s (value)
@@ -1336,7 +1353,9 @@
      buffer-readonly
      buffer-misc
      &optional
-     buffer-locals)
+     buffer-locals
+     compacted-vars
+     &rest _unsupported)
 
   (let ((desktop-file-version	    file-version)
 	(desktop-buffer-file-name   buffer-filename)
@@ -1426,7 +1445,14 @@
 		  (set (car this) (cdr this)))
 	      ;; An entry of the form `symbol'.
 	      (make-local-variable this)
-	      (makunbound this))))))))
+	      (makunbound this)))
+	  (unless (< desktop-file-version 208) ; Don't misinterpret any old custom args
+	    (dolist (record compacted-vars)
+	      (let*
+		  ((var (car record))
+		   (deser-fun (cl-caddr (assq var desktop-var-serdes-funs))))
+		(if deser-fun (set var (funcall deser-fun (cadr record))))))))
+	result))))
 
 ;; ----------------------------------------------------------------------------
 ;; Backward compatibility -- update parameters to 205 standards.

  reply	other threads:[~2015-01-22  5:43 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-22  3:44 [PATCH] Desktop mode saves mark-ring too verbosely Kelly Dean
2013-11-23 13:40 ` Stefan Monnier
2015-01-21 12:11   ` Kelly Dean
2015-01-21 15:04     ` Stefan Monnier
2015-01-22  5:43       ` Kelly Dean [this message]
2015-01-22  8:20         ` Ivan Shmakov
2015-01-23 13:20           ` Kelly Dean
2015-01-23 14:09             ` Ivan Shmakov
2015-01-24  3:08             ` Stephen J. Turnbull
2015-01-24 23:30               ` Elisp terminology (was: Re: [PATCH] Desktop mode saves mark-ring too verbosely) Kelly Dean
2015-01-25  9:49                 ` Elisp terminology David Kastrup
  -- strict thread matches above, loose matches on Subject: below --
2015-01-23  2:59 Rant - Elisp terminology is deceptive Kelly Dean
2015-01-23 20:15 ` Stefan Monnier
2015-01-24  0:41   ` Kelly Dean
2015-01-24  0:48     ` Óscar Fuentes
2015-01-24  3:28     ` Stephen J. Turnbull
2015-01-24  8:51       ` Eli Zaretskii
2015-01-24 10:32         ` Kelly Dean
2015-01-24 11:26           ` Eli Zaretskii
2015-01-24 10:30       ` Kelly Dean
2015-01-24 11:03         ` David Kastrup
2015-01-24 23:24           ` Kelly Dean
2015-01-25  9:16             ` David Kastrup
2015-01-26  3:52               ` Kelly Dean
2015-01-26  8:28                 ` Thien-Thi Nguyen

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=tHs2sJr0e2Gzp3ZnKllZVwFMbqABlBPugC3PJmzSpcR@local \
    --to=kelly@prtime.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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).