1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-03 11:33:37 +00:00

insert-directory: use split-string

This commit is contained in:
Sam Steingold 2000-07-18 14:18:03 +00:00
parent 088831a6ff
commit 34342a07bd
2 changed files with 50 additions and 53 deletions

View File

@ -1,3 +1,8 @@
2000-07-17 Sam Steingold <sds@gnu.org>
* files.el (insert-directory): Call `split-string' instead of
re-implementing it.
2000-07-18 Gerd Moellmann <gerd@gnu.org>
* mail/vms-pmail.el: Change maintainer to FSF.
@ -196,7 +201,7 @@
* battery.el, info-look.el: Change author's mail address.
2000-07-07 Jonathan I. Kamens <jik@kamens.brookline.ma.us>
* mail/rmail.el (rmail-clear-headers): Don't throw an error
if rmail-ignored-headers is nil.
(rmail-retry-failure): Bind rmail-ignored-headers and
@ -213,7 +218,7 @@
* rmail.el (mail-unsent-separator): Changed "the" to "\\w+", as
exim can use "your message" instead of "the message".
2000-07-06 Stefan Monnier <monnier@cs.yale.edu>
* facemenu.el: Docstrings fixes.
@ -224,7 +229,7 @@
backwards over `=' not to bump into BOBP.
2000-07-05 Michael Kifer <kifer@cs.sunysb.edu>
* ediff-diff.el (ediff-wordify): Use syntax table.
* ediff-init.el (ediff-has-face-support-p): Use
ediff-color-display-p.
@ -233,7 +238,7 @@
Got rid of special cases for NeXT and OS/2.
* ediff-wind.el (ediff-setup-control-frame): Set proper modeline
face.
2000-07-05 Stefan Monnier <monnier@cs.yale.edu>
* emacs-lisp/lucid.el: Require CL.
@ -250,7 +255,7 @@
* emacs-lisp/cl-extra.el (cl-old-mapc): Removed; don't defalias mapc.
(cl-mapc): Use mapc instead of cl-old-mapc.
2000-07-05 Andrew Innes <andrewi@gnu.org>
* makefile.nt: Add support for `bootstrap' and related targets.
@ -403,7 +408,7 @@
* replace.el (perform-replace): Undo change of 2000-04-04.
Instead, move backward 1 character at the end of the loop when
necessary.
* faces.el (fringe): Change face for different backgrounds.
* eshell/esh-module.el (toplevel): Load defgroup's differently;
@ -467,7 +472,7 @@
* comint.el (comint-substitute-in-file-name): Call replace-match
with second and third arg t.
* cus-edit.el (custom-button-face, custom-button-pressed-face):
* cus-edit.el (custom-button-face, custom-button-pressed-face):
Specify foreground color.
* faces.el (tool-bar, mode-line, header-line): Specify foreground

View File

@ -3217,7 +3217,7 @@ See also `auto-save-file-name-p'."
(let ((fn (file-name-nondirectory buffer-file-name)))
(string-match "\\`\\([^.]+\\)\\(\\.\\(..?\\)?.?\\|\\)\\'" fn)
(concat (file-name-directory buffer-file-name)
"#" (match-string 1 fn)
"#" (match-string 1 fn)
"." (match-string 3 fn) "#"))
(concat (file-name-directory filename)
"#"
@ -3444,8 +3444,8 @@ This works by running a directory listing program
whose name is in the variable `insert-directory-program'.
If WILDCARD, it also runs the shell specified by `shell-file-name'."
;; We need the directory in order to find the right handler.
(let ((handler (find-file-name-handler (expand-file-name file)
'insert-directory)))
(let* ((file (expand-file-name file))
(handler (find-file-name-handler file 'insert-directory)))
(if handler
(funcall handler 'insert-directory file switches
wildcard full-directory-p)
@ -3459,61 +3459,53 @@ If WILDCARD, it also runs the shell specified by `shell-file-name'."
(coding-system-for-write coding-system-for-read)
(result
(if wildcard
;; Run ls in the directory of the file pattern we asked for.
(let ((default-directory
(if (file-name-absolute-p file)
(file-name-directory file)
(file-name-directory (expand-file-name file))))
;; Run ls in the directory of the file pattern we asked for
(let ((default-directory (file-name-directory file))
(pattern (file-name-nondirectory file))
(beg 0))
;; Quote some characters that have special meanings in shells;
;; but don't quote the wildcards--we want them to be special.
;; We also currently don't quote the quoting characters
;; in case people want to use them explicitly to quote
;; wildcard characters.
;; Quote some characters that have special
;; meanings in shells; but don't quote the
;; wildcards--we want them to be special.
;; We also currently don't quote the quoting
;; characters in case people want to use them
;; explicitly to quote wildcard characters.
(while (string-match "[ \t\n;<>&|()#$]" pattern beg)
(setq pattern
(concat (substring pattern 0 (match-beginning 0))
"\\"
(substring pattern (match-beginning 0)))
beg (1+ (match-end 0))))
(call-process shell-file-name nil t nil
"-c" (concat "\\";; Disregard shell aliases!
insert-directory-program
" -d "
(if (stringp switches)
switches
(mapconcat 'identity switches " "))
" -- "
pattern)))
(call-process
shell-file-name nil t nil
"-c" (concat "\\" ; Disregard shell aliases!
insert-directory-program
" -d "
(if (stringp switches)
switches
(mapconcat 'identity switches " "))
" -- "
pattern)))
;; SunOS 4.1.3, SVr4 and others need the "." to list the
;; directory if FILE is a symbolic link.
(apply 'call-process
insert-directory-program nil t nil
(let (list)
(if (listp switches)
(setq list switches)
(if (not (equal switches ""))
(progn
;; Split the switches at any spaces
;; so we can pass separate options as separate args.
(while (string-match " " switches)
(setq list (cons (substring switches 0 (match-beginning 0))
list)
switches (substring switches (match-end 0))))
(setq list (nreverse (cons switches list))))))
(append list
;; Avoid lossage if FILE starts with `-'.
'("--")
(progn
(if (string-match "\\`~" file)
(setq file (expand-file-name file)))
(list
(if full-directory-p
(concat (file-name-as-directory file) ".")
file)))))))))
(append
(if (listp switches) switches
(unless (equal switches "")
;; Split the switches at any spaces so we can
;; pass separate options as separate args.
(split-string switches)))
;; Avoid lossage if FILE starts with `-'.
'("--")
(progn
(if (string-match "\\`~" file)
(setq file (expand-file-name file)))
(list
(if full-directory-p
(concat (file-name-as-directory file) ".")
file))))))))
(if (/= result 0)
;; We get here if ls failed.
;; We get here if `insert-directory-program' failed.
;; Access the file to get a suitable error.
(access-file file "Reading directory")
;; Replace "total" with "used", to avoid confusion.
@ -3534,7 +3526,7 @@ If WILDCARD, it also runs the shell specified by `shell-file-name'."
(forward-word -1)
(setq available (buffer-substring (point) end))))
(insert " available " available))))))))))
(defvar kill-emacs-query-functions nil
"Functions to call with no arguments to query about killing Emacs.
If any of these functions returns nil, killing Emacs is cancelled.