emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: safe_call1 considered harmful


From: Kenichi Handa
Subject: Re: safe_call1 considered harmful
Date: Mon, 24 Jul 2006 10:36:12 +0900
User-agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/22.0.50 (i686-pc-linux-gnu) MULE/5.0 (SAKAKI)

In article <address@hidden>, Eli Zaretskii <address@hidden> writes:

>> But, by considering this problem again, I found another
>> solution than calling find-operation-coding-system with
>> (FILENAME . BUFFER).  That is to provide an extra argument
>> BUFFER.  Then, we can keep backward compatibility and
>> find-buffer-file-type-coding-system works as before, and, by
>> modifying po-find-file-coding-system to check that extra
>> argument instead of checking if FILENAME is cons or not, we
>> can make it work well too.

> This will work if no function on file-coding-system-alist currently
> looks at arguments beyond the 1st one, the file name.  If there are
> functions which look beyond that, such a change will break them.

No, what I meant is to give the extra argument BUFFER at the
END of the normal arguments to insert-file-contents.  So,
for instance, tar-extract will call
find-operation-coding-system as this:

                             (car (find-operation-coding-system
                                   'insert-file-contents
                                   name t nil nil nil (current-buffer)))

The new docstring (only the last paragraph) for
find-operation-coding-system will be:

----------------------------------------------------------------------
[...]
If OPERATION is `insert-file-contents', there may be an extra argument
BUFFER at the end.  In that case, FILENAME is a file name to look up,
and BUFFER is a buffer that contains the file's contents (not yet
decoded).  If `file-coding-system-alist' specifies a function to call
for FILENAME, that function should examine the contents of BUFFER
instead of reading the file.
----------------------------------------------------------------------

This change breaks only such a function that checks that the
number of given arguments is not greater than 5 (the maximum
arguments to insert-file-contents).  I believe such a
function is very very rare.

> In any case, I think we should revert the change you made to use
> safe_call1.

Yes.

---
Kenichi Handa
address@hidden




reply via email to

[Prev in Thread] Current Thread [Next in Thread]