Commit 1d75432d authored by Glenn Morris's avatar Glenn Morris

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.
parent c578a993
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).
......
......@@ -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.
......
;;; 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")))
......
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
......
;;; 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)))))
......
......@@ -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))))
......
;;; 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)
......
......@@ -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"))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment