Hi Stephen,
As you can see, I am not very good at english, so I will rewrite all
the docstring as you suggested.
BTW, some additional reponses inline....
Thanks
FKtPp
--- "Stephen J. Turnbull" <stephen(a)xemacs.org> wrote:
It's me FKtPp ;) writes:
> +(defsubst overlay-validate-begin-end-buffer ()
I prefer the name "overlay-normalize-begin-end-buffer". Validate is
OK, but for example in XML processing a "validating process" will
give
a fatal error on invalid XML; it won't fix it up.
Well, thanks for your suggestion. I'll change it to normalize...
> + "validte the value of BEG, END and BUFFER
> +
> +If BUFFER is nil, set to current buffer. If BEG is
> +greater than END, exchange their value. If either
> +BEG or END is out of buffer boundary, set their
> +value to corresponding boundary-value."
"Normalize the BEG, END, and BUFFER arguments.
BUFFER must be a buffer or nil, meaning the current buffer.
BEG and END must be integers. They are sorted and truncated to
values
legal in BUFFER so that 1 <= BEG <= END <= \(1+ \(length BUFFER))."
> + (if (null buffer)
> + (setq buffer (current-buffer))
> + (check-argument-type 'bufferp buffer))
> + (when (> beg end)
> + (setq beg (prog1 end (setq end beg))))
> +
> + (setq beg (max beg 1)
> + end (min end (1+ (buffer-size))))
> + t)
I would write these as
(when (< beg 1)
(setq beg 1))
(when (> end (1+ (buffer-size buffer)))
(setq end (1+ (buffer-size buffer))))
I use #'min and #'max is because I find the docstring saying that BEG
and END could be a marker. I don't know if #'< or #'> can handle the
comparation of a marker with a integer, but #'min and #'max announced
they could in their docstring.
And beside this, I find another possiable way of get into error of
"args out of range". If some bad guy or buggy program set both BEG and
END < 1 or > (1+ (buffer-size)), boom!! I will change the code to avoid
this...
suggestions are welcome :P
____________________________________________________________________________________
Never miss a thing. Make Yahoo your home page.
http://www.yahoo.com/r/hs
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches