gud-mode retrieves a list of possible terminations by calling the gdb complete command. In your example, the returned list will contain the following (assuming that there is only one directory on your file system that starts with "/ mn"):
(run /mnt)
The first part of each entry in the returned list is disabled, so the remaining complete list
(/mnt)
As you can see, this entry returned by the gdb complete command no longer has a trailing slash. Your only hope of fixing this would be to either gdb complete patches or to fix Emacs gud-mode , as it detects that the filled word is a directory and then adds a slash (and suppresses the automatic insertion of a space).
But, of course, you can simply bind the TAB key to another completion function, potentially one that returns to the default gud-gdb-complete-command by default, but may perform a different kind of termination when called.
To do this, try placing the following in the .emacs file:
(defun my-gud-gdb-setup () (define-key (current-local-map) "\t" 'my-gud-gdb-complete-command)) (defun my-gud-gdb-complete-command (&optional COMMAND PREDICATE FLAGS) (interactive) (unless (comint-dynamic-complete-filename) (gud-gdb-complete-command COMMAND PREDICATE FLAGS))) (add-hook 'gdb-mode-hook 'my-gud-gdb-setup)
This code associates the new function with the TAB key, which first tries to expand the current word as a file, and only if this fails, gud-gdb-complete-command is called by default.
source share