Created
May 4, 2015 13:50
-
-
Save jordonbiondo/67557e28bcbdb4e38b2a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun jorbi/init.el-jump (&optional package) | |
"Jump to the top level use-package definition in the init file." | |
(interactive) | |
(unless package | |
(setq package | |
(ido-completing-read | |
"Package: " | |
(mapcar (lambda (p) (symbol-name (cadr p))) | |
(remove-if-not (lambda (f) (equal (car-safe f) 'use-package)) | |
(with-temp-buffer | |
(insert-file-contents user-init-file) | |
(read (concat "(list " (buffer-string) ")"))))) nil t))) | |
(find-file user-init-file) | |
(goto-char (point-min)) | |
(re-search-forward (format "( *use-package +%s *$" package) nil nil 1) | |
(recenter-top-bottom) | |
(pulse-momentary-highlight-one-line (point))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment