Background: making file-attributes compatible with the GNU version
triggered an idea of changing the interface to file attributes into
something incompatible. The discussion has taken place in
xemacs-patches which might not attract so many readers so I move this
to xemacs-beta now.
>>>> Mats Lidell <matsl(a)xemacs.org> writes:
OK. I'll see what I can come up with then! Stay tuned.
I did this to try the idea out.
* Core
Since file-attributes more or less is what stat(2) delivers I renamed
file-attribute to file-stat in XEmacs core. file-stat further returns
a vector instead of a list. It is not a 100% match to stat but good
enough to warrant that name I think.
Since we use file-attribute internally in elisp files in core those
where changed to use file-stat instead.
To get to the new functionality I reused the function user-login-name
that provides the conversion from uid to username. I also added a new
function get-group-name that provides the group name from the group
id.
Q: Since I don't really understand the file handler business with
packages such as tramp I don't know how this core change will
influence those. I guess file-attributes in those places would need to
be changed to use of file-stat instead!?
* xemacs-base
In xemacs-base I added a new file os.el which provides access
functions to the file-stat data. Such as "file-stat/uid". So for
getting the uid of a file you would write:
(file-stat/uid (file-stat "file"))
I also introduced there the vectorized file-attributes function called
file-attr that returns in a vector everything that file-stat does plus
two more fields, user-login-name and group-name. (This is the
interface that has been described as backwards compatible since the
new fields are added instead of replacing fields.)
* fsf-compat
Finally in fsf-compat I added file-attributes with the GNU
compatibility interface.
* Conclusion?
This can be done in other ways and it can be improved but now you see
more how it will turn out if we do like this. Is this how you would
want it? If not, how would you like to change it?
Yours
--
%% Mats
_______________________________________________
XEmacs-Beta mailing list
XEmacs-Beta(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-beta