# HG changeset patch # User Michael Albinus # Date 1289644952 -3600 # Node ID 49c1b16ca6b14122233cb58a6ce3fbefe66b9d96 # Parent d65a4bd9b059bf123faee5367f93f2413f60b5fb * net/tramp-compat.el (tramp-compat-line-beginning-position) (tramp-compat-line-end-position): Remove them. * net/tramp.el (tramp-parse-rhosts-group) (tramp-parse-shosts-group, tramp-parse-sconfig-group) (tramp-parse-hosts-group, tramp-parse-passwd-group) (tramp-parse-netrc-group, tramp-parse-putty-group) * net/tramp-cmds.el (tramp-append-tramp-buffers) * net/tramp-sh.el (tramp-do-file-attributes-with-ls) (tramp-sh-handle-file-selinux-context) (tramp-sh-handle-file-name-all-completions) (tramp-sh-handle-insert-directory) (tramp-sh-handle-expand-file-name, tramp-find-executable) (tramp-wait-for-output, tramp-send-command-and-read) * net/tramp-smb.el (tramp-smb-read-file-entry) (tramp-smb-get-cifs-capabilities): Use `point-at-eol'. * net/tramp-sh.el (tramp-sh-handle-insert-directory) Use `point-at-bol'. (tramp-remote-coding-commands): Add an alternative using "base64 -d -i". This is needed for older base64 versions from GNU coreutils. Reported by Klaus Reichl . diff -r d65a4bd9b059 -r 49c1b16ca6b1 lisp/ChangeLog --- a/lisp/ChangeLog Fri Nov 12 19:48:16 2010 -0800 +++ b/lisp/ChangeLog Sat Nov 13 11:42:32 2010 +0100 @@ -1,3 +1,29 @@ +2010-11-13 Michael Albinus + + * net/tramp-compat.el (tramp-compat-line-beginning-position) + (tramp-compat-line-end-position): Remove them. + + * net/tramp.el (tramp-parse-rhosts-group) + (tramp-parse-shosts-group, tramp-parse-sconfig-group) + (tramp-parse-hosts-group, tramp-parse-passwd-group) + (tramp-parse-netrc-group, tramp-parse-putty-group) + * net/tramp-cmds.el (tramp-append-tramp-buffers) + * net/tramp-sh.el (tramp-do-file-attributes-with-ls) + (tramp-sh-handle-file-selinux-context) + (tramp-sh-handle-file-name-all-completions) + (tramp-sh-handle-insert-directory) + (tramp-sh-handle-expand-file-name, tramp-find-executable) + (tramp-wait-for-output, tramp-send-command-and-read) + * net/tramp-smb.el (tramp-smb-read-file-entry) + (tramp-smb-get-cifs-capabilities): Use `point-at-eol'. + + * net/tramp-sh.el (tramp-sh-handle-insert-directory) Use + `point-at-bol'. + (tramp-remote-coding-commands): Add an alternative using "base64 + -d -i". This is needed for older base64 versions from GNU + coreutils. Reported by Klaus Reichl + . + 2010-11-13 Hrvoje Niksic * simple.el (count-words-region): New function. @@ -1227,7 +1253,7 @@ * newcomment.el (comment-dwim): Fix the intentation in the doc string. -010-10-21 Michael Albinus +2010-10-21 Michael Albinus * net/tramp-sh.el (tramp-do-file-attributes-with-stat): Do not use space in stat format string. diff -r d65a4bd9b059 -r 49c1b16ca6b1 lisp/net/tramp-cmds.el --- a/lisp/net/tramp-cmds.el Fri Nov 12 19:48:16 2010 -0800 +++ b/lisp/net/tramp-cmds.el Sat Nov 13 11:42:32 2010 +0100 @@ -298,8 +298,7 @@ (setq buffer-read-only nil) (goto-char (point-min)) (while (not (eobp)) - (if (re-search-forward - tramp-buf-regexp (tramp-compat-line-end-position) t) + (if (re-search-forward tramp-buf-regexp (point-at-eol) t) (forward-line 1) (forward-line 0) (let ((start (point))) @@ -372,5 +371,4 @@ ;; ordinary variable that gets its initial value from ;; tramp-default-user-alist and then is added to. (Pete Forman) -;; arch-tag: 190d4c33-76bb-4e99-8b6f-71741f23d98c ;;; tramp-cmds.el ends here diff -r d65a4bd9b059 -r 49c1b16ca6b1 lisp/net/tramp-compat.el --- a/lisp/net/tramp-compat.el Fri Nov 12 19:48:16 2010 -0800 +++ b/lisp/net/tramp-compat.el Sat Nov 13 11:42:32 2010 +0100 @@ -199,29 +199,6 @@ (ignore-errors (tramp-compat-funcall 'font-lock-add-keywords mode keywords how))) -;; FIXME is this really necessary? Eg Emacs has both l-b-p and p-at-b -;; since at least 21.1. -(defsubst tramp-compat-line-beginning-position () - "Return point at beginning of line (compat function). -Calls `line-beginning-position' or `point-at-bol' if defined, else -own implementation." - (cond - ((fboundp 'line-beginning-position) - (tramp-compat-funcall 'line-beginning-position)) - ((fboundp 'point-at-bol) (tramp-compat-funcall 'point-at-bol)) - (t (save-excursion (beginning-of-line) (point))))) - -;; FIXME is this really necessary? Eg Emacs has both l-e-p and p-at-e -;; since at least 21.1. -(defsubst tramp-compat-line-end-position () - "Return point at end of line (compat function). -Calls `line-end-position' or `point-at-eol' if defined, else -own implementation." - (cond - ((fboundp 'line-end-position) (tramp-compat-funcall 'line-end-position)) - ((fboundp 'point-at-eol) (tramp-compat-funcall 'point-at-eol)) - (t (save-excursion (end-of-line) (point))))) - (defsubst tramp-compat-temporary-file-directory () "Return name of directory for temporary files (compat function). For Emacs, this is the variable `temporary-file-directory', for XEmacs diff -r d65a4bd9b059 -r 49c1b16ca6b1 lisp/net/tramp-sh.el --- a/lisp/net/tramp-sh.el Fri Nov 12 19:48:16 2010 -0800 +++ b/lisp/net/tramp-sh.el Sat Nov 13 11:42:32 2010 +0100 @@ -1189,8 +1189,7 @@ ;; if symlink, find out file name pointed to (when symlinkp (search-forward "-> ") - (setq res-symlink-target - (buffer-substring (point) (tramp-compat-line-end-position)))) + (setq res-symlink-target (buffer-substring (point) (point-at-eol)))) ;; return data gathered (list ;; 0. t for directory, string (name linked to) for symbolic @@ -1438,7 +1437,7 @@ (tramp-shell-quote-argument localname)))) (with-current-buffer (tramp-get-connection-buffer v) (goto-char (point-min)) - (when (re-search-forward regexp (tramp-compat-line-end-position) t) + (when (re-search-forward regexp (point-at-eol) t) (setq context (list (match-string 1) (match-string 2) (match-string 3) (match-string 4)))))) ;; Return the context. @@ -1746,8 +1745,7 @@ (tramp-error v 'file-error "tramp-sh-handle-file-name-all-completions: %s" - (buffer-substring - (point) (tramp-compat-line-end-position)))) + (buffer-substring (point) (point-at-eol)))) ;; For peace of mind, if buffer doesn't end in `fail' ;; then it should end in `ok'. If neither are in the ;; buffer something went seriously wrong on the remote @@ -1760,9 +1758,7 @@ (tramp-shell-quote-argument localname) (buffer-string)))) (while (zerop (forward-line -1)) - (push (buffer-substring - (point) (tramp-compat-line-end-position)) - result))) + (push (buffer-substring (point) (point-at-eol)) result))) ;; Because the remote op went through OK we know the ;; directory we `cd'-ed to exists @@ -2524,7 +2520,7 @@ (forward-line -1)) (when (looking-at "//DIRED//\\s-+") (let ((databeg (match-end 0)) - (end (tramp-compat-line-end-position))) + (end (point-at-eol))) ;; Now read the numeric positions of file names. (goto-char databeg) (while (< (point) end) @@ -2534,7 +2530,7 @@ ;; End is followed by \n or by " -> ". (put-text-property start end 'dired-filename t)))))) ;; Remove trailing lines. - (goto-char (tramp-compat-line-beginning-position)) + (goto-char (point-at-bol)) (while (looking-at "//") (forward-line 1) (delete-region (match-beginning 0) (point))) @@ -2593,8 +2589,7 @@ v (format "cd %s; pwd" (tramp-shell-quote-argument uname))) (with-current-buffer (tramp-get-buffer v) (goto-char (point-min)) - (buffer-substring - (point) (tramp-compat-line-end-position))))) + (buffer-substring (point) (point-at-eol))))) (setq localname (concat uname fname)))) ;; There might be a double slash, for example when "~/" ;; expands to "/". Remove this. @@ -3496,8 +3491,7 @@ (when (search-backward "tramp_executable " nil t) (skip-chars-forward "^ ") (skip-chars-forward " ") - (setq result (buffer-substring - (point) (tramp-compat-line-end-position))))) + (setq result (buffer-substring (point) (point-at-eol))))) result))) (defun tramp-set-remote-path (vec) @@ -3647,7 +3641,7 @@ ;; the single quotes makes it work under `rc', too. We also unset ;; the variable $ENV because that is read by some sh ;; implementations (eg, bash when called as sh) on startup; this - ;; way, we avoid the startup file clobbering $PS1. $PROMP_COMMAND + ;; way, we avoid the startup file clobbering $PS1. $PROMPT_COMMAND ;; is another way to set the prompt in /bin/bash, it must be ;; discarded as well. (tramp-open-shell @@ -3858,7 +3852,11 @@ with the encoded or decoded results, respectively.") (defconst tramp-remote-coding-commands - '((b64 "base64" "base64 -d") + '((b64 "base64" "base64 -d -i") + ;; "-i" is more robust with older base64 from GNU coreutils. + ;; However, I don't know whether all base64 versions do supports + ;; this option. + (b64 "base64" "base64 -d") (b64 "mimencode -b" "mimencode -u -b") (b64 "mmencode -b" "mmencode -u -b") (b64 "recode data..base64" "recode base64..data") @@ -4360,8 +4358,8 @@ (tramp-set-connection-property p "check-remote-echo" t) (setq command (format "%s%s%s" tramp-echo-mark command tramp-echo-mark))) (when (string-match "<<'EOF'" command) - ;; Unset $PS1 when using here documents, in order not to get - ;; several prompts. + ;; Unset $PS1 when using here documents, in order to avoid + ;; multiple prompts. (setq command (concat "(PS1= ; " command "\n)"))) ;; Send the command. (tramp-message vec 6 "%s" command) @@ -4387,8 +4385,7 @@ ;; A simple-minded busybox has sent " ^H" sequences. ;; Delete them. (goto-char (point-min)) - (when (re-search-forward - "^\\(.\b\\)+$" (tramp-compat-line-end-position) t) + (when (re-search-forward "^\\(.\b\\)+$" (point-at-eol) t) (forward-line 1) (delete-region (point-min) (point))) ;; Delete the prompt. @@ -4450,7 +4447,7 @@ (condition-case nil (prog1 (read (current-buffer)) ;; Error handling. - (when (re-search-forward "\\S-" (tramp-compat-line-end-position) t) + (when (re-search-forward "\\S-" (point-at-eol) t) (error nil))) (error (tramp-error vec 'file-error @@ -5042,5 +5039,6 @@ ;; rsync. ;; * Try telnet+curl as new method. It might be useful for busybox, ;; without built-in uuencode/uudecode. +;; * Try ssh+netcat as out-of-band method. ;;; tramp-sh.el ends here diff -r d65a4bd9b059 -r 49c1b16ca6b1 lisp/net/tramp-smb.el --- a/lisp/net/tramp-smb.el Fri Nov 12 19:48:16 2010 -0800 +++ b/lisp/net/tramp-smb.el Sat Nov 13 11:42:32 2010 +0100 @@ -1079,7 +1079,7 @@ Result is the list (LOCALNAME MODE SIZE MTIME)." ;; We are called from `tramp-smb-get-file-entries', which sets the ;; current buffer. - (let ((line (buffer-substring (point) (tramp-compat-line-end-position))) + (let ((line (buffer-substring (point) (point-at-eol))) localname mode size month day hour min sec year mtime) (if (not share) @@ -1177,8 +1177,7 @@ (member "pathnames" (split-string - (buffer-substring - (point) (tramp-compat-line-end-position)) nil t))))))))) + (buffer-substring (point) (point-at-eol)) nil t))))))))) (defun tramp-smb-get-stat-capability (vec) "Check, whether the SMB server supports the STAT command." @@ -1396,5 +1395,4 @@ ;; regular again. ;; * Make it multi-hop capable. -;; arch-tag: fcc9dbec-7503-4d73-b638-3c8aa59575f5 ;;; tramp-smb.el ends here diff -r d65a4bd9b059 -r 49c1b16ca6b1 lisp/net/tramp.el --- a/lisp/net/tramp.el Fri Nov 12 19:48:16 2010 -0800 +++ b/lisp/net/tramp.el Sat Nov 13 11:42:32 2010 +0100 @@ -2352,7 +2352,7 @@ (concat "^\\(" tramp-host-regexp "\\)" "\\([ \t]+" "\\(" tramp-user-regexp "\\)" "\\)?"))) - (narrow-to-region (point) (tramp-compat-line-end-position)) + (narrow-to-region (point) (point-at-eol)) (when (re-search-forward regexp nil t) (setq result (append (list (match-string 3) (match-string 1))))) (widen) @@ -2379,7 +2379,7 @@ User is always nil." (let ((result) (regexp (concat "^\\(" tramp-host-regexp "\\)"))) - (narrow-to-region (point) (tramp-compat-line-end-position)) + (narrow-to-region (point) (point-at-eol)) (when (re-search-forward regexp nil t) (setq result (list nil (match-string 1)))) (widen) @@ -2408,7 +2408,7 @@ User is always nil." (let ((result) (regexp (concat "^[ \t]*Host[ \t]+" "\\(" tramp-host-regexp "\\)"))) - (narrow-to-region (point) (tramp-compat-line-end-position)) + (narrow-to-region (point) (point-at-eol)) (when (re-search-forward regexp nil t) (setq result (list nil (match-string 1)))) (widen) @@ -2469,7 +2469,7 @@ (let ((result) (regexp (concat "^\\(" tramp-ipv6-regexp "\\|" tramp-host-regexp "\\)"))) - (narrow-to-region (point) (tramp-compat-line-end-position)) + (narrow-to-region (point) (point-at-eol)) (when (re-search-forward regexp nil t) (setq result (list nil (match-string 1)))) (widen) @@ -2504,7 +2504,7 @@ Host is always \"localhost\"." (let ((result) (regexp (concat "^\\(" tramp-user-regexp "\\):"))) - (narrow-to-region (point) (tramp-compat-line-end-position)) + (narrow-to-region (point) (point-at-eol)) (when (re-search-forward regexp nil t) (setq result (list (match-string 1) "localhost"))) (widen) @@ -2534,7 +2534,7 @@ (concat "^[ \t]*machine[ \t]+" "\\(" tramp-host-regexp "\\)" "\\([ \t]+login[ \t]+" "\\(" tramp-user-regexp "\\)" "\\)?"))) - (narrow-to-region (point) (tramp-compat-line-end-position)) + (narrow-to-region (point) (point-at-eol)) (when (re-search-forward regexp nil t) (setq result (list (match-string 3) (match-string 1)))) (widen) @@ -2560,7 +2560,7 @@ User is always nil." (let ((result) (regexp (concat (regexp-quote registry) "\\\\\\(.+\\)"))) - (narrow-to-region (point) (tramp-compat-line-end-position)) + (narrow-to-region (point) (point-at-eol)) (when (re-search-forward regexp nil t) (setq result (list nil (match-string 1)))) (widen) @@ -3662,7 +3662,6 @@ ;; expects English? Or just to set LC_MESSAGES to "C" if Tramp ;; expects only English messages? (Juri Linkov) ;; * Make shadowfile.el grok Tramp filenames. (Bug#4526, Bug#4846) -;; * Load ~/.emacs_SHELLNAME on the remote host for `shell'. ;; * I was wondering it it would be possible to use tramp even if I'm ;; actually using sshfs. But when I launch a command I would like ;; to get it executed on the remote machine where the files really @@ -3674,7 +3673,6 @@ ;; Functions for file-name-handler-alist: ;; diff-latest-backup-file -- in diff.el -;; arch-tag: 3a21a994-182b-48fa-b0cd-c1d9fede424a ;;; tramp.el ends here ;; Local Variables: