[slime-cvs] CVS slime/contrib

CVS User sboukarev sboukarev at common-lisp.net
Sat May 1 15:28:43 UTC 2010


Update of /project/slime/cvsroot/slime/contrib
In directory cl-net:/tmp/cvs-serv26218

Modified Files:
	ChangeLog slime-fuzzy.el 
Log Message:
* slime-fuzzy.el(slime-fuzzy-dehighlight-current-completion):
instead of creating new overlays, move one overlay around.
(slime-mimic-key-bindings): Renamed from mimic-key-bindings.
Patch by Leo Liu.


--- /project/slime/cvsroot/slime/contrib/ChangeLog	2010/05/01 06:12:30	1.372
+++ /project/slime/cvsroot/slime/contrib/ChangeLog	2010/05/01 15:28:43	1.373
@@ -1,5 +1,12 @@
 2010-05-01  Stas Boukarev  <stassats at gmail.com>
 
+	* slime-fuzzy.el(slime-fuzzy-dehighlight-current-completion):
+	instead of creating new overlays, move one overlay around.
+	(slime-mimic-key-bindings): Renamed from mimic-key-bindings.
+	Patch by Leo Liu.
+
+2010-05-01  Stas Boukarev  <stassats at gmail.com>
+
 	* slime-repl.el (slime-repl-update-banner): Use slime-move-point
 	instead of goto-char alone, ensuring that the point is moved even
 	if the window isn't currently selected.
--- /project/slime/cvsroot/slime/contrib/slime-fuzzy.el	2010/03/20 08:27:50	1.17
+++ /project/slime/cvsroot/slime/contrib/slime-fuzzy.el	2010/05/01 15:28:43	1.18
@@ -80,7 +80,7 @@
 
 ;; FIXME: clean this up
 
-(defun mimic-key-bindings (from-keymap to-keymap bindings-or-operation operation)
+(defun slime-mimic-key-bindings (from-keymap to-keymap bindings-or-operation operation)
   "Iterate on BINDINGS-OR-OPERATION. If an element is a symbol then
 try to look it up (as an operation) in FROM-KEYMAP. Non symbols are taken
 as default key bindings when none to be mimiced was found in FROM-KEYMAP.
@@ -97,7 +97,7 @@
 (defvar slime-target-buffer-fuzzy-completions-map
   (let* ((map (make-sparse-keymap)))
     (flet ((remap (keys to)
-             (mimic-key-bindings global-map map keys to)))
+             (slime-mimic-key-bindings global-map map keys to)))
       
       (remap (list 'keyboard-quit (kbd "C-g")) 'slime-fuzzy-abort)
 
@@ -116,8 +116,7 @@
       ;; some unconditional direct bindings
       (dolist (key (list (kbd "<return>") (kbd "RET") (kbd "<SPC>") "(" ")" "[" "]"))
         (define-key map key 'slime-fuzzy-select-and-process-event-in-target-buffer)))
-    map
-    )
+    map)
   "Keymap for slime-target-buffer-fuzzy-completions-mode. This will override the key
 bindings in the target buffer temporarily during completion.")
 
@@ -185,12 +184,14 @@
 
 \\<slime-fuzzy-completions-map>\
 \\{slime-fuzzy-completions-map}"
-  (use-local-map slime-fuzzy-completions-map))
+  (use-local-map slime-fuzzy-completions-map)
+  (set (make-local-variable 'slime-fuzzy-current-completion-overlay)
+       (make-overlay (point) (point) nil t nil)))
 
 (defvar slime-fuzzy-completions-map  
   (let* ((map (make-sparse-keymap)))
     (flet ((remap (keys to)
-             (mimic-key-bindings global-map map keys to)))
+             (slime-mimic-key-bindings global-map map keys to)))
       (remap (list 'keyboard-quit (kbd "C-g")) 'slime-fuzzy-abort)
       (define-key map "q" 'slime-fuzzy-abort)
     
@@ -461,7 +462,6 @@
 buffer."
   (interactive)
   (with-current-buffer (slime-get-fuzzy-buffer)
-    (slime-fuzzy-dehighlight-current-completion)
     (let ((point (next-single-char-property-change (point) 'completion nil slime-fuzzy-last)))
       (set-window-point (get-buffer-window (current-buffer)) point)
       (goto-char point))
@@ -472,24 +472,19 @@
 completions buffer."
   (interactive)
   (with-current-buffer (slime-get-fuzzy-buffer)
-    (slime-fuzzy-dehighlight-current-completion)
     (let ((point (previous-single-char-property-change (point) 'completion nil slime-fuzzy-first)))
       (set-window-point (get-buffer-window (current-buffer)) point)
       (goto-char point))
     (slime-fuzzy-highlight-current-completion)))
 
-(defun slime-fuzzy-dehighlight-current-completion ()
-  "Restores the original face for the current completion."
-  (when slime-fuzzy-current-completion-overlay
-    (overlay-put slime-fuzzy-current-completion-overlay 'face 'nil)))
-
 (defun slime-fuzzy-highlight-current-completion ()
   "Highlights the current completion, so that the user can see it on the screen."
   (let ((pos (point)))
-    (setq slime-fuzzy-current-completion-overlay 
-          (make-overlay (point) (1- (search-forward " "))
-                        (current-buffer) t nil))
-    (overlay-put slime-fuzzy-current-completion-overlay 'face 'secondary-selection)
+    (when (overlayp slime-fuzzy-current-completion-overlay)
+      (move-overlay slime-fuzzy-current-completion-overlay
+                    (point) (1- (search-forward " ")))
+      (overlay-put slime-fuzzy-current-completion-overlay
+                   'face 'secondary-selection))
     (goto-char pos)))
 
 (defun slime-fuzzy-abort ()





More information about the slime-cvs mailing list