Subject: Re: bug#4817: unclear value type of select-safe-coding-system-accept-default-p

From: Glenn Morris <[email-masked]>
Date: Fri, 30 Oct 2009 22:24:41 -0400

Norbert Eisinger wrote:

> Alternative 1:
> The value of select-safe-coding-system-accept-default-p can be either nil
> or a symbol naming a coding system (e.g., mule-utf-8-unix)

No.

C-h v select-safe-coding-system-accept-default-p makes it pretty clear
to me:

   If non-nil, a function to control the behavior of coding system
   selection. The meaning is the same as the argument ACCEPT-DEFAULT-P of
   the function `select-safe-coding-system' (which see). This variable
   overrides that argument.

> The value of select-safe-coding-system-accept-default-p can be either nil
> or a one-argument function that returns either nil or a symbol naming a
> coding system.

Almost. It should be either nil or a one-argument function that
returns nil only if the coding system silently selected by
select-safe-coding-system is to be rejected. Any non-nil return value
means "accept the coding system automatically selected".

> (custom-set-variables
>  ;; ...
>  '(select-safe-coding-system-accept-default-p
>     (function (lambda (coding-system)
>       (read-coding-system (format "Coding system [%s]: " coding-system)
>                           coding-system))))
> )

Therefore this makes no sense.

> (custom-set-variables
>  ;; ...
>  '(select-safe-coding-system-accept-default-p
>     (function (lambda (coding-system) nil)))
> )

This would make sense, meaning "always reject the automatically
selected coding system", and prompt the user instead.

> However, when I cause a situation where this code is evaluated, I get
>
> select-safe-coding-system: Wrong type argument: listp, mule-utf-8-unix

The example that makes sense works for me.

If you still have a problem, please provide more details on exactly
what you are doing.