From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs 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 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1409681911 28843 80.91.229.3 (2 Sep 2014 18:18:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 2 Sep 2014 18:18:31 +0000 (UTC) Cc: 18282-done@debbugs.gnu.org To: Mat Smiglarski Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Sep 02 20:18:24 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XOset-0002n4-1D for geb-bug-gnu-emacs@m.gmane.org; Tue, 02 Sep 2014 20:18:23 +0200 Original-Received: from localhost ([::1]:39653 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOses-0004kc-JK for geb-bug-gnu-emacs@m.gmane.org; Tue, 02 Sep 2014 14:18:22 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45167) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOseh-0004jc-6F for bug-gnu-emacs@gnu.org; Tue, 02 Sep 2014 14:18:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XOseY-0006ko-Um for bug-gnu-emacs@gnu.org; Tue, 02 Sep 2014 14:18:11 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:37309) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOseY-0006kk-SL for bug-gnu-emacs@gnu.org; Tue, 02 Sep 2014 14:18:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XOseY-0006cj-JY for bug-gnu-emacs@gnu.org; Tue, 02 Sep 2014 14:18:02 -0400 Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Tue, 02 Sep 2014 18:18:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 18282 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Mail-Followup-To: 18282@debbugs.gnu.org, monnier@iro.umontreal.ca, penthief@SDF.ORG Original-Received: via spool by 18282-done@debbugs.gnu.org id=D18282.140968186025423 (code D ref 18282); Tue, 02 Sep 2014 18:18:01 +0000 Original-Received: (at 18282-done) by debbugs.gnu.org; 2 Sep 2014 18:17:40 +0000 Original-Received: from localhost ([127.0.0.1]:57104 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XOseB-0006by-Rz for submit@debbugs.gnu.org; Tue, 02 Sep 2014 14:17:40 -0400 Original-Received: from mercure.iro.umontreal.ca ([132.204.24.67]:41090) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XOse9-0006bq-Q9 for 18282-done@debbugs.gnu.org; Tue, 02 Sep 2014 14:17:38 -0400 Original-Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id 3FFFD84E9D; Tue, 2 Sep 2014 14:17:37 -0400 (EDT) Original-Received: from lechon.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id 75DD41E5B8D; Tue, 2 Sep 2014 14:17:10 -0400 (EDT) Original-Received: by lechon.iro.umontreal.ca (Postfix, from userid 20848) id 4D0BCB40F7; Tue, 2 Sep 2014 14:17:10 -0400 (EDT) In-Reply-To: (Glenn Morris's message of "Mon, 18 Aug 2014 13:45:46 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-2.82, requis 5, autolearn=not spam, ALL_TRUSTED -2.82, MC_TSTLAST 0.00) X-DIRO-MailScanner-From: monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:92970 Archived-At: >> 1. emacs -Q >> 2. M-: (gud-gdb "gdb") >> 3. Type the following at the gdb prompt "hel" >> >> 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)