all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [Bug] Issues with format.el: coding system, byte/char confusion
@ 2003-04-07 17:30 Wedler, Christoph
  2003-04-08  6:46 ` Richard Stallman
  0 siblings, 1 reply; 2+ messages in thread
From: Wedler, Christoph @ 2003-04-07 17:30 UTC (permalink / raw)


[Test using Emacs-21.2.95.1, with head revision of: format.el,v 1.40,
fileio.c,v 1.479]

There are some issues with format.el:

 1. Shouldn't `format-annotate-function' also save the buffer-local
    variable `buffer-file-coding-system' (as it does with
    `selective-display' and `enable-multibyte-characters' since v1.38)?

 2. To compute the coding system of the current buffer, Emacs adds
    function `after-insert-file-set-buffer-file-coding-system' to
    `after-insert-file-functions'.  Is this correct?

    In the DEFUN for "insert-file-contents" in fileio.c, Emacs first
    calls Qformat_decode and then the functions in
    `after-insert-file-functions'.  In other words, we have the
    following call sequence:

     - decode functions using format.el,
     - decode functions in `after-insert-file-functions' before
       `after-insert-file-set-buffer-file-coding-system',
     - Emacs determines the coding system with
       `after-insert-file-set-buffer-file-coding-system',
     - decode functions in `after-insert-file-functions' after
       `after-insert-file-set-buffer-file-coding-system'

    I would assume that the coding system must be determined before any
    of the decode functions have been executed...  Or does it simply not
    matter when `after-insert-file-set-buffer-file-coding-system' is
    called?

 3. The docstring of `after-insert-file-functions' includes "It should
    return the new byte count", whereas `format-decode' returns the
    new char count.

    In the DEFUN for "insert-file-contents" in fileio.c, the invocations
    of Qformat_decode and the functions in Vafter_insert_file_functions
    (and the use of the return value `inserted') look quite similar...

    Which is correct for both: byte count or char count?  (I hope the
    latter, you might want to check
    `after-insert-file-set-buffer-file-coding-system' in this case.)

- Christoph

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Bug] Issues with format.el: coding system, byte/char confusion
  2003-04-07 17:30 [Bug] Issues with format.el: coding system, byte/char confusion Wedler, Christoph
@ 2003-04-08  6:46 ` Richard Stallman
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Stallman @ 2003-04-08  6:46 UTC (permalink / raw)
  Cc: emacs-devel

     1. Shouldn't `format-annotate-function' also save the buffer-local
	variable `buffer-file-coding-system' (as it does with
	`selective-display' and `enable-multibyte-characters' since v1.38)?

That seems plausible, but one ought to test it.

     2. To compute the coding system of the current buffer, Emacs adds
	function `after-insert-file-set-buffer-file-coding-system' to
	`after-insert-file-functions'.  Is this correct?

Yes.

	 - decode functions using format.el,
	 - decode functions in `after-insert-file-functions' before
	   `after-insert-file-set-buffer-file-coding-system',
	 - Emacs determines the coding system with
	   `after-insert-file-set-buffer-file-coding-system',
	 - decode functions in `after-insert-file-functions' after
	   `after-insert-file-set-buffer-file-coding-system'

That would be true, if there is anything in
after-insert-file-functions other than
after-insert-file-set-buffer-file-coding-system.  Normally I believe
there isn't anything else.

	I would assume that the coding system must be determined before any
	of the decode functions have been executed...

Not necessarily.  That would depend on what those other functions are.
Normally there aren't any others.  I suppose if you add other functions
to this hook that you should put them in the proper order.

Is there any real example where this question arises, or is it
purely hypothetical.

     3. The docstring of `after-insert-file-functions' includes "It should
	return the new byte count", whereas `format-decode' returns the
	new char count.

It looks like they are really both measured in characters.
I will fix some doc strings.

Thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-04-08  6:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-04-07 17:30 [Bug] Issues with format.el: coding system, byte/char confusion Wedler, Christoph
2003-04-08  6:46 ` Richard Stallman

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.