Subject: Re: bug#14300: 24.3; comint-dynamic-complete-functions breaks

From: Leo Liu <[email-masked]>
Date: Tue, 07 May 2013 16:18:15 +0800

On 2013-05-06 21:32 +0800, Stefan Monnier wrote:
> That's what ":exclusive t" does.  Of course "no match" is tricky to
> define: if you use a fancy completion style that tries really hard to
> find a match (ido-flex style, maybe even with "typo-correction"), then
> only trying the second table when "there's no match" for the first one
> might end up meaning that it never tries the second one.

I got a solution that seems good enough. Do you see any room for
improvement? Thanks.

diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el
index 138c1948..3118f49e 100644
--- a/lisp/progmodes/octave.el
+++ b/lisp/progmodes/octave.el
@@ -741,13 +741,19 @@ (defun inferior-octave-completion-table ()
 
 (defun inferior-octave-completion-at-point ()
   "Return the data to complete the Octave symbol at point."
-  (let* ((end (point))
+  ;; http://debbugs.gnu.org/14300
+  (let* ((filecomp (string-match-p
+                    "/" (or (comint--match-partial-filename) "")))
+         (end (point))
 	 (start
-	  (save-excursion
-	    (skip-syntax-backward "w_" (comint-line-beginning-position))
-            (point))))
-    (when (> end start)
-      (list start end (inferior-octave-completion-table)))))
+	  (unless filecomp
+            (save-excursion
+              (skip-syntax-backward "w_" (comint-line-beginning-position))
+              (point)))))
+    (when (and start (> end start))
+      (list start end (completion-table-in-turn
+                       (inferior-octave-completion-table)
+                       'comint-completion-file-name-table)))))
 
 (define-obsolete-function-alias 'inferior-octave-complete
   'completion-at-point "24.1")