Function: cvs-get-buffer-create

cvs-get-buffer-create is a byte-compiled function defined in pcvs-util.el.gz.

Signature

(cvs-get-buffer-create NAME &optional NOREUSE)

Documentation

Create a buffer NAME unless such a buffer already exists.

If the NAME looks like an absolute file name, the buffer will be created with create-file-buffer and will probably get another name than NAME. In such a case, the search for another buffer with the same name doesn't use the buffer name but the buffer's list-buffers-directory variable. If NOREUSE is non-nil, always return a new buffer.

Source Code

;; Defined in /usr/src/emacs/lisp/vc/pcvs-util.el.gz
(defun cvs-get-buffer-create (name &optional noreuse)
  "Create a buffer NAME unless such a buffer already exists.
If the NAME looks like an absolute file name, the buffer will be created
with `create-file-buffer' and will probably get another name than NAME.
In such a case, the search for another buffer with the same name doesn't
use the buffer name but the buffer's `list-buffers-directory' variable.
If NOREUSE is non-nil, always return a new buffer."
  (or (and (not (file-name-absolute-p name))
           (if noreuse (generate-new-buffer name)
             (get-buffer-create name)))
      (unless noreuse
	(cl-dolist (buf (buffer-list))
	  (with-current-buffer buf
	    (when (equal name list-buffers-directory)
	      (cl-return buf)))))
      (with-current-buffer (create-file-buffer name)
	(setq list-buffers-directory name)
	(current-buffer))))