aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2009-09-15 07:06:04 +0000
committerGlenn Morris2009-09-15 07:06:04 +0000
commitcd05fe7fd3b95074c80131cc1fe56ed9699fdc31 (patch)
tree24f5cc18230969e6a87c77341adf606f89c60489
parentb3c7c12d65aa8e806975b73ef4673f52d7883429 (diff)
downloademacs-cd05fe7fd3b95074c80131cc1fe56ed9699fdc31.tar.gz
emacs-cd05fe7fd3b95074c80131cc1fe56ed9699fdc31.zip
(command-line-1): Give local variables with common names a
distinguishing prefix, so as not to hide free variable warnings during bootstrap.
-rw-r--r--lisp/ChangeLog4
-rw-r--r--lisp/startup.el95
2 files changed, 53 insertions, 46 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 35eff3c3b98..5545992e8e2 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -40,6 +40,10 @@
40 (batch-byte-compile): Give some more local variables with common names 40 (batch-byte-compile): Give some more local variables with common names
41 a "bytecomp-" prefix to avoid masking warnings about free variables. 41 a "bytecomp-" prefix to avoid masking warnings about free variables.
42 42
43 * startup.el (command-line-1): Give local variables with common names a
44 distinguishing prefix, so as not to hide free variable warnings during
45 bootstrap.
46
43 * mail/rmailmm.el (rmail-mime-save): If file exists, don't try to be 47 * mail/rmailmm.el (rmail-mime-save): If file exists, don't try to be
44 clever and add a suffix to make a unique name, just let the user decide 48 clever and add a suffix to make a unique name, just let the user decide
45 whether or not to overwrite it. If the input is a directory, write the 49 whether or not to overwrite it. If the input is a directory, write the
diff --git a/lisp/startup.el b/lisp/startup.el
index 14758727c02..a60ba03ce6b 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -2040,8 +2040,11 @@ A fancy display is used on graphic displays, normal otherwise."
2040 first-file-buffer) 2040 first-file-buffer)
2041 (when command-line-args-left 2041 (when command-line-args-left
2042 ;; We have command args; process them. 2042 ;; We have command args; process them.
2043 (let ((dir command-line-default-directory) 2043 ;; Note that any local variables in this function affect the
2044 tem 2044 ;; ability of -f batch-byte-compile to detect free variables.
2045 ;; So we give some of them with common names a cl1- prefix.
2046 (let ((cl1-dir command-line-default-directory)
2047 cl1-tem
2045 ;; This approach loses for "-batch -L DIR --eval "(require foo)", 2048 ;; This approach loses for "-batch -L DIR --eval "(require foo)",
2046 ;; if foo is intended to be found in DIR. 2049 ;; if foo is intended to be found in DIR.
2047 ;; 2050 ;;
@@ -2064,18 +2067,18 @@ A fancy display is used on graphic displays, normal otherwise."
2064 "--find-file" "--visit" "--file" "--no-desktop") 2067 "--find-file" "--visit" "--file" "--no-desktop")
2065 (mapcar (lambda (elt) (concat "-" (car elt))) 2068 (mapcar (lambda (elt) (concat "-" (car elt)))
2066 command-switch-alist))) 2069 command-switch-alist)))
2067 (line 0) 2070 (cl1-line 0)
2068 (column 0)) 2071 (cl1-column 0))
2069 2072
2070 ;; Add the long X options to longopts. 2073 ;; Add the long X options to longopts.
2071 (dolist (tem command-line-x-option-alist) 2074 (dolist (cl1-tem command-line-x-option-alist)
2072 (if (string-match "^--" (car tem)) 2075 (if (string-match "^--" (car cl1-tem))
2073 (push (car tem) longopts))) 2076 (push (car cl1-tem) longopts)))
2074 2077
2075 ;; Add the long NS options to longopts. 2078 ;; Add the long NS options to longopts.
2076 (dolist (tem command-line-ns-option-alist) 2079 (dolist (cl1-tem command-line-ns-option-alist)
2077 (if (string-match "^--" (car tem)) 2080 (if (string-match "^--" (car cl1-tem))
2078 (push (list (car tem)) longopts))) 2081 (push (list (car cl1-tem)) longopts)))
2079 2082
2080 ;; Loop, processing options. 2083 ;; Loop, processing options.
2081 (while command-line-args-left 2084 (while command-line-args-left
@@ -2106,12 +2109,12 @@ A fancy display is used on graphic displays, normal otherwise."
2106 argi orig-argi))))) 2109 argi orig-argi)))))
2107 2110
2108 ;; Execute the option. 2111 ;; Execute the option.
2109 (cond ((setq tem (assoc argi command-switch-alist)) 2112 (cond ((setq cl1-tem (assoc argi command-switch-alist))
2110 (if argval 2113 (if argval
2111 (let ((command-line-args-left 2114 (let ((command-line-args-left
2112 (cons argval command-line-args-left))) 2115 (cons argval command-line-args-left)))
2113 (funcall (cdr tem) argi)) 2116 (funcall (cdr cl1-tem) argi))
2114 (funcall (cdr tem) argi))) 2117 (funcall (cdr cl1-tem) argi)))
2115 2118
2116 ((equal argi "-no-splash") 2119 ((equal argi "-no-splash")
2117 (setq inhibit-startup-screen t)) 2120 (setq inhibit-startup-screen t))
@@ -2120,22 +2123,22 @@ A fancy display is used on graphic displays, normal otherwise."
2120 "-funcall" 2123 "-funcall"
2121 "-e")) ; what the source used to say 2124 "-e")) ; what the source used to say
2122 (setq inhibit-startup-screen t) 2125 (setq inhibit-startup-screen t)
2123 (setq tem (intern (or argval (pop command-line-args-left)))) 2126 (setq cl1-tem (intern (or argval (pop command-line-args-left))))
2124 (if (commandp tem) 2127 (if (commandp cl1-tem)
2125 (command-execute tem) 2128 (command-execute cl1-tem)
2126 (funcall tem))) 2129 (funcall cl1-tem)))
2127 2130
2128 ((member argi '("-eval" "-execute")) 2131 ((member argi '("-eval" "-execute"))
2129 (setq inhibit-startup-screen t) 2132 (setq inhibit-startup-screen t)
2130 (eval (read (or argval (pop command-line-args-left))))) 2133 (eval (read (or argval (pop command-line-args-left)))))
2131 2134
2132 ((member argi '("-L" "-directory")) 2135 ((member argi '("-L" "-directory"))
2133 (setq tem (expand-file-name 2136 (setq cl1-tem (expand-file-name
2134 (command-line-normalize-file-name 2137 (command-line-normalize-file-name
2135 (or argval (pop command-line-args-left))))) 2138 (or argval (pop command-line-args-left)))))
2136 (cond (splice (setcdr splice (cons tem (cdr splice))) 2139 (cond (splice (setcdr splice (cons cl1-tem (cdr splice)))
2137 (setq splice (cdr splice))) 2140 (setq splice (cdr splice)))
2138 (t (setq load-path (cons tem load-path) 2141 (t (setq load-path (cons cl1-tem load-path)
2139 splice load-path)))) 2142 splice load-path))))
2140 2143
2141 ((member argi '("-l" "-load")) 2144 ((member argi '("-l" "-load"))
@@ -2159,10 +2162,10 @@ A fancy display is used on graphic displays, normal otherwise."
2159 2162
2160 ((equal argi "-insert") 2163 ((equal argi "-insert")
2161 (setq inhibit-startup-screen t) 2164 (setq inhibit-startup-screen t)
2162 (setq tem (or argval (pop command-line-args-left))) 2165 (setq cl1-tem (or argval (pop command-line-args-left)))
2163 (or (stringp tem) 2166 (or (stringp cl1-tem)
2164 (error "File name omitted from `-insert' option")) 2167 (error "File name omitted from `-insert' option"))
2165 (insert-file-contents (command-line-normalize-file-name tem))) 2168 (insert-file-contents (command-line-normalize-file-name cl1-tem)))
2166 2169
2167 ((equal argi "-kill") 2170 ((equal argi "-kill")
2168 (kill-emacs t)) 2171 (kill-emacs t))
@@ -2175,41 +2178,41 @@ A fancy display is used on graphic displays, normal otherwise."
2175 (message "\"--no-desktop\" ignored because the Desktop package is not loaded")) 2178 (message "\"--no-desktop\" ignored because the Desktop package is not loaded"))
2176 2179
2177 ((string-match "^\\+[0-9]+\\'" argi) 2180 ((string-match "^\\+[0-9]+\\'" argi)
2178 (setq line (string-to-number argi))) 2181 (setq cl1-line (string-to-number argi)))
2179 2182
2180 ((string-match "^\\+\\([0-9]+\\):\\([0-9]+\\)\\'" argi) 2183 ((string-match "^\\+\\([0-9]+\\):\\([0-9]+\\)\\'" argi)
2181 (setq line (string-to-number (match-string 1 argi)) 2184 (setq cl1-line (string-to-number (match-string 1 argi))
2182 column (string-to-number (match-string 2 argi)))) 2185 cl1-column (string-to-number (match-string 2 argi))))
2183 2186
2184 ((setq tem (assoc argi command-line-x-option-alist)) 2187 ((setq cl1-tem (assoc argi command-line-x-option-alist))
2185 ;; Ignore X-windows options and their args if not using X. 2188 ;; Ignore X-windows options and their args if not using X.
2186 (setq command-line-args-left 2189 (setq command-line-args-left
2187 (nthcdr (nth 1 tem) command-line-args-left))) 2190 (nthcdr (nth 1 cl1-tem) command-line-args-left)))
2188 2191
2189 ((setq tem (assoc argi command-line-ns-option-alist)) 2192 ((setq cl1-tem (assoc argi command-line-ns-option-alist))
2190 ;; Ignore NS-windows options and their args if not using NS. 2193 ;; Ignore NS-windows options and their args if not using NS.
2191 (setq command-line-args-left 2194 (setq command-line-args-left
2192 (nthcdr (nth 1 tem) command-line-args-left))) 2195 (nthcdr (nth 1 cl1-tem) command-line-args-left)))
2193 2196
2194 ((member argi '("-find-file" "-file" "-visit")) 2197 ((member argi '("-find-file" "-file" "-visit"))
2195 (setq inhibit-startup-screen t) 2198 (setq inhibit-startup-screen t)
2196 ;; An explicit option to specify visiting a file. 2199 ;; An explicit option to specify visiting a file.
2197 (setq tem (or argval (pop command-line-args-left))) 2200 (setq cl1-tem (or argval (pop command-line-args-left)))
2198 (unless (stringp tem) 2201 (unless (stringp cl1-tem)
2199 (error "File name omitted from `%s' option" argi)) 2202 (error "File name omitted from `%s' option" argi))
2200 (setq file-count (1+ file-count)) 2203 (setq file-count (1+ file-count))
2201 (let ((file (expand-file-name 2204 (let ((file (expand-file-name
2202 (command-line-normalize-file-name tem) dir))) 2205 (command-line-normalize-file-name cl1-tem) cl1-dir)))
2203 (if (= file-count 1) 2206 (if (= file-count 1)
2204 (setq first-file-buffer (find-file file)) 2207 (setq first-file-buffer (find-file file))
2205 (find-file-other-window file))) 2208 (find-file-other-window file)))
2206 (unless (zerop line) 2209 (unless (zerop cl1-line)
2207 (goto-char (point-min)) 2210 (goto-char (point-min))
2208 (forward-line (1- line))) 2211 (forward-line (1- cl1-line)))
2209 (setq line 0) 2212 (setq cl1-line 0)
2210 (unless (< column 1) 2213 (unless (< cl1-column 1)
2211 (move-to-column (1- column))) 2214 (move-to-column (1- cl1-column)))
2212 (setq column 0)) 2215 (setq cl1-column 0))
2213 2216
2214 ((equal argi "--") 2217 ((equal argi "--")
2215 (setq just-files t)) 2218 (setq just-files t))
@@ -2232,19 +2235,19 @@ A fancy display is used on graphic displays, normal otherwise."
2232 (let ((file 2235 (let ((file
2233 (expand-file-name 2236 (expand-file-name
2234 (command-line-normalize-file-name orig-argi) 2237 (command-line-normalize-file-name orig-argi)
2235 dir))) 2238 cl1-dir)))
2236 (cond ((= file-count 1) 2239 (cond ((= file-count 1)
2237 (setq first-file-buffer (find-file file))) 2240 (setq first-file-buffer (find-file file)))
2238 (inhibit-startup-screen 2241 (inhibit-startup-screen
2239 (find-file-other-window file)) 2242 (find-file-other-window file))
2240 (t (find-file file)))) 2243 (t (find-file file))))
2241 (unless (zerop line) 2244 (unless (zerop cl1-line)
2242 (goto-char (point-min)) 2245 (goto-char (point-min))
2243 (forward-line (1- line))) 2246 (forward-line (1- cl1-line)))
2244 (setq line 0) 2247 (setq cl1-line 0)
2245 (unless (< column 1) 2248 (unless (< cl1-column 1)
2246 (move-to-column (1- column))) 2249 (move-to-column (1- cl1-column)))
2247 (setq column 0)))))) 2250 (setq cl1-column 0))))))
2248 ;; In unusual circumstances, the execution of Lisp code due 2251 ;; In unusual circumstances, the execution of Lisp code due
2249 ;; to command-line options can cause the last visible frame 2252 ;; to command-line options can cause the last visible frame
2250 ;; to be deleted. In this case, kill emacs to avoid an 2253 ;; to be deleted. In this case, kill emacs to avoid an