Gnus development mailing list
 help / color / mirror / Atom feed
* Suggest to change gnus-sum.el -- deal with float number for article number to read
@ 2004-10-21  2:01 Cheng Gao
  2004-10-21  7:09 ` Suggest to change gnus-sum.el -- deal with float number for Reiner Steib
  0 siblings, 1 reply; 4+ messages in thread
From: Cheng Gao @ 2004-10-21  2:01 UTC (permalink / raw)



After line 5365 of gnus-sum.el:
(setq select (if (stringp select) (string-to-number select) select))

add
(setq select (if (floatp select) (round select) select))



-- 
相濡以沫,不如相忘于江湖。




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

* Re: Suggest to change gnus-sum.el -- deal with float number for
  2004-10-21  2:01 Suggest to change gnus-sum.el -- deal with float number for article number to read Cheng Gao
@ 2004-10-21  7:09 ` Reiner Steib
  2004-10-21  8:41   ` Cheng Gao
  0 siblings, 1 reply; 4+ messages in thread
From: Reiner Steib @ 2004-10-21  7:09 UTC (permalink / raw)


On Thu, Oct 21 2004, Cheng Gao wrote:

[ Please put the question/suggestion in the body, not only in the
  subject ]

To deal with float number for article number to read:

> After line 5365 of gnus-sum.el:
> (setq select (if (stringp select) (string-to-number select) select))
>
> add
> (setq select (if (floatp select) (round select) select))

Why is this useful?

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/




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

* Re: Suggest to change gnus-sum.el -- deal with float number for
  2004-10-21  7:09 ` Suggest to change gnus-sum.el -- deal with float number for Reiner Steib
@ 2004-10-21  8:41   ` Cheng Gao
  2004-10-21 10:34     ` Reiner Steib
  0 siblings, 1 reply; 4+ messages in thread
From: Cheng Gao @ 2004-10-21  8:41 UTC (permalink / raw)


Say a NG has 5000 articles.
When you press SPC on it, you are prompted to input articles to read.

1. If you input "10abcd", 10 articles will be displayed as does by
(setq select (if (stringp select) (string-to-number select) select))

2. If you input "10.11", you get error message, and no articles
   displayed.

The code 

(setq select (if (floatp select) (round select) select))

can solve this.

I think since case 1 is addressed in Gnus for error tolerance and
user-friendliness, why not going a little further?

-- 
相濡以沫,不如相忘于江湖。




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

* Re: Suggest to change gnus-sum.el -- deal with float number for
  2004-10-21  8:41   ` Cheng Gao
@ 2004-10-21 10:34     ` Reiner Steib
  0 siblings, 0 replies; 4+ messages in thread
From: Reiner Steib @ 2004-10-21 10:34 UTC (permalink / raw)


On Thu, Oct 21 2004, Cheng Gao wrote:

> Say a NG has 5000 articles.
> When you press SPC on it, you are prompted to input articles to read.
>
> 1. If you input "10abcd", 10 articles will be displayed as does by
> (setq select (if (stringp select) (string-to-number select) select))
>
> 2. If you input "10.11", you get error message, and no articles
>    displayed.

GIGO (Garbage In Garbage Out).

> I think since case 1 is addressed in Gnus for error tolerance and
> user-friendliness, 

I don't thinks so.  It is most probably just because
`string-to-number' behaves like this.  Striping non-number characters
is not even documented (beside spaces and tabs):

,----[ C-h f string-to-number RET ]
| string-to-number is a built-in function in `C source code'.
| (string-to-number STRING &optional BASE)
| 
| Parse STRING as a decimal number and return the number.
| This parses both integers and floating point numbers.
| It ignores leading spaces and tabs.
| 
| If BASE, interpret STRING as a number in that base.  If BASE isn't
| present, base 10 is used.  BASE must be between 2 and 16 (inclusive).
| If the base used is not 10, floating point is not recognized.
`----

> why not going a little further?

It makes the code more difficult to read without any gain, IMHO.  _If_
anything should be changed, then Gnus should error out on "10abcd",
too.  (But I don't think this is necessary.)

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/




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

end of thread, other threads:[~2004-10-21 10:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-21  2:01 Suggest to change gnus-sum.el -- deal with float number for article number to read Cheng Gao
2004-10-21  7:09 ` Suggest to change gnus-sum.el -- deal with float number for Reiner Steib
2004-10-21  8:41   ` Cheng Gao
2004-10-21 10:34     ` Reiner Steib

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 NNTP newsgroup(s).