Permalink
Browse files

added a few functions for jumping around parts of lisp defuns

  • Loading branch information...
1 parent e66ebea commit a6c9341126775547ecf0eedef4a4bafe95a470e8 @tavisrudd committed Feb 27, 2011
Showing with 20 additions and 6 deletions.
  1. +20 −6 dss-codenav-helpers.el
View
26 dss-codenav-helpers.el
@@ -166,7 +166,8 @@ Do nothing if not in string."
(save-excursion
(dss/out-sexp)
(forward-to-word 2)
- (k2-copy-whole-sexp)))
+ (k2-copy-whole-sexp)
+ (message (car kill-ring))))
(defun dss/eval-defun ()
"The built-in eval-defun doesn't choose the top level forms I would expect expect"
@@ -177,16 +178,29 @@ Do nothing if not in string."
(cond ((or (equal major-mode 'clojure-mode)
(equal major-mode 'slime-repl-mode))
(slime-eval-last-expression))
- (t (eval-last-sexp nil)))
- ))
+ (t (eval-last-sexp nil)))))
;; (message "%S" (preceding-sexp))
-(defun dss/goto-defun-args ()
+(defun dss/goto-defun-name ()
(interactive)
(dss/out-sexp)
- (forward-to-word 2)
- (search-forward "("))
+ (forward-to-word 2))
+
+(defun dss/goto-defun-docstring ()
+ "Jumps to the first quote in the defun form. If there is no
+ docstring it just jumps forward to the first quote anyway. I
+ should make this smarter and have it automatically insert the
+ docstring if one does not exist."
+
+ (interactive)
+ (dss/goto-defun-name)
+ (search-forward-regexp "\""))
+
+(defun dss/goto-defun-args ()
+ (interactive)
+ (dss/goto-defun-name)
+ (search-forward-regexp "(\\|\\["))
(defun dss/fix-sexp-whitespace ()
(interactive)

0 comments on commit a6c9341

Please sign in to comment.