[slime-cvs] CVS update: slime/slime.el

Luke Gorrie lgorrie at common-lisp.net
Mon Jun 28 21:05:16 UTC 2004


Update of /project/slime/cvsroot/slime
In directory common-lisp.net:/tmp/cvs-serv12241

Modified Files:
	slime.el 
Log Message:
(slime-doc-map): New keymap for documentation commands. These all use
the `C-c C-d' prefix, followed by:

  a - apropos
  p - apropos-package
  z - apropos-all
  d - describe-symbol
  f - describe-function
  h - hyperspec lookup
  ~ - hyperspec lookup of a format character

The final keystroke is bound both unmodified and with control, so
both `C-c C-d a' and `C-c C-d C-a' will make an apropos
search. The exception is hyperspec-lookup, because it's nice to
leave C-h unbound so that `C-c C-d C-h' will summarise the
documentation bindings.

Date: Mon Jun 28 14:05:16 2004
Author: lgorrie

Index: slime/slime.el
diff -u slime/slime.el:1.342 slime/slime.el:1.343
--- slime/slime.el:1.342	Mon Jun 28 09:02:54 2004
+++ slime/slime.el	Mon Jun 28 14:05:16 2004
@@ -466,20 +466,15 @@
     ;; Documentation
     (" " slime-space :inferior t)
     ("\C-s" slime-insert-arglist :prefixed t :inferior t)
-    ("\C-d" slime-describe-symbol :prefixed t :inferior t :sldb t)
     ("\C-f" slime-describe-function :prefixed t :inferior t :sldb t)
     ("\M-d" slime-disassemble-symbol :prefixed t :inferior t :sldb t)
     ("\C-t" slime-toggle-trace-fdefinition :prefixed t :sldb t)
     ("\C-u" slime-undefine-function :prefixed t)
-    ("\C-a" slime-apropos :prefixed t :inferior t :sldb t)
-    ("\M-a" slime-apropos-all :prefixed t :inferior t :sldb t)
     ;; Kinda crappy binding. Maybe we should introduce some extra
     ;; prefixes for documentation commands. -luke (17/Jan/2004)
-    ("P"    slime-apropos-package :prefixed t :inferior t :sldb t)
     ("\C-m" slime-macroexpand-1 :prefixed t :inferior t)
     ("\M-m" slime-macroexpand-all :prefixed t :inferior t)
     ("\M-0" slime-restore-window-configuration :prefixed t :inferior t)
-    ("\C-h" slime-hyperspec-lookup :prefixed t :inferior t :sldb t)
     ([(control meta ?\.)] slime-next-location :inferior t)
     ;; Emacs20 on LinuxPPC signals a 
     ;; "Invalid character: 400000040, 2147479172, 0xffffffd8"
@@ -501,6 +496,18 @@
     ("\C-xt" slime-list-threads :prefixed t :inferior t :sldb t)
     ("\C-xc" slime-list-connections :prefixed t :inferior t :sldb t)))
 
+(defvar slime-doc-map (make-sparse-keymap)
+  "Keymap for documentation commands. Bound to a prefix key.")
+
+(defvar slime-doc-bindings
+  '((?a slime-apropos)
+    (?z slime-apropos-all)
+    (?p slime-apropos-package)
+    (?d slime-describe-symbol)
+    (?f slime-describe-function)
+    (?h slime-hyperspec-lookup)
+    (?~ common-lisp-hyperspec-format)))
+  
 ;; Maybe a good idea, maybe not..
 (defvar slime-prefix-key "\C-c"
   "The prefix key to use in SLIME keybinding sequences.")
@@ -525,7 +532,23 @@
   (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)
+  ;; Documentation
+  (setq slime-doc-map (make-sparse-keymap))
+  (loop for (key command) in slime-doc-bindings
+        do (progn
+             ;; We bind both unmodified and with control.
+             (define-key slime-doc-map (string key) command)
+             (unless (equal key ?h)     ; But don't bind C-h
+               (let ((modified (slime-control-modified-char key)))
+                 (define-key slime-doc-map (string modified) command)))))
+  ;; C-c C-d is the prefix for the doc map.
+  (slime-define-key "\C-d" slime-doc-map :prefixed t :inferior t))
+
+(defun slime-control-modified-char (char)
+  "Return the control-modified version of CHAR."
+  ;; Maybe better to just bitmask it?
+  (car (read-from-string (format "?\\C-%c" char))))
 
 (slime-init-keymaps)
 
@@ -2482,6 +2505,7 @@
   ;("\t"   'slime-complete-symbol)
   ("\t"   'slime-indent-and-complete-symbol)
   (" "    'slime-space)
+  ("\C-c\C-d" slime-doc-map)
   ("\C-\M-x" 'slime-eval-defun)
   ("\C-c\C-o" 'slime-repl-clear-output)
   ("\C-c\C-t" 'slime-repl-clear-buffer)





More information about the slime-cvs mailing list