Function: denote-faces-dired-file-name-matcher
denote-faces-dired-file-name-matcher is a byte-compiled function
defined in denote.el.
Signature
(denote-faces-dired-file-name-matcher LIMIT)
Documentation
Find the file name in a Dired line, not looking beyond LIMIT.
Source Code
;; Defined in ~/.emacs.d/elpa/denote-4.2.3/denote.el
;; The following matchers must obey the doc of `font-lock-keywords':
;; - Have one parameter, the limit of the search
;; - Set match-data (and restore it on failure)
;; - Move point after the match (or restore it on failure).
;; - Return t on success and nil on failure. re-search-forward returns (point) on success. It may be better to do the same.
(defun denote-faces-dired-file-name-matcher (limit)
"Find the file name in a Dired line, not looking beyond LIMIT."
(let ((initial-match-data (match-data))
(initial-point (point))
(line-found nil))
;; Find the next non empty line that contains a Dired file name
(while (and (not line-found)
(re-search-forward "^.+$" limit t))
;; dired-move-to-filename moves the point even if it returns nil
(let ((saved-point (point)))
(if (and (dired-move-to-filename)
(save-match-data
(denote-file-has-denoted-filename-p (buffer-substring (point) (line-end-position)))))
(setq line-found t)
(goto-char saved-point))))
(if line-found
(let ((beginning-point (point)))
(goto-char (match-end 0))
(set-match-data (list beginning-point (match-end 0)))
(point))
(goto-char initial-point)
(set-match-data initial-match-data)
nil)))