Search code examples
emacsmarkdownreadonly-attribute

Is there a way in Emacs to fill a paragraph containing some read-only characters?


In Emacs I am using cm-mode with markdown buffers. cm-mode inserts a few read-only characters to indicate document changes. When I issue fill-paragraph the fill is aborted with the message read-only Text.

Is there a way to fill a paragraph containing a few read-only characters? (I.e. after the fill the read-only characters should be read-only again.)


Solution

  • Bind or temporarily set inhibit-read-only to non-nil. C-h v tells us:

    inhibit-read-only is a variable defined in C source code.

    Its value is nil

    Documentation:

    Non-nil means disregard read-only status of buffers or characters.

    If the value is t, disregard buffer-read-only and all read-only text properties. If the value is a list, disregard buffer-read-only and disregard a read-only text property if the property value is a member of the list.