Giter VIP home page Giter VIP logo

auto-sudoedit's Introduction

MELPA

auto-sudoedit

English

Summary

A package that automatically reopens files with sudo.

When opening a file that requires root authority, you can open the file via sudo using tramp, but it is troublesome to input it one by one.

This is a package that will automatically reopen with sudo if it cannot write to the opened file or directory.

How to install

Place it in melpa or directly downloaded by PATH.

If downloaded directly

(require 'auto-sudoedit)

auto-sudoedit works when minor mode is enabled.

(auto-sudoedit-mode 1)

If you enable minor mode, When you open a file that requires root privileges, It will be reopened automatically.

Recommend

If you find the following message depressing

Autosave file on local temporary directory, do you want to continue? (y or n) y

On a non-shared PC, you can allow some security risk and use. Set tramp-allow-unsafe-temporary-files to t.

Japanese

概要

自動的にsudoでファイルを開き直すパッケージです。

root権限が必要なファイルを開く場合。 trampを使ってsudo経由でファイルを開くことが出来ますが、 一々入力するのは面倒くさいです。

これは開いたファイルかディレクトリに書き込みができない場合、 自動的にsudoで開き直してくれるパッケージです。

How to install

melpaか直接ダウンロードでPATHが通った場所に置きます。

直接ダウンロードした場合は、

(require 'auto-sudoedit)

auto-sudoeditはマイナーモードが有効の時に動きます。

(auto-sudoedit-mode 1)

マイナーモードを有効にしておけば、 root権限が必要なファイルを開いたときに、 自動で開き直されます。

推奨

もし以下のメッセージが鬱陶しいならば、

Autosave file on local temporary directory, do you want to continue? (y or n) y

共有してないPCでは多少のセキュリティリスクを許容して、 tramp-allow-unsafe-temporary-filestにするのをオススメします。

auto-sudoedit's People

Contributors

amake avatar c0001 avatar dragoncraft89 avatar lemonbreezes avatar ncaq avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

auto-sudoedit's Issues

OCaml環境でのsmart-jump-goと相性が悪い

システムライブラリに飛んだ時、リードオンリーなので開き直されるのは仕方ないとして、smart-jump-goで飛んだ場合何故か /root/ をtrampで開いてしまう。
merlin-locateで直接飛んだ時は問題なし。

Feature upstreaming

Hi 👋
I did some customizations for my use-case: Dragoncraft89@7c70781

Now, I'm wondering what parts you'd like me to contribute back upstream. Here's a list of my changes:

Bug fixes

  • Sudo syntax over tramp was wrong, which made reopen as sudo trying to open an invalid file when using tramp

Features

  • advice-add doesn't work when you use a different find-file function (such as ido-find-file). This may be the problem observed in #11 . I solved this by using the find-file-hook instead.
  • Added a y-or-no-p query before reopening the buffer. This allows you to open files when you don't have sudo permissions (e.g. via tramp on other people's machines)
  • Added auto-detection of the user owning a file. Therefore auto-sudoedit can reopen files as other users beside root (e.g. as www-data)

Just tell me whether you'd like me to upstream some of these changes and I'll happily prepare a pull request

親ディレクトリに書き込めるが子ディレクトリに書き込めない形式に対応する

#3 でとりあえずディレクトリが存在しない方に寄せるようにしたが,
/var/tmp/systemd-private-45f10fa9b0de45f48a257a8e512c83c0-rtkit-daemon.service-FagvJXのように親ディレクトリが書き込めるが子ディレクトリが書き込めないケースで問題が発生する.
何の関数を使うように変更すれば良いだろうか.
単に場合分けするしかない?

Is the concept corect?

My apologies, I may just not understand the idea behind auto-sudoedit, but I do have difficulties understanding the idea behind it:

  • I open a file that is rw-r--r-- root:root as user foo. Emacs opens it.
  • I try to edit it, but emacs says it's only rw for root, foo can't edit it.
  • I try to save it (without editing), emacs says "no need to save, no changes"

Shouldn't auto-sudoedit instead intercept the "find-file" function and say "hey, you won't be able to edit/save this file, do you want to open it as root via tramp instead"?

`auto-sudoedit-sudoedit` invocation fails

Invoking auto-sudoedit-sudoedit fails with this error:

Symbol’s function definition is void: auto-sudoedit-current-path

auto-sudoedit-current-path was removed in #6, but is still referenced by auto-sudoedit-sudoedit.

sudo-edit as a backend

Nice idea, but I think it'd be better to use sudo-edit as a backend engine, because it has more checks and covers many more cases of filenames.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.