From d89ea56c889ba732f90453e9b1ff63a8731f7283 Mon Sep 17 00:00:00 2001 From: Mitchel Humpherys Date: Mon, 14 Nov 2022 17:43:42 -0800 Subject: [PATCH 1/2] README.md: Generate with make-readme-markdown This adds support for generating our README.md from sudo-edit.el source itself using make-readme-markdown [1]. This is nice because, as per the MRM docs [1], "when you're writing an elisp module, the module itself should be the canonical source of documentation. But it's not very user-friendly or good marketing for your project to have an empty README.md that refers people to your source code, and it's even worse if you have to maintain two separate files that say the same thing." [1] https://github.com/mgalgs/make-readme-markdown --- Makefile | 8 ++++++ README.md | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 79 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 776afcb..1a7e97b 100644 --- a/Makefile +++ b/Makefile @@ -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 $< $@ 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: diff --git a/README.md b/README.md index 113af5d..a545c2f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,72 @@ -sudo-edit -========= +Emacs Logo +## 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": + + `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`. + +----- +
+Markdown README file generated by +make-readme-markdown.el +
From 1d1b1d6c73c5798d9d4778a85996abcf886fb36e Mon Sep 17 00:00:00 2001 From: Mitchel Humpherys Date: Mon, 14 Nov 2022 17:47:38 -0800 Subject: [PATCH 2/2] Make interactive command example more clear Hard to tell if that's a shell command or what. Prefix with M-x to make it clear that it's an interactive Emacs command. --- README.md | 2 +- sudo-edit.el | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a545c2f..8c5ab81 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ This package allows to open files as another user, by default "root": - `sudo-edit` + M-x sudo-edit Suggested keybinding: diff --git a/sudo-edit.el b/sudo-edit.el index 4202114..5735465 100644 --- a/sudo-edit.el +++ b/sudo-edit.el @@ -31,7 +31,7 @@ ;; This package allows to open files as another user, by default "root": ;; -;; `sudo-edit' +;; M-x sudo-edit ;; ;; Suggested keybinding: ;;