Skip to content

Instantly share code, notes, and snippets.

@jordonbiondo
Created May 4, 2015 13:50
Show Gist options
  • Save jordonbiondo/67557e28bcbdb4e38b2a to your computer and use it in GitHub Desktop.
Save jordonbiondo/67557e28bcbdb4e38b2a to your computer and use it in GitHub Desktop.
(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