summaryrefslogtreecommitdiff
path: root/lisp/startup.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1996-01-27 00:14:59 +0000
committerRichard M. Stallman <rms@gnu.org>1996-01-27 00:14:59 +0000
commitf851311e968957938af73a15481be8d97ea0f626 (patch)
tree18549c87bedd852bafa399189702bcfc3b095825 /lisp/startup.el
parentae6e5aad3d3e45beabbb3783980703618ecf9a54 (diff)
downloademacs-f851311e968957938af73a15481be8d97ea0f626.tar.gz
(command-line-normalize-file-name): New function.
(command-line-1): Call it to handle foo//bar in non-Emacs fashion.
Diffstat (limited to 'lisp/startup.el')
-rw-r--r--lisp/startup.el12
1 files changed, 10 insertions, 2 deletions
diff --git a/lisp/startup.el b/lisp/startup.el
index abe5b3b79c7..4ef04665b70 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -841,6 +841,7 @@ Type \\[describe-distribution] for information on getting the latest version."))
(setq tem argval)
(setq tem (car command-line-args-left)
command-line-args-left (cdr command-line-args-left)))
+ (setq tem (command-line-normalize-file-name tem))
(setq extra-load-path
(cons (expand-file-name tem) extra-load-path))
(setq load-path (append (nreverse extra-load-path)
@@ -851,7 +852,7 @@ Type \\[describe-distribution] for information on getting the latest version."))
(setq tem argval)
(setq tem (car command-line-args-left)
command-line-args-left (cdr command-line-args-left)))
- (let ((file tem))
+ (let ((file (command-line-normalize-file-name tem)))
;; Take file from default dir if it exists there;
;; otherwise let `load' search for it.
(if (file-exists-p (expand-file-name file))
@@ -864,7 +865,7 @@ Type \\[describe-distribution] for information on getting the latest version."))
command-line-args-left (cdr command-line-args-left)))
(or (stringp tem)
(error "File name omitted from `-insert' option"))
- (insert-file-contents tem))
+ (insert-file-contents (command-line-normalize-file-name tem)))
((string-equal argi "-kill")
(kill-emacs t))
((string-match "^\\+[0-9]+\\'" argi)
@@ -887,6 +888,7 @@ Type \\[describe-distribution] for information on getting the latest version."))
(if (string-match "\\`-" argi)
(error "Unknown option `%s'" argi))
(setq file-count (1+ file-count))
+ (setq argi (command-line-normalize-file-name argi))
(cond ((= file-count 1)
(setq first-file-buffer
(find-file (expand-file-name argi dir))))
@@ -902,4 +904,10 @@ Type \\[describe-distribution] for information on getting the latest version."))
(progn (other-window 1)
(buffer-menu)))))))
+(defun command-line-normalize-file-name (file)
+ "Collapse multiple slashes to one, to handle non-Emacs file names."
+ (while (string-match "//+" file)
+ (setq file (replace-match "/" t t file)))
+ file)
+
;;; startup.el ends here