Related to How to "Disable Editing" of a document in LyX?: Is it possible to open documents as read-only by default in LyX?

While scrolling through a mostly finished document, or when copying contents from another document, it is easy to accidentially change the contents. For instance I may want to to a forward search and therefore type M-x forward-search, but accidentially start typing xforward-search instead. Under time constraints it is easy to accidentially miss the extra characters added.

LyX allows a "disable editing" state as described in the linked question, and meanwhile also has it in the menubar.

But I would prefer for "Disable editing" / read-only mode to be the default state of LyX documents.

Is this possible?


You can open a LyX file read-only with the following command:

lyx -x "buffer-toggle-read-only" file.lyx

I just tested on Ubuntu with LyX 2.3.3 and it worked well for me.

If you prefer to not use the command-line, it should be easy to set this as the default, or as an alternative. On Ubuntu, I would just edit the lyx.desktop file. Or you can create a separate entry, e.g., "LyX-readonly", so that in your desktop environment whenever you open a LyX file you can choose between "LyX" and "LyX-readonly". Let me know if you are using Ubuntu (or more generally Gnome) and I can give more instructions.

For Microsoft Windows and macOS, there must be a way as well but I am not familiar with it. [if anyone knows, please feel free to edit this answer]

| improve this answer | |
  • Sadly not a complete solution. Opening documents from the command line or by clicking them in a file explorer is the exception for me. I usually open documents be <kbd>Ctrl+O</kbd>, File > Recent, restoring the last session (command affects only one of the buffers) or clicking "edit child document" on child document insets. All of these will open the document without "disable editing" enabled. – kdb Sep 12 '19 at 9:50
  • @kdb thanks for the details about your workflow. I can see how this solution doesn't work for you. – scottkosty Sep 12 '19 at 13:29

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.