Questions tagged [read-only-mode]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
8
votes
2answers
586 views

Make buffer read-only on a per-file basis

I know I can set something like -*- mode: read-only-mode -*- inside a commentary and Emacs will open the corresponding file as read-only. My problem is that I still want to read files that include ...
7
votes
2answers
2k views

Flush all output in shell buffer (and *Messages* too)

Is there any easy way to flush all output in the shell buffer? Since recently (I believe Emacs 24.4 already has this) *shell* buffers aren't editable, they behave similar to how typical terminal would ...
7
votes
1answer
119 views

View a buffer in read-only mode in a window while editing it in another window

A buffer can be made write-protected by toggling the read-only mode via M-x toggle-read-only. Is there a way to make a buffer read-only in a window, while editing it in another window?
7
votes
2answers
130 views

Is there a hook that runs for all read only buffers

I want to enable show-trailing-whitespace for editable file and disable show-trailing-whitespace for read only files. I've tried (defun my/read-only-whitespace () (setq-local show-trailing-...
5
votes
3answers
538 views

How to exit read-only mode

I have a buffer in read-only mode. Killing the buffer and reopening it does not do the job while restarting emacs does. How to exit the read-only mode without restarting emacs?
4
votes
1answer
454 views

Is there a hook that runs when exiting read-only-mode?

I'd like to set some things (e.g., cursor shape) when in read-only-mode. That part is easy enough with (add-hook 'read-only-mode-hook (lambda() (setq-local cursor-type 'box))) Then ...
4
votes
2answers
323 views

how to open all files from specific path as read-only buffer

I am looking for a way to open all files from $MYPATH (for instance) as read-only buffer by default. And all rest of the files should be opened as normal buffer (I mean, not read-only buffer). Does ...
3
votes
1answer
580 views

Open some files with read-only mode

I want some files to be read-only when I open them. Maybe using some kind of header would work? Parsing the extension would work too but I want to apply to, for example, some ".txt" files so is not ...
3
votes
1answer
424 views

Is it possible to modify the emacs buffer with read-only text?

I am new to emacs lisp and emacs itself, coming from vim. I have seen such a nice feature in the idea: This is a mutable buffer with read-only text hints: type of a variable and a argument name in ...
3
votes
1answer
206 views

How can I edit read-only text after pasting?

I want to create a buffer where some parts are editable, but others are not. I'm using the read-only string property to do this, e.g.: (with-current-buffer (get-buffer-create "*scratch-demo*") (...
2
votes
2answers
528 views

Sentence in text is read only even though the buffer is not, how to fix this?

I am running emacs 24 with the Inferior Python mode for the interpreter. See below for all the minor modes in effect. Basically the problem is that particular lines (say at the prompt) remain read-...
2
votes
1answer
100 views

making specific regions of a buffer read-only

I know it's possible to make a "portion" of a buffer read-only. As an effect, the whole line becomes uneditable. What I would like it to make a specific region uneditable, for exemple a rectangle ...
2
votes
1answer
961 views

How to make a specific read-only buffer writable?

The readonly status of the current buffer can be toggled with (read-only-mode) or pressing C-x C-q but I intend to make a buffer which is not current, writable. The below is what I am using (with-...
2
votes
0answers
319 views

How to make ansi-term output read only?

When using ansi-term in line mode emacs lets you edit the buffer arbitrarily, not just after the last prompt. I'm trying to make it read only so I stop fudging with command output. The problem is all ...
1
vote
3answers
237 views

How can I copy text from read only buffer?

When read the org mode manual to provide support for the raised question. The contents in read-only buffer is causally need to be copied as reference here. Take the Org Capture Template as an ...
1
vote
1answer
111 views

Create a read-only buffer but which can be written to by Emacs-Lisp code

Is there a standard function to create an Emacs buffer in which we cannot type anything in (i.e. cannot be edited) but any running Elisp code can make changes to the buffer The following code does ...
1
vote
1answer
592 views

Add clickable text in read only buffer?

If i have a writable buffer, i can use this to insert hyperlink. (require 'button) (insert-button "foo" 'action (lambda (x) (find-file "~/test.py"))) But i have to add clickable text property to a ...
1
vote
1answer
123 views

Use write-region in read-only buffer

I am writing a custom function which is supposed to write selected text to some arbitrary file on the system. It does something like (defun write-region-to-file (&optional arg) (interactive "*...
1
vote
1answer
43 views

Read-only text stops working after a while

This is a very strange issue and its cause is hard to determine. I often leave Emacs open for days, or even weeks at a time. My current emacs-uptime is 9 and a half days. That's pretty normal and ...
1
vote
1answer
158 views

“Recentf”: Open file from *Open Recent* Buffer, but read-only

I'm using recentf-mode, part of Emacs. I'd like to open a file from the Open Recent buffer read-only, like if I had opened it via C-x C-r. Maybe if you type C-u in the Open Recent buffer before ...
1
vote
0answers
48 views

Dired-narrow view disappears after using dired-toggle-read-only

I use the package dired-narrow (which I have bound to C-x /) together with dired-toggle-read-only (C-x C-q). However, if I press C-c C-c to commit my changes after using dired-toggle-read-only this ...
0
votes
2answers
128 views

Make parts of a working buffer read-only

Is it possible to make only parts of a buffer read-only? Say I have set two marks or line-numbers in the buffer and I would like to make everything between those two marks or line-numbers as read-...
0
votes
1answer
63 views

How to set key binding for read-only-mode? in order to simplify cursor movement

moving point command: next-line, previous-line, forward-char, backward-char, etc. How to omit Ctrl key in read-only-mode? How can I combine with read-only-mode-hook to automatically enable keybind ...
0
votes
0answers
65 views

ECB Never ask to make buffer read-only

In my current Emacs configuration, when ECB is active and I find-file in a non-existing directory, I keep getting interrupted to answer the following question in the echo-area: File /tmp/new-foo/bar....