Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ compile: $(OBJS)
test:
$(CASK) exec $(EMACSBATCH) -L . -l sudo-edit-test.el -f ert-run-tests-batch-and-exit

README.md: make-readme-markdown.el sudo-edit.el
$(CASK) exec $(EMACSBATCH) --script $< <sudo-edit.el >$@ 2>/dev/null

make-readme-markdown.el:
$(WGET) -q -O $@ "https://raw.github.com/mgalgs/make-readme-markdown/master/make-readme-markdown.el"

.INTERMEDIATE: make-readme-markdown.el

clean: clean-elc

clean-elc:
Expand Down
74 changes: 71 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,72 @@
sudo-edit
=========
<a href="https://github.com/nflath/sudo-edit"><img src="https://www.gnu.org/software/emacs/images/emacs.png" alt="Emacs Logo" width="80" height="80" align="right"></a>
## sudo-edit.el
*Open files as another user*

Utilities for opening files with sudo
---
[![MELPA](http://melpa.org/packages/sudo-edit-badge.svg)](http://melpa.org/#/sudo-edit)
[![MELPA Stable](http://stable.melpa.org/packages/sudo-edit-badge.svg)](http://stable.melpa.org/#/sudo-edit)

This package allows to open files as another user, by default "root":

M-x sudo-edit

Suggested keybinding:

(global-set-key (kbd "C-c C-r") 'sudo-edit)

Installation:

To use this mode, put the following in your init.el:

(require 'sudo-edit)



### Customization Documentation

#### `sudo-edit-user`

Default user to edit a file with `sudo-edit`.

#### `sudo-edit-local-method`

Tramp method to use with `sudo-edit` for local files.

#### `sudo-edit-remote-method`

Tramp method to use with `sudo-edit` for remote files.

### Function and Macro Documentation

#### `(sudo-edit-set-header)`

*Display a warning in header line of the current buffer.
This function is suitable to add to `find-file-hook` and `dired-file-hook`.

#### `(sudo-edit-tramp-get-parameter VEC PARAM)`

Return from tramp VEC a parameter PARAM.

#### `(sudo-edit-out-of-band-ssh-p FILENAME)`

Check if tramp FILENAME is a out-of-band method and use ssh.

#### `(sudo-edit-filename FILENAME USER)`

Return a tramp edit name for a FILENAME as USER.

#### `(sudo-edit &optional ARG)`

Edit currently visited file as another user, by default `sudo-edit-user`.
With a prefix ARG prompt for a file to visit. Will also prompt
for a file to visit if current buffer is not visiting a file.

#### `(sudo-edit-find-file FILENAME)`

Edit FILENAME as another user, by default `sudo-edit-user`.

-----
<div style="padding-top:15px;color: #d0d0d0;">
Markdown README file generated by
<a href="https://github.com/mgalgs/make-readme-markdown">make-readme-markdown.el</a>
</div>
2 changes: 1 addition & 1 deletion sudo-edit.el
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

;; This package allows to open files as another user, by default "root":
;;
;; `sudo-edit'
;; M-x sudo-edit
;;
;; Suggested keybinding:
;;
Expand Down