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

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

bug#61708: 28.2; file-modes-symbolic-to-number inconsistency


From: Eli Zaretskii
Subject: bug#61708: 28.2; file-modes-symbolic-to-number inconsistency
Date: Thu, 23 Feb 2023 08:08:52 +0200

> Cc: Andreas Schwab <schwab@suse.de>, 61708@debbugs.gnu.org
> Date: Wed, 22 Feb 2023 21:40:21 +0000
> From: Gregory Heytings <gregory@heytings.org>
> 
> 
> >>> How one convert the output of (nth 8 (file-attributes "/home/user")) 
> >>> to numeric mode?
> >>
> >> (file-modes "/home/user")
> >
> > Yes, thanks I know this one, what I want to convert is e.g. "-rwxr-x---" 
> > to number.
> >
> 
> (defun symbolic-mode-to-number (mode)
>    (string-to-number
>     (replace-regexp-in-string
>      "[^0]" "1"
>      (string-replace "-" "0" mode))
>     2))

Maybe we should have a knob in file-attributes or in
file-attribute-modes to return the modes as either a number or in
symbolic form suitable for file-modes-symbolic-to-number?





reply via email to

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