Remove the open-this-file-as-other-user function
This commit is contained in:
parent
1849204a57
commit
31bb9c922f
@ -613,26 +613,6 @@ line first. Then jump to the actual end of the line."
|
|||||||
(message "File '%s' successfully removed" filename)))))
|
(message "File '%s' successfully removed" filename)))))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
*** Open this file as another user
|
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
(defun open-this-file-as-other-user (user)
|
|
||||||
"Edit current file as USER, using `tramp' and `sudo'.
|
|
||||||
|
|
||||||
If the current buffer is not visiting a file, prompt for a file
|
|
||||||
name."
|
|
||||||
(interactive "sEdit as user (default: root): ")
|
|
||||||
(when (string= "" user)
|
|
||||||
(setq user "root"))
|
|
||||||
(let* ((filename (or buffer-file-name
|
|
||||||
(read-file-name (format "Find file (as %s): "
|
|
||||||
user))))
|
|
||||||
(tramp-path (concat (format "/sudo:%s@localhost:" user) filename)))
|
|
||||||
(if buffer-file-name
|
|
||||||
(find-alternate-file tramp-path)
|
|
||||||
(find-file tramp-path))))
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
** Frame manipulation
|
** Frame manipulation
|
||||||
|
|
||||||
*** Hidden modeline mode
|
*** Hidden modeline mode
|
||||||
|
Loading…
Reference in New Issue
Block a user