Subject: bug#18282: 24.3.93; Tab completion in gud-gdb at the start of a line overwrites the prompt.

From: Glenn Morris <[email-masked]>
Date: Wed, 27 Aug 2014 02:53:05 -0400

Her's an awful kludge that seems to work somewhat, maybe.
But it can't be the right solution.
But it can't be worse than it is now (?).

*** lisp/progmodes/gud.el	2014-02-10 01:34:22 +0000
--- lisp/progmodes/gud.el	2014-08-27 06:48:45 +0000
***************
*** 778,784 ****
    (add-hook 'completion-at-point-functions #'gud-gdb-completion-at-point
              nil 'local)
    (set (make-local-variable 'gud-gdb-completion-function) 'gud-gdb-completions)
! 
    (local-set-key "\C-i" 'completion-at-point)
    (setq comint-prompt-regexp "^(.*gdb[+]?) *")
    (setq paragraph-start comint-prompt-regexp)
--- 778,784 ----
    (add-hook 'completion-at-point-functions #'gud-gdb-completion-at-point
              nil 'local)
    (set (make-local-variable 'gud-gdb-completion-function) 'gud-gdb-completions)
!   (setq-local completion-in-region-function 'gud--completion-in-region)
    (local-set-key "\C-i" 'completion-at-point)
    (setq comint-prompt-regexp "^(.*gdb[+]?) *")
    (setq paragraph-start comint-prompt-regexp)
***************
*** 787,792 ****
--- 787,795 ----
    (setq gud-filter-pending-text nil)
    (run-hooks 'gud-gdb-mode-hook))
  
+ (defun gud--completion-in-region (start end collection &optional predicate)
+   (completion--in-region (copy-marker start t) end collection predicate))
+ 
  ;; The completion process filter indicates when it is finished.
  (defvar gud-gdb-fetch-lines-in-progress)