[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
problems with tramp
From: |
Kirill Kuvaldin |
Subject: |
problems with tramp |
Date: |
16 Feb 2006 19:33:50 +0100 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (darwin) |
Hello!
I want to open files with sudo using tramp, but the suggestions from
http://www.emacswiki.org/cgi-bin/wiki/TrampMode didn't help me.
I've put the following code into my ~/.emacs:
(defvar find-file-root-prefix (if (featurep 'xemacs) "/[sudo/root@localhost]"
"/sudo:root@localhost:" )
"*The filename prefix used to open a file with `find-file-root'.")
(defvar find-file-root-history nil
"History list for files found using `find-file-root'.")
(defvar find-file-root-hook nil
"Normal hook for functions to run after finding a \"root\" file.")
(defun find-file-root ()
"*Open a file as the root user.
Prepends `find-file-root-prefix' to the selected file name so that it
maybe accessed via the corresponding tramp method."
(interactive)
(require 'tramp)
(let* (;; We bind the variable `file-name-history' locally so we can
;; use a separate history list for "root" files.
(file-name-history find-file-root-history)
(name (or buffer-file-name default-directory))
(tramp (and (tramp-tramp-file-p name)
(tramp-dissect-file-name name)))
path dir file)
;; If called from a "root" file, we need to fix up the path.
(when tramp
(setq path (tramp-file-name-path tramp)
dir (file-name-directory path)))
(when (setq file (read-file-name "Find file (UID = 0): " dir path))
(find-file (concat find-file-root-prefix file))
;; If this all succeeded save our new history list.
(setq find-file-root-history file-name-history)
;; allow some user customization
(run-hooks 'find-file-root-hook))))
(global-set-key [(control x) (control r)] 'find-file-root)
However that didn't make tramp works properly. When I invoke find-file-root
and enter the filename I want to open, emacs hangs up and doesn't open file.
Did anybody encounter similar problem?
--
kuvkir
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- problems with tramp,
Kirill Kuvaldin <=