emacs-devel
[Top][All Lists]
Advanced

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

fall-back for gud-gdb-complete-command


From: Masatake YAMATO
Subject: fall-back for gud-gdb-complete-command
Date: Sat, 07 Feb 2004 01:58:41 +0900 (JST)

Some gdb commands like run, source, directory take file names
as the arguments. However the file names are not completed in
the gud buffer. I've added code which completes file name
if gdb's complete command returns no completion.

Masatake YAMATO

2004-02-06  Masatake YAMATO  <address@hidden>

        * progmodes/gud.el (gud-gdb-complete-command): Add
        comint-dynamic-complete-filename as the fall back of
        completion methods.

Index: lisp/progmodes/gud.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/progmodes/gud.el,v
retrieving revision 1.15
diff -u -r1.15 gud.el
--- lisp/progmodes/gud.el       7 Jan 2004 23:22:34 -0000       1.15
+++ lisp/progmodes/gud.el       6 Feb 2004 16:51:34 -0000
@@ -564,7 +564,8 @@
 (defun gud-gdb-complete-command ()
   "Perform completion on the GDB command preceding point.
 This is implemented using the GDB `complete' command which isn't
-available with older versions of GDB."
+available with older versions of GDB. If GDB `complete' command returns
+no completion, invoke `comint-dynamic-complete-filename'."
   (interactive)
   (let* ((end (point))
         (command (buffer-substring (comint-line-beginning-position) end))
@@ -602,8 +603,12 @@
                   pos (match-end 0)))
           (and (= (mod count 2) 1)
                (setq complete-list (list (concat str "'"))))))
-    ;; Let comint handle the rest.
-    (comint-dynamic-simple-complete command-word complete-list)))
+    ;; Let comint handle the rest if complete-list is not empty.
+    (if complete-list
+       (comint-dynamic-simple-complete command-word complete-list)
+      ;; For some commands completing file name may be useful.
+      ;; e.g. run, source, directory
+      (comint-dynamic-complete-filename))))
 
 ;; The completion process filter is installed temporarily to slurp the
 ;; output of GDB up to the next prompt and build the completion list.




reply via email to

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