aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2008-10-18 18:41:32 +0000
committerEli Zaretskii2008-10-18 18:41:32 +0000
commite240aaa99e92d7903abd68f217231bdc6b8684dd (patch)
tree332c05937295b47e0dec5a4c94e592b4d9605723
parent7e51d89b73bd14ca12480c476af995adda41c41d (diff)
downloademacs-e240aaa99e92d7903abd68f217231bdc6b8684dd.tar.gz
emacs-e240aaa99e92d7903abd68f217231bdc6b8684dd.zip
(trash-directory): Run thru `convert-standard-filename'.
(file-modes-char-to-who, file-modes-char-to-right) (file-modes-rights-to-number, file-modes-symbolic-to-number) (read-file-modes): Doc fixes.
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/files.el38
2 files changed, 31 insertions, 14 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index cd89f7ed4b9..1470dd09e05 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
12008-10-18 Eli Zaretskii <eliz@gnu.org>
2
3 * files.el (trash-directory): Run thru `convert-standard-filename'.
4 (file-modes-char-to-who, file-modes-char-to-right)
5 (file-modes-rights-to-number, file-modes-symbolic-to-number)
6 (read-file-modes): Doc fixes.
7
12008-10-17 Chong Yidong <cyd@stupidchicken.com> 82008-10-17 Chong Yidong <cyd@stupidchicken.com>
2 9
3 * abbrev.el (define-abbrev): Doc fix. 10 * abbrev.el (define-abbrev): Doc fix.
diff --git a/lisp/files.el b/lisp/files.el
index 10c4574cb53..1fd6265e949 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -5694,8 +5694,11 @@ only these files will be asked to be saved."
5694;; Symbolic modes and read-file-modes. 5694;; Symbolic modes and read-file-modes.
5695 5695
5696(defun file-modes-char-to-who (char) 5696(defun file-modes-char-to-who (char)
5697 "Convert CHAR to a who-mask from a symbolic mode notation. 5697 "Convert CHAR to a numeric bit-mask for extracting mode bits.
5698CHAR is in [ugoa] and represents the users on which rights are applied." 5698CHAR is in [ugoa] and represents the category of users (Owner, Group,
5699Others, or All) for whom to produce the mask.
5700The bit-mask that is returned extracts from mode bits the access rights
5701for the specified category of users."
5699 (cond ((= char ?u) #o4700) 5702 (cond ((= char ?u) #o4700)
5700 ((= char ?g) #o2070) 5703 ((= char ?g) #o2070)
5701 ((= char ?o) #o1007) 5704 ((= char ?o) #o1007)
@@ -5703,9 +5706,9 @@ CHAR is in [ugoa] and represents the users on which rights are applied."
5703 (t (error "%c: bad `who' character" char)))) 5706 (t (error "%c: bad `who' character" char))))
5704 5707
5705(defun file-modes-char-to-right (char &optional from) 5708(defun file-modes-char-to-right (char &optional from)
5706 "Convert CHAR to a right-mask from a symbolic mode notation. 5709 "Convert CHAR to a numeric value of mode bits.
5707CHAR is in [rwxXstugo] and represents a right. 5710CHAR is in [rwxXstugo] and represents symbolic access permissions.
5708If CHAR is in [Xugo], the value is extracted from FROM (or 0 if nil)." 5711If CHAR is in [Xugo], the value is taken from FROM (or 0 if omitted)."
5709 (or from (setq from 0)) 5712 (or from (setq from 0))
5710 (cond ((= char ?r) #o0444) 5713 (cond ((= char ?r) #o0444)
5711 ((= char ?w) #o0222) 5714 ((= char ?w) #o0222)
@@ -5723,10 +5726,13 @@ If CHAR is in [Xugo], the value is extracted from FROM (or 0 if nil)."
5723 (t (error "%c: bad right character" char)))) 5726 (t (error "%c: bad right character" char))))
5724 5727
5725(defun file-modes-rights-to-number (rights who-mask &optional from) 5728(defun file-modes-rights-to-number (rights who-mask &optional from)
5726 "Convert a right string to a right-mask from a symbolic modes notation. 5729 "Convert a symbolic mode string specification to an equivalent number.
5727RIGHTS is the right string, it should match \"([+=-][rwxXstugo]+)+\". 5730RIGHTS is the symbolic mode spec, it should match \"([+=-][rwxXstugo]+)+\".
5728WHO-MASK is the mask number of the users on which the rights are to be applied. 5731WHO-MASK is the bit-mask specifying the category of users to which to
5729FROM (or 0 if nil) is the orginal modes of the file to be chmod'ed." 5732apply the access permissions. See `file-modes-char-to-who'.
5733FROM (or 0 if nil) gives the mode bits on which to base permissions if
5734RIGHTS request to add, remove, or set permissions based on existing ones,
5735as in \"og+rX-w\"."
5730 (let* ((num-rights (or from 0)) 5736 (let* ((num-rights (or from 0))
5731 (list-rights (string-to-list rights)) 5737 (list-rights (string-to-list rights))
5732 (op (pop list-rights))) 5738 (op (pop list-rights)))
@@ -5752,7 +5758,9 @@ MODES is the string to convert, it should match
5752\"[ugoa]*([+-=][rwxXstugo]+)+,...\". 5758\"[ugoa]*([+-=][rwxXstugo]+)+,...\".
5753See (info \"(coreutils)File permissions\") for more information on this 5759See (info \"(coreutils)File permissions\") for more information on this
5754notation. 5760notation.
5755FROM (or 0 if nil) is the orginal modes of the file to be chmod'ed." 5761FROM (or 0 if nil) gives the mode bits on which to base permissions if
5762MODES request to add, remove, or set permissions based on existing ones,
5763as in \"og+rX-w\"."
5756 (save-match-data 5764 (save-match-data
5757 (let ((case-fold-search nil) 5765 (let ((case-fold-search nil)
5758 (num-modes (or from 0))) 5766 (num-modes (or from 0)))
@@ -5771,9 +5779,11 @@ FROM (or 0 if nil) is the orginal modes of the file to be chmod'ed."
5771 num-modes))) 5779 num-modes)))
5772 5780
5773(defun read-file-modes (&optional prompt orig-file) 5781(defun read-file-modes (&optional prompt orig-file)
5774 "Read file modes in octal or symbolic notation. 5782 "Read file modes in octal or symbolic notation and return its numeric value.
5775PROMPT is used as the prompt, default to `File modes (octal or symbolic): '. 5783PROMPT is used as the prompt, default to `File modes (octal or symbolic): '.
5776ORIG-FILE is the original file of which modes will be changed." 5784ORIG-FILE is the name of a file on whose mode bits to base returned
5785permissions if what user types requests to add, remove, or set permissions
5786based on existing mode bits, as in \"og+rX-w\"."
5777 (let* ((modes (or (if orig-file (file-modes orig-file) 0) 5787 (let* ((modes (or (if orig-file (file-modes orig-file) 0)
5778 (error "File not found"))) 5788 (error "File not found")))
5779 (modestr (and (stringp orig-file) 5789 (modestr (and (stringp orig-file)
@@ -5795,8 +5805,8 @@ ORIG-FILE is the original file of which modes will be changed."
5795 (file-modes-symbolic-to-number value modes))))) 5805 (file-modes-symbolic-to-number value modes)))))
5796 5806
5797 5807
5798;; Trash can handling. 5808;; Trashcan handling.
5799(defcustom trash-directory "~/.Trash" 5809(defcustom trash-directory (convert-standard-filename "~/.Trash")
5800 "Directory for `move-file-to-trash' to move files and directories to. 5810 "Directory for `move-file-to-trash' to move files and directories to.
5801This directory is only used when the function `system-move-file-to-trash' is 5811This directory is only used when the function `system-move-file-to-trash' is
5802not defined. Relative paths are interpreted relative to `default-directory'. 5812not defined. Relative paths are interpreted relative to `default-directory'.