Mercurial > emacs
comparison lisp/startup.el @ 102152:c526d585a715
(command-line): Don't match an empty argument as an
option.
(command-line-1): Likewise.
author | Andreas Schwab <schwab@suse.de> |
---|---|
date | Fri, 20 Feb 2009 14:24:55 +0000 |
parents | a9dc0e7c3f2b |
children | b6361d016a5a |
comparison
equal
deleted
inserted
replaced
102151:328f4b370b74 | 102152:c526d585a715 |
---|---|
826 ("--no-blinking-cursor") ("--basic-display"))) | 826 ("--no-blinking-cursor") ("--basic-display"))) |
827 (argi (pop args)) | 827 (argi (pop args)) |
828 (orig-argi argi) | 828 (orig-argi argi) |
829 argval) | 829 argval) |
830 ;; Handle --OPTION=VALUE format. | 830 ;; Handle --OPTION=VALUE format. |
831 (when (string-match "^\\(--[^=]*\\)=" argi) | 831 (when (string-match "\\`\\(--[^=]*\\)=" argi) |
832 (setq argval (substring argi (match-end 0)) | 832 (setq argval (substring argi (match-end 0)) |
833 argi (match-string 1 argi))) | 833 argi (match-string 1 argi))) |
834 (unless (equal argi "--") | 834 (when (string-match "\\`--." orig-argi) |
835 (let ((completion (try-completion argi longopts))) | 835 (let ((completion (try-completion argi longopts))) |
836 (if (eq completion t) | 836 (if (eq completion t) |
837 (setq argi (substring argi 1)) | 837 (setq argi (substring argi 1)) |
838 (if (stringp completion) | 838 (if (stringp completion) |
839 (let ((elt (assoc completion longopts))) | 839 (let ((elt (assoc completion longopts))) |
2123 (if just-files | 2123 (if just-files |
2124 ;; After --, don't look for options; treat all args as files. | 2124 ;; After --, don't look for options; treat all args as files. |
2125 (setq argi "") | 2125 (setq argi "") |
2126 ;; Convert long options to ordinary options | 2126 ;; Convert long options to ordinary options |
2127 ;; and separate out an attached option argument into argval. | 2127 ;; and separate out an attached option argument into argval. |
2128 (when (string-match "^\\(--[^=]*\\)=" argi) | 2128 (when (string-match "\\`\\(--[^=]*\\)=" argi) |
2129 (setq argval (substring argi (match-end 0)) | 2129 (setq argval (substring argi (match-end 0)) |
2130 argi (match-string 1 argi))) | 2130 argi (match-string 1 argi))) |
2131 (if (equal argi "--") | 2131 (when (string-match "\\`--." orig-argi) |
2132 (setq completion nil) | 2132 (setq completion (try-completion argi longopts)) |
2133 (setq completion (try-completion argi longopts))) | 2133 (if (eq completion t) |
2134 (if (eq completion t) | 2134 (setq argi (substring argi 1)) |
2135 (setq argi (substring argi 1)) | 2135 (if (stringp completion) |
2136 (if (stringp completion) | 2136 (let ((elt (assoc completion longopts))) |
2137 (let ((elt (assoc completion longopts))) | 2137 (or elt |
2138 (or elt | 2138 (error "Option `%s' is ambiguous" argi)) |
2139 (error "Option `%s' is ambiguous" argi)) | 2139 (setq argi (substring (car elt) 1))) |
2140 (setq argi (substring (car elt) 1))) | 2140 (setq argval nil |
2141 (setq argval nil | 2141 argi orig-argi))))) |
2142 argi orig-argi)))) | |
2143 | 2142 |
2144 ;; Execute the option. | 2143 ;; Execute the option. |
2145 (cond ((setq tem (assoc argi command-switch-alist)) | 2144 (cond ((setq tem (assoc argi command-switch-alist)) |
2146 (if argval | 2145 (if argval |
2147 (let ((command-line-args-left | 2146 (let ((command-line-args-left |