unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* fall-back for gud-gdb-complete-command
@ 2004-02-06 16:58 Masatake YAMATO
  0 siblings, 0 replies; 2+ messages in thread
From: Masatake YAMATO @ 2004-02-06 16:58 UTC (permalink / raw)


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  <jet@gyve.org>

	* 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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: fall-back for gud-gdb-complete-command
@ 2004-02-07  1:11 Nick Roberts
  0 siblings, 0 replies; 2+ messages in thread
From: Nick Roberts @ 2004-02-07  1:11 UTC (permalink / raw)
  Cc: emacs-devel


> 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.

This is a nice idea but GDB has its own filename completion. In fact GDB has
three types of completion: command, filename and location. Its just that
filename completion using the GDB command "complete", which is what Emacs uses,
was broken. This has recently been fixed by the change below (from GDB's
ChangeLog):

2004-02-01  Daniel Jacobowitz  <drow@mvista.com>

	* cli/cli-cmds.c: Include readline.h.
	(complete_command): Pass the start of the last word to
	complete_line.

This change is still in the CVS repository at sources.redhat.com but should be
part of gdb 6.1 due to be released around the end of March.


Nick

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-02-07  1:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-07  1:11 fall-back for gud-gdb-complete-command Nick Roberts
  -- strict thread matches above, loose matches on Subject: below --
2004-02-06 16:58 Masatake YAMATO

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).