- (while (not found)
- (cond
- ((looking-at makefile-macroassign-regex)
- (setq found (buffer-substring-no-properties (match-beginning 1)
- (match-end 1))))
- ((looking-at makefile-dependency-regex)
- (setq found (buffer-substring-no-properties (match-beginning 1)
- (match-end 1))))
- ;; Don't keep looking across a blank line or comment. Give up.
- ((looking-at "$\\|#")
- (setq found 'bobp))
- ((bobp)
- (setq found 'bobp)))
- (or found
- (forward-line -1)))
- (if (stringp found) found))))
-
-;; FIXME it might be nice to have them separated by macro vs target.
-(defun makefile-menu-index-function ()
- ;; "Generate alist of indices for imenu."
- (let (alist
- stupid
- (re (concat makefile-dependency-regex
- "\\|"
- makefile-macroassign-regex)))
- (imenu-progress-message stupid 0)
- (goto-char (point-min))
- (while (re-search-forward re nil t)
- (imenu-progress-message stupid)
- (let ((n (if (match-beginning 1) 1 5)))
- (setq alist (cons
- (cons (buffer-substring (match-beginning n)
- (match-end n))
- (match-beginning n))
- alist))))
- (imenu-progress-message stupid 100)
- (nreverse alist)))
-
-(defun makefile-define-space-face ()
- (make-face 'makefile-space-face)
- (or (not (eq window-system 'x))
- (face-differs-from-default-p 'makefile-space-face)
- (let* ((params (frame-parameters))
- (light-bg (cdr (assq 'background-mode params)))
- (bg-color (cond ((eq (cdr (assq 'display-type params)) 'mono)
- (if light-bg "black" "white"))
- ((eq (cdr (assq 'display-type params)) 'grayscale)
- (if light-bg "black" "white"))
- (light-bg ; Light color background.
- "hotpink")
- (t ; Dark color background.
- "hotpink"))))
- (set-face-background 'makefile-space-face bg-color))))
-
+ (while (not (or (setq found
+ (when (or (looking-at makefile-macroassign-regex)
+ (looking-at makefile-dependency-regex))
+ (match-string-no-properties 1)))
+ ;; Don't keep looking across a blank line or comment.
+ (looking-at "$\\|#")
+ (not (zerop (forward-line -1))))))
+ found)))
+
+(provide 'make-mode)
+
+;;; arch-tag: bd23545a-de91-44fb-b1b2-feafbb2635a0