[slime-devel] indent and autocomplete

Eric Blood eblood at winkywooster.org
Wed Jun 9 15:40:24 UTC 2004


The attached patch creates the option of having the naked Tab key do
both indent and autocomplete as it currently does in the repl.  I
moved and renamed slime-repl-indent-and-complete-symbol to
slime-indent-and-complete-symbol since it is not repl specific.

Also, I have added more default options for the typeout
frame--specifically it now has a default width, and moves the typeout
frame to the upper right.

--
eblood

Index: slime.el
===================================================================
RCS file: /project/slime/cvsroot/slime/slime.el,v
retrieving revision 1.309
diff -u -w -r1.309 slime.el
--- slime.el	8 Jun 2004 23:58:09 -0000	1.309
+++ slime.el	9 Jun 2004 04:44:28 -0000
@@ -135,6 +135,10 @@
 (defvar slime-kill-without-query-p t
   "If non-nil, kill Slime processes without query when quitting Emacs.")
 
+(defvar slime-tab-indent-and-complete-p t
+  "Whether the TAB key should do both an indent and autocomplete in the 
+Slime minor mode.")
+
 (defvar slime-sbcl-manual-root "http://www.sbcl.org/manual/"
   "*The base URL of the SBCL manual, for documentation lookup.")
 
@@ -553,7 +557,10 @@
   (define-key inferior-slime-mode-map
     [(control return)] 'inferior-slime-closing-return)
   (define-key inferior-slime-mode-map
-    [(meta control ?m)] 'inferior-slime-closing-return))
+    [(meta control ?m)] 'inferior-slime-closing-return)
+  (when slime-tab-indent-and-complete-p
+      (slime-define-key "\C-i" 'slime-indent-and-complete-symbol
+                        :inferior t)))
 
 (slime-init-keymaps)
 
@@ -1033,6 +1040,18 @@
   (when (buffer-live-p (get-buffer buffer-name))
     (kill-buffer buffer-name)))
 
+(defun slime-indent-and-complete-symbol ()
+  "Indent the current line and perform symbol completion.
+First indent the line.  If indenting doesn't move point complete the
+symbol."
+  (interactive)
+  (let ((pos (point)))
+    (lisp-indent-line)
+    (when (and (= pos (point))
+               (save-excursion 
+                 (re-search-backward "\\(\\s_\\|\\sw\\)+\\=" nil t)))
+      (slime-complete-symbol))))
+
 (defmacro slime-with-rigid-indentation (level &rest body)
   "Execute BODY and then rigidly indent its text insertions.
 Assumes all insertions are made at point."
@@ -2330,18 +2349,6 @@
     (insert "\n")
     (lisp-indent-line)))
 
-(defun slime-repl-indent-and-complete-symbol ()
-  "Indent the current line and perform symbol completion.
-First indent the line.  If indenting doesn't move point complete the
-symbol."
-  (interactive)
-  (let ((pos (point)))
-    (lisp-indent-line)
-    (when (and (= pos (point))
-               (save-excursion 
-                 (re-search-backward "\\(\\s_\\|\\sw\\)+\\=" nil t)))
-      (slime-complete-symbol))))
-
 (defun slime-repl-delete-current-input ()
   (delete-region slime-repl-input-start-mark slime-repl-input-end-mark))
 
@@ -2490,7 +2497,7 @@
   ("\C-c:"    'slime-interactive-eval)
   ("\C-c\C-e" 'slime-interactive-eval)
   ;("\t"   'slime-complete-symbol)
-  ("\t"   'slime-repl-indent-and-complete-symbol)
+  ("\t"   'slime-indent-and-complete-symbol)
   (" "    'slime-space)
   ("\C-\M-x" 'slime-eval-defun)
   ("\C-c\C-o" 'slime-repl-clear-output)
@@ -3565,7 +3572,8 @@
   "The current typeout window.")
 
 (defvar slime-typeout-frame-properties
-  '((height . 16) (minibuffer . nil) (name . "SLIME Typeout"))
+  '((width . 40) (height . 10) (minibuffer . nil)
+    (left . -10) (top . 10) (name . "SLIME Typeout"))
   "The typeout frame properties (passed to `make-frame').")
 
 (defun slime-typeout-active-p ()
@@ -3637,7 +3645,7 @@
              (slime-complete-restore-window-configuration))
             ((memq this-command '(self-insert-command
                                   slime-complete-symbol
-                                  slime-repl-indent-and-complete-symbol
+                                  slime-indent-and-complete-symbol
                                   backward-delete-char-untabify
                                   backward-delete-char
                                   scroll-other-window))





More information about the slime-devel mailing list