bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

condition-case affecting read-only text


From: Alex Schroeder
Subject: condition-case affecting read-only text
Date: 19 Feb 2001 23:41:31 +0100
User-agent: Gnus/5.090001 (Oort Gnus v0.01) Emacs/20.7

I have difficulties formulating...  Therefore, consider this:

(with-temp-buffer
  (insert "XXX")
  (put-text-property (point-min) (point-max) 'read-only t)
  (goto-char (point-min))
  (re-search-forward "X")
  (replace-match "-")
  (buffer-substring-no-properties (point-min) (point-max)))

An error is raised.  Great.

Now, consider this:

(with-temp-buffer
  (insert "XXX")
  (put-text-property (point-min) (point-max) 'read-only t)
  (goto-char (point-min))
  (re-search-forward "X")
  (condition-case nil
      (replace-match "-")
    (error))
  (buffer-substring-no-properties (point-min) (point-max)))

The replace-match will insert a hyphen eventhough the entire buffer is
marked read-only.  I expect there to be no error, but I also expect
there to be no modification to the buffer content.  This is a bug.

Alex.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]