unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#5591: 23.1.92; bookmark.el and file path
@ 2010-02-17 19:48 Leo
  2010-02-17 22:26 ` Thierry Volpiatto
  2010-02-18 18:54 ` Stefan Monnier
  0 siblings, 2 replies; 5+ messages in thread
From: Leo @ 2010-02-17 19:48 UTC (permalink / raw)
  To: 5591

If you open a file in your home directory and bookmark it, the path in
bookmark list (C-x r l) will be something beginning with ~ for example:
~/Emacs/gtd/Tasks.org.

However, if the directory gtd does not exist and you use bookmark's
relocation to change to a new file, say ~/Emacs/todo/Tasks.org. The path
in bookmark list will be a absolute path:
/home/someone/Emacs/todo/Tasks.org.

Using a absolute path here is not a good idea. For example I sync some
directories between machines and I don't have the same user name on all
of them. And these bookmarks will fail.

Another case. I recently installed Snow Leopard and decided to create a
different user name for myself. But I find out many bookmarks are no
longer valid due to the use of absolute paths.


In GNU Emacs 23.1.92.2 (x86_64-apple-darwin10.2.0, Carbon Version 1.6.0 AppKit 1038.25)
 of 2010-02-03 on Victoria.local
Windowing system distributor `Apple Inc.', version 10.6.2
configured using `configure  '--prefix=/usr/local/unix/emacs' '--with-mac''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: nil
  value of $XMODIFIERS: nil
  locale-coding-system: iso-latin-1-unix
  default enable-multibyte-characters: t

Major mode: Group







^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#5591: 23.1.92; bookmark.el and file path
  2010-02-17 19:48 bug#5591: 23.1.92; bookmark.el and file path Leo
@ 2010-02-17 22:26 ` Thierry Volpiatto
  2010-02-18 14:00   ` Stefan Monnier
  2010-02-18 18:54 ` Stefan Monnier
  1 sibling, 1 reply; 5+ messages in thread
From: Thierry Volpiatto @ 2010-02-17 22:26 UTC (permalink / raw)
  To: bug-gnu-emacs

Hi all,
is there any reason to expand-file-name here in bookmark-relocate?

,----
| (let* ((bmrk-filename (bookmark-get-filename bookmark))
|        (newloc (expand-file-name ==> here
|                 (read-file-name
|                  (format "Relocate %s to: " bookmark)
|                  (file-name-directory bmrk-filename)))))
`----

Work fine without here.

Leo <sdl.web@gmail.com> writes:

> If you open a file in your home directory and bookmark it, the path in
> bookmark list (C-x r l) will be something beginning with ~ for example:
> ~/Emacs/gtd/Tasks.org.
>
> However, if the directory gtd does not exist and you use bookmark's
> relocation to change to a new file, say ~/Emacs/todo/Tasks.org. The path
> in bookmark list will be a absolute path:
> /home/someone/Emacs/todo/Tasks.org.
>
> Using a absolute path here is not a good idea. For example I sync some
> directories between machines and I don't have the same user name on all
> of them. And these bookmarks will fail.
>
> Another case. I recently installed Snow Leopard and decided to create a
> different user name for myself. But I find out many bookmarks are no
> longer valid due to the use of absolute paths.
>
>
> In GNU Emacs 23.1.92.2 (x86_64-apple-darwin10.2.0, Carbon Version 1.6.0 AppKit 1038.25)
>  of 2010-02-03 on Victoria.local
> Windowing system distributor `Apple Inc.', version 10.6.2
> configured using `configure  '--prefix=/usr/local/unix/emacs' '--with-mac''
>
> Important settings:
>   value of $LC_ALL: nil
>   value of $LC_COLLATE: nil
>   value of $LC_CTYPE: nil
>   value of $LC_MESSAGES: nil
>   value of $LC_MONETARY: nil
>   value of $LC_NUMERIC: nil
>   value of $LC_TIME: nil
>   value of $LANG: nil
>   value of $XMODIFIERS: nil
>   locale-coding-system: iso-latin-1-unix
>   default enable-multibyte-characters: t
>
> Major mode: Group
>
>
>
>
>
>

-- 
Thierry Volpiatto








^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#5591: 23.1.92; bookmark.el and file path
  2010-02-17 22:26 ` Thierry Volpiatto
@ 2010-02-18 14:00   ` Stefan Monnier
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2010-02-18 14:00 UTC (permalink / raw)
  To: Thierry Volpiatto; +Cc: bug-gnu-emacs

> is there any reason to expand-file-name here in bookmark-relocate?

> ,----
> | (let* ((bmrk-filename (bookmark-get-filename bookmark))
> |        (newloc (expand-file-name ==> here
> |                 (read-file-name
> |                  (format "Relocate %s to: " bookmark)
> |                  (file-name-directory bmrk-filename)))))
> `----

> Work fine without here.

read-file-name can return a relative file name, so yes, expand-file-name
is needed.  So the solution is to add a call to abbreviate-file-name.


        Stefan








^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#5591: 23.1.92; bookmark.el and file path
  2010-02-17 19:48 bug#5591: 23.1.92; bookmark.el and file path Leo
  2010-02-17 22:26 ` Thierry Volpiatto
@ 2010-02-18 18:54 ` Stefan Monnier
  2010-02-20 11:18   ` Leo
  1 sibling, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2010-02-18 18:54 UTC (permalink / raw)
  To: Leo

> However, if the directory gtd does not exist and you use bookmark's
> relocation to change to a new file, say ~/Emacs/todo/Tasks.org. The path
> in bookmark list will be a absolute path:
> /home/someone/Emacs/todo/Tasks.org.

Thank you.  Should be fixed now,


        Stefan






^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#5591: 23.1.92; bookmark.el and file path
  2010-02-18 18:54 ` Stefan Monnier
@ 2010-02-20 11:18   ` Leo
  0 siblings, 0 replies; 5+ messages in thread
From: Leo @ 2010-02-20 11:18 UTC (permalink / raw)
  To: bug-gnu-emacs

On 2010-02-18 18:54 +0000, Stefan Monnier wrote:
>> However, if the directory gtd does not exist and you use bookmark's
>> relocation to change to a new file, say ~/Emacs/todo/Tasks.org. The path
>> in bookmark list will be a absolute path:
>> /home/someone/Emacs/todo/Tasks.org.
>
> Thank you.  Should be fixed now,
>
>
>         Stefan

On 2010-02-17 22:26 +0000, Thierry Volpiatto wrote:
> Hi all,
> is there any reason to expand-file-name here in bookmark-relocate?
>
> ,----
> | (let* ((bmrk-filename (bookmark-get-filename bookmark))
> |        (newloc (expand-file-name ==> here
> |                 (read-file-name
> |                  (format "Relocate %s to: " bookmark)
> |                  (file-name-directory bmrk-filename)))))
> `----
>
> Work fine without here.

Many thanks.

Leo








^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-02-20 11:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-17 19:48 bug#5591: 23.1.92; bookmark.el and file path Leo
2010-02-17 22:26 ` Thierry Volpiatto
2010-02-18 14:00   ` Stefan Monnier
2010-02-18 18:54 ` Stefan Monnier
2010-02-20 11:18   ` Leo

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).