Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

A few more minor fixes.

Including a major one -- a bug introduced by my previous misreading of
`vimpulse-surround-pairs'.
  • Loading branch information...
commit 2151b3f5b3d83e7e369d78eeccc6f66045c107a9 1 parent 6312e09
stepnem authored July 24, 2010 timcharper committed July 24, 2010

Showing 1 changed file with 15 additions and 16 deletions. Show diff stats Hide diff stats

  1. 31  vimpulse-surround.el
31  vimpulse-surround.el
... ...
@@ -1,4 +1,4 @@
1  
-;;; vimpulse-surround.el --- emulates surround.vim, for vimpulse
  1
+;;; vimpulse-surround.el --- emulate surround.vim in Vimpulse
2 2
 
3 3
 ;; Copyright (C) 2010 Tim Harper
4 4
 ;;
@@ -38,16 +38,16 @@
38 38
   :group 'vimpulse)
39 39
 
40 40
 (defcustom vimpulse-surround-pairs
41  
-  '((")" ("(" . ")"))
42  
-    ("(" ("( " . " )"))
43  
-    ("]" ("[" . "]"))
44  
-    ("[" ("[ " . " ]"))
45  
-    ("}" ("{" . "}"))
46  
-    ("{" ("{ " . " }"))
47  
-    ("#" ("#{" . "}")))
  41
+  '((")" . ("(" . ")"))
  42
+    ("(" . ("( " . " )"))
  43
+    ("]" . ("[" . "]"))
  44
+    ("[" . ("[ " . " ]"))
  45
+    ("}" . ("{" . "}"))
  46
+    ("{" . ("{ " . " }"))
  47
+    ("#" . ("#{" . "}")))
48 48
   "Alist of surround items.
49  
-Each item is of the form (TRIGGER (LEFT . RIGHT)), all strings.
50  
-Does not apply to delete surround, change surround."
  49
+Each item is of the form (TRIGGER . (LEFT . RIGHT)), all strings.
  50
+This only affects inserting pairs, not deleting or changing them."
51 51
   :group 'vimpulse-surround
52 52
   :type '(repeat (cons (regexp :tag "Key")
53 53
                        (symbol :tag "Surround pair"))))
@@ -118,10 +118,10 @@ It triggers `vimpulse-change'. Nothing to see here, move along.")
118 118
     output))
119 119
 
120 120
 (defun vimpulse-surround-zap-whitespace (direction boundary)
121  
-  (let ((looking-at-space? (if (= direction 1)
122  
-                            (lambda () (looking-at "[ \t]"))
123  
-                          (lambda () (looking-back "[ \t]")))))
124  
-    (while (and (funcall looking-at-space?) (not (= (point) boundary)))
  121
+  (let ((pred (if (= direction 1)
  122
+		  'looking-at
  123
+		'looking-back)))
  124
+    (while (and (funcall pred "[ \t]") (not (= (point) boundary)))
125 125
       (delete-char direction)
126 126
       (when (= direction 1) (setq boundary (1- boundary))))))
127 127
 
@@ -166,8 +166,7 @@ Prompt for a range. If the range returned is detected to be a surround
166 166
 range, dispatch to `vimpulse-surround-change'.
167 167
 Otherwise, dispatch to `vimpulse-change'."
168 168
   (interactive)
169  
-
170  
-    (let (*vimpulse-surrounding*)
  169
+  (let (*vimpulse-surrounding*)
171 170
     (when (not beg) (let ((range (vimpulse-range)))
172 171
                       (setq beg (car range)
173 172
                             end (cadr range))))

0 notes on commit 2151b3f

Please sign in to comment.
Something went wrong with that request. Please try again.