all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: emacs-devel@gnu.org
Subject: (insert ?\n) spuriously calls before-change-functions twice. Help!
Date: Tue, 5 Jan 2010 11:09:54 +0000	[thread overview]
Message-ID: <20100105110954.GA2639@muc.de> (raw)

Hi, Emacs.

The following is a partial diagnosis of a bug reported by an AWK user.
(AWK Mode throws an error when require-final-newline is t).

In emacs -Q, in an AWK buffer, do M-: (insert ?\n).  The following
happens:
1. before-change-functions is invoked with arguments (beg end) (16 16).
2. The NL is inserted at position 16.
3. before-change-functions is invoked with arguments (16 17).
This all happens before after-change-functions is invoked.

However, M-: (insert "\n") just does the Right Thing.

This second invocation of before-change-functions is surely a bug.  I
can make this happen in a Fundamental Mode buffer in my normal Emacs
session, but not in Emacs -Q.

What is causing this spurious invocation?  Does anybody have any idea?
I've perused the C source for `insert', without finding anything.  Could
it be anything to do with text-properties?

Thanks for the help!

-- 
Alan Mackenzie (Nuremberg, Germany).




             reply	other threads:[~2010-01-05 11:09 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-05 11:09 Alan Mackenzie [this message]
2010-01-05 15:22 ` (insert ?\n) spuriously calls before-change-functions twice. Help! Stefan Monnier
2010-01-05 17:31   ` Alan Mackenzie
2010-01-05 19:52     ` Stefan Monnier
2010-01-06 13:05       ` Alan Mackenzie
2010-01-06 14:33         ` Stefan Monnier
2010-01-19 13:23       ` Alan Mackenzie
2010-01-19 15:11         ` Chong Yidong
2010-01-19 17:11           ` Alan Mackenzie
2010-01-19 18:02             ` Chong Yidong
2010-01-19 22:30               ` Alan Mackenzie

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

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

  git send-email \
    --in-reply-to=20100105110954.GA2639@muc.de \
    --to=acm@muc.de \
    --cc=emacs-devel@gnu.org \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.