Function: ido-visit-buffer

ido-visit-buffer is a byte-compiled function defined in ido.el.gz.

Signature

(ido-visit-buffer BUFFER METHOD &optional RECORD)

Documentation

Switch to BUFFER according to METHOD.

Record command in command-history(var)/command-history(fun) if optional RECORD is non-nil.

Source Code

;; Defined in /usr/src/emacs/lisp/ido.el.gz
;;; VISIT CHOSEN BUFFER
(defun ido-visit-buffer (buffer method &optional record)
  "Switch to BUFFER according to METHOD.
Record command in `command-history' if optional RECORD is non-nil."
  (if (bufferp buffer)
      (setq buffer (buffer-name buffer)))
  (let (win newframe)
    (cond
     ;; "Killing" of virtual buffers is handled in `ido-buffer-internal'.
     ((eq method 'kill)
      (if record
	  (ido-record-command 'kill-buffer buffer))
      (kill-buffer buffer))

     ((eq method 'other-window)
      (if record
	  (ido-record-command 'switch-to-buffer buffer))
      (switch-to-buffer-other-window buffer))

     ((eq method 'display)
      (display-buffer buffer))

     ((eq method 'display-even-when-displayed)
      (display-buffer buffer t))

     ((eq method 'other-frame)
      (switch-to-buffer-other-frame buffer)
      (select-frame-set-input-focus (selected-frame)))

     ((eq method 'display-other-frame)
      (display-buffer-other-frame buffer))

     ((and (memq method '(raise-frame maybe-frame))
	   window-system
	   (setq win (ido-buffer-window-other-frame buffer))
	   (or (eq method 'raise-frame)
	       (y-or-n-p "Jump to frame? ")))
      (setq newframe (window-frame win))
      (select-frame-set-input-focus newframe)
      (select-window win))

     ;; (eq method 'selected-window)
     (t
      ;;  No buffer in other frames...
      (if record
	  (ido-record-command 'switch-to-buffer buffer))
      (switch-to-buffer buffer)
      ))))