diff options
author | Glenn Morris <rgm@gnu.org> | 2014-05-09 00:02:00 -0700 |
---|---|---|
committer | Glenn Morris <rgm@gnu.org> | 2014-05-09 00:02:00 -0700 |
commit | 1d75432d5c42a7f7c13486c7421f959132179b5b (patch) | |
tree | 946965f0033dbab3c9725b86d7875ab61d8e0a57 /lisp | |
parent | c578a99338e44511fc3792f1d14ea2193cb58aa5 (diff) | |
download | emacs-1d75432d5c42a7f7c13486c7421f959132179b5b.tar.gz |
Use file-accessible-directory-p in some more places
* 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.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/ChangeLog | 10 | ||||
-rw-r--r-- | lisp/files.el | 16 | ||||
-rw-r--r-- | lisp/man.el | 8 | ||||
-rw-r--r-- | lisp/mh-e/ChangeLog | 4 | ||||
-rw-r--r-- | lisp/mh-e/mh-e.el | 6 | ||||
-rw-r--r-- | lisp/printing.el | 6 | ||||
-rw-r--r-- | lisp/progmodes/grep.el | 7 | ||||
-rw-r--r-- | lisp/textmodes/ispell.el | 12 |
8 files changed, 36 insertions, 33 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4111e3dfcda..0fe7ed67067 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -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). diff --git a/lisp/files.el b/lisp/files.el index 34c66bbd1d6..5487e27198a 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -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. diff --git a/lisp/man.el b/lisp/man.el index 7a095981ebd..35fab2040a5 100644 --- a/lisp/man.el +++ b/lisp/man.el @@ -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"))) diff --git a/lisp/mh-e/ChangeLog b/lisp/mh-e/ChangeLog index b3d37ac4b1b..96a9b19ab78 100644 --- a/lisp/mh-e/ChangeLog +++ b/lisp/mh-e/ChangeLog @@ -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 diff --git a/lisp/mh-e/mh-e.el b/lisp/mh-e/mh-e.el index eaa05720f43..7368c0b9ffb 100644 --- a/lisp/mh-e/mh-e.el +++ b/lisp/mh-e/mh-e.el @@ -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))))) diff --git a/lisp/printing.el b/lisp/printing.el index bb7e3843c32..f24c0ab4297 100644 --- a/lisp/printing.el +++ b/lisp/printing.el @@ -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)))) diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index 181c5e5dba5..d3e06892abf 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -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) diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index 5cdae22cc0f..0fc6b4a9995 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el @@ -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")) |