help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Function to find symlink target


From: Emanuel Berg
Subject: Re: Function to find symlink target
Date: Mon, 23 May 2022 22:46:50 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Jean Louis wrote:

>>> S lrwxrwxrwx     1    8 May 22 16:15 test1.pdf -> test.pdf [...]
>>>   -rw-r--r--     1  15K May 22 15:13 test.pdf
>>>
>>> as if I invoke function on first line it will come to ->
>>> test.pdf which is not what I would like.
>> 
>> Right, I see. Okey then, put the search in a loop and upon
>> every hit goto the beginning of the match and do
>> 
>>   (get-text-property (point) 'dired-filename)
>> 
>> this will be true for the third line's test.pdf but not
>> the first.
>
> When I evaluate it, I get t only, I do not understand.
> Tell me more about the idea of finding particular file in
> dired list and placing cursor on it.

Wasn't the problem how to find the right, in this case,
"target.txt" in a situation like this:

/home/incal/test/dired:
  lrwxrwxrwx 1 incal 10 May 23 22:41 target-link.txt -> target.txt
  -rw-r--r-- 1 incal  0 May 23 22:41 target.txt

Search for "target.txt". When you find it, use

  (get-text-property (point) 'dired-filename)

Here it is nil:

  lrwxrwxrwx 1 incal 10 May 23 22:41 target-link.txt -> target.txt
                                                        ^
So search again, here it is t:

  -rw-r--r-- 1 incal  0 May 23 22:41 target.txt
                                     ^

and that's the target you are looking for.

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

[Prev in Thread] Current Thread [Next in Thread]