diff options
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/emacs-lisp/autoload.el | 7 | ||||
-rw-r--r-- | lisp/net/tramp-sh.el | 247 | ||||
-rw-r--r-- | lisp/subr.el | 2 | ||||
-rw-r--r-- | lisp/vc/vc-cvs.el | 137 |
4 files changed, 159 insertions, 234 deletions
diff --git a/lisp/emacs-lisp/autoload.el b/lisp/emacs-lisp/autoload.el index 426601c81f7..1292ea992d3 100644 --- a/lisp/emacs-lisp/autoload.el +++ b/lisp/emacs-lisp/autoload.el @@ -1012,7 +1012,12 @@ write its autoloads into the specified file instead." (interactive "DUpdate autoloads from directory: ") (let* ((files-re (let ((tmp nil)) (dolist (suf (get-load-suffixes)) - (unless (string-match "\\.elc" suf) (push suf tmp))) + ;; We don't use module-file-suffix below because + ;; we don't want to depend on whether Emacs was + ;; built with or without modules support, nor + ;; what is the suffix for the underlying OS. + (unless (string-match "\\.\\(elc\\|\\so\\|dll\\)" suf) + (push suf tmp))) (concat "^[^=.].*" (regexp-opt tmp t) "\\'"))) (files (apply #'nconc (mapcar (lambda (dir) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 555e3711db2..e9077194691 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -4046,10 +4046,10 @@ process to set up. VEC specifies the connection." (case-fold-search t)) (tramp-open-shell vec (tramp-get-method-parameter vec 'tramp-remote-shell)) - ;; Disable tab and echo expansion. + ;; Disable echo expansion. (tramp-message vec 5 "Setting up remote shell environment") (tramp-send-command - vec "stty tab0 -inlcr -onlcr -echo kill '^U' erase '^H'" t) + vec "stty -inlcr -onlcr -echo kill '^U' erase '^H'" t) ;; Check whether the echo has really been disabled. Some ;; implementations, like busybox of embedded GNU/Linux, don't ;; support disabling. @@ -4066,7 +4066,8 @@ process to set up. VEC specifies the connection." (tramp-message vec 5 "Setting shell prompt") (tramp-send-command vec (format "PS1=%s PS2='' PS3='' PROMPT_COMMAND=''" - (tramp-shell-quote-argument tramp-end-of-output)) t) + (tramp-shell-quote-argument tramp-end-of-output)) + t) ;; Check whether the output of "uname -sr" has been changed. If ;; yes, this is a strong indication that we must expire all @@ -4074,138 +4075,132 @@ process to set up. VEC specifies the connection." ;; `tramp-maybe-open-connection', it will be caught there. (tramp-message vec 5 "Checking system information") (let ((old-uname (tramp-get-connection-property vec "uname" nil)) - (new-uname + (uname (tramp-set-connection-property vec "uname" (tramp-send-command-and-read vec "echo \\\"`uname -sr`\\\"")))) - (when (and (stringp old-uname) (not (string-equal old-uname new-uname))) + (when (and (stringp old-uname) (not (string-equal old-uname uname))) (tramp-message vec 3 "Connection reset, because remote host changed from `%s' to `%s'" - old-uname new-uname) + old-uname uname) ;; We want to keep the password. (tramp-cleanup-connection vec t t) - (throw 'uname-changed (tramp-maybe-open-connection vec)))) + (throw 'uname-changed (tramp-maybe-open-connection vec))) - ;; Try to set up the coding system correctly. - ;; CCC this can't be the right way to do it. Hm. - (tramp-message vec 5 "Determining coding system") - (with-current-buffer (process-buffer proc) - ;; Use MULE to select the right EOL convention for communicating - ;; with the process. - (let ((cs (or (and (memq 'utf-8 (coding-system-list)) - (string-match "utf-?8" (tramp-get-remote-locale vec)) - (cons 'utf-8 'utf-8)) - (process-coding-system proc) - (cons 'undecided 'undecided))) - cs-decode cs-encode) - (when (symbolp cs) (setq cs (cons cs cs))) - (setq cs-decode (or (car cs) 'undecided) - cs-encode (or (cdr cs) 'undecided) - cs-encode - (coding-system-change-eol-conversion - cs-encode - (if (string-match - "^Darwin" (tramp-get-connection-property vec "uname" "")) - 'mac 'unix))) - (tramp-send-command vec "echo foo ; echo bar" t) - (goto-char (point-min)) - (when (search-forward "\r" nil t) - (setq cs-decode (coding-system-change-eol-conversion cs-decode 'dos))) - ;; Special setting for Mac OS X. - (when (and (string-match - "^Darwin" (tramp-get-connection-property vec "uname" "")) - (memq 'utf-8-hfs (coding-system-list))) - (setq cs-decode 'utf-8-hfs - cs-encode 'utf-8-hfs)) - (set-buffer-process-coding-system cs-decode cs-encode) - (tramp-message - vec 5 "Setting coding system to `%s' and `%s'" cs-decode cs-encode))) - - (tramp-send-command vec "set +o vi +o emacs" t) - - ;; Check whether the remote host suffers from buggy - ;; `send-process-string'. This is known for FreeBSD (see comment in - ;; `send_process', file process.c). I've tested sending 624 bytes - ;; successfully, sending 625 bytes failed. Emacs makes a hack when - ;; this host type is detected locally. It cannot handle remote - ;; hosts, though. - (with-tramp-connection-property proc "chunksize" - (cond - ((and (integerp tramp-chunksize) (> tramp-chunksize 0)) - tramp-chunksize) - (t - (tramp-message - vec 5 "Checking remote host type for `send-process-string' bug") - (if (string-match - "^FreeBSD" (tramp-get-connection-property vec "uname" "")) - 500 0)))) - - ;; Set remote PATH variable. - (tramp-set-remote-path vec) - - ;; Search for a good shell before searching for a command which - ;; checks if a file exists. This is done because Tramp wants to use - ;; "test foo; echo $?" to check if various conditions hold, and - ;; there are buggy /bin/sh implementations which don't execute the - ;; "echo $?" part if the "test" part has an error. In particular, - ;; the OpenSolaris /bin/sh is a problem. There are also other - ;; problems with /bin/sh of OpenSolaris, like redirection of stderr - ;; in function declarations, or changing HISTFILE in place. - ;; Therefore, OpenSolaris' /bin/sh is replaced by bash, when - ;; detected. - (tramp-find-shell vec) - - ;; Disable unexpected output. - (tramp-send-command vec "mesg n 2>/dev/null; biff n 2>/dev/null" t) - - ;; IRIX64 bash expands "!" even when in single quotes. This - ;; destroys our shell functions, we must disable it. See - ;; <http://stackoverflow.com/questions/3291692/irix-bash-shell-expands-expression-in-single-quotes-yet-shouldnt>. - (when (string-match "^IRIX64" (tramp-get-connection-property vec "uname" "")) - (tramp-send-command vec "set +H" t)) - - ;; On BSD-like systems, ?\t is expanded to spaces. Suppress this. - (when (string-match "BSD\\|Darwin" - (tramp-get-connection-property vec "uname" "")) - (tramp-send-command vec "stty -oxtabs" t)) - - ;; Set utf8 encoding. Needed for Mac OS X, for example. This is - ;; non-POSIX, so we must expect errors on some systems. - (tramp-send-command vec "stty iutf8 2>/dev/null" t) - - ;; Set `remote-tty' process property. - (let ((tty (tramp-send-command-and-read vec "echo \\\"`tty`\\\"" 'noerror))) - (unless (zerop (length tty)) - (process-put proc 'remote-tty tty))) - - ;; Dump stty settings in the traces. - (when (>= tramp-verbose 9) - (tramp-send-command vec "stty -a" t)) - - ;; Set the environment. - (tramp-message vec 5 "Setting default environment") - - (let (unset vars) - (dolist (item (reverse - (append `(,(tramp-get-remote-locale vec)) - (copy-sequence tramp-remote-process-environment)))) - (setq item (split-string item "=" 'omit)) - (setcdr item (mapconcat 'identity (cdr item) "=")) - (if (and (stringp (cdr item)) (not (string-equal (cdr item) ""))) - (push (format "%s %s" (car item) (cdr item)) vars) - (push (car item) unset))) - (when vars - (tramp-send-command - vec - (format "while read var val; do export $var=$val; done <<'%s'\n%s\n%s" - tramp-end-of-heredoc - (mapconcat 'identity vars "\n") - tramp-end-of-heredoc) - t)) - (when unset - (tramp-send-command - vec (format "unset %s" (mapconcat 'identity unset " ")) t)))) + ;; Try to set up the coding system correctly. + ;; CCC this can't be the right way to do it. Hm. + (tramp-message vec 5 "Determining coding system") + (with-current-buffer (process-buffer proc) + ;; Use MULE to select the right EOL convention for + ;; communicating with the process. + (let ((cs (or (and (memq 'utf-8 (coding-system-list)) + (string-match "utf-?8" (tramp-get-remote-locale vec)) + (cons 'utf-8 'utf-8)) + (process-coding-system proc) + (cons 'undecided 'undecided))) + cs-decode cs-encode) + (when (symbolp cs) (setq cs (cons cs cs))) + (setq cs-decode (or (car cs) 'undecided) + cs-encode (or (cdr cs) 'undecided) + cs-encode + (coding-system-change-eol-conversion + cs-encode (if (string-match "^Darwin" uname) 'mac 'unix))) + (tramp-send-command vec "echo foo ; echo bar" t) + (goto-char (point-min)) + (when (search-forward "\r" nil t) + (setq cs-decode (coding-system-change-eol-conversion cs-decode 'dos))) + ;; Special setting for Mac OS X. + (when (and (string-match "^Darwin" uname) + (memq 'utf-8-hfs (coding-system-list))) + (setq cs-decode 'utf-8-hfs + cs-encode 'utf-8-hfs)) + (set-buffer-process-coding-system cs-decode cs-encode) + (tramp-message + vec 5 "Setting coding system to `%s' and `%s'" cs-decode cs-encode))) + + (tramp-send-command vec "set +o vi +o emacs" t) + + ;; Check whether the remote host suffers from buggy + ;; `send-process-string'. This is known for FreeBSD (see comment + ;; in `send_process', file process.c). I've tested sending 624 + ;; bytes successfully, sending 625 bytes failed. Emacs makes a + ;; hack when this host type is detected locally. It cannot handle + ;; remote hosts, though. + (with-tramp-connection-property proc "chunksize" + (cond + ((and (integerp tramp-chunksize) (> tramp-chunksize 0)) + tramp-chunksize) + (t + (tramp-message + vec 5 "Checking remote host type for `send-process-string' bug") + (if (string-match "^FreeBSD" uname) 500 0)))) + + ;; Set remote PATH variable. + (tramp-set-remote-path vec) + + ;; Search for a good shell before searching for a command which + ;; checks if a file exists. This is done because Tramp wants to + ;; use "test foo; echo $?" to check if various conditions hold, + ;; and there are buggy /bin/sh implementations which don't execute + ;; the "echo $?" part if the "test" part has an error. In + ;; particular, the OpenSolaris /bin/sh is a problem. There are + ;; also other problems with /bin/sh of OpenSolaris, like + ;; redirection of stderr in function declarations, or changing + ;; HISTFILE in place. Therefore, OpenSolaris' /bin/sh is replaced + ;; by bash, when detected. + (tramp-find-shell vec) + + ;; Disable unexpected output. + (tramp-send-command vec "mesg n 2>/dev/null; biff n 2>/dev/null" t) + + ;; IRIX64 bash expands "!" even when in single quotes. This + ;; destroys our shell functions, we must disable it. See + ;; <http://stackoverflow.com/questions/3291692/irix-bash-shell-expands-expression-in-single-quotes-yet-shouldnt>. + (when (string-match "^IRIX64" uname) + (tramp-send-command vec "set +H" t)) + + ;; Disable tab expansion. + (if (string-match "BSD\\|Darwin" uname) + (tramp-send-command vec "stty tabs" t) + (tramp-send-command vec "stty tab0" t)) + + ;; Set utf8 encoding. Needed for Mac OS X, for example. This is + ;; non-POSIX, so we must expect errors on some systems. + (tramp-send-command vec "stty iutf8 2>/dev/null" t) + + ;; Set `remote-tty' process property. + (let ((tty (tramp-send-command-and-read vec "echo \\\"`tty`\\\"" 'noerror))) + (unless (zerop (length tty)) + (process-put proc 'remote-tty tty))) + + ;; Dump stty settings in the traces. + (when (>= tramp-verbose 9) + (tramp-send-command vec "stty -a" t)) + + ;; Set the environment. + (tramp-message vec 5 "Setting default environment") + + (let (unset vars) + (dolist (item (reverse + (append `(,(tramp-get-remote-locale vec)) + (copy-sequence tramp-remote-process-environment)))) + (setq item (split-string item "=" 'omit)) + (setcdr item (mapconcat 'identity (cdr item) "=")) + (if (and (stringp (cdr item)) (not (string-equal (cdr item) ""))) + (push (format "%s %s" (car item) (cdr item)) vars) + (push (car item) unset))) + (when vars + (tramp-send-command + vec + (format "while read var val; do export $var=$val; done <<'%s'\n%s\n%s" + tramp-end-of-heredoc + (mapconcat 'identity vars "\n") + tramp-end-of-heredoc) + t)) + (when unset + (tramp-send-command + vec (format "unset %s" (mapconcat 'identity unset " ")) t))))) ;; Old text from documentation of tramp-methods: ;; Using a uuencode/uudecode inline method is discouraged, please use one diff --git a/lisp/subr.el b/lisp/subr.el index 8a1792ad8b7..fba43be9e34 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1999,7 +1999,7 @@ this process is not associated with any buffer. PROGRAM is the program file name. It is searched for in `exec-path' \(which see). If nil, just associate a pty with the buffer. Remaining -arguments are strings to give program as arguments. +arguments PROGRAM-ARGS are strings to give program as arguments. If you want to separate standard output from standard error, use `make-process' or invoke the command through a shell and redirect diff --git a/lisp/vc/vc-cvs.el b/lisp/vc/vc-cvs.el index 50198713b41..6a010b34f26 100644 --- a/lisp/vc/vc-cvs.el +++ b/lisp/vc/vc-cvs.el @@ -944,103 +944,32 @@ state." (t 'edited)))))))) (defun vc-cvs-after-dir-status (update-function) - ;; Heavily inspired by vc-cvs-parse-status. AKA a quick hack. - ;; This needs a lot of testing. - (let ((status nil) - (status-str nil) - (file nil) - (result nil) - (missing nil) - (ignore-next nil) - (subdir default-directory)) + (let ((result nil) + (translation '((?? . unregistered) + (?A . added) + (?C . conflict) + (?M . edited) + (?P . needs-merge) + (?R . removed) + (?U . needs-update)))) (goto-char (point-min)) - (while - ;; Look for either a file entry, an unregistered file, or a - ;; directory change. - (re-search-forward - "\\(^=+\n\\([^=c?\n].*\n\\|\n\\)+\\)\\|\\(\\(^?? .*\n\\)+\\)\\|\\(^cvs status: \\(Examining\\|nothing\\) .*\n\\)" - nil t) - ;; FIXME: get rid of narrowing here. - (narrow-to-region (match-beginning 0) (match-end 0)) - (goto-char (point-min)) - ;; The subdir - (when (looking-at "cvs status: Examining \\(.+\\)") - (setq subdir (expand-file-name (match-string 1)))) - ;; Unregistered files - (while (looking-at "? \\(.*\\)") - (setq file (file-relative-name - (expand-file-name (match-string 1) subdir))) - (push (list file 'unregistered) result) - (forward-line 1)) - (when (looking-at "cvs status: nothing known about") - ;; We asked about a non existent file. The output looks like this: - - ;; cvs status: nothing known about `lisp/v.diff' - ;; =================================================================== - ;; File: no file v.diff Status: Unknown - ;; - ;; Working revision: No entry for v.diff - ;; Repository revision: No revision control file - ;; - - ;; Due to narrowing in this iteration we only see the "cvs - ;; status:" line, so just set a flag so that we can ignore the - ;; file in the next iteration. - (setq ignore-next t)) - ;; A file entry. - (when (re-search-forward "^File: \\(no file \\)?\\(.*[^ \t]\\)[ \t]+Status: \\(.*\\)" nil t) - (setq missing (match-string 1)) - (setq file (file-relative-name - (expand-file-name (match-string 2) subdir))) - (setq status-str (match-string 3)) - (setq status - (cond - ((string-match "Up-to-date" status-str) 'up-to-date) - ((string-match "Locally Modified" status-str) 'edited) - ((string-match "Needs Merge" status-str) 'needs-merge) - ((string-match "Needs \\(Checkout\\|Patch\\)" status-str) - (if missing 'missing 'needs-update)) - ((string-match "Locally Added" status-str) 'added) - ((string-match "Locally Removed" status-str) 'removed) - ((string-match "File had conflicts " status-str) 'conflict) - ((string-match "Unknown" status-str) 'unregistered) - (t 'edited))) - (if ignore-next - (setq ignore-next nil) - (unless (eq status 'up-to-date) - (push (list file status) result)))) - (goto-char (point-max)) - (widen)) - (funcall update-function result)) - ;; Alternative implementation: use the "update" command instead of - ;; the "status" command. - ;; (let ((result nil) - ;; (translation '((?? . unregistered) - ;; (?A . added) - ;; (?C . conflict) - ;; (?M . edited) - ;; (?P . needs-merge) - ;; (?R . removed) - ;; (?U . needs-update)))) - ;; (goto-char (point-min)) - ;; (while (not (eobp)) - ;; (if (looking-at "^[ACMPRU?] \\(.*\\)$") - ;; (push (list (match-string 1) - ;; (cdr (assoc (char-after) translation))) - ;; result) - ;; (cond - ;; ((looking-at "cvs update: warning: \\(.*\\) was lost") - ;; ;; Format is: - ;; ;; cvs update: warning: FILENAME was lost - ;; ;; U FILENAME - ;; (push (list (match-string 1) 'missing) result) - ;; ;; Skip the "U" line - ;; (forward-line 1)) - ;; ((looking-at "cvs update: New directory `\\(.*\\)' -- ignored") - ;; (push (list (match-string 1) 'unregistered) result)))) - ;; (forward-line 1)) - ;; (funcall update-function result))) - ) + (while (not (eobp)) + (if (looking-at "^[ACMPRU?] \\(.*\\)$") + (push (list (match-string 1) + (cdr (assoc (char-after) translation))) + result) + (cond + ((looking-at "cvs update: warning: \\(.*\\) was lost") + ;; Format is: + ;; cvs update: warning: FILENAME was lost + ;; U FILENAME + (push (list (match-string 1) 'missing) result) + ;; Skip the "U" line + (forward-line 1)) + ((looking-at "cvs update: New directory `\\(.*\\)' -- ignored") + (push (list (match-string 1) 'unregistered) result)))) + (forward-line 1)) + (funcall update-function result))) ;; Based on vc-cvs-dir-state-heuristic from Emacs 22. ;; FIXME does not mention unregistered files. @@ -1077,16 +1006,12 @@ state." Query all files in DIR if files is nil." (let ((local (vc-cvs-stay-local-p dir))) (if (and (not files) local (not (eq local 'only-file))) - (vc-cvs-dir-status-heuristic dir update-function) - (if (not files) (setq files (vc-expand-dirs (list dir) 'CVS))) - (vc-cvs-command (current-buffer) 'async files "-f" "status") - ;; Alternative implementation: use the "update" command instead of - ;; the "status" command. - ;; (vc-cvs-command (current-buffer) 'async - ;; (file-relative-name dir) - ;; "-f" "-n" "update" "-d" "-P") - (vc-run-delayed - (vc-cvs-after-dir-status update-function))))) + (vc-cvs-dir-status-heuristic dir update-function)) + (vc-cvs-command (current-buffer) 'async + files + "-f" "-n" "-q" "update") + (vc-run-delayed + (vc-cvs-after-dir-status update-function)))) (defun vc-cvs-file-to-string (file) "Read the content of FILE and return it as a string." |