* Remove `dired-chmod-program'.
@ 2008-02-17 0:50 Michaël Cadilhac
0 siblings, 0 replies; only message in thread
From: Michaël Cadilhac @ 2008-02-17 0:50 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1.1: Type: text/plain, Size: 321 bytes --]
Hi list !
A while ago, dired-do-chmod has been modified to not use an external
chmod program any longer, but directly `set-file-modes'. Some other
pieces of code still use the variable `dired-chmod-program', and it
maybe a gain of consistency to remove it.
Files modified : dired.el, wdired.el, ange-ftp.el.
[-- Attachment #1.2: dired-chmod.patch --]
[-- Type: text/x-patch, Size: 10761 bytes --]
Index: dired.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/dired.el,v
retrieving revision 1.378
diff -c -r1.378 dired.el
*** dired.el 8 Jan 2008 20:44:46 -0000 1.378
--- dired.el 17 Feb 2008 00:44:56 -0000
***************
*** 80,88 ****
(defvar dired-use-ls-dired (not (not (string-match "gnu" system-configuration)))
"Non-nil means Dired should use `ls --dired'.")
- (defvar dired-chmod-program "chmod"
- "Name of chmod command (usually `chmod').")
-
(defvar dired-touch-program "touch"
"Name of touch command (usually `touch').")
--- 80,85 ----
Index: wdired.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/wdired.el,v
retrieving revision 1.35
diff -c -r1.35 wdired.el
*** wdired.el 17 Feb 2008 00:29:47 -0000 1.35
--- wdired.el 17 Feb 2008 00:44:56 -0000
***************
*** 47,62 ****
;;
;; - To change the target of symbolic links.
;;
! ;; - To change the permission bits of the filenames (in systems with a
! ;; working unix-alike `dired-chmod-program'). See and customize the
! ;; variable `wdired-allow-to-change-permissions'. To change a single
! ;; char (toggling between its two more usual values) you can press
! ;; the space bar over it or left-click the mouse. To set any char to
! ;; an specific value (this includes the SUID, SGID and STI bits) you
! ;; can use the key labeled as the letter you want. Please note that
! ;; permissions of the links cannot be changed in that way, because
! ;; the change would affect to their targets, and this would not be
! ;; WYSIWYG :-).
;;
;; - To mark files for deletion, by deleting their whole filename.
--- 47,61 ----
;;
;; - To change the target of symbolic links.
;;
! ;; - To change the permission bits of the filenames. See and customize
! ;; the variable `wdired-allow-to-change-permissions'. To change a
! ;; single char (toggling between its two more usual values) you can
! ;; press the space bar over it or left-click the mouse. To set any
! ;; char to an specific value (this includes the SUID, SGID and STI
! ;; bits) you can use the key labeled as the letter you want. Please
! ;; note that permissions of the links cannot be changed in that way,
! ;; because the change would affect to their targets, and this would
! ;; not be WYSIWYG :-).
;;
;; - To mark files for deletion, by deleting their whole filename.
***************
*** 160,169 ****
If `advanced', the bits are freely editable. You can use
`string-rectangle', `query-replace', etc. You can put any value (even
newlines), but if you want your changes to be useful, you better put a
! intelligible value.
!
! Anyway, the real change of the permissions is done by the external
! program `dired-chmod-program', which must exist."
:type '(choice (const :tag "Not allowed" nil)
(const :tag "Toggle/set bits" t)
(other :tag "Bits freely editable" advanced))
--- 159,165 ----
If `advanced', the bits are freely editable. You can use
`string-rectangle', `query-replace', etc. You can put any value (even
newlines), but if you want your changes to be useful, you better put a
! intelligible value."
:type '(choice (const :tag "Not allowed" nil)
(const :tag "Toggle/set bits" t)
(other :tag "Bits freely editable" advanced))
***************
*** 726,747 ****
;; Allowed chars for 2000 bit are Ssl in position 6
;; Allowed chars for 1000 bit are Tt in position 9
(defun wdired-perms-to-number (perms)
! (let ((nperm 0777))
! (if (= (elt perms 1) ?-) (setq nperm (- nperm 400)))
! (if (= (elt perms 2) ?-) (setq nperm (- nperm 200)))
(let ((p-bit (elt perms 3)))
! (if (memq p-bit '(?- ?S)) (setq nperm (- nperm 100)))
! (if (memq p-bit '(?s ?S)) (setq nperm (+ nperm 4000))))
! (if (= (elt perms 4) ?-) (setq nperm (- nperm 40)))
! (if (= (elt perms 5) ?-) (setq nperm (- nperm 20)))
(let ((p-bit (elt perms 6)))
! (if (memq p-bit '(?- ?S ?l)) (setq nperm (- nperm 10)))
! (if (memq p-bit '(?s ?S ?l)) (setq nperm (+ nperm 2000))))
! (if (= (elt perms 7) ?-) (setq nperm (- nperm 4)))
! (if (= (elt perms 8) ?-) (setq nperm (- nperm 2)))
(let ((p-bit (elt perms 9)))
(if (memq p-bit '(?- ?T)) (setq nperm (- nperm 1)))
! (if (memq p-bit '(?t ?T)) (setq nperm (+ nperm 1000))))
nperm))
;; Perform the changes in the permissions of the files that have
--- 722,743 ----
;; Allowed chars for 2000 bit are Ssl in position 6
;; Allowed chars for 1000 bit are Tt in position 9
(defun wdired-perms-to-number (perms)
! (let ((nperm #o777))
! (if (= (elt perms 1) ?-) (setq nperm (- nperm #o400)))
! (if (= (elt perms 2) ?-) (setq nperm (- nperm #o200)))
(let ((p-bit (elt perms 3)))
! (if (memq p-bit '(?- ?S)) (setq nperm (- nperm #o100)))
! (if (memq p-bit '(?s ?S)) (setq nperm (+ nperm #o4000))))
! (if (= (elt perms 4) ?-) (setq nperm (- nperm #o40)))
! (if (= (elt perms 5) ?-) (setq nperm (- nperm #o20)))
(let ((p-bit (elt perms 6)))
! (if (memq p-bit '(?- ?S ?l)) (setq nperm (- nperm #o10)))
! (if (memq p-bit '(?s ?S ?l)) (setq nperm (+ nperm #o2000))))
! (if (= (elt perms 7) ?-) (setq nperm (- nperm #o4)))
! (if (= (elt perms 8) ?-) (setq nperm (- nperm #o2)))
(let ((p-bit (elt perms 9)))
(if (memq p-bit '(?- ?T)) (setq nperm (- nperm 1)))
! (if (memq p-bit '(?t ?T)) (setq nperm (+ nperm #o1000))))
nperm))
;; Perform the changes in the permissions of the files that have
***************
*** 751,757 ****
(errors 0)
(prop-wanted (if (eq wdired-allow-to-change-permissions 'advanced)
'old-perm 'perm-changed))
! filename perms-ori perms-new perm-tmp)
(goto-char (next-single-property-change (point-min) prop-wanted
nil (point-max)))
(while (not (eobp))
--- 747,753 ----
(errors 0)
(prop-wanted (if (eq wdired-allow-to-change-permissions 'advanced)
'old-perm 'perm-changed))
! filename perms-ori perms-new)
(goto-char (next-single-property-change (point-min) prop-wanted
nil (point-max)))
(while (not (eobp))
***************
*** 762,775 ****
(setq changes t)
(setq filename (wdired-get-filename nil t))
(if (= (length perms-new) 10)
! (progn
! (setq perm-tmp
! (int-to-string (wdired-perms-to-number perms-new)))
! (unless (equal 0 (process-file dired-chmod-program
! nil nil nil perm-tmp filename))
! (setq errors (1+ errors))
! (dired-log (concat dired-chmod-program " " perm-tmp
! " `" filename "' failed\n\n"))))
(setq errors (1+ errors))
(dired-log (concat "Cannot parse permission `" perms-new
"' for file `" filename "'\n\n"))))
--- 758,773 ----
(setq changes t)
(setq filename (wdired-get-filename nil t))
(if (= (length perms-new) 10)
! (condition-case exception
! (set-file-modes filename
! (wdired-perms-to-number perms-new))
! (error
! (setq errors (1+ errors))
! (dired-log (concat "Changing mode of `" filename "' to "
! perms-new " failed"
! (when (eq (car oops 'file-error))
! (concat ": " (nth 2 exception)))
! "\n\n"))))
(setq errors (1+ errors))
(dired-log (concat "Cannot parse permission `" perms-new
"' for file `" filename "'\n\n"))))
Index: net/ange-ftp.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/net/ange-ftp.el,v
retrieving revision 1.96
diff -c -r1.96 ange-ftp.el
*** net/ange-ftp.el 13 Feb 2008 17:27:38 -0000 1.96
--- net/ange-ftp.el 17 Feb 2008 00:44:58 -0000
***************
*** 979,984 ****
--- 979,988 ----
:group 'ange-ftp
:type '(repeat string))
+ (defcustom ange-ftp-chmod-program "chmod"
+ "Name of `chmod' program, usually `chmod'.
+ This is executed on distant machines.")
+
(defcustom ange-ftp-nslookup-program nil
"*If non-nil, this is a string naming the nslookup program."
:group 'ange-ftp
***************
*** 4548,4554 ****
;; Can't use ange-ftp-dired-host-type here because the current
;; buffer is *dired-check-process output*
(condition-case oops
! (cond ((equal dired-chmod-program program)
(ange-ftp-call-chmod arguments))
;; ((equal "chgrp" program))
;; ((equal dired-chown-program program))
--- 4552,4558 ----
;; Can't use ange-ftp-dired-host-type here because the current
;; buffer is *dired-check-process output*
(condition-case oops
! (cond ((equal ange-ftp-chmod-program program)
(ange-ftp-call-chmod arguments))
;; ((equal "chgrp" program))
;; ((equal dired-chown-program program))
***************
*** 4588,4594 ****
(or (car result)
(call-process
remote-shell-program
! nil t nil host dired-chmod-program mode name))))))
rest))
(setq ange-ftp-ls-cache-file nil) ;Stop confusing Dired.
0)
--- 4592,4598 ----
(or (car result)
(call-process
remote-shell-program
! nil t nil host ange-ftp-chmod-program mode name))))))
rest))
(setq ange-ftp-ls-cache-file nil) ;Stop confusing Dired.
0)
Index: ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.12810
diff -c -r1.12810 ChangeLog
*** ChangeLog 17 Feb 2008 00:30:06 -0000 1.12810
--- ChangeLog 17 Feb 2008 00:45:09 -0000
***************
*** 1,6 ****
--- 1,15 ----
2008-02-17 Michaël Cadilhac <michael@cadilhac.name>
+ * dired.el (dired-chmod-program): Remove.
+
* wdired.el (wdired-allow-to-change-permissions): Fix typo.
+ (wdired-perms-to-number): Return real octal value of modes.
+ (wdired-do-perm-changes): Use `set-file-modes'.
+
+ * net/ange-ftp.el (ange-ftp-chmod-program): New. Chmod program
+ used on distant machines.
+ (ange-ftp-process-file, ange-ftp-call-chmod): Use it instead of
+ the now defunct `dired-chmod-program'.
2008-02-16 Juri Linkov <juri@jurta.org>
[-- Attachment #1.3: Type: text/plain, Size: 344 bytes --]
Any comment ?
--
| Michaël `Micha' Cadilhac | Le copillage-collage |
| http://michael.cadilhac.name | tue le programmeur. |
| JID/MSN: | -- Dictons LRDE |
`---- michael.cadilhac@gmail.com | - --'
[-- Attachment #2: Type: application/pgp-signature, Size: 188 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-02-17 0:50 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-17 0:50 Remove `dired-chmod-program' Michaël Cadilhac
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).