From: "Juanma Barranquero" <lekktu@gmail.com>
To: "Stefan Monnier" <monnier@iro.umontreal.ca>
Cc: emacs-pretest-bug@gnu.org, Martin Fischer <parozusa@web.de>
Subject: Re: 22.1.90; desktop-save throws (error "No buffer named <uniquified buffername>")
Date: Tue, 12 Feb 2008 01:44:13 +0100 [thread overview]
Message-ID: <f7ccd24b0802111644s739ac867qd8a9e39ecc153834@mail.gmail.com> (raw)
In-Reply-To: <jwvodar9n1s.fsf-monnier+emacs@gnu.org>
On Feb 8, 2008 10:17 PM, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
> Actually, any use of the "base name" will be uniquify-specific as well,
> so I'll still say "Yuck!".
Well, I'm trying to fix a problem derived of the interaction of
uniquify and desktop, so using uniquify-specific info seems
unavoidable.
> Indeed for uniquified buffers, you should only [need to] save the
> base-name to disk, so there's no need to change the disk representation
> of your data.
The "base name" and the buffer name are two different pieces of info;
even if no uniquify is present, it would be perhaps interesting to
know (and save) whether "my-buffer<2>" is called so by user fiat or
via rename-buffer's UNIQUE argument; but that is not needed right now.
Anyway. Does this version lessen your yucky factor somewhat?
Juanma
Index: lisp/uniquify.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/uniquify.el,v
retrieving revision 1.62.2.7
diff -u -2 -r1.62.2.7 uniquify.el
--- lisp/uniquify.el 7 Jan 2008 02:44:10 -0000 1.62.2.7
+++ lisp/uniquify.el 12 Feb 2008 00:10:32 -0000
@@ -190,4 +190,10 @@
(put 'uniquify-managed 'permanent-local t)
+;; Used in desktop.el to save the non-uniquified buffer name
+(defun uniquify-buffer-base-name ()
+ "Return the base name of the current buffer."
+ (and (bound-and-true-p uniquify-managed)
+ (uniquify-item-base (car uniquify-managed))))
+
;;; Main entry point.
Index: lisp/desktop.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/desktop.el,v
retrieving revision 1.108.2.6
diff -u -2 -r1.108.2.6 desktop.el
--- lisp/desktop.el 7 Jan 2008 02:44:57 -0000 1.108.2.6
+++ lisp/desktop.el 12 Feb 2008 00:14:02 -0000
@@ -136,6 +136,4 @@
;;; Code:
-(defvar uniquify-managed)
-
(defvar desktop-file-version "206"
"Version number of desktop file format.
@@ -654,9 +652,9 @@
(set-buffer buffer)
(list
+ ;; base name of the buffer; replaces the buffer name if managed by uniquify
+ (and (fboundp 'uniquify-buffer-base-name) (uniquify-buffer-base-name))
;; basic information
(desktop-file-name (buffer-file-name) desktop-dirname)
- (if (bound-and-true-p uniquify-managed)
- (uniquify-item-base (car uniquify-managed))
- (buffer-name))
+ (buffer-name)
major-mode
;; minor modes
@@ -887,5 +885,5 @@
(insert "\n;; Buffer section -- buffers listed in same order as in
buffer list:\n")
(dolist (l (mapcar 'desktop-buffer-info (buffer-list)))
- (when (apply 'desktop-save-buffer-p l)
+ (when (apply 'desktop-save-buffer-p (cdr l))
(insert "("
(if (or (not (integerp eager))
@@ -897,4 +895,7 @@
" "
desktop-file-version)
+ (let ((base (pop l)))
+ ;; If the base name is non-nil, we substitute it for the buffer name
+ (when base (setcar (nthcdr 1 l) base)))
(dolist (e l)
(insert "\n " (desktop-value-to-string e)))
next prev parent reply other threads:[~2008-02-12 0:44 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-06 16:12 22.1.90; desktop-save throws (error "No buffer named <uniquified buffername>") Martin Fischer
2008-02-07 0:23 ` Juanma Barranquero
2008-02-08 16:59 ` Juanma Barranquero
2008-02-08 18:30 ` Stefan Monnier
2008-02-08 19:00 ` Juanma Barranquero
2008-02-08 21:17 ` Stefan Monnier
2008-02-12 0:44 ` Juanma Barranquero [this message]
2008-02-12 3:39 ` Stefan Monnier
2008-02-12 4:15 ` Juanma Barranquero
2008-02-27 12:43 ` Martin Fischer
2008-02-27 12:48 ` Juanma Barranquero
2008-02-27 16:28 ` Juanma Barranquero
2008-02-27 21:18 ` Stefan Monnier
2008-02-27 22:17 ` Juanma Barranquero
2008-02-27 22:37 ` Stefan Monnier
2008-02-27 23:00 ` Juanma Barranquero
2008-02-28 1:54 ` Stefan Monnier
2008-02-28 9:14 ` Juanma Barranquero
2008-02-28 17:09 ` Stefan Monnier
2008-02-28 13:27 ` Martin Fischer
2008-02-28 16:29 ` Juanma Barranquero
2008-02-29 10:07 ` Martin Fischer
2008-02-29 10:49 ` Juanma Barranquero
2008-02-29 13:17 ` Martin Fischer
2008-02-29 14:24 ` Juanma Barranquero
2008-02-29 14:48 ` Jason Rumney
2008-02-29 15:03 ` Juanma Barranquero
2008-02-29 15:16 ` Lennart Borgman (gmail)
2008-02-29 15:19 ` Juanma Barranquero
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f7ccd24b0802111644s739ac867qd8a9e39ecc153834@mail.gmail.com \
--to=lekktu@gmail.com \
--cc=emacs-pretest-bug@gnu.org \
--cc=monnier@iro.umontreal.ca \
--cc=parozusa@web.de \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.