GNU bug report logs -
#18282
24.3.93; Tab completion in gud-gdb at the start of a line overwrites the prompt.
Previous Next
Reported by: Mat Smiglarski <penthief <at> SDF.ORG>
Date: Sun, 17 Aug 2014 10:24:01 UTC
Severity: important
Found in version 24.3.93
Done: Stefan Monnier <monnier <at> iro.umontreal.ca>
Bug is archived. No further changes may be made.
Full log
Message #28 received at 18282-done <at> debbugs.gnu.org (full text, mbox):
>> 1. emacs -Q
>> 2. M-: (gud-gdb "gdb")
>> 3. Type the following at the gdb prompt "hel<TAB><RET>"
>>
>> What happens is the command "help" is correctly completed, but the
>> prompt "(gdb)" is overwritten.
I installed the patch below which seems to fix it for now.
Stefan
=== modified file 'lisp/progmodes/gud.el'
--- lisp/progmodes/gud.el 2014-02-10 01:34:22 +0000
+++ lisp/progmodes/gud.el 2014-09-02 18:14:45 +0000
@@ -809,18 +809,6 @@
(current-buffer)
;; From string-match above.
(length context))))
- ;; `gud-gdb-run-command-fetch-lines' has some nasty side-effects on the
- ;; buffer (via `gud-delete-prompt-marker'): it removes the prompt and then
- ;; re-adds it later, thus messing up markers and overlays along the way.
- ;; This is a problem for completion-in-region which uses an overlay to
- ;; create a field.
- ;; So we restore completion-in-region's field if needed.
- ;; FIXME: change gud-gdb-run-command-fetch-lines so it doesn't modify the
- ;; buffer at all.
- (when (/= start (- (point) (field-beginning)))
- (dolist (ol (overlays-at (1- (point))))
- (when (eq (overlay-get ol 'field) 'completion)
- (move-overlay ol (- (point) start) (overlay-end ol)))))
;; Protect against old versions of GDB.
(and complete-list
(string-match "^Undefined command: \"complete\"" (car complete-list))
@@ -859,7 +847,14 @@
(save-excursion
(skip-chars-backward "^ " (comint-line-beginning-position))
(point))))
- (list start end
+ ;; FIXME: `gud-gdb-run-command-fetch-lines' has some nasty side-effects on
+ ;; the buffer (via `gud-delete-prompt-marker'): it removes the prompt and
+ ;; then re-adds it later, thus messing up markers and overlays along the
+ ;; way (bug#18282).
+ ;; We use an "insert-before" marker for `start', since it's typically right
+ ;; after the prompt, which works around the problem, but is a hack (and
+ ;; comes with other downsides, e.g. if completion adds text at `start').
+ (list (copy-marker start t) end
(completion-table-dynamic
(apply-partially gud-gdb-completion-function
(buffer-substring (comint-line-beginning-position)
This bug report was last modified 10 years and 268 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.