Skip to content

Instantly share code, notes, and snippets.

@porterjamesj
Created November 12, 2013 09:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save porterjamesj/7427774 to your computer and use it in GitHub Desktop.
Save porterjamesj/7427774 to your computer and use it in GitHub Desktop.
love you josh <3
(defun josh/navigate (p s)
(interactive "P\nsWhere to my prince? :")
(let* ((move (if p #'next-line #'previous-line))
(char-to-pos (lambda (c) (- c 96)))
(nums (string-to-list s))
(first (car nums))
(count (apply '+ (mapcar (lambda (c) (if (equalp first c) 1 0)) nums))))
;; (ignore-errors
(progn
(funcall move (+ (funcall char-to-pos first) (* 26 (- count 1))))
(when (> count 1)
(move-to-column (* (funcall char-to-pos (car (last nums))) 5))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment