Function: dired-move-to-filename

dired-move-to-filename is a byte-compiled function defined in dired.el.gz.

Signature

(dired-move-to-filename &optional RAISE-ERROR EOL)

Documentation

Move to the beginning of the filename on the current line.

Return the position of the beginning of the filename, or nil if none found.

If RAISE-ERROR, signal an error if we can't find the filename on the current line.

If EOL, it should be an position to use instead of line-end-position as the end of the line.

Source Code

;; Defined in /usr/src/emacs/lisp/dired.el.gz
;; Move to first char of filename on this line.
;; Returns position (point) or nil if no filename on this line."
(defun dired-move-to-filename (&optional raise-error eol)
  "Move to the beginning of the filename on the current line.
Return the position of the beginning of the filename, or nil if none found.

If RAISE-ERROR, signal an error if we can't find the filename on
the current line.

If EOL, it should be an position to use instead of
`line-end-position' as the end of the line."
  ;; This is the UNIX version.
  (or eol (setq eol (line-end-position)))
  (beginning-of-line)
  ;; First try assuming `ls --dired' was used.
  (let ((change (next-single-property-change (point) 'dired-filename nil eol)))
    (cond
     ((and change (< change eol))
      (goto-char change))
     ((re-search-forward directory-listing-before-filename-regexp eol t)
      (goto-char (match-end 0)))
     ((re-search-forward dired-permission-flags-regexp eol t)
      ;; Ha!  There *is* a file.  Our regexp-from-hell just failed to find it.
      (if raise-error
	  (error "Unrecognized line!  Check directory-listing-before-filename-regexp"))
      (beginning-of-line)
      nil)
     (raise-error
      (error "No file on this line")))))