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

From: Gregory Heytings <[email-masked]>
Date: Wed, 22 Feb 2023 21:40:21 +0000

>>> 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))