Function: ff-get-file

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

Signature

(ff-get-file SEARCH-DIRS FILENAME &optional SUFFIX-LIST OTHER-WINDOW)

Documentation

Find a file in the SEARCH-DIRS with the given FILENAME (or filename stub).

If (optional) SUFFIX-LIST is nil, search for FILENAME, otherwise search for FILENAME with each of the given suffixes. Get the file or the buffer corresponding to the name of the first file found, or nil.

Source Code

;; Defined in /usr/src/emacs/lisp/find-file.el.gz
    found))                        ;; return buffer-name or filename

(defun ff-get-file (search-dirs filename &optional suffix-list other-window)
  "Find a file in the SEARCH-DIRS with the given FILENAME (or filename stub).
If (optional) SUFFIX-LIST is nil, search for FILENAME, otherwise search
for FILENAME with each of the given suffixes.  Get the file or the buffer
corresponding to the name of the first file found, or nil."
  (let ((filename (ff-get-file-name search-dirs filename suffix-list)))

    (cond
     ((not filename)
      nil)

     ((bufferp (get-file-buffer filename))
      (ff-switch-to-buffer (get-file-buffer filename) other-window)
      filename)

     ((file-exists-p filename)
      (ff-find-file filename other-window nil)
      filename)

     (t
      nil))))