From a9e2078b7150478c5783a9ad82f7017fc93a7e69 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Fri, 26 May 2006 04:48:21 +0000 Subject: (Ffind_operation_coding_system): Allow (FILENAME . BUFFER) in TARGET. --- src/coding.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/coding.c') diff --git a/src/coding.c b/src/coding.c index 478e119c003..5ef412a3619 100644 --- a/src/coding.c +++ b/src/coding.c @@ -7457,7 +7457,7 @@ is selected as the TARGET. For example, if OPERATION does file I/O, whichever argument specifies the file name is TARGET. TARGET has a meaning which depends on OPERATION: - For file I/O, TARGET is a file name. + For file I/O, TARGET is a file name (except for the special case below). For process I/O, TARGET is a process name. For network I/O, TARGET is a service name or a port number @@ -7469,6 +7469,12 @@ or a function symbol to call. In the last case, we call the function with one argument, which is a list of all the arguments given to this function. +If OPERATION is `insert-file-contents', the argument corresponding to +TARGET may be a cons (FILENAME . BUFFER). In that case, FILENAME is a +file name to look up, and BUFFER is a buffer that already contains the +file (but not yet decoded). If a function is found as above, the +function must pay attention to this format of TARGET. + usage: (find-operation-coding-system OPERATION ARGUMENTS ...) */) (nargs, args) int nargs; @@ -7495,8 +7501,12 @@ usage: (find-operation-coding-system OPERATION ARGUMENTS ...) */) target_idx = make_number (4); target = args[XINT (target_idx) + 1]; if (!(STRINGP (target) + || (EQ (operation, Qinsert_file_contents) && CONSP (target) + && STRINGP (XCAR (target)) && BUFFERP (XCDR (target))) || (EQ (operation, Qopen_network_stream) && INTEGERP (target)))) error ("Invalid argument %d", XINT (target_idx) + 1); + if (CONSP (target)) + target = XCAR (target); chain = ((EQ (operation, Qinsert_file_contents) || EQ (operation, Qwrite_region)) -- cgit v1.2.1 From 7311509ee6842235502d446a4aaf16d3f0a6e068 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Mon, 29 May 2006 00:57:27 +0000 Subject: (Ffind_operation_coding_system): Call a function by safe_call1 instead of call1. --- src/coding.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/coding.c') diff --git a/src/coding.c b/src/coding.c index 5ef412a3619..03c07c3ba68 100644 --- a/src/coding.c +++ b/src/coding.c @@ -7539,7 +7539,7 @@ usage: (find-operation-coding-system OPERATION ARGUMENTS ...) */) return Fcons (val, val); if (! NILP (Ffboundp (val))) { - val = call1 (val, Flist (nargs, args)); + val = safe_call1 (val, Flist (nargs, args)); if (CONSP (val)) return val; if (SYMBOLP (val) && ! NILP (Fcoding_system_p (val))) -- cgit v1.2.1 From a952cebe16c99c28c403758663de026b1a61cfeb Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Mon, 29 May 2006 21:44:59 +0000 Subject: (Ffind_operation_coding_system): Doc fix. --- src/coding.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/coding.c') diff --git a/src/coding.c b/src/coding.c index 03c07c3ba68..0809e2331ad 100644 --- a/src/coding.c +++ b/src/coding.c @@ -7471,9 +7471,10 @@ which is a list of all the arguments given to this function. If OPERATION is `insert-file-contents', the argument corresponding to TARGET may be a cons (FILENAME . BUFFER). In that case, FILENAME is a -file name to look up, and BUFFER is a buffer that already contains the -file (but not yet decoded). If a function is found as above, the -function must pay attention to this format of TARGET. +file name to look up, and BUFFER is a buffer that will contain the +file (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. usage: (find-operation-coding-system OPERATION ARGUMENTS ...) */) (nargs, args) -- cgit v1.2.1 From 74b08af9468504c1f38217cc488bfa8d3270bd93 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Tue, 30 May 2006 04:33:21 +0000 Subject: (Ffind_operation_coding_system): Doc fix. --- src/coding.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/coding.c') diff --git a/src/coding.c b/src/coding.c index 0809e2331ad..be39ceb7fe6 100644 --- a/src/coding.c +++ b/src/coding.c @@ -7471,8 +7471,8 @@ which is a list of all the arguments given to this function. If OPERATION is `insert-file-contents', the argument corresponding to TARGET may be a cons (FILENAME . BUFFER). In that case, FILENAME is a -file name to look up, and BUFFER is a buffer that will contain the -file (not yet decoded). If `file-coding-system-alist' specifies 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. -- cgit v1.2.1