comint-replace-by-expanded-filename and Slime

Aidan Kehoe kehoea at parhasard.net
Mon Aug 23 16:45:25 EDT 2010


 Ar an tríú lá is fiche de mí Lúnasa, scríobh Raymond Toy: 

 > [...] This doesn't work. I always get a error from
 > comint-replace-by-expanded-filename which says "last thing matched was
 > not a buffer". I don't really understand what that means, but this means
 > filename completion doesn't work.
 > 
 > Looking at comint-replace-by-expanded-filename, I see a call to
 > replace-match, but that doesn't need a buffer does it?  It just needs
 > some match to so it knows what to replace.

If STRING is not supplied, #'replace-match does need the last match to have
been in a buffer. Our issue is that #'comint-word (called by
#'comint-match-partial-filename, called by #'c-r-b-e-f, the function that
errors) directly modifies the match data and trashes the buffer information. 
If my understanding of the code is correct, the below patch to our comint.el
will get things working for you. (Not tested!)

--- comint.el~	2010-08-23 21:27:27.000000000 +0100
+++ comint.el	2010-08-23 21:28:39.000000000 +0100
@@ -2145,7 +2145,8 @@
 Word constituents are considered to be those in WORD-CHARS, which is like the
 inside of a \"[...]\" (see `skip-chars-forward')."
   (save-excursion
-    (let ((non-word-chars (concat "[^\\\\" word-chars "]")) (here (point)))
+    (let ((non-word-chars (concat "[^\\\\" word-chars "]"))
+	  (here (point-marker)))
       (while (and (re-search-backward non-word-chars nil 'move)
 		  ;(memq (char-after (point)) shell-file-name-quote-list)
 		  (eq (preceding-char) ?\\))
@@ -2155,7 +2156,7 @@
 	  (forward-char 1))
       ;; Set match-data to match the entire string.
       (if (< (point) here)
-	  (progn (store-match-data (list (point) here))
+	  (progn (store-match-data (list (point-marker) here))
 		 (match-string 0))))))
 
 (defun comint-substitute-in-file-name (filename)


-- 
“Apart from the nine-banded armadillo, man is the only natural host of
Mycobacterium leprae, although it can be grown in the footpads of mice.”
  -- Kumar & Clark, Clinical Medicine, summarising improbable leprosy research



More information about the XEmacs-Beta mailing list