diff options
author | João Távora <joaotavora@gmail.com> | 2023-04-07 19:40:27 +0100 |
---|---|---|
committer | João Távora <joaotavora@gmail.com> | 2023-04-07 19:40:27 +0100 |
commit | 7239098ad436a10afddce117ab224189f6bd6b7f (patch) | |
tree | 0220c83eb7f6ecd0fcd325bfcd2d8cc9c7d0155d | |
parent | 3aedd5c920560fe6456a860a900be40a35e850d2 (diff) | |
download | emacs-7239098ad436a10afddce117ab224189f6bd6b7f.tar.gz |
Eglot: be careful about gfm-view-mode read-only buffers
Although in most situations this doesn't error, it's only because of
the very wide binding of inhibit-read-only in jsonrpc--process-filter.
That binding will soon be narrowed, so better not rely on it.
Originally reported in
https://github.com/joaotavora/eglot/discussions/1202.
* lisp/progmodes/eglot.el (eglot--format-markup): Inhibit
read-only before touching buffer potentially in gfm-view-mode.
-rw-r--r-- | lisp/progmodes/eglot.el | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index db57b122a94..da7e53730e7 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -1672,9 +1672,10 @@ Doubles as an indicator of snippet support." (ignore-errors (delay-mode-hooks (funcall mode))) (font-lock-ensure) (goto-char (point-min)) - (while (setq match (text-property-search-forward 'invisible)) - (delete-region (prop-match-beginning match) - (prop-match-end match))) + (let ((inhibit-read-only t)) + (while (setq match (text-property-search-forward 'invisible)) + (delete-region (prop-match-beginning match) + (prop-match-end match)))) (string-trim (buffer-string)))))) (define-obsolete-variable-alias 'eglot-ignored-server-capabilites |