unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#4817: unclear value type of select-safe-coding-system-accept-default-p
@ 2009-10-27 23:04 ` Norbert Eisinger
  2009-10-31  2:24   ` Glenn Morris
  2009-10-31 19:50   ` bug#4817: marked as done (unclear value type of select-safe-coding-system-accept-default-p) Emacs bug Tracking System
  0 siblings, 2 replies; 4+ messages in thread
From: Norbert Eisinger @ 2009-10-27 23:04 UTC (permalink / raw)
  To: bug-gnu-emacs


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







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

* bug#4817: unclear value type of select-safe-coding-system-accept-default-p
  2009-10-27 23:04 ` bug#4817: unclear value type of select-safe-coding-system-accept-default-p Norbert Eisinger
@ 2009-10-31  2:24   ` Glenn Morris
  2009-10-31 18:08     ` Norbert Eisinger
  2009-10-31 19:50   ` bug#4817: marked as done (unclear value type of select-safe-coding-system-accept-default-p) Emacs bug Tracking System
  1 sibling, 1 reply; 4+ messages in thread
From: Glenn Morris @ 2009-10-31  2:24 UTC (permalink / raw)
  To: eisinger; +Cc: 4817

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.





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

* bug#4817: unclear value type of select-safe-coding-system-accept-default-p
  2009-10-31  2:24   ` Glenn Morris
@ 2009-10-31 18:08     ` Norbert Eisinger
  0 siblings, 0 replies; 4+ messages in thread
From: Norbert Eisinger @ 2009-10-31 18:08 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 4817

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










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

* bug#4817: marked as done (unclear value type of select-safe-coding-system-accept-default-p)
  2009-10-27 23:04 ` bug#4817: unclear value type of select-safe-coding-system-accept-default-p Norbert Eisinger
  2009-10-31  2:24   ` Glenn Morris
@ 2009-10-31 19:50   ` Emacs bug Tracking System
  1 sibling, 0 replies; 4+ messages in thread
From: Emacs bug Tracking System @ 2009-10-31 19:50 UTC (permalink / raw)
  To: Glenn Morris

[-- Attachment #1: Type: text/plain, Size: 928 bytes --]

Your message dated Sat, 31 Oct 2009 15:44:36 -0400
with message-id <8zmy37cpqz.fsf@fencepost.gnu.org>
and subject line Re: bug#4817: unclear value type of select-safe-coding-system-accept-default-p
has caused the Emacs bug report #4817,
regarding unclear value type of select-safe-coding-system-accept-default-p
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@emacsbugs.donarmstrong.com
immediately.)


-- 
4817: http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=4817
Emacs Bug Tracking System
Contact owner@emacsbugs.donarmstrong.com with problems

[-- Attachment #2: Type: message/rfc822, Size: 4484 bytes --]

From: Norbert Eisinger <eisinger@informatik.uni-muenchen.de>
To: bug-gnu-emacs@gnu.org
Subject: unclear value type of select-safe-coding-system-accept-default-p
Date: Wed, 28 Oct 2009 00:04:03 +0100
Message-ID: <4AE77C63.3020004@informatik.uni-muenchen.de>


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




[-- Attachment #3: Type: message/rfc822, Size: 1691 bytes --]

From: Glenn Morris <rgm@gnu.org>
To: 4817-done@emacsbugs.donarmstrong.com
Subject: Re: bug#4817: unclear value type of select-safe-coding-system-accept-default-p
Date: Sat, 31 Oct 2009 15:44:36 -0400
Message-ID: <8zmy37cpqz.fsf@fencepost.gnu.org>


Thanks, I tweaked the manual a bit.

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

end of thread, other threads:[~2009-10-31 19:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <8zmy37cpqz.fsf@fencepost.gnu.org>
2009-10-27 23:04 ` bug#4817: unclear value type of select-safe-coding-system-accept-default-p Norbert Eisinger
2009-10-31  2:24   ` Glenn Morris
2009-10-31 18:08     ` Norbert Eisinger
2009-10-31 19:50   ` bug#4817: marked as done (unclear value type of select-safe-coding-system-accept-default-p) Emacs bug Tracking System

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).