- Subject: Re: [Jed-users-l] editing symbolic links
- From: "John E. Davis" <davis@xxxxxxxxxxxxx>
- Date: Fri, 12 Apr 2013 11:25:46 -0400
Ulli Horlacher <framstag@xxxxxxxxxxxxxxxxxxxx> wrote:
> You mean, there are 3 files?
>
> foo -> /tmp/bar
> bar
> /tmp/bar
>
> I see here no problem at all?
> Editing foo leads to:
>
> foo -> /tmp/bar
> /tmp/bar~
Suppose that there are 3 files in /tmp,
/tmp/foo --> /some/other/dir/bar
/tmp/zzz
/tmp/bar
and two others in /some/other/dir:
/some/other/dir/bar
/some/other/dir/zzz
Note that /tmp/foo is a symlink.
Now suppose the current directory is /home/ulli/ and from there you
edit /tmp/foo:
%unix> pwd
/home/ulli
%unix> jed /tmp/foo
In the current scheme, the list_buffers will show:
Flags umask Buffer Name Dir/File
----------- 0000 "*scratch*" /home/ulli/
-----U---AM 0000 "foo" /tmp/foo
Now, suppose you use the find_file function to edit another file. You
will see the prompt:
Find file: /tmp/
Now type zzz and press enter. The list_buffers function will show:
Flags umask Buffer Name Dir/File
----------- 0000 "*scratch*" /home/ulli/
-----U---AM 0000 "foo" /tmp/foo
-----U---AM 0000 "zzz" /tmp/zzz
So you make some changes to foo and zzz and save the results. This
will lead to the following files:
/tmp/foo --> /some/other/dir/bar (foo still has the same link name)
/tmp/bar (unchanged, since it was not edited)
/tmp/zzz (changed)
/tmp/zzz~ (previous version)
/some/other/dir/bar (modified, via foo)
/some/other/dir/bar~ (the backup file)
/some/other/dir/zzz (unchanged)
Now consider what would happen in your scheme which uses not the link
foo, but the target of the link as the basis for buffer names and
directories:
%unix> pwd
/home/ulli
%unix> jed /tmp/foo
The list_buffers command would show:
Flags umask Buffer Name Dir/File
----------- 0000 "*scratch*" /home/ulli/
-----U---AM 0000 "bar" /some/other/dir/bar
Any reference to /tmp has been lost. Use find_file to load zzz:
-----U---AM 0000 "zzz" /tmp/zzz
The prompt will read:
Find file: /some/other/dir/
If your intent is to edit /tmp/zzz, you will have to change
/some/other/dir/ to /tmp/. On the other hand, if you blindly assume
that since you originally loaded a file from /tmp, and you are now
loading another file from that buffer, then you might enter zzz at the
prompt without realizing that the prompt is different. As a result,
you will be editing the wrong file.
For these reasons, I think that using the target of a symlink as the
filename is conceptually more confusing. On the other hand, if your
intent is to edit /some/other/dir/bar, why not edit it directly?
I hope I have explained the rationale for the current behavior.
Thanks,
--John
_______________________________________________
Jed-users-l mailing list
Jed-users-l@xxxxxxxx
http://mailman.jtan.com/mailman/listinfo/jed-users-l
[2013 date index]
[2013 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]