diff options
| author | David Aspinall | 2002-08-31 00:11:19 +0000 |
|---|---|---|
| committer | David Aspinall | 2002-08-31 00:11:19 +0000 |
| commit | 50bfed262794f034c6cb48f978a9e48ffc2a05a3 (patch) | |
| tree | ce725b127a00a0c095fa844eab72df198ec338f0 | |
| parent | 3117ba9ac2f2416e8f246ae777ed03023ba0c924 (diff) | |
Test inhibit-read-only
| -rw-r--r-- | generic/span-overlay.el | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/generic/span-overlay.el b/generic/span-overlay.el index d1ff8f6b..41097447 100644 --- a/generic/span-overlay.el +++ b/generic/span-overlay.el @@ -64,17 +64,22 @@ elements = S0 S1 S2 .... [tl-seq.el]" "Return SPAN's value for property PROPERTY." (overlay-get span name)) -;; This function is problematical with font-lock turned on. (defun span-read-only-hook (overlay after start end &optional len) - (error "Region is read-only")) + (unless inhibit-read-only + (error "Region is read-only"))) (defun span-read-only (span) "Set SPAN to be read only." - ;; Unfortunately, this function is called on spans which are - ;; detached from a buffer, which gives an error here, since - ;; text-properties are associated with text in a particular - ;; buffer position. So we use the read only hook instead. + ;; This function may be called on spans which are detached from a + ;; buffer, which gives an error here, since text-properties are + ;; associated with text in a particular buffer position. So we use + ;; our own read only hook. ;(add-text-properties (span-start span) (span-end span) '(read-only t))) + ;; 30.8.02: tested using overlay-put as below with Emacs 21.2.1, + ;; bit this seems to have no effect when the overlay is added to + ;; the buffer. (Maybe read-only is only a text property, not an + ;; overlay property?). + ;; (overlay-put span 'read-only t)) (set-span-property span 'modification-hooks '(span-read-only-hook)) (set-span-property span 'insert-in-front-hooks '(span-read-only-hook))) |
