]> git.eshelyaron.com Git - emacs.git/commitdiff
Use file-accessible-directory-p in some more places
authorGlenn Morris <rgm@gnu.org>
Fri, 9 May 2014 07:02:00 +0000 (00:02 -0700)
committerGlenn Morris <rgm@gnu.org>
Fri, 9 May 2014 07:02:00 +0000 (00:02 -0700)
* lisp/files.el (file-expand-wildcards):
* lisp/man.el (Man-support-local-filenames):
* lisp/printing.el (pr-i-directory, pr-interface-directory):
* lisp/progmodes/grep.el (lgrep, rgrep):
* lisp/textmodes/ispell.el (ispell-call-process)
(ispell-call-process-region, ispell-start-process)
(ispell-init-process):
* lisp/mh-e/mh-e.el (mh-variants):
Use file-accessible-directory-p.

lisp/ChangeLog
lisp/files.el
lisp/man.el
lisp/mh-e/ChangeLog
lisp/mh-e/mh-e.el
lisp/printing.el
lisp/progmodes/grep.el
lisp/textmodes/ispell.el

index 4111e3dfcdaa7994560b1425427f4bf8031b9e9c..0fe7ed6706792f20558623ac1d214df2618ecb5c 100644 (file)
@@ -1,3 +1,13 @@
+2014-05-09  Glenn Morris  <rgm@gnu.org>
+
+       * files.el (file-expand-wildcards):
+       * man.el (Man-support-local-filenames):
+       * printing.el (pr-i-directory, pr-interface-directory):
+       * progmodes/grep.el (lgrep, rgrep):
+       * textmodes/ispell.el (ispell-call-process)
+       (ispell-call-process-region, ispell-start-process)
+       (ispell-init-process): Use file-accessible-directory-p.
+
 2014-05-08  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * xt-mouse.el: Drop spurious/oddly shaped events (bug#17378).
index 34c66bbd1d6977358b8ff760769122da9295aed3..5487e27198ad4c147df315dfe3cbab5dee650431 100644 (file)
@@ -5987,10 +5987,9 @@ default directory.  However, if FULL is non-nil, they are absolute."
                             (file-expand-wildcards (directory-file-name dirpart)))
                   (list dirpart)))
           contents)
-      (while dirs
-       (when (or (null (car dirs))     ; Possible if DIRPART is not wild.
-                 (and (file-directory-p (directory-file-name (car dirs)))
-                      (file-readable-p (car dirs))))
+      (dolist (dir dirs)
+       (when (or (null dir)    ; Possible if DIRPART is not wild.
+                 (file-accessible-directory-p dir))
          (let ((this-dir-contents
                 ;; Filter out "." and ".."
                 (delq nil
@@ -5998,16 +5997,15 @@ default directory.  However, if FULL is non-nil, they are absolute."
                                   (unless (string-match "\\`\\.\\.?\\'"
                                                         (file-name-nondirectory name))
                                     name))
-                              (directory-files (or (car dirs) ".") full
+                              (directory-files (or dir ".") full
                                                (wildcard-to-regexp nondir))))))
            (setq contents
                  (nconc
-                  (if (and (car dirs) (not full))
-                      (mapcar (function (lambda (name) (concat (car dirs) name)))
+                  (if (and dir (not full))
+                      (mapcar #'(lambda (name) (concat dir name))
                               this-dir-contents)
                     this-dir-contents)
-                  contents))))
-       (setq dirs (cdr dirs)))
+                  contents)))))
       contents)))
 
 ;; Let Tramp know that `file-expand-wildcards' does not need an advice.
index 7a095981ebde4df94be2dd912a5a23f5de752864..35fab2040a5abee91cc370b646a77fd6e7e2fc4e 100644 (file)
@@ -1,7 +1,6 @@
 ;;; man.el --- browse UNIX manual pages  -*- coding: utf-8 -*-
 
-;; Copyright (C) 1993-1994, 1996-1997, 2001-2014 Free Software
-;; Foundation, Inc.
+;; Copyright (C) 1993-1994, 1996-1997, 2001-2014 Free Software Foundation, Inc.
 
 ;; Author: Barry A. Warsaw <bwarsaw@cen.com>
 ;; Maintainer: emacs-devel@gnu.org
@@ -695,9 +694,8 @@ a \"/\" as a local filename.  The function returns either `man-db'
             (with-temp-buffer
               (let ((default-directory
                       ;; Ensure that `default-directory' exists and is readable.
-                      (if (and (file-directory-p default-directory)
-                               (file-readable-p default-directory))
-                        default-directory
+                      (if (file-accessible-directory-p default-directory)
+                          default-directory
                         (expand-file-name "~/"))))
                 (ignore-errors
                   (call-process manual-program nil t nil "--help")))
index b3d37ac4b1b430780cc58f373e7f2b532b6c2557..96a9b19ab78c2c13996ce1ab7cf993722c5b6410 100644 (file)
@@ -1,3 +1,7 @@
+2014-05-09  Glenn Morris  <rgm@gnu.org>
+
+       * mh-e.el (mh-variants): Use file-accessible-directory-p.
+
 2014-03-16  Bill Wohler  <wohler@newt.com>
 
        * mh-folder.el (mh-regenerate-headers): Fix scan: bad message list
index eaa05720f436f812e0809c8262135528ff1397d2..7368c0b9ffba6496d673145f1168259c5fb463ef 100644 (file)
@@ -1,7 +1,7 @@
 ;;; mh-e.el --- GNU Emacs interface to the MH mail system
 
-;; Copyright (C) 1985-1988, 1990, 1992-1995, 1997, 1999-2014 Free
-;; Software Foundation, Inc.
+;; Copyright (C) 1985-1988, 1990, 1992-1995, 1997, 1999-2014
+;;   Free Software Foundation, Inc.
 
 ;; Author: Bill Wohler <wohler@newt.com>
 ;; Maintainer: Bill Wohler <wohler@newt.com>
@@ -739,7 +739,7 @@ is described by the variable `mh-variants'."
             (setq dir (file-chase-links (directory-file-name dir)))
             (add-to-list 'list-unique dir))
       (loop for dir in (nreverse list-unique) do
-            (when (and dir (file-directory-p dir) (file-readable-p dir))
+            (when (and dir (file-accessible-directory-p dir))
               (let ((variant (mh-variant-info dir)))
                 (if variant
                     (add-to-list 'mh-variants variant)))))
index bb7e3843c32acf5b724b5c6405c21c51629f7f46..f24c0ab429750f6b566d0d4e33d932c4a51dfd52 100644 (file)
@@ -6543,8 +6543,7 @@ COMMAND.exe, COMMAND.bat and COMMAND.com in this order."
 
 
 (defun pr-i-directory ()
-  (or (and (file-directory-p pr-i-directory)
-          (file-readable-p pr-i-directory))
+  (or (file-accessible-directory-p pr-i-directory)
       (error "Please specify be a readable directory")))
 
 
@@ -6552,8 +6551,7 @@ COMMAND.exe, COMMAND.bat and COMMAND.com in this order."
   (and pr-buffer-verbose
        (message "You can use M-TAB or ESC TAB for file completion"))
   (let ((dir (widget-value widget)))
-    (and (file-directory-p dir)
-        (file-readable-p dir)
+    (and (file-accessible-directory-p dir)
         (setq pr-i-directory dir))))
 
 
index 181c5e5dba509e06deae68e656682458f525b307..d3e06892abfeb45c8a1e8c09ac2cf6a73e393dc9 100644 (file)
@@ -1,7 +1,6 @@
 ;;; grep.el --- run `grep' and display the results  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1985-1987, 1993-1999, 2001-2014 Free Software
-;; Foundation, Inc.
+;; Copyright (C) 1985-1987, 1993-1999, 2001-2014 Free Software Foundation, Inc.
 
 ;; Author: Roland McGrath <roland@gnu.org>
 ;; Maintainer: emacs-devel@gnu.org
@@ -905,7 +904,7 @@ This command shares argument histories with \\[rgrep] and \\[grep]."
                (confirm (equal current-prefix-arg '(4))))
           (list regexp files dir confirm))))))
   (when (and (stringp regexp) (> (length regexp) 0))
-    (unless (and dir (file-directory-p dir) (file-readable-p dir))
+    (unless (and dir (file-acessible-directory-p dir))
       (setq dir default-directory))
     (let ((command regexp))
       (if (null files)
@@ -986,7 +985,7 @@ to specify a command to run."
                (confirm (equal current-prefix-arg '(4))))
           (list regexp files dir confirm))))))
   (when (and (stringp regexp) (> (length regexp) 0))
-    (unless (and dir (file-directory-p dir) (file-readable-p dir))
+    (unless (and dir (file-accessible-directory-p dir))
       (setq dir default-directory))
     (if (null files)
        (if (not (string= regexp (if (consp grep-find-command)
index 5cdae22cc0fc8070108bb2c158f48ce49c50517e..0fc6b4a9995a1daca9886e869540c0690da53536 100644 (file)
@@ -931,16 +931,14 @@ Otherwise returns the library directory name, if that is defined."
 (defun ispell-call-process (&rest args)
   "Like `call-process' but defend against bad `default-directory'."
   (let ((default-directory default-directory))
-    (unless (and (file-directory-p default-directory)
-                (file-readable-p default-directory))
+    (unless (file-accessible-directory-p default-directory)
       (setq default-directory (expand-file-name "~/")))
     (apply 'call-process args)))
 
 (defun ispell-call-process-region (&rest args)
   "Like `call-process-region' but defend against bad `default-directory'."
   (let ((default-directory default-directory))
-    (unless (and (file-directory-p default-directory)
-                (file-readable-p default-directory))
+    (unless (file-accessible-directory-p default-directory)
       (setq default-directory (expand-file-name "~/")))
     (apply 'call-process-region args)))
 
@@ -2939,8 +2937,7 @@ Keeps argument list for future Ispell invocations for no async support."
          (ispell-hunspell-fill-dictionary-entry ispell-current-dictionary)))
 
   (let* ((default-directory
-           (if (and (file-directory-p default-directory)
-                    (file-readable-p default-directory))
+           (if (file-accessible-directory-p default-directory)
                default-directory
              ;; Defend against bad `default-directory'.
              (expand-file-name "~/")))
@@ -2998,8 +2995,7 @@ Keeps argument list for future Ispell invocations for no async support."
           (if (or ispell-really-aspell
                   ispell-really-hunspell
                   ;; Protect against bad default-directory
-                  (not (and (file-directory-p default-directory)
-                            (file-readable-p default-directory)))
+                  (not (file-accessible-directory-p default-directory))
                   ;; Ispell and per-dir personal dicts available
                   (not (or (file-readable-p (concat default-directory
                                                     ".ispell_words"))