all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* API for excess DOS file attributes??
@ 2011-09-29 19:59 Oleksandr Gavenko
  2011-09-29 20:23 ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Oleksandr Gavenko @ 2011-09-29 19:59 UTC (permalink / raw)
  To: help-gnu-emacs

Under Windows this done through:

   GetFileAttributes()

call. I grep sources and find only 2 occurrence:

./src/fileio.c:1878:      attributes = GetFileAttributes (filename);
./src/w32.c:2630:  else if ((attributes = GetFileAttributes (path)) == -1)

which used for internal purpose...

So I think that I can not excess to this data from Emacs
(native Windows build).

I try rewrite 'follow-cygwin-symlink' from:

   http://www.emacswiki.org/emacs/setup-cygwin.el

for more strict conformance of definition of symbolic link
in Cygwin (from 'cygwin-ug-net-nochunks.html'):

   The file style symlinks are files containing a magic cookie
   followed by the path to which the link points. They are marked
   with the System DOS attribute so that only files with that
   attribute have to be read to determine whether or not the file is
   a symbolic link.




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

* Re: API for excess DOS file attributes??
  2011-09-29 19:59 API for excess DOS file attributes?? Oleksandr Gavenko
@ 2011-09-29 20:23 ` Eli Zaretskii
  2011-09-29 21:55   ` Oleksandr Gavenko
  0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2011-09-29 20:23 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Oleksandr Gavenko <gavenkoa@gmail.com>
> Date: Thu, 29 Sep 2011 22:59:09 +0300
> 
> So I think that I can not excess to this data from Emacs
> (native Windows build).

Not from Lisp, no.

> I try rewrite 'follow-cygwin-symlink' from:
> 
>    http://www.emacswiki.org/emacs/setup-cygwin.el
> 
> for more strict conformance of definition of symbolic link
> in Cygwin (from 'cygwin-ug-net-nochunks.html'):
> 
>    The file style symlinks are files containing a magic cookie
>    followed by the path to which the link points. They are marked
>    with the System DOS attribute so that only files with that
>    attribute have to be read to determine whether or not the file is
>    a symbolic link.

What's in setup-cygwin.el is about as good as you can get in Lisp.  A
better solution would be to add to file-symlink-p and
make-symbolic-link the ability to recognize and create Cygwin-style
symlink (and Windows 7 style symlink as well), but that requires
changes on the C level.



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

* Re: API for excess DOS file attributes??
  2011-09-29 20:23 ` Eli Zaretskii
@ 2011-09-29 21:55   ` Oleksandr Gavenko
  0 siblings, 0 replies; 3+ messages in thread
From: Oleksandr Gavenko @ 2011-09-29 21:55 UTC (permalink / raw)
  To: help-gnu-emacs

29.09.2011 23:23, Eli Zaretskii пишет:
>> From: Oleksandr Gavenko<gavenkoa@gmail.com>
>> Date: Thu, 29 Sep 2011 22:59:09 +0300
>>
>> So I think that I can not excess to this data from Emacs
>> (native Windows build).
>
> Not from Lisp, no.
>
>> I try rewrite 'follow-cygwin-symlink' from:
>>
>>     http://www.emacswiki.org/emacs/setup-cygwin.el
>>
>> for more strict conformance of definition of symbolic link
>> in Cygwin (from 'cygwin-ug-net-nochunks.html'):
>>
>>     The file style symlinks are files containing a magic cookie
>>     followed by the path to which the link points. They are marked
>>     with the System DOS attribute so that only files with that
>>     attribute have to be read to determine whether or not the file is
>>     a symbolic link.
>
> What's in setup-cygwin.el is about as good as you can get in Lisp.  A
> better solution would be to add to file-symlink-p and
> make-symbolic-link the ability to recognize and create Cygwin-style
> symlink (and Windows 7 style symlink as well), but that requires
> changes on the C level.
>
OK.

I get next new definition of 'follow-cygwin-symlink', which work with
new (to Cygwin 1.7) style of links:

(when (eq windows-system 'w32)

   (defun follow-cygwin-symlink ()
     "Follow new-style (and also UCS-16) Cygwin symlinks."
     (save-excursion
       (goto-char 0)
       (when (looking-at "!<symlink>\xff\xfe")
         (find-alternate-file
          (substring
           (decode-coding-string
            (buffer-substring (match-end 0) (point-max))
            'utf-16-le)
           0 -1)                           ; -1 for stripping final \0.
          ))))
   (add-hook 'find-file-hooks 'follow-cygwin-symlink)

  )

I don't incorporate it back to emacswiki as don't understand some part
of old code.

Maintainer of this file is Drew Adams, but I don't know how contact
with him.




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

end of thread, other threads:[~2011-09-29 21:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-29 19:59 API for excess DOS file attributes?? Oleksandr Gavenko
2011-09-29 20:23 ` Eli Zaretskii
2011-09-29 21:55   ` Oleksandr Gavenko

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.