File tree Expand file tree Collapse file tree 2 files changed +26
-4
lines changed Expand file tree Collapse file tree 2 files changed +26
-4
lines changed Original file line number Diff line number Diff line change 1616 (transient-mark-mode 1 )
1717 (lispy-mode)
1818 (insert , in )
19- (when (search-backward " ~" nil t )
20- (delete-char 1 )
21- (set-mark (point ))
22- (goto-char (point-max )))
19+ (goto-char (point-min ))
20+ (when (search-forward " ~" nil t )
21+ (backward-delete-char 1 )
22+ (set-mark (point )))
23+ (goto-char (point-max ))
2324 (search-backward " |" )
2425 (delete-char 1 )
2526 (setq current-prefix-arg)
@@ -1243,6 +1244,12 @@ Insert KEY if there's no command."
12431244 (should (string= (lispy-with " |;;* Intro" " a" )
12441245 " ;;* Intro\n ;;* |" )))
12451246
1247+ (ert-deftest lispy-outline-add ()
1248+ (should (string= (lispy-with " (quote ~foo|)" " ~" )
1249+ " (quote ~~foo|)" ))
1250+ (should (string= (lispy-with " (quote ~~foo|)" " ~" )
1251+ " (quote ~foo|)" )))
1252+
12461253(provide 'lispy-test )
12471254
12481255; ;; lispy-test.el ends here
Original file line number Diff line number Diff line change @@ -1277,6 +1277,20 @@ Special case is (|( -> ( |(."
12771277 (lispy--space-unless " \\ s-\\ |\\ s(\\ |[:?`']\\\\ ?" )
12781278 (insert " `" ))
12791279
1280+ (defun lispy-tilde (arg )
1281+ " Insert ~ ARG times.
1282+ When region is active, toggle a ~ at the start of the region."
1283+ (interactive " p" )
1284+ (if (region-active-p )
1285+ (let ((bnd (lispy--bounds-dwim))
1286+ deactivate-mark)
1287+ (save-excursion
1288+ (goto-char (car bnd))
1289+ (if (eq (char-after ) ?~ )
1290+ (delete-char 1 )
1291+ (insert " ~" ))))
1292+ (self-insert-command 1 )))
1293+
12801294(defun lispy-hash ()
12811295 " Insert #."
12821296 (interactive )
@@ -5318,6 +5332,7 @@ FUNC is obtained from (`lispy--insert-or-call' DEF PLIST)"
53185332 (lispy-define-key map " V" 'lispy-visit )
53195333 (lispy-define-key map " -" 'lispy-ace-subword )
53205334 (lispy-define-key map " ." 'lispy-repeat )
5335+ (lispy-define-key map " ~" 'lispy-tilde )
53215336 ; ; ——— locals: digit argument ———————————————
53225337 (mapc (lambda (x ) (lispy-define-key map (format " %d " x) 'digit-argument ))
53235338 (number-sequence 0 9 )))
You can’t perform that action at this time.
0 commit comments