summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2014-09-02 14:16:32 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2014-09-02 14:16:32 -0400
commit9de3064db6370972998737a9aa7cce7856c42aef (patch)
tree1dcc365f885cbb3101cf6219a89a00e25b3cfab2
parent5735a30d59af16ba004a151b6e0a4c18ba1d481e (diff)
downloademacs-9de3064db6370972998737a9aa7cce7856c42aef.tar.gz
* lisp/progmodes/gud.el (gud-gdb-completion-at-point): Add hack.
(gud-gdb-completions): Remove obsolete workaround. Fixes: debbugs:18282
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/progmodes/gud.el21
2 files changed, 13 insertions, 13 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index f729f42da87..c91f43cafa0 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2014-09-02 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * progmodes/gud.el (gud-gdb-completion-at-point): Add hack (bug#18282).
+ (gud-gdb-completions): Remove obsolete workaround.
+
2014-09-02 Eli Zaretskii <eliz@gnu.org>
* subr.el (posn-col-row): Revert the change from commit
diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el
index c6fc944bc13..98912ca5acb 100644
--- a/lisp/progmodes/gud.el
+++ b/lisp/progmodes/gud.el
@@ -809,18 +809,6 @@ CONTEXT is the text before COMMAND on the line."
(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 @@ CONTEXT is the text before COMMAND on the line."
(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)