[slime-devel] Slime filename completion for filenames with spaces

Gregory Novak novak at ucolick.org
Sun Oct 29 18:39:36 UTC 2006


Attached below are two small changes that allow slime to complete
filenames that have spaces in them.  Filename completion is great--I
admit to being mystified for a moment when I (unconsciously) hit tab
while typing source code and slime did what I meant.  

The caveat is that with this change slime will try to complete
any quoted string as a filename... but for me, the filename completion
is worth it.

Finally, the diff is against a slightly old version but I checked
against the latest CVS version and the relevant lines of code haven't
changed.  Also I'm using a ~May 2006 build of Emacs from CVS.

Cheers,
Greg

Index: slime.el
===================================================================
RCS file: /project/slime/cvsroot/slime/slime.el,v
retrieving revision 1.663
diff -c -r1.663 slime.el
*** slime.el	16 Oct 2006 20:20:42 -0000	1.663
--- slime.el	29 Oct 2006 18:33:51 -0000
***************
*** 933,938 ****
--- 933,941 ----
  (easy-menu-define menubar-slime slime-mode-map "SLIME" slime-easy-menu)
  
  (add-hook 'slime-mode-hook
+           ;; GSN -- allow comint to complete filenames with spaces
+           (defun slime-allow-spaces-in-filename-completion ()
+             (setq comint-file-name-chars (concat " " comint-file-name-chars)))
            (defun slime-add-easy-menu ()
              (easy-menu-add slime-easy-menu 'slime-mode-map)))
  
***************
*** 6148,6154 ****
  (defun* slime-fuzzy-complete-symbol ()
    "Fuzzily completes the abbreviation at point into a symbol."
    (interactive)
!   (when (save-excursion (re-search-backward "\"[^ \t\n]+\\=" nil t))
      (return-from slime-fuzzy-complete-symbol 
        (if slime-when-complete-filename-expand
            (comint-replace-by-expanded-filename)
--- 6151,6158 ----
  (defun* slime-fuzzy-complete-symbol ()
    "Fuzzily completes the abbreviation at point into a symbol."
    (interactive)
!   ;; GSN -- removed space from complemented character class
!   (when (save-excursion (re-search-backward "\"[^\t\n]+\\=" nil t))
      (return-from slime-fuzzy-complete-symbol 
        (if slime-when-complete-filename-expand
            (comint-replace-by-expanded-filename)



More information about the slime-devel mailing list