emacs-devel
[Top][All Lists]
Advanced

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

Re: Inhibiting read-only


From: Jambunathan K
Subject: Re: Inhibiting read-only
Date: Wed, 19 Jun 2013 22:47:39 +0530
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Lars Magne Ingebrigtsen <address@hidden> writes:

> Jambunathan K <address@hidden> writes:
>
>> Mark editable fields with  (... 'readonly 'editable).
>
> So you're suggesting making the buffer read-onlu, but then putting
> 'read-only 'editable on the input fields?  And then setting
> `inhibit-read-only' to `(editable)' in that buffer?  If that works,
> that's pretty twisty.  :-)

How about something like this to make first line editable and second and
third lines not editable.

(with-current-buffer (generate-new-buffer  "read-only")
  (pop-to-buffer (current-buffer))
  (insert "first line\nsecond line\nthird line")

  (add-text-properties (point-min) (point-max) '(read-only read-only))

  (let ((inhibit-read-only '(read-only)))
    (goto-char (point-min))                   
    (add-text-properties (point-at-bol) (point-at-eol) '(read-only
                                                         editable)))
  (setq inhibit-read-only '(editable)))



reply via email to

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