Function: makefile-add-log-defun

makefile-add-log-defun is a byte-compiled function defined in make-mode.el.gz.

Signature

(makefile-add-log-defun)

Documentation

Return name of target or variable assignment that point is in.

If it isn't in one, return nil.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/make-mode.el.gz
;;; Support for other packages, like add-log.

(defun makefile-add-log-defun ()
  "Return name of target or variable assignment that point is in.
If it isn't in one, return nil."
  (save-excursion
    (let (found)
      (beginning-of-line)
      ;; Scan back line by line, noticing when we come to a
      ;; variable or rule definition, and giving up when we see
      ;; a line that is not part of either of those.
      (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))))))
      ;; Remove leading and trailing whitespace.
      (when found
	(setq found (replace-regexp-in-string "[ \t]+\\'" "" found))
	(setq found (replace-regexp-in-string "\\`[ \t]+" "" found)))
      found)))