Skip to main content

Questions tagged [read-only-mode]

Filter by
Sorted by
Tagged with
0 votes
1 answer
31 views

`kill-words` and related commands erase text in read-only buffers

Killing commands, such as kill-word, have started to erase text in read-only buffers. For example, invoking kill-word in dired-mode or mu4e-headers-mode will delete words from a filename or from an ...
Pablo's user avatar
  • 330
0 votes
0 answers
53 views

How to turn on `read-only-mode` when running a command in `comint` buffers and turn off it when the command is finished?

I'd like to prevent all user inputs when a command is running in comint-like buffers (created by shell, run-python etc.) by enabling read-only-mode when I hit enter to run the command and disabling it ...
Saddle Point's user avatar
0 votes
1 answer
50 views

How to make my own evil(?) mode? view mode while debugging?

I'd like to switch between two modes source editing mode debug mode (where source is read-only, and you can use all other regular emacs commands + some debug related hot keys (such as n for next) ...
eugene's user avatar
  • 529
0 votes
0 answers
31 views

Mode to automatically open generated files

I'm looking for a mode or hook that automatically opens a generated in read-only and auto-revert-mode mode alongside an associated with a source file. For instance when calling dmd -vgc-ast on a .d-...
Nordlöw's user avatar
  • 527
1 vote
0 answers
58 views

How to open file with it being editable but not writeable?

I teach, and I like to use real files as examples in class. I want to be able to edit the buffer to show student things, but I don't want to risk accidentally writing the changes on the file. What I ...
elPolloDiablo's user avatar
1 vote
2 answers
216 views

Read-only mode gets in the way when query-replacing text in multiple files

I am searching and replacing text within all marked files in a Dired buffer, as per this post: https://emacs.stackexchange.com/a/9497/37866 I am successful until the point where it finds the first ...
marsh's user avatar
  • 11
1 vote
1 answer
69 views

modify text properties in read-only buffer

I am annotating parts of text in an emacs buffer using text properties. The code I am using looks something like this: (set-text-properties beg end nil) ; clear properties (add-face-text-property ...
Ott Toomet's user avatar
1 vote
1 answer
376 views

How to disable evil insert key in read only mode

I want to disable evil insert key such as a, i, o in read-only mode (keep navigation key such as j and k), my idea is to disable these keys in local buffer when enabling read-only mode and enable ...
Ynjxsjmh's user avatar
  • 313
0 votes
1 answer
81 views

org-fill-paragraph doesn't comply with org-list-allow-alphabetical

Given that (setq org-list-allow-alphabetical t). Consider the following example, where | stands for the point: 1. |Lorem Ipsum 1. Lorem Ipsum 1. |Lorem Ipsum a. Lorem Ipsum While org-fill-...
Firmin Martin's user avatar
1 vote
1 answer
120 views

Read only mode in mu4e

Is there a "read only mode" in mu4e? I recently had the case to use mu4e to read emails from a system using thunderbird with maildir. I noticed that for example a file called somemessage.eml ...
student's user avatar
  • 1,179
0 votes
1 answer
530 views

Emacs open all buffers in read only mode

This problem is driving me crazy. Emacs open all buffers including new ones in read only mode (yes, I know that I can do C-x C-q). I've tried everything including: Delete .emacs.d/ Delete .config/...
guasian's user avatar
2 votes
2 answers
432 views

Cannot edit ".gitignore" due to strange errors and read-only switched on

A new error has occurred with a recent upgrade to Emacs 27.1. I'm trying to edit .gitignore and get the following error: *ERROR*: Unlocking file: Invalid argument, <directory>/.gitignore To ...
user avatar
0 votes
2 answers
127 views

How can I more easily see interactively whether `overwrite-mode` is enabled?

I am sick of pressing Insert instead of Backspace and running into problems in certain modes. How can I fix it? One option is to have some visual indication that overwrite mode has been activated, so ...
ruby_object's user avatar
0 votes
1 answer
132 views

Asterisk in interactive specification

Just when is it appropriate to put the asterisk * into the interactive spec of a command function? The elisp manual says the effect is to cause an error if the command is attempted in a read only ...
q.undertow's user avatar
2 votes
0 answers
99 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 ...
Edman's user avatar
  • 1,229
9 votes
3 answers
7k 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?
Viesturs's user avatar
  • 865
1 vote
1 answer
175 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 "*...
Pommy's user avatar
  • 124
2 votes
1 answer
490 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 ...
dongli si's user avatar
2 votes
3 answers
1k 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 ...
Alice's user avatar
  • 219
1 vote
2 answers
444 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-...
smilingbuddha's user avatar
1 vote
1 answer
669 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 ...
smilingbuddha's user avatar
2 votes
1 answer
289 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 ...
loukios's user avatar
  • 865
1 vote
1 answer
64 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 ...
GDP2's user avatar
  • 1,350
7 votes
1 answer
192 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?
AlQuemist's user avatar
  • 175
9 votes
2 answers
1k 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 ...
StupidKris's user avatar
7 votes
2 answers
351 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-...
Moyamo's user avatar
  • 398
4 votes
1 answer
1k 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 ...
VP.'s user avatar
  • 197
5 votes
1 answer
2k 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 ...
hhaamm's user avatar
  • 305
7 votes
1 answer
4k 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-...
myTerminal's user avatar
4 votes
1 answer
770 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 ...
Ista's user avatar
  • 1,208
3 votes
1 answer
252 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*") (...
Wilfred Hughes's user avatar
1 vote
1 answer
228 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 ...
Keks Dose's user avatar
  • 538
1 vote
1 answer
997 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 ...
Chillar Anand's user avatar
1 vote
0 answers
123 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....
user avatar
2 votes
2 answers
976 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-...
Pushpendre's user avatar
2 votes
0 answers
483 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 ...
Joseph Garvin's user avatar
9 votes
2 answers
855 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 ...
shackra's user avatar
  • 2,812
9 votes
2 answers
4k 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 ...
wvxvw's user avatar
  • 11.5k