Function: ff-switch-file

ff-switch-file is a byte-compiled function defined in find-file.el.gz.

Signature

(ff-switch-file F1 F2 FILE &optional IN-OTHER-WINDOW NEW-FILE)

Documentation

Call F1 or F2 on FILE, according to IN-OTHER-WINDOW.

In addition, this runs various hooks.

Either F1 or F2 receives FILE as the sole argument. The decision of which one to call is based on IN-OTHER-WINDOW and on the global variable ff-always-in-other-window.

F1 and F2 are typically find-file / find-file-other-window or switch-to-buffer / switch-to-buffer-other-window function pairs.

If optional NEW-FILE is t, then a special hook (ff-file-created-hook) is called before ff-post-load-hook.

Source Code

;; Defined in /usr/src/emacs/lisp/find-file.el.gz
(defun ff-switch-file (f1 f2 file &optional in-other-window new-file)
  "Call F1 or F2 on FILE, according to IN-OTHER-WINDOW.
In addition, this runs various hooks.

Either F1 or F2 receives FILE as the sole argument.
The decision of which one to call is based on IN-OTHER-WINDOW
and on the global variable `ff-always-in-other-window'.

F1 and F2 are typically `find-file' / `find-file-other-window'
or `switch-to-buffer' / `switch-to-buffer-other-window' function pairs.

If optional NEW-FILE is t, then a special hook (`ff-file-created-hook') is
called before `ff-post-load-hook'."
  (run-hooks 'ff-pre-load-hook 'ff-pre-load-hooks)
  (funcall (if (or
                (and in-other-window (not ff-always-in-other-window))
                (and (not in-other-window) ff-always-in-other-window))
               f2 f1)
           file)
  (if new-file
      (run-hooks 'ff-file-created-hook 'ff-file-created-hooks))
  (run-hooks 'ff-post-load-hook 'ff-post-load-hooks))