unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Magne Ingebrigtsen <larsi@gnus.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: New text property: `inhibit-read-only'
Date: Mon, 17 Nov 2014 11:20:31 +0100	[thread overview]
Message-ID: <m361eeb028.fsf@stories.gnus.org> (raw)
In-Reply-To: <jwvbno6sb4x.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Sun, 16 Nov 2014 23:30:14 -0500")

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> What is different that the solution used in Custom buffers can't be used
> or doesn't work well in eww?

Custom buffers uses a bewildering number of hooks, bindings and
... mysteries to achieve this pretty trivial thing.  It binds all
inserting commands to `Custom-no-edit' (and then has an overlay over the
text input bits that has a different keymap).

To inhibit deletions, it uses

(add-hook 'before-change-functions 'widget-before-change nil t)

that checks stuff in some contexts

Debugger entered--Lisp error: (text-read-only "Attempt to change text outside editable field")
  signal(text-read-only ("Attempt to change text outside editable field"))
  widget-before-change(3 6)
  delete-region(3 6)

Hm.  After that backtrace I'm now able to delete text in the Custom
buffer.

Anyway, with a new buffer `C-k' again fails as it should with

Debugger entered--Lisp error: (text-read-only #<buffer *Customize Apropos*>)
  signal(text-read-only (#<buffer *Customize Apropos*>))
  kill-region(124 126 region)

but I'm not quite sure how that's set up.

And and.

It just seems ridiculous to me that all modes that need this simple
thing (a read-only buffer with some bits that are editable) would have
to jump through all these vaguely defined hoops.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



      parent reply	other threads:[~2014-11-17 10:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-16 22:45 New text property: `inhibit-read-only' Lars Magne Ingebrigtsen
2014-11-17  4:30 ` Stefan Monnier
2014-11-17  7:47   ` Lars Brinkhoff
2014-11-17 10:20   ` Lars Magne Ingebrigtsen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m361eeb028.fsf@stories.gnus.org \
    --to=larsi@gnus.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).