Function: makefile-match-dependency

makefile-match-dependency is a byte-compiled function defined in make-mode.el.gz.

Signature

(makefile-match-dependency BOUND)

Documentation

Search for makefile-dependency-regex up to BOUND.

Checks that the colon has not already been fontified, else we matched in a rule action.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/make-mode.el.gz
(defun makefile-match-dependency (bound)
  "Search for `makefile-dependency-regex' up to BOUND.
Checks that the colon has not already been fontified, else we
matched in a rule action."
  (catch 'found
    (let ((pt (point)))
      (while (progn (skip-chars-forward makefile-dependency-skip bound)
		    (< (point) (or bound (point-max))))
	(forward-char)
        ;; The GNU immediate assignment operator is ":=", while the
        ;; POSIX operator is "::=".
	(or (looking-at ":?=")
	    (get-text-property (1- (point)) 'face)
	    (if (> (line-beginning-position) (+ (point-min) 2))
		(eq (char-before (line-end-position 0)) ?\\))
	    (when (save-excursion
		    (beginning-of-line)
		    (looking-at makefile-dependency-regex))
	      (save-excursion
		(let ((deps-end (match-end 1))
		      (match-data (match-data)))
		  (goto-char deps-end)
		  (skip-chars-backward " \t")
		  (setq deps-end (point))
		  (beginning-of-line)
		  (skip-chars-forward " \t")
		  ;; Alter the bounds recorded for subexp 1,
		  ;; which is what is supposed to match the targets.
		  (setcar (nthcdr 2 match-data) (point))
		  (setcar (nthcdr 3 match-data) deps-end)
		  (store-match-data match-data)))
	      (end-of-line)
	      (throw 'found (point)))))
      (goto-char pt))
    nil))