mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-03 02:31:03 -08:00
* net/tramp-cmds.el (tramp-cleanup-all-connections) (tramp-reporter-dump-variable, tramp-load-report-modules) (tramp-append-tramp-buffers): Use `tramp-compat-funcall'. (tramp-bug): Recommend setting of `tramp-verbose' to 9. * net/tramp-compat.el (top): Do not autoload `tramp-handle-file-remote-p'. Load tramp-util.el and tramp-vc.el only when `start-file-process' is not bound. (byte-compile-not-obsolete-vars): Define if not bound. (tramp-compat-funcall): New defmacro. (tramp-compat-line-beginning-position) (tramp-compat-line-end-position) (tramp-compat-temporary-file-directory) (tramp-compat-make-temp-file, tramp-compat-file-attributes) (tramp-compat-copy-file, tramp-compat-copy-directory) (tramp-compat-delete-file, tramp-compat-delete-directory) (tramp-compat-number-sequence, tramp-compat-process-running-p): Use it. (tramp-advice-file-expand-wildcards): Do not use `tramp-handle-file-remote-p'. (tramp-compat-make-temp-file): Simplify fallback implementation. (tramp-compat-copy-file): Add PRESERVE-SELINUX-CONTEXT. (tramp-compat-copy-tree): Remove function. (tramp-compat-delete-file): New defun. (tramp-compat-delete-directory): Provide implementation for older Emacsen. (tramp-compat-file-attributes): Handle only `wrong-number-of-arguments' error. * net/tramp-fish.el (tramp-fish-handle-copy-file): Add PRESERVE_SELINUX_CONTEXT. (tramp-fish-handle-delete-file): Add TRASH arg. (tramp-fish-handle-directory-files-and-attributes): Do not use `tramp-fish-handle-file-attributes. (tramp-fish-handle-file-local-copy) (tramp-fish-handle-insert-file-contents) (tramp-fish-maybe-open-connection): Use `with-progress-reporter'. * net/tramp-gvfs.el (top): Require url-util. (tramp-gvfs-mount-point): Remove. (tramp-gvfs-file-name-handler-alist): Add `file-selinux-context' and `set-file-selinux-context'. (tramp-gvfs-stringify-dbus-message, tramp-gvfs-send-command) (tramp-gvfs-handle-file-selinux-context) (tramp-gvfs-handle-set-file-selinux-context): New defuns. (with-tramp-dbus-call-method): Format trace message. (tramp-gvfs-handle-copy-file): Handle PRESERVE-SELINUX-CONTEXT. (tramp-gvfs-handle-copy-file, tramp-gvfs-handle-rename-file): Implement backup call, when operation on local files fails. Use progress reporter. Flush properties of changed files. (tramp-gvfs-handle-delete-file): Add TRASH arg. Use `tramp-compat-delete-file'. (tramp-gvfs-handle-expand-file-name): Expand "~/". (tramp-gvfs-handle-make-directory): Make more traces. (tramp-gvfs-handle-write-region): Protect deleting tmpfile. (tramp-gvfs-url-file-name): Hexify file name in url. (tramp-gvfs-fuse-file-name): Take also prefix (like dav shares) into account for the resulting file name. (tramp-gvfs-handler-askquestion): Preserve current message, in order to let progress reporter continue afterwards. (Bug#6257) Return dummy mountpoint, when the answer is "no". See `tramp-gvfs-maybe-open-connection'. (tramp-gvfs-handler-mounted-unmounted) (tramp-gvfs-connection-mounted-p): Test also for new mountspec attribute "default_location". Set "prefix" property. Handle default-location. (tramp-gvfs-mount-spec): Return both prefix and mountspec. (tramp-gvfs-maybe-open-connection): Test, whether mountpoint exists. Raise an error, if not (due to a corresponding answer "no" in interactive questions, for example). Use `tramp-compat-funcall'. * net/tramp-imap.el (top): Autoload `epg-make-context'. (tramp-imap-handle-copy-file): Add PRESERVE-SELINUX-CONTEXT. (tramp-imap-do-copy-or-rename-file) (tramp-imap-handle-insert-file-contents) (tramp-imap-handle-file-local-copy): Use `with-progress-reporter'. (tramp-imap-handle-delete-file): Add TRASH arg. * net/tramp-smb.el (tramp-smb-handle-copy-file): Add PRESERVE-SELINUX-CONTEXT. (tramp-smb-handle-copy-file) (tramp-smb-handle-file-local-copy, tramp-smb-handle-rename-file) (tramp-smb-handle-write-region, tramp-smb-maybe-open-connection): Use `with-progress-reporter'. (tramp-smb-handle-delete-file): Add TRASH arg. * net/tramp.el (tramp-methods): Move hostname to the end in all ssh `tramp-login-args'. Add `tramp-async-args' attribute where appropriate. (tramp-verbose): Describe verbose level 9. (tramp-completion-function-alist) (tramp-file-name-regexp, tramp-chunksize) (tramp-local-coding-commands, tramp-remote-coding-commands) (with-connection-property, tramp-completion-mode-p) (tramp-action-process-alive, tramp-action-out-of-band) (tramp-check-for-regexp, tramp-file-name-p, tramp-equal-remote) (tramp-exists-file-name-handler): Fix docstring. (tramp-remote-process-environment): Use `format' instead of `concat'. Protect version string by apostroph. (tramp-shell-prompt-pattern): Do not use a shy group in case of XEmacs. (tramp-file-name-regexp-unified) (tramp-completion-file-name-regexp-unified): On W32 systems, do not regard the volume letter as remote filename. (Bug#5447) (tramp-perl-file-attributes) (tramp-perl-directory-files-and-attributes): Don't pass "$3". (tramp-vc-registered-read-file-names): Read input as here-document, otherwise the command could exceed maximum length of command line. (tramp-file-name-handler-alist): Add `file-selinux-context' and `set-file-selinux-context'. (tramp-debug-message): Add `tramp-compat-funcall' to ignored backtrace functions. (tramp-error-with-buffer): Don't show the connection buffer when we are in completion mode. (tramp-progress-reporter-update, tramp-remote-selinux-p) (tramp-handle-file-selinux-context) (tramp-handle-set-file-selinux-context, tramp-process-sentinel) (tramp-connectable-p, tramp-open-shell, tramp-get-remote-trash): New defuns. (with-progress-reporter): New defmacro. (tramp-debug-outline-regexp): New defconst. (top, tramp-rfn-eshadow-setup-minibuffer) (tramp-rfn-eshadow-update-overlay, tramp-handle-set-file-times) (tramp-handle-dired-compress-file, tramp-handle-shell-command) (tramp-completion-mode-p, tramp-check-for-regexp) (tramp-open-connection-setup-interactive-shell) (tramp-compute-multi-hops, tramp-read-passwd, tramp-clear-passwd) (tramp-time-diff, tramp-coding-system-change-eol-conversion) (tramp-set-process-query-on-exit-flag, tramp-unload-tramp): Use `tramp-compat-funcall'. (tramp-handle-make-symbolic-link): Flush file properties. (tramp-handle-load, tramp-handle-file-local-copy) (tramp-handle-insert-file-contents, tramp-handle-write-region) (tramp-handle-vc-registered, tramp-maybe-send-script) (tramp-find-shell): Use `with-progress-reporter'. (tramp-do-file-attributes-with-stat): Add space in format string, in order to work around a bug in pdksh. Reported by Gilles Pion <gpion@lfdj.com>. (tramp-handle-verify-visited-file-modtime): Do not send a command when the connection is not established. (tramp-handle-set-file-times): Simplify the check for utc. (tramp-handle-directory-files-and-attributes) (tramp-get-remote-path): Use `copy-tree'. (tramp-completion-handle-file-name-all-completions): Ensure, that non remote files are still checked. Oops. (tramp-handle-copy-file, tramp-do-copy-or-rename-file): Handle PRESERVE-SELINUX-CONTEXT. (tramp-do-copy-or-rename-file): Add progress reporter. (tramp-do-copy-or-rename-file-directly): Do not use `tramp-handle-file-remote-p'. (tramp-do-copy-or-rename-file-out-of-band): Use `tramp-compat-delete-directory'. (tramp-do-copy-or-rename-file-out-of-band) (tramp-compute-multi-hops, tramp-maybe-open-connection): Use `format-spec-make'. (tramp-handle-delete-file): Add TRASH arg. (tramp-handle-dired-uncache): Flush directory cache, not only file cache. (tramp-handle-expand-file-name) (tramp-completion-handle-file-name-all-completions) (tramp-completion-handle-file-name-completion): Use `tramp-connectable-p'. (tramp-handle-start-file-process): Set connection property "vec". Use it, in order to invalidate file caches. Check only for `remote-tty' process property. Implement tty setting. (Bug#4604, Bug#6360) (tramp-file-name-for-operation): Add `call-process-region' and `set-file-selinux-context'. (tramp-find-foreign-file-name-handler) (tramp-advice-make-auto-save-file-name) (tramp-set-auto-save-file-modes): Remove superfluous check for `stringp'. This is done inside `tramp-tramp-file-p'. (tramp-file-name-handler): Trace 'quit. Catch the error for some operations when we are in completion mode. This gives the user the chance to correct the file name in the minibuffer. (tramp-completion-mode-p): Use `non-essential'. (tramp-handle-file-name-all-completions): Backward/ XEmacs compatibility: Use `completion-ignore-case' if `read-file-name-completion-ignore-case' does not exist. (tramp-get-debug-buffer): Use `tramp-debug-outline-regexp'. (tramp-find-shell, tramp-open-connection-setup-interactive-shell): `tramp-open-shell'. (tramp-action-password): Hide password prompt before next run. (tramp-process-actions): Widen connection buffer for the trace. (tramp-open-connection-setup-interactive-shell): Set `remote-tty' process property. Trace stty settings if `tramp-verbose' >= 9. Apply workaround for IRIX64 bug. Move argument of last `tramp-send-command' where it belongs to. (tramp-maybe-open-connection): Use `async-args' and `gw-args' in front of `login-args'. (tramp-get-ls-command, tramp-get-ls-command-with-dired): Run tests on "/dev/null" instead of "/". (tramp-get-ls-command-with-dired): Make test for "--dired" stronger. (tramp-set-auto-save-file-modes): Adapt version check. (tramp-set-process-query-on-exit-flag): Fix wrong parentheses. (tramp-handle-process-file): Call the program in a subshell, in order to preserve working directory. (tramp-handle-shell-command): Don't use hard-wired "/bin/sh" but `tramp-remote-sh' from `tramp-methods'. (tramp-get-ls-command): Make test for "--color=never" stronger. (tramp-check-for-regexp): Use (forward-line 1). * net/trampver.el: Update release number. * net/tramp-gvfs.el (tramp-gvfs-handle-copy-file): Do not pass empty argument to gvfs-copy. * net/tramp-compat.el (tramp-compat-delete-file): Rewrite to handle new TRASH arg of `delete-file'. * net/tramp.el (tramp-handle-insert-directory): Don't use `forward-word', its default syntax could be changed. Implement compression for inline methods. * net/tramp.el (tramp-inline-compress-start-size): New defcustom. (tramp-copy-size-limit): Allow also nil. (tramp-inline-compress-commands): New defconst. (tramp-find-inline-compress, tramp-get-inline-compress) (tramp-get-inline-coding): New defuns. (tramp-get-remote-coding, tramp-get-local-coding): Remove, replaced by `tramp-get-inline-coding'. (tramp-handle-file-local-copy, tramp-handle-write-region) (tramp-method-out-of-band-p): Use `tramp-get-inline-coding'. Detect ssh 'ControlMaster' argument automatically in some cases. * net/tramp.el (tramp-detect-ssh-controlmaster): New defun. (tramp-default-method): Use it. * net/tramp.el (tramp-file-name-for-operation): Add file-selinux-context.
409 lines
13 KiB
EmacsLisp
409 lines
13 KiB
EmacsLisp
;;; tramp-cmds.el --- Interactive commands for Tramp
|
|
|
|
;; Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
|
|
|
|
;; Author: Michael Albinus <michael.albinus@gmx.de>
|
|
;; Keywords: comm, processes
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
|
;; it under the terms of the GNU General Public License as published by
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
;; (at your option) any later version.
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
;; GNU General Public License for more details.
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
|
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
;;; Commentary:
|
|
|
|
;; This package provides all interactive commands which are releated
|
|
;; to Tramp.
|
|
|
|
;;; Code:
|
|
|
|
(require 'tramp)
|
|
|
|
(defun tramp-list-tramp-buffers ()
|
|
"Return a list of all Tramp connection buffers."
|
|
(append
|
|
(all-completions
|
|
"*tramp" (mapcar 'list (mapcar 'buffer-name (buffer-list))))
|
|
(all-completions
|
|
"*debug tramp" (mapcar 'list (mapcar 'buffer-name (buffer-list))))))
|
|
|
|
(defun tramp-list-remote-buffers ()
|
|
"Return a list of all buffers with remote default-directory."
|
|
(delq
|
|
nil
|
|
(mapcar
|
|
(lambda (x)
|
|
(with-current-buffer x
|
|
(when (and (stringp default-directory)
|
|
(file-remote-p default-directory))
|
|
x)))
|
|
(buffer-list))))
|
|
|
|
(defun tramp-cleanup-connection (vec)
|
|
"Flush all connection related objects.
|
|
This includes password cache, file cache, connection cache, buffers.
|
|
When called interactively, a Tramp connection has to be selected."
|
|
(interactive
|
|
;; When interactive, select the Tramp remote identification.
|
|
;; Return nil when there is no Tramp connection.
|
|
(list
|
|
(let ((connections
|
|
(mapcar
|
|
(lambda (x)
|
|
(tramp-make-tramp-file-name
|
|
(tramp-file-name-method x)
|
|
(tramp-file-name-user x)
|
|
(tramp-file-name-host x)
|
|
(tramp-file-name-localname x)))
|
|
(tramp-list-connections)))
|
|
name)
|
|
|
|
(when connections
|
|
(setq name
|
|
(completing-read
|
|
"Enter Tramp connection: " connections nil t
|
|
(try-completion "" connections)))
|
|
(when (and name (file-remote-p name))
|
|
(with-parsed-tramp-file-name name nil v))))))
|
|
|
|
(if (not vec)
|
|
;; Nothing to do.
|
|
(message "No Tramp connection found.")
|
|
|
|
;; Flush password cache.
|
|
(tramp-clear-passwd vec)
|
|
|
|
;; Flush file cache.
|
|
(tramp-flush-directory-property vec "")
|
|
|
|
;; Flush connection cache.
|
|
(tramp-flush-connection-property (tramp-get-connection-process vec))
|
|
(tramp-flush-connection-property vec)
|
|
|
|
;; Remove buffers.
|
|
(dolist
|
|
(buf (list (get-buffer (tramp-buffer-name vec))
|
|
(get-buffer (tramp-debug-buffer-name vec))
|
|
(tramp-get-connection-property vec "process-buffer" nil)))
|
|
(when (bufferp buf) (kill-buffer buf)))))
|
|
|
|
(defun tramp-cleanup-all-connections ()
|
|
"Flush all Tramp internal objects.
|
|
This includes password cache, file cache, connection cache, buffers."
|
|
(interactive)
|
|
|
|
;; Unlock Tramp.
|
|
(setq tramp-locked nil)
|
|
|
|
;; Flush password cache.
|
|
(tramp-compat-funcall 'password-reset)
|
|
|
|
;; Flush file and connection cache.
|
|
(clrhash tramp-cache-data)
|
|
|
|
;; Remove buffers.
|
|
(dolist (name (tramp-list-tramp-buffers))
|
|
(when (bufferp (get-buffer name)) (kill-buffer name))))
|
|
|
|
(defun tramp-cleanup-all-buffers ()
|
|
"Kill all remote buffers."
|
|
(interactive)
|
|
|
|
;; Remove all Tramp related buffers.
|
|
(tramp-cleanup-all-connections)
|
|
|
|
;; Remove all buffers with a remote default-directory.
|
|
(dolist (name (tramp-list-remote-buffers))
|
|
(when (bufferp (get-buffer name)) (kill-buffer name))))
|
|
|
|
;; Tramp version is useful in a number of situations.
|
|
|
|
(defun tramp-version (arg)
|
|
"Print version number of tramp.el in minibuffer or current buffer."
|
|
(interactive "P")
|
|
(if arg (insert tramp-version) (message tramp-version)))
|
|
|
|
;; Make the `reporter` functionality available for making bug reports about
|
|
;; the package. A most useful piece of code.
|
|
|
|
(autoload 'reporter-submit-bug-report "reporter")
|
|
|
|
(defun tramp-bug ()
|
|
"Submit a bug report to the Tramp developers."
|
|
(interactive)
|
|
(require 'reporter)
|
|
(catch 'dont-send
|
|
(let ((reporter-prompt-for-summary-p t))
|
|
(reporter-submit-bug-report
|
|
tramp-bug-report-address ; to-address
|
|
(format "tramp (%s)" tramp-version) ; package name and version
|
|
(delq nil
|
|
`(;; Current state
|
|
tramp-current-method
|
|
tramp-current-user
|
|
tramp-current-host
|
|
|
|
;; System defaults
|
|
tramp-auto-save-directory ; vars to dump
|
|
tramp-default-method
|
|
tramp-default-method-alist
|
|
tramp-default-host
|
|
tramp-default-proxies-alist
|
|
tramp-default-user
|
|
tramp-default-user-alist
|
|
tramp-rsh-end-of-line
|
|
tramp-default-password-end-of-line
|
|
tramp-login-prompt-regexp
|
|
;; Mask non-7bit characters
|
|
(tramp-password-prompt-regexp . tramp-reporter-dump-variable)
|
|
tramp-wrong-passwd-regexp
|
|
tramp-yesno-prompt-regexp
|
|
tramp-yn-prompt-regexp
|
|
tramp-terminal-prompt-regexp
|
|
tramp-temp-name-prefix
|
|
tramp-file-name-structure
|
|
tramp-file-name-regexp
|
|
tramp-methods
|
|
tramp-end-of-output
|
|
tramp-local-coding-commands
|
|
tramp-remote-coding-commands
|
|
tramp-actions-before-shell
|
|
tramp-actions-copy-out-of-band
|
|
tramp-terminal-type
|
|
;; Mask non-7bit characters
|
|
(tramp-shell-prompt-pattern . tramp-reporter-dump-variable)
|
|
,(when (boundp 'tramp-backup-directory-alist)
|
|
'tramp-backup-directory-alist)
|
|
,(when (boundp 'tramp-bkup-backup-directory-info)
|
|
'tramp-bkup-backup-directory-info)
|
|
;; Dump cache.
|
|
(tramp-cache-data . tramp-reporter-dump-variable)
|
|
|
|
;; Non-tramp variables of interest
|
|
;; Mask non-7bit characters
|
|
(shell-prompt-pattern . tramp-reporter-dump-variable)
|
|
backup-by-copying
|
|
backup-by-copying-when-linked
|
|
backup-by-copying-when-mismatch
|
|
,(when (boundp 'backup-by-copying-when-privileged-mismatch)
|
|
'backup-by-copying-when-privileged-mismatch)
|
|
,(when (boundp 'password-cache)
|
|
'password-cache)
|
|
,(when (boundp 'password-cache-expiry)
|
|
'password-cache-expiry)
|
|
,(when (boundp 'backup-directory-alist)
|
|
'backup-directory-alist)
|
|
,(when (boundp 'bkup-backup-directory-info)
|
|
'bkup-backup-directory-info)
|
|
file-name-handler-alist))
|
|
|
|
'tramp-load-report-modules ; pre-hook
|
|
'tramp-append-tramp-buffers ; post-hook
|
|
"\
|
|
Enter your bug report in this message, including as much detail
|
|
as you possibly can about the problem, what you did to cause it
|
|
and what the local and remote machines are.
|
|
|
|
If you can give a simple set of instructions to make this bug
|
|
happen reliably, please include those. Thank you for helping
|
|
kill bugs in Tramp.
|
|
|
|
Before reproducing the bug, you might apply
|
|
|
|
M-x tramp-cleanup-all-connections
|
|
|
|
This allows to investigate from a clean environment. Another
|
|
useful thing to do is to put
|
|
|
|
(setq tramp-verbose 9)
|
|
|
|
in the ~/.emacs file and to repeat the bug. Then, include the
|
|
contents of the *tramp/foo* buffer and the *debug tramp/foo*
|
|
buffer in your bug report.
|
|
|
|
--bug report follows this line--
|
|
"))))
|
|
|
|
(defun tramp-reporter-dump-variable (varsym mailbuf)
|
|
"Pretty-print the value of the variable in symbol VARSYM.
|
|
Used for non-7bit chars in strings."
|
|
(let* ((reporter-eval-buffer (symbol-value 'reporter-eval-buffer))
|
|
(val (with-current-buffer reporter-eval-buffer
|
|
(symbol-value varsym))))
|
|
|
|
(if (hash-table-p val)
|
|
;; Pretty print the cache.
|
|
(set varsym (read (format "(%s)" (tramp-cache-print val))))
|
|
;; There are characters to be masked.
|
|
(when (and (boundp 'mm-7bit-chars)
|
|
(string-match
|
|
(concat "[^" (symbol-value 'mm-7bit-chars) "]") val))
|
|
(with-current-buffer reporter-eval-buffer
|
|
(set varsym (format "(base64-decode-string \"%s\""
|
|
(base64-encode-string val))))))
|
|
|
|
;; Dump variable.
|
|
(tramp-compat-funcall 'reporter-dump-variable varsym mailbuf)
|
|
|
|
(unless (hash-table-p val)
|
|
;; Remove string quotation.
|
|
(forward-line -1)
|
|
(when (looking-at
|
|
(concat "\\(^.*\\)" "\"" ;; \1 "
|
|
"\\((base64-decode-string \\)" "\\\\" ;; \2 \
|
|
"\\(\".*\\)" "\\\\" ;; \3 \
|
|
"\\(\")\\)" "\"$")) ;; \4 "
|
|
(replace-match "\\1\\2\\3\\4")
|
|
(beginning-of-line)
|
|
(insert " ;; variable encoded due to non-printable characters\n"))
|
|
(forward-line 1))
|
|
|
|
;; Reset VARSYM to old value.
|
|
(with-current-buffer reporter-eval-buffer
|
|
(set varsym val))))
|
|
|
|
(defun tramp-load-report-modules ()
|
|
"Load needed modules for reporting."
|
|
|
|
;; We load message.el and mml.el from Gnus.
|
|
(if (featurep 'xemacs)
|
|
(progn
|
|
(load "message" 'noerror)
|
|
(load "mml" 'noerror))
|
|
(require 'message nil 'noerror)
|
|
(require 'mml nil 'noerror))
|
|
(tramp-compat-funcall 'message-mode)
|
|
(tramp-compat-funcall 'mml-mode t))
|
|
|
|
(defun tramp-append-tramp-buffers ()
|
|
"Append Tramp buffers and buffer local variables into the bug report."
|
|
|
|
(goto-char (point-max))
|
|
|
|
;; Dump buffer local variables.
|
|
(dolist (buffer
|
|
(delq nil
|
|
(mapcar
|
|
'(lambda (b)
|
|
(when (string-match "\\*tramp/" (buffer-name b)) b))
|
|
(buffer-list))))
|
|
(let ((reporter-eval-buffer buffer)
|
|
(buffer-name (buffer-name buffer))
|
|
(elbuf (get-buffer-create " *tmp-reporter-buffer*")))
|
|
(with-current-buffer elbuf
|
|
(emacs-lisp-mode)
|
|
(erase-buffer)
|
|
(insert "\n(setq\n")
|
|
(lisp-indent-line)
|
|
(tramp-compat-funcall
|
|
'reporter-dump-variable 'buffer-name (current-buffer))
|
|
(dolist (varsym-or-cons-cell (buffer-local-variables buffer))
|
|
(let ((varsym (or (car-safe varsym-or-cons-cell)
|
|
varsym-or-cons-cell)))
|
|
(when (string-match "tramp" (symbol-name varsym))
|
|
(tramp-compat-funcall
|
|
'reporter-dump-variable varsym (current-buffer)))))
|
|
(lisp-indent-line)
|
|
(insert ")\n"))
|
|
(insert-buffer-substring elbuf)))
|
|
|
|
;; Append buffers only when we are in message mode.
|
|
(when (and
|
|
(eq major-mode 'message-mode)
|
|
(boundp 'mml-mode)
|
|
(symbol-value 'mml-mode))
|
|
|
|
(let ((tramp-buf-regexp "\\*\\(debug \\)?tramp/")
|
|
(buffer-list (tramp-compat-funcall 'tramp-list-tramp-buffers))
|
|
(curbuf (current-buffer)))
|
|
|
|
;; There is at least one Tramp buffer.
|
|
(when buffer-list
|
|
(switch-to-buffer (list-buffers-noselect nil))
|
|
(delete-other-windows)
|
|
(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)
|
|
(forward-line 1)
|
|
(forward-line 0)
|
|
(let ((start (point)))
|
|
(forward-line 1)
|
|
(kill-region start (point)))))
|
|
(insert "
|
|
The buffer(s) above will be appended to this message. If you
|
|
don't want to append a buffer because it contains sensitive data,
|
|
or because the buffer is too large, you should delete the
|
|
respective buffer. The buffer(s) will contain user and host
|
|
names. Passwords will never be included there.")
|
|
|
|
(when (>= tramp-verbose 6)
|
|
(insert "\n\n")
|
|
(let ((start (point)))
|
|
(insert "\
|
|
Please note that you have set `tramp-verbose' to a value of at
|
|
least 6. Therefore, the contents of files might be included in
|
|
the debug buffer(s).")
|
|
(add-text-properties start (point) (list 'face 'italic))))
|
|
|
|
(set-buffer-modified-p nil)
|
|
(setq buffer-read-only t)
|
|
(goto-char (point-min))
|
|
|
|
(if (y-or-n-p "Do you want to append the buffer(s)? ")
|
|
;; OK, let's send. First we delete the buffer list.
|
|
(progn
|
|
(kill-buffer nil)
|
|
(switch-to-buffer curbuf)
|
|
(goto-char (point-max))
|
|
(insert "\n\
|
|
This is a special notion of the `gnus/message' package. If you
|
|
use another mail agent (by copying the contents of this buffer)
|
|
please ensure that the buffers are attached to your email.\n\n")
|
|
(dolist (buffer buffer-list)
|
|
(tramp-compat-funcall
|
|
'mml-insert-empty-tag 'part 'type "text/plain"
|
|
'encoding "base64" 'disposition "attachment" 'buffer buffer
|
|
'description buffer))
|
|
(set-buffer-modified-p nil))
|
|
|
|
;; Don't send. Delete the message buffer.
|
|
(set-buffer curbuf)
|
|
(set-buffer-modified-p nil)
|
|
(kill-buffer nil)
|
|
(throw 'dont-send nil))))))
|
|
|
|
(defalias 'tramp-submit-bug 'tramp-bug)
|
|
|
|
(provide 'tramp-cmds)
|
|
|
|
;;; TODO:
|
|
|
|
;; * Clean up unused *tramp/foo* buffers after a while. (Pete Forman)
|
|
;; * WIBNI there was an interactive command prompting for Tramp
|
|
;; method, hostname, username and filename and translates the user
|
|
;; input into the correct filename syntax (depending on the Emacs
|
|
;; flavor) (Reiner Steib)
|
|
;; * Let the user edit the connection properties interactively.
|
|
;; Something like `gnus-server-edit-server' in Gnus' *Server* buffer.
|
|
;; * It's just that when I come to Customize `tramp-default-user-alist'
|
|
;; I'm presented with a mismatch and raw lisp for a value. It is my
|
|
;; understanding that a variable declared with defcustom is a User
|
|
;; Option and should not be modified by the code. add-to-list is
|
|
;; called in several places. One way to handle that is to have a new
|
|
;; 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
|