* uniquify conflicts with package workgroups2
@ 2014-01-06 19:40 Mirko M.
2014-01-06 21:41 ` Stefan Monnier
0 siblings, 1 reply; 4+ messages in thread
From: Mirko M. @ 2014-01-06 19:40 UTC (permalink / raw)
To: help-gnu-emacs
Hello,
I found that uniquify conflicts with the package workgroups2: when
workgroups2 restores a session, buffer names are retrieved from the
saved session, then uniquify treats those names as "base names" for
each buffer and eventually adds a string (maybe yet present) to
uniquify them, e.g. ".emacs:/root" will become ".emacs:/root:/root".
I managed to solve the problem forcing uniquify to get the "base name"
form the file name if the buffer is visiting a file, else it uses the
buffer name, which could have been retrieved by workgroups2.
----------
diff -c /usr/share/emacs/24.3/lisp/uniquify.el /root/uniquify.el
*** /usr/share/emacs/24.3/lisp/uniquify.el 2014-01-06 11:58:01.000000000 +0100
--- /root/uniquify.el 2014-01-06 15:37:49.100158663 +0100
***************
*** 280,285 ****
--- 280,291 ----
(when new-fix-list
(uniquify-rationalize new-fix-list))))
+ (defun uniquify-item-file (item)
+ "Get the buffer file name or the current buffer name."
+ (if (buffer-file-name)
+ (file-name-nondirectory (buffer-file-name))
+ (uniquify-item-base item)))
+
(defun uniquify-rationalize (fix-list)
;; Set up uniquify to re-rationalize after killing/renaming
;; if there is a conflict.
***************
*** 287,293 ****
(with-current-buffer (uniquify-item-buffer item)
;; Refresh the dirnames and proposed names.
(setf (uniquify-item-proposed item)
! (uniquify-get-proposed-name (uniquify-item-base item)
(uniquify-item-dirname item)))
(setq uniquify-managed fix-list)))
;; Strip any shared last directory names of the dirname.
--- 293,299 ----
(with-current-buffer (uniquify-item-buffer item)
;; Refresh the dirnames and proposed names.
(setf (uniquify-item-proposed item)
! (uniquify-get-proposed-name (uniquify-item-file item)
(uniquify-item-dirname item)))
(setq uniquify-managed fix-list)))
;; Strip any shared last directory names of the dirname.
Diff finished. Mon Jan 6 15:48:02 2014
----------
Thanks,
Mirko M.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: uniquify conflicts with package workgroups2
2014-01-06 19:40 uniquify conflicts with package workgroups2 Mirko M.
@ 2014-01-06 21:41 ` Stefan Monnier
2014-01-07 15:53 ` Mirko M.
0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2014-01-06 21:41 UTC (permalink / raw)
To: help-gnu-emacs
> I managed to solve the problem forcing uniquify to get the "base name"
> form the file name if the buffer is visiting a file, else it uses the
> buffer name, which could have been retrieved by workgroups2.
Better make workgroups2 do what desktop does: use
uniquify-buffer-base-name instead of buffer-name.
Stefan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: uniquify conflicts with package workgroups2
2014-01-06 21:41 ` Stefan Monnier
@ 2014-01-07 15:53 ` Mirko M.
2014-01-08 12:58 ` Stefan Monnier
0 siblings, 1 reply; 4+ messages in thread
From: Mirko M. @ 2014-01-07 15:53 UTC (permalink / raw)
To: help-gnu-emacs
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
>
> > I managed to solve the problem forcing uniquify to get the "base name"
> > form the file name if the buffer is visiting a file, else it uses the
> > buffer name, which could have been retrieved by workgroups2.
>
> Better make workgroups2 do what desktop does: use
> uniquify-buffer-base-name instead of buffer-name.
>
> Stefan
>
>
You are right, that is another way.
NOTES:
When you switch uniquify on, to fix the buffer name, save the session
(wg-save-session), then restart emacs.
----------
diff -c /root/.emacs.d/elpa/workgroups2-20131224.657/workgroups-functions.el
/root/workgroups-functions.el
*** /root/.emacs.d/elpa/workgroups2-20131224.657/workgroups-functions.el
2014-01-07 15:10:24.000000000 +0100
--- /root/workgroups-functions.el 2014-01-07 15:41:57.000000000 +0100
***************
*** 199,205 ****
"Return the serialization (a wg-buf) of Emacs buffer BUFFER."
(with-current-buffer buffer
(wg-make-buf
! :name (buffer-name)
:file-name (buffer-file-name)
:point (point)
:mark (mark)
--- 199,210 ----
"Return the serialization (a wg-buf) of Emacs buffer BUFFER."
(with-current-buffer buffer
(wg-make-buf
! ;; base name of the buffer or file; replaces the buffer name if
managed by uniquify
! :name (or (and (fboundp 'uniquify-buffer-base-name)
! (if (buffer-file-name)
! (file-name-nondirectory (buffer-file-name))
! (uniquify-buffer-base-name)))
! (buffer-name))
:file-name (buffer-file-name)
:point (point)
:mark (mark)
Diff finished. Tue Jan 7 16:13:46 2014
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: uniquify conflicts with package workgroups2
2014-01-07 15:53 ` Mirko M.
@ 2014-01-08 12:58 ` Stefan Monnier
0 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2014-01-08 12:58 UTC (permalink / raw)
To: help-gnu-emacs
> ! ;; base name of the buffer or file; replaces the buffer name if
> managed by uniquify
> ! :name (or (and (fboundp 'uniquify-buffer-base-name)
> ! (if (buffer-file-name)
> ! (file-name-nondirectory (buffer-file-name))
> ! (uniquify-buffer-base-name)))
> ! (buffer-name))
Eh, no:
:name (or (and (fboundp 'uniquify-buffer-base-name)
(uniquify-buffer-base-name))
-- Stefan
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-01-08 12:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-06 19:40 uniquify conflicts with package workgroups2 Mirko M.
2014-01-06 21:41 ` Stefan Monnier
2014-01-07 15:53 ` Mirko M.
2014-01-08 12:58 ` Stefan Monnier
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).