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

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

Re: Making a read-only buffer writable


From: Philip Kaludercic
Subject: Re: Making a read-only buffer writable
Date: Tue, 12 Sep 2023 10:06:57 +0000

Heime <heimeborgia@protonmail.com> writes:

> Have been reading the documentation, any time one wants to write (insert) 
> into a 
> read-only buffer, one has to make it writable.  Doesn't matter when that time 
> is. 
> If it's read-only you need to make it writable to write into it. 
>
> Then I wonder how it is possible for the following function 
> to call  
>
> (insert-button "[1]"
>
> and
>
> (insert " Graphic Organisation")
>
> without calling 
>
> (setq buffer-read-only nil)
>
> first, just after  
>
> (with-help-window (help-buffer)
>
> -------------
>
> (defun maces ()
>   "Prints information about frames."
>   (interactive)
>
>   (with-help-window (help-buffer)
>
>     (insert-button "[1]" 'action
>       (lambda (button)
>         (setq buffer-read-only nil)
>         (insert "> Graphic Organisation \n\n")
>         (setq buffer-read-only t)))
>     (insert " Graphic Organisation") ))

The usual approach would be to do something like

(let ((inhibit-read-only t))
  (insert "> Graphic Organisation \n\n"))



reply via email to

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