all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: rms@gnu.org
Cc: emacs-devel@gnu.org
Subject: Re: insert-file-contents and format-decode
Date: Sun, 24 Jun 2007 12:30:07 +0200	[thread overview]
Message-ID: <467E47AF.1080702@gmx.at> (raw)
In-Reply-To: <E1I2AJt-0006pb-Hy@fencepost.gnu.org>

 >     (1) The `format-decode' ("round-trip" as the new Elisp manual entry
 >     calls them) based functions are Lisp functions, may change the buffer,
 >     and may call the after-change functions for what they do.  They precede,
 >     within `insert-file-contents', the after-change-functions call.
 >
 > That sounds like a bug to me.  I guess signal_after_change
 > should be done before `format-decode'.
 >
 > Does anyone disagree?

`format-decode' is similar to character decoding and eol conversion.  We
don't run `after-change-functions' for decoding characters or converting
line ends.

 > Can you test such a change?

It would have to be tested against the `after-change-functions' of many
major and minor modes (which holds for testing the present behavior as
well).

 >     (2) Calling `after-change-functions' from within `format-decode' or
 >     `after-insert-file-functions' seems to me highly risky.  Personally, I'd
 >     never trust any of them if they don't use `inhibit-modification-hooks'.
 >
 > I won't say you are wrong, but I don't see why that would be so.
 > Can you explain?

People who write after-change functions usually don't think in terms of
raw text.  They think in terms of fully decoded buffer text.

 >     (3) Not calling `after-change-functions' after performing all functions
 >     in `after-insert-file-functions' may mean, for example, not executing
 >     `font-lock-after-change-function' after inserting the contents of some
 >     file in the current buffer.
 >
 > No, because if `after-insert-file-functions' change the buffer,
 > the primitives they use will themselves call signal_after_change.

Then we must tell people to not inhibit such hooks while running the
primitives.

An aside: `format-decode' has

   (let ((mod (buffer-modified-p))
         ...
	  ;; Don't record undo information for the decoding.
         ...
       (set-buffer-modified-p mod))

hence it does not change the buffer-modified state.  It's somehow
unnatural to run `after-change-functions' and keep the buffer-modified
state unchanged at the same time.  The comment about not recording undo
information suggests that someone has been considering (but not
implementing) this.  If it's implemented it would probably have to be
done as in `after-insert-file-set-coding' (very tedious).  And we'd have
to decide and document how `after-insert-file-functions' shall handle
this.  If it's not implemented, `undo' may reveal the raw file contents
which seems worse.

  reply	other threads:[~2007-06-24 10:30 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-06 14:06 insert-file-contents and format-decode martin rudalics
2007-06-08  7:12 ` Richard Stallman
2007-06-17 13:34   ` martin rudalics
2007-06-18 21:31     ` Richard Stallman
2007-06-19  7:50       ` martin rudalics
2007-06-23 18:26         ` Richard Stallman
2007-06-23 18:26         ` Richard Stallman
2007-06-24 10:30           ` martin rudalics [this message]
2007-06-25 13:19             ` Richard Stallman
2007-06-26  6:54               ` martin rudalics
2007-06-26 22:48                 ` Richard Stallman
2007-06-27  6:33                   ` martin rudalics
2007-06-27 19:50                     ` Richard Stallman
2007-06-30 11:11                       ` martin rudalics
2007-07-01  0:30                         ` Richard Stallman
2007-07-02  8:14                           ` martin rudalics
2007-07-03  4:24                             ` Richard Stallman
2007-07-03  6:47                               ` martin rudalics
2007-07-04  3:43                                 ` Richard Stallman
2007-06-26 22:48                 ` Richard Stallman
2007-06-27  6:34                   ` martin rudalics
2007-06-27 23:43                     ` Richard Stallman
2007-06-30 11:32                       ` martin rudalics
2007-07-01  0:30                         ` Richard Stallman
2007-07-02  8:27                           ` martin rudalics
2007-07-03  4:24                             ` Richard Stallman
2007-07-03  6:43                               ` martin rudalics
2007-08-06 14:22                                 ` Richard Stallman

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=467E47AF.1080702@gmx.at \
    --to=rudalics@gmx.at \
    --cc=emacs-devel@gnu.org \
    --cc=rms@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.