You used to be able to do (buffer-string nil nil somebuffer) to get the
entire string out of a buffer. With XEmacs 21.2, it has been changed to
just take a 'buffer' arguent, but it is _supposed_ to be backwards
compatible and take 'buffer old-end old-buffer' arguments.
But if you pass in nil for 'buffer', it thinks you want the new way and
'nil' means current-buffer. This broke the content-id (cid) url handling
in Emacs/W3 + pGnus.
The offending code is:
;; This function used to be an alias to `buffer-substring', except
;; that FSF Emacs 20.4 added a BUFFER argument in an incompatible way.
;; The new FSF's semantics makes more sense, but we try to support
;; both for backward compatibility.
(defun buffer-string (&optional buffer old-end old-buffer)
"Return the contents of the current buffer as a string.
If narrowing is in effect, this function returns only the visible part
of the buffer.
If BUFFER is specified, the contents of that buffer are returned.
The arguments OLD-END and OLD-BUFFER are supported for backward
compatibility with pre-21.2 XEmacsen times when arguments to this
function were (buffer-string &optional START END BUFFER)."
(if (or (null buffer)
(bufferp buffer)
(stringp buffer))
;; The new way
(buffer-substring nil nil buffer)
;; The old way
(buffer-substring buffer old-end old-buffer)))
I think this would be better written as:
(cond
((or (stringp buffer) (bufferp buffer))
;; most definitely the new way
(buffer-substring nil nil buffer))
((or (stringp old-buffer) (bufferp old-buffer)
(natnump buffer) (natnump old-end))
;; definitely the old way
(buffer-substring buffer old-end old-buffer))
(t
;; probably the old way
(buffer-substring buffer old-end old-buffer)))
Might be a little more robust and preserve the old behaviour in the 'nil
nil buff' case.
-bp