From 1cdd2a1b363afb91bfaa397fa04be1bb3e88c9ae Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Wed, 6 Jul 2011 11:48:20 +0200 Subject: [PATCH] * net/tramp-compat.el (tramp-compat-pop-to-buffer-same-window): New defun. * net/tramp-cmds.el (tramp-append-tramp-buffers): Use it. --- lisp/ChangeLog | 6 ++++++ lisp/net/tramp-cmds.el | 4 ++-- lisp/net/tramp-compat.el | 29 +++++++++++++++++++---------- 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f0558e789da..fb4d94117c6 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2011-07-06 Michael Albinus + + * net/tramp-compat.el (tramp-compat-pop-to-buffer-same-window): + New defun. + * net/tramp-cmds.el (tramp-append-tramp-buffers): Use it. + 2011-07-06 Michael R. Mauger * progmodes/sql.el: Version 3.0 diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el index 307ce5368ce..f20040e8a9a 100644 --- a/lisp/net/tramp-cmds.el +++ b/lisp/net/tramp-cmds.el @@ -308,7 +308,7 @@ buffer in your bug report. ;; There is at least one Tramp buffer. (when buffer-list - (pop-to-buffer-same-window (list-buffers-noselect nil)) + (tramp-compat-pop-to-buffer-same-window (list-buffers-noselect nil)) (delete-other-windows) (setq buffer-read-only nil) (goto-char (point-min)) @@ -343,7 +343,7 @@ the debug buffer(s).") ;; OK, let's send. First we delete the buffer list. (progn (kill-buffer nil) - (pop-to-buffer-same-window curbuf) + (tramp-compat-pop-to-buffer-same-window curbuf) (goto-char (point-max)) (insert "\n\ This is a special notion of the `gnus/message' package. If you diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el index 3c0642c3c78..e7ea4354b51 100644 --- a/lisp/net/tramp-compat.el +++ b/lisp/net/tramp-compat.el @@ -23,9 +23,9 @@ ;;; Commentary: -;; Tramp's main Emacs version for development is GNU Emacs 24. This -;; package provides compatibility functions for GNU Emacs 22, GNU -;; Emacs 23 and XEmacs 21.4+. +;; Tramp's main Emacs version for development is Emacs 24. This +;; package provides compatibility functions for Emacs 22, Emacs 23, +;; XEmacs 21.4+ and SXEmacs 22. ;;; Code: @@ -286,9 +286,8 @@ Not actually used. Use `(format \"%o\" i)' instead?" (tramp-compat-funcall 'file-attributes filename id-format) (wrong-number-of-arguments (file-attributes filename)))))) -;; PRESERVE-UID-GID has been introduced with Emacs 23. It does not -;; hurt to ignore it for other (X)Emacs versions. -;; PRESERVE-SELINUX-CONTEXT has been introduced with Emacs 24. +;; PRESERVE-UID-GID does not exist in XEmacs. +;; PRESERVE-SELINUX-CONTEXT has been introduced with Emacs 24.1. (defun tramp-compat-copy-file (filename newname &optional ok-if-already-exists keep-date preserve-uid-gid preserve-selinux-context) @@ -484,10 +483,7 @@ exiting if process is running." (tramp-compat-funcall 'set-process-query-on-exit-flag process flag) (tramp-compat-funcall 'process-kill-without-query process flag))) -(add-hook 'tramp-unload-hook - (lambda () - (unload-feature 'tramp-compat 'force))) - +;; There exist different implementations for this function. (defun tramp-compat-coding-system-change-eol-conversion (coding-system eol-type) "Return a coding system like CODING-SYSTEM but with given EOL-TYPE. EOL-TYPE can be one of `dos', `unix', or `mac'." @@ -506,6 +502,19 @@ EOL-TYPE can be one of `dos', `unix', or `mac'." "`dos', `unix', or `mac'"))))) (t (error "Can't change EOL conversion -- is MULE missing?")))) +;; `pop-to-buffer-same-window' has been introduced with Emacs 24.1. +(defun tramp-compat-pop-to-buffer-same-window + (&optional buffer-or-name norecord label) + "Pop to buffer specified by BUFFER-OR-NAME in the selected window." + (if (fboundp 'pop-to-buffer-same-window) + (tramp-compat-funcall + 'pop-to-buffer-same-window buffer-or-name norecord label) + (tramp-compat-funcall 'switch-to-buffer buffer-or-name norecord))) + +(add-hook 'tramp-unload-hook + (lambda () + (unload-feature 'tramp-compat 'force))) + (provide 'tramp-compat) ;;; TODO: -- 2.39.2