Function: ebrowse-tags-next-file

ebrowse-tags-next-file is an interactive and byte-compiled function defined in ebrowse.el.gz.

Signature

(ebrowse-tags-next-file &optional INITIALIZE TREE-BUFFER)

Documentation

Select next file among files in current tag table.

Non-nil argument INITIALIZE (prefix arg, if interactive) initializes to the beginning of the list of files in the tag table. TREE-BUFFER specifies the class tree we operate on.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/ebrowse.el.gz
(defun ebrowse-tags-next-file (&optional initialize tree-buffer)
  "Select next file among files in current tag table.
Non-nil argument INITIALIZE (prefix arg, if interactive) initializes
to the beginning of the list of files in the tag table.
TREE-BUFFER specifies the class tree we operate on."
  (interactive "P")
  ;; Call with INITIALIZE non-nil initializes the files list.
  ;; If more than one tree buffer is loaded, let the user choose
  ;; on which tree (s)he wants to operate.
  (when initialize
    (let ((buffer (or tree-buffer (ebrowse-choose-from-browser-buffers))))
      (with-current-buffer buffer
	(setq ebrowse-tags-next-file-list
	      (ebrowse-files-list (ebrowse-marked-classes-p))
	      ebrowse-tags-loop-last-file
	      nil
	      ebrowse-tags-next-file-path
	      (file-name-directory ebrowse--tags-file-name)))))
  ;; End of the loop if the stack of files is empty.
  (unless ebrowse-tags-next-file-list
    (error "All files processed"))
  ;; ebrowse-tags-loop-last-file is the last file that was visited due
  ;; to a call to BROWSE-LOOP (see below). If that file is still
  ;; in memory, and it wasn't modified, throw its buffer away to
  ;; prevent cluttering up the buffer list.
  (when ebrowse-tags-loop-last-file
    (let ((buffer (get-file-buffer ebrowse-tags-loop-last-file)))
      (when (and buffer
		 (not (buffer-modified-p buffer)))
	(kill-buffer buffer))))
  ;; Remember this buffer file name for later deletion, if it
  ;; wasn't visited by other means.
  (let ((file (expand-file-name (car ebrowse-tags-next-file-list)
				ebrowse-tags-next-file-path)))
    (setq ebrowse-tags-loop-last-file (if (get-file-buffer file) nil file))
    ;; Find the file and pop the file list. Pop has to be done
    ;; before the file is loaded because FIND-FILE might encounter
    ;; an error, and we want to be able to proceed with the next
    ;; file in this case.
    (pop ebrowse-tags-next-file-list)
    (find-file file)))