changeset 57476:6205fd61e464

* progmodes/gud.el (gdb-script-beginning-of-defun): New function. (gdb-script-end-of-defun): New function. (gdb-script-mode): Use `gdb-script-beginning-of-defun' and `gdb-script-end-of-defun' as *-of-defun-function.
author Masatake YAMATO <jet@gyve.org>
date Wed, 13 Oct 2004 16:32:42 +0000
parents 1550c9f141cc
children c4f6faab46b0
files lisp/ChangeLog lisp/progmodes/gud.el
diffstat 2 files changed, 32 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Wed Oct 13 12:18:37 2004 +0000
+++ b/lisp/ChangeLog	Wed Oct 13 16:32:42 2004 +0000
@@ -1,3 +1,10 @@
+2004-10-14  Masatake YAMATO  <jet@gyve.org>
+
+	* progmodes/gud.el (gdb-script-beginning-of-defun): New function.
+	(gdb-script-end-of-defun): New function.
+	(gdb-script-mode): Use `gdb-script-beginning-of-defun' and
+	`gdb-script-end-of-defun' as *-of-defun-function.
+
 2004-10-12  Michael Albinus  <michael.albinus@gmx.de>
 
 	Sync with Tramp 2.0.45.
--- a/lisp/progmodes/gud.el	Wed Oct 13 12:18:37 2004 +0000
+++ b/lisp/progmodes/gud.el	Wed Oct 13 16:32:42 2004 +0000
@@ -3027,6 +3027,27 @@
 	  (save-excursion (indent-line-to indent))
 	(indent-line-to indent)))))
 
+;; Derived from cfengine.el.
+(defun gdb-script-beginning-of-defun ()
+  "`beginning-of-defun' function for Gdb script mode.
+Treats actions as defuns."
+  (unless (<= (current-column) (current-indentation))
+    (end-of-line))
+  (if (re-search-backward "^define \\|^document " nil t)
+      (beginning-of-line)
+    (goto-char (point-min)))
+  t)
+
+;; Derived from cfengine.el.
+(defun gdb-script-end-of-defun ()
+  "`end-of-defun' function for Gdb script mode.
+Treats actions as defuns."
+  (end-of-line)
+  (if (re-search-forward "^end" nil t)
+      (beginning-of-line)
+    (goto-char (point-max)))
+  t)
+
 ;;;###autoload
 (add-to-list 'auto-mode-alist '("/\\.gdbinit" . gdb-script-mode))
 
@@ -3039,6 +3060,10 @@
   (set (make-local-variable 'imenu-generic-expression)
        '((nil "^define[ \t]+\\(\\w+\\)" 1)))
   (set (make-local-variable 'indent-line-function) 'gdb-script-indent-line)
+  (set (make-local-variable 'beginning-of-defun-function)
+       #'gdb-script-beginning-of-defun)
+  (set (make-local-variable 'end-of-defun-function)
+       #'gdb-script-end-of-defun)
   (set (make-local-variable 'font-lock-defaults)
        '(gdb-script-font-lock-keywords nil nil ((?_ . "w")) nil
 	 (font-lock-syntactic-keywords