unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Help requirements for setting buffer-read-only to nil
@ 2023-09-10 20:15 Heime
  0 siblings, 0 replies; only message in thread
From: Heime @ 2023-09-10 20:15 UTC (permalink / raw)
  To: Heime via Users list for the GNU Emacs text editor

Because a help buffer is always read-only, one has to change buffer-read-only to nil.

But consider the two functions below. maces1 should be the appropriate implementation 
because it set buffer-read-only to nil twice. One for the function maces1 and the other 
for the defined lambda function.

Yet, the version maces2 does not give any errors if I only retain (setq buffer-read-only nil) 
only inside the lambda function. Why is this so ? Shouldn't one change buffer-read-only to nil
twice ?

(defun maces1 ()
  "Prints information about frames."
  (interactive)

  (with-help-window (help-buffer)
    (setq buffer-read-only nil)

    (insert-button "[1]" 'action
      (lambda (button)
        (setq buffer-read-only nil)
        (insert "> Graphic Organisation \n\n")
        (setq buffer-read-only t)))

    (insert " Graphic Organisation") 
    (setq buffer-read-only nil)))

;;------------- 

(defun maces2 ()
  "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") ))







^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-09-10 20:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-10 20:15 Help requirements for setting buffer-read-only to nil Heime

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).