;;; m4-mode.el --- m4 code editing commands for Emacs
-;; Copyright (C) 1996-1997, 2001-2012 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1997, 2001-2013 Free Software Foundation, Inc.
;; Author: Andrew Csillag <drew_csillag@geocities.com>
;; Maintainer: Andrew Csillag <drew_csillag@geocities.com>
"Default font-lock-keywords for `m4 mode'.")
(defcustom m4-mode-hook nil
- "*Hook called by `m4-mode'."
+ "Hook called by `m4-mode'."
:type 'hook
:group 'm4)
"*m4-output*" nil)
(switch-to-buffer-other-window "*m4-output*"))
+(defun m4-current-defun-name ()
+ "Return the name of the M4 function at point, or nil."
+ (save-excursion
+ (if (re-search-backward
+ "^\\(\\(m4_\\)?define\\|A._DEFUN\\)(\\[?\\([A-Za-z0-9_]+\\)" nil t)
+ (match-string-no-properties 3))))
+
;;;###autoload
(define-derived-mode m4-mode prog-mode "m4"
"A major mode to edit m4 macro files."
:abbrev-table m4-mode-abbrev-table
- (set (make-local-variable 'comment-start) "#")
- (set (make-local-variable 'parse-sexp-ignore-comments) t)
- (set (make-local-variable 'font-lock-defaults) '(m4-font-lock-keywords nil)))
+ (setq-local comment-start "#")
+ (setq-local parse-sexp-ignore-comments t)
+ (setq-local add-log-current-defun-function #'m4-current-defun-name)
+ (setq font-lock-defaults '(m4-font-lock-keywords nil)))
(provide 'm4-mode)
;;stuff to play with for debugging