5

I use GNU Emacs 24.3.1 and want to create a new buffer and execute that directly without using terminal and chmod. Is there a way to change the permission of a saved buffer (file) directly from emacs?

  • 2
    A new buffer is not a file, unless you save it to the hard drive and create a file. See the function set-file-modes. And to see an implementation of that function, have a look at dired-do-chmod. – lawlist Dec 8 '16 at 5:27
10

The easy to remember (if you are used to unix) way is

M-x chmod

which is an alias of set-file-modes

5

The dired way

Create file C-x c-f

Open this file in dired (you need to load dired-x for this keybinding): C-x C-j

Toggle read only: C-x C-q and change e.g. the permission attributes to x (this is wdired mode ;-).

Activate your changes: C-x C-q.

Type RET to edit your file.

Alternatively without dired-x

Enter dired: C-x d

Create your file: M-! > your_file.name RET

Refresh the dired buffer: g

Search the file and type Dired-do-chmode M

Type RET to edit your file.

  • Could you edit this to present the defaults first and the extensions after? I'm mashing keys over here and nothing is working. – daveloyall Nov 8 at 22:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.