]> code.delx.au - gnu-emacs/blobdiff - lisp/progmodes/m4-mode.el
Merge from emacs-24; up to 2012-12-17T11:17:34Z!rgm@gnu.org
[gnu-emacs] / lisp / progmodes / m4-mode.el
index b1884bd105b8155369a5b7111b3bf0788a9d876e..0641fc776de6d67e8e1b2df8f6ebffe2acf2e1cc 100644 (file)
@@ -1,6 +1,6 @@
 ;;; m4-mode.el --- m4 code editing commands for Emacs
 
-;; Copyright (C) 1996-1997, 2001-201 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>
@@ -80,7 +80,7 @@
   "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