aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1996-09-01 21:38:48 +0000
committerRichard M. Stallman1996-09-01 21:38:48 +0000
commitb7fa904ccb0c0a8b4da9168b4819dce8e21dd244 (patch)
tree584676ac6b646a9f9bffe1f539eb4b81e12cd5f4
parente3678b64333787df03e203b1ed5a4c2ec76d0272 (diff)
downloademacs-b7fa904ccb0c0a8b4da9168b4819dce8e21dd244.tar.gz
emacs-b7fa904ccb0c0a8b4da9168b4819dce8e21dd244.zip
(insert-directory): If ls fails, get an error.
-rw-r--r--lisp/files.el102
1 files changed, 53 insertions, 49 deletions
diff --git a/lisp/files.el b/lisp/files.el
index 35c430c1942..9c848463fe8 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -2631,55 +2631,59 @@ If WILDCARD, it also runs the shell specified by `shell-file-name'."
2631 wildcard full-directory-p) 2631 wildcard full-directory-p)
2632 (if (eq system-type 'vax-vms) 2632 (if (eq system-type 'vax-vms)
2633 (vms-read-directory file switches (current-buffer)) 2633 (vms-read-directory file switches (current-buffer))
2634 (if wildcard 2634 (or (= 0
2635 ;; Run ls in the directory of the file pattern we asked for. 2635 (if wildcard
2636 (let ((default-directory 2636 ;; Run ls in the directory of the file pattern we asked for.
2637 (if (file-name-absolute-p file) 2637 (let ((default-directory
2638 (file-name-directory file) 2638 (if (file-name-absolute-p file)
2639 (file-name-directory (expand-file-name file)))) 2639 (file-name-directory file)
2640 (pattern (file-name-nondirectory file)) 2640 (file-name-directory (expand-file-name file))))
2641 (beg 0)) 2641 (pattern (file-name-nondirectory file))
2642 ;; Quote some characters that have special meanings in shells; 2642 (beg 0))
2643 ;; but don't quote the wildcards--we want them to be special. 2643 ;; Quote some characters that have special meanings in shells;
2644 ;; We also currently don't quote the quoting characters 2644 ;; but don't quote the wildcards--we want them to be special.
2645 ;; in case people want to use them explicitly to quote 2645 ;; We also currently don't quote the quoting characters
2646 ;; wildcard characters. 2646 ;; in case people want to use them explicitly to quote
2647 (while (string-match "[ \t\n;<>&|()#$]" pattern beg) 2647 ;; wildcard characters.
2648 (setq pattern 2648 (while (string-match "[ \t\n;<>&|()#$]" pattern beg)
2649 (concat (substring pattern 0 (match-beginning 0)) 2649 (setq pattern
2650 "\\" 2650 (concat (substring pattern 0 (match-beginning 0))
2651 (substring pattern (match-beginning 0))) 2651 "\\"
2652 beg (1+ (match-end 0)))) 2652 (substring pattern (match-beginning 0)))
2653 (call-process shell-file-name nil t nil 2653 beg (1+ (match-end 0))))
2654 "-c" (concat "\\" ;; Disregard shell aliases! 2654 (call-process shell-file-name nil t nil
2655 insert-directory-program 2655 "-c" (concat "\\" ;; Disregard shell aliases!
2656 " -d " 2656 insert-directory-program
2657 (if (stringp switches) 2657 " -d "
2658 switches 2658 (if (stringp switches)
2659 (mapconcat 'identity switches " ")) 2659 switches
2660 " " 2660 (mapconcat 'identity switches " "))
2661 pattern))) 2661 " "
2662 ;; SunOS 4.1.3, SVr4 and others need the "." to list the 2662 pattern)))
2663 ;; directory if FILE is a symbolic link. 2663 ;; SunOS 4.1.3, SVr4 and others need the "." to list the
2664 (apply 'call-process 2664 ;; directory if FILE is a symbolic link.
2665 insert-directory-program nil t nil 2665 (apply 'call-process
2666 (let (list) 2666 insert-directory-program nil t nil
2667 (if (listp switches) 2667 (let (list)
2668 (setq list switches) 2668 (if (listp switches)
2669 (if (not (equal switches "")) 2669 (setq list switches)
2670 (progn 2670 (if (not (equal switches ""))
2671 ;; Split the switches at any spaces 2671 (progn
2672 ;; so we can pass separate options as separate args. 2672 ;; Split the switches at any spaces
2673 (while (string-match " " switches) 2673 ;; so we can pass separate options as separate args.
2674 (setq list (cons (substring switches 0 (match-beginning 0)) 2674 (while (string-match " " switches)
2675 list) 2675 (setq list (cons (substring switches 0 (match-beginning 0))
2676 switches (substring switches (match-end 0)))) 2676 list)
2677 (setq list (nreverse (cons switches list)))))) 2677 switches (substring switches (match-end 0))))
2678 (append list 2678 (setq list (nreverse (cons switches list))))))
2679 (list 2679 (append list
2680 (if full-directory-p 2680 (list
2681 (concat (file-name-as-directory file) ".") 2681 (if full-directory-p
2682 file)))))))))) 2682 (concat (file-name-as-directory file) ".")
2683 file)))))))
2684 ;; We get here if ls failed.
2685 ;; Access the file to get a suitable error.
2686 (access-file file "Reading directory"))))))
2683 2687
2684(defvar kill-emacs-query-functions nil 2688(defvar kill-emacs-query-functions nil
2685 "Functions to call with no arguments to query about killing Emacs. 2689 "Functions to call with no arguments to query about killing Emacs.