From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Mat Smiglarski <penthief@SDF.ORG>
Cc: 18282-done@debbugs.gnu.org
Subject: bug#18282: 24.3.93; Tab completion in gud-gdb at the start of a line overwrites the prompt.
Date: Tue, 02 Sep 2014 14:17:10 -0400 [thread overview]
Message-ID: <jwvr3ztewba.fsf-monnier+emacsbugs@gnu.org> (raw)
In-Reply-To: <s1a971669h.fsf@fencepost.gnu.org> (Glenn Morris's message of "Mon, 18 Aug 2014 13:45:46 -0400")
>> 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)
prev parent reply other threads:[~2014-09-02 18:17 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-17 10:07 bug#18282: 24.3.93; Tab completion in gud-gdb at the start of a line overwrites the prompt Mat Smiglarski
2014-08-18 17:45 ` Glenn Morris
2014-08-18 18:28 ` Stefan Monnier
2014-08-19 19:45 ` Glenn Morris
2014-08-19 19:50 ` Glenn Morris
2014-08-27 6:53 ` Glenn Morris
2014-08-28 3:14 ` Stefan Monnier
2014-09-02 18:17 ` Stefan Monnier [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvr3ztewba.fsf-monnier+emacsbugs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=18282-done@debbugs.gnu.org \
--cc=penthief@SDF.ORG \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).