autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

20-fyi-emacs-mode.patch


From: Akim Demaille
Subject: 20-fyi-emacs-mode.patch
Date: Mon, 08 Oct 2001 10:29:37 +0200

Thanks to Tom for having pointed me to the right functions.  I first
was scared because I thought a lot was to be kept from the
add-log-current-defun, but it's only because I had not realized how
much modes dedicated code it contained.  Peeking at python-mode.el
helped me.

Index: ChangeLog
from  Akim Demaille  <address@hidden>

        Use `add-log-current-defun-function' for ChangeLog creation.
        Suggested by Tom Tromey.

        * lib/emacs/autotest-mode.el (autotest-mode-map): New.
        (autotest-mode): Adjust.
        * lib/emacs/autoconf-mode.el (autoconf-mode-map): Modernize, map
        'comment-region onto `C-c ;'.
        Comments are `#', not `dnl'.
        (autoconf-current-defun): New.
        (autoconf-font-lock-keywords): Recognize `m4_defun'.

Index: lib/emacs/autotest-mode.el
--- lib/emacs/autotest-mode.el Mon, 01 Oct 2001 16:36:39 +0200 akim
+++ lib/emacs/autotest-mode.el Sun, 07 Oct 2001 14:44:30 +0200 akim
@@ -58,14 +58,26 @@
     (define-key map '[(control c) (\;)] 'comment-region)
     map))

+(defun autotest-current-defun ()
+  "Autotest value for `add-log-current-defun-function'.
+This tells add-log.el how to find the current test group/macro."
+  (save-excursion
+    (if (re-search-backward 
"^\\(m4_define\\|m4_defun\\|AT_SETUP\\)(\\[+\\([^]]+\\)" nil t)
+       (buffer-substring (match-beginning 2)
+                         (match-end 2))
+      nil)))
+
 ;;;###autoload
 (defun autotest-mode ()
-  "A major-mode to edit Autotest input files like testsuite.at
+  "A major-mode to edit Autotest files like testsuite.at.
 \\{autotest-mode-map}
 "
   (interactive)
   (kill-all-local-variables)
   (use-local-map autotest-mode-map)
+
+  (make-local-variable 'add-log-current-defun-function)
+  (setq add-log-current-defun-function 'autotest-current-defun)

   (make-local-variable 'comment-start)
   (setq comment-start "# ")
Index: lib/emacs/autoconf-mode.el
--- lib/emacs/autoconf-mode.el Mon, 01 Oct 2001 16:36:39 +0200 akim
+++ lib/emacs/autoconf-mode.el Sun, 07 Oct 2001 14:51:58 +0200 akim
@@ -33,7 +33,7 @@
   `(("\\bdnl \\(.*\\)"  1 font-lock-comment-face t)
     ("address@hidden" . font-lock-variable-name-face)
     
("\\b\\(m4_\\)?\\(builtin\\|change\\(com\\|quote\\|word\\)\\|d\\(e\\(bug\\(file\\|mode\\)\\|cr\\|f\\(ine\\|n\\)\\)\\|iv\\(ert\\|num\\)\\|nl\\|umpdef\\)\\|e\\(rrprint\\|syscmd\\|val\\)\\|f\\(ile\\|ormat\\)\\|gnu\\|i\\(f\\(def\\|else\\)\\|n\\(c\\(lude\\|r\\)\\|d\\(ex\\|ir\\)\\)\\)\\|l\\(en\\|ine\\)\\|m\\(4\\(exit\\|wrap\\)\\|aketemp\\)\\|p\\(atsubst\\|opdef\\|ushdef\\)\\|regexp\\|s\\(hift\\|include\\|ubstr\\|ys\\(cmd\\|val\\)\\)\\|tra\\(ceo\\(ff\\|n\\)\\|nslit\\)\\|un\\(d\\(efine\\|ivert\\)\\|ix\\)\\)\\b"
 . font-lock-keyword-face)
-    ("^\\(\\(m4_\\)?define\\|A._DEFUN\\)(\\[?\\([A-Za-z0-9_]+\\)" 3 
font-lock-function-name-face)
+    ("^\\(\\(m4_\\)?define\\|A._DEFUN\\|m4_defun\\)(\\[?\\([A-Za-z0-9_]+\\)" 3 
font-lock-function-name-face)
     "default font-lock-keywords")
 )

@@ -53,20 +53,32 @@

 (defvar autoconf-mode-map
   (let ((map (make-sparse-keymap)))
-    (define-key map "\C-c\C-c" 'comment-region)
+    (define-key map '[(control c) (\;)] 'comment-region)
     map))

+(defun autoconf-current-defun ()
+  "Autoconf value for `add-log-current-defun-function'.
+This tells add-log.el how to find the current macro."
+  (save-excursion
+    (if (re-search-backward 
"^\\(m4_define\\|m4_defun\\|A._DEFUN\\)(\\[*\\([A-Za-z0-9_]+\\)" nil t)
+       (buffer-substring (match-beginning 2)
+                         (match-end 2))
+      nil)))
+
 ;;;###autoload
 (defun autoconf-mode ()
-  "A major-mode to edit autoconf input files like configure.in
+  "A major-mode to edit Autoconf files like configure.ac.
 \\{autoconf-mode-map}
 "
   (interactive)
   (kill-all-local-variables)
   (use-local-map autoconf-mode-map)

+  (make-local-variable 'add-log-current-defun-function)
+  (setq add-log-current-defun-function 'autoconf-current-defun)
+
   (make-local-variable 'comment-start)
-  (setq comment-start "dnl")
+  (setq comment-start "# ")
   (make-local-variable 'parse-sexp-ignore-comments)
   (setq parse-sexp-ignore-comments t)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]