GNU bug report logs - #9361
24.0.50; default value of `dired-do-chmod'

Previous Next

Package: emacs;

Reported by: "Drew Adams" <drew.adams <at> oracle.com>

Date: Wed, 24 Aug 2011 16:20:03 UTC

Severity: minor

Tags: notabug

Found in version 24.0.50

Done: Chong Yidong <cyd <at> stupidchicken.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Chong Yidong <cyd <at> stupidchicken.com>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: 'Juri Linkov' <juri <at> jurta.org>, 'Lars Magne Ingebrigtsen' <larsi <at> gnus.org>, 9361 <at> debbugs.gnu.org
Subject: bug#9361: 24.0.50; default value of `dired-do-chmod'
Date: Sun, 11 Sep 2011 17:41:24 -0400
I think there's a problem here, indeed.  It's a bad idea to take an
empty input to mean a certain default permission---especially when that
default permission is not displayed in the prompt.

The following patch makes dired-do-chmod demand a non-empty input.  The
precomputed permission is still available in the M-n `future history'.

*** lisp/dired-aux.el	2011-08-04 00:58:07 +0000
--- lisp/dired-aux.el	2011-09-11 21:38:35 +0000
***************
*** 267,272 ****
--- 267,280 ----
  	 (format "%s: error" operation)
  	 nil))))
  
+ (defun dired--read-permission-string (prompt default)
+   (let ((result ""))
+     (while (equal result "")
+       (setq result
+ 	    (read-from-minibuffer prompt nil nil
+ 				  nil nil default)))
+     result))
+ 
  ;;;###autoload
  (defun dired-do-chmod (&optional arg)
    "Change the mode of the marked (or next ARG) files.
***************
*** 284,292 ****
  			 (match-string 1 modestr)
  			 (match-string 2 modestr)
  			 (match-string 3 modestr)))))
! 	 (modes (dired-mark-read-string
! 		 "Change mode of %s to: " nil
! 		 'chmod arg files default))
  	 (num-modes (if (string-match "^[0-7]+" modes)
  			(string-to-number modes 8))))
      (dolist (file files)
--- 292,303 ----
  			 (match-string 1 modestr)
  			 (match-string 2 modestr)
  			 (match-string 3 modestr)))))
! 	 (modes
! 	  (dired-mark-pop-up nil 'chmod files
! 			     'dired--read-permission-string
! 			     (format "Change mode of %s to: "
! 				     (dired-mark-prompt arg files))
! 			     default))
  	 (num-modes (if (string-match "^[0-7]+" modes)
  			(string-to-number modes 8))))
      (dolist (file files)





This bug report was last modified 13 years and 178 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.