GNU bug report logs - #4817
unclear value type of select-safe-coding-system-accept-default-p

Previous Next

Package: emacs;

Reported by: eisinger <at> informatik.uni-muenchen.de

Date: Tue, 27 Oct 2009 23:10:07 UTC

Severity: normal

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 4817 in the body.
You can then email your comments to 4817 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4817; Package emacs. (Tue, 27 Oct 2009 23:10:07 GMT) Full text and rfc822 format available.

Acknowledgement sent to eisinger <at> informatik.uni-muenchen.de:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Tue, 27 Oct 2009 23:10:08 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Norbert Eisinger <eisinger <at> informatik.uni-muenchen.de>
To: bug-gnu-emacs <at> gnu.org
Subject: unclear value type of select-safe-coding-system-accept-default-p
Date: Wed, 28 Oct 2009 00:04:03 +0100
GNU Emacs Lisp Reference Manual
33.9.4 User-Chosen Coding Systems
Function: select-safe-coding-system from to &optional default-coding-system accept-default-p file

Quotation 1:
> The optional argument accept-default-p, if non-nil, should be a
> function to determine whether a coding system selected without user
> interaction is acceptable. select-safe-coding-system calls this
> function with one argument, the base coding system of the selected
> coding system. If accept-default-p returns nil,
> select-safe-coding-system rejects the silently selected coding system,
> and asks the user to select a coding system from a list of possible
> candidates.

Quotation 2:
> If the variable select-safe-coding-system-accept-default-p is non-nil,
> its value overrides the value of accept-default-p.


I cannot quite decide which of the following two alternatives is the problem:

=========================================================================
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)

In this case the sentence in quotation 2 might need some rephrasing, such as
"..., its value overrides the value returned by the function that is
the actual argument for accept-default-p"

=========================================================================
Alternative 2:
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.

If this is what quotation 2 means (and I understood it to mean this),
one of the following entries in the init file would seem to make sense:

(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))))
)

or

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

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
=========================================================================

Norbert Eisinger





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4817; Package emacs. (Sat, 31 Oct 2009 02:30:07 GMT) Full text and rfc822 format available.

Message #8 received at 4817 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: eisinger <at> informatik.uni-muenchen.de
Cc: 4817 <at> debbugs.gnu.org
Subject: Re: bug#4817: unclear value type of select-safe-coding-system-accept-default-p
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.



Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4817; Package emacs. (Sat, 31 Oct 2009 18:15:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to eisinger <at> informatik.uni-muenchen.de:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Sat, 31 Oct 2009 18:15:05 GMT) Full text and rfc822 format available.

Message #13 received at 4817 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Norbert Eisinger <eisinger <at> informatik.uni-muenchen.de>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 4817 <at> debbugs.gnu.org
Subject: Re: bug#4817: unclear value type of select-safe-coding-system-accept-default-p
Date: Sat, 31 Oct 2009 19:08:19 +0100
Glenn Morris wrote:
> 
> 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.

Yes, this is much clearer than the text in the Reference Manual.
Maybe something like this could be added to the Reference Manual
to say explicitly that the variable's value is a function?


>> (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.

Good, that's exactly what I wanted to achieve.

> The example that makes sense works for me.
> 
> If you still have a problem, please provide more details on exactly
> what you are doing.

I suggest to close this issue here because I am discussing related
problems in a different thread (bug#4816). I reported bug#4817
separately because I considered it a mere documentation issue.


Thanks for explaining select-safe-coding-system-accept-default-p,
your explanations answered my questions much better than the
documentation did.

Norbert








Reply sent to Glenn Morris <rgm <at> gnu.org>:
You have taken responsibility. (Sat, 31 Oct 2009 19:50:08 GMT) Full text and rfc822 format available.

Notification sent to eisinger <at> informatik.uni-muenchen.de:
bug acknowledged by developer. (Sat, 31 Oct 2009 19:50:09 GMT) Full text and rfc822 format available.

Message #18 received at 4817-done <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: 4817-done <at> debbugs.gnu.org
Subject: Re: bug#4817: unclear value type of select-safe-coding-system-accept-default-p
Date: Sat, 31 Oct 2009 15:44:36 -0400
Thanks, I tweaked the manual a bit.



bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> emacsbugs.donarmstrong.com. (Sun, 29 Nov 2009 15:24:11 GMT) Full text and rfc822 format available.

This bug report was last modified 15 years and 207 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.