]> git.eshelyaron.com Git - emacs.git/commitdiff
(gud-gdb-complete-command): Add a trailing single quote to partially quoted
authorKarl Heuer <kwzh@gnu.org>
Thu, 3 Nov 1994 20:30:28 +0000 (20:30 +0000)
committerKarl Heuer <kwzh@gnu.org>
Thu, 3 Nov 1994 20:30:28 +0000 (20:30 +0000)
unique completions.

lisp/gud.el

index 34e740bd50fd8f63e89d869b2bf87af7125d1027..b8080e0ae72ce583ff398f94ab62f92b7efedcc5 100644 (file)
@@ -317,6 +317,17 @@ available with older versions of GDB."
            (setcdr first (setq second (cdr second)))
          (setq first second
                second (cdr second)))))
+    ;; Add a trailing single quote if there is a unique completion
+    ;; and it contains an odd number of unquoted single quotes.
+    (and (= (length gud-gdb-complete-list) 1)
+        (let ((str (car gud-gdb-complete-list))
+              (pos 0)
+              (count 0))
+          (while (string-match "\\([^'\\]\\|\\\\'\\)*'" str pos)
+            (setq count (1+ count)
+                  pos (match-end 0)))
+          (and (= (mod count 2) 1)
+               (setq gud-gdb-complete-list (list (concat str "'"))))))
     ;; Let comint handle the rest.
     (comint-dynamic-simple-complete command-word gud-gdb-complete-list)))