Fix Spacemacs Home Buffer to jump to bookmarks.

Instead of opening the file for the bookmark, use the bookmark-jump
function to properly jump to the file and location in the file.  Also
show the bookmark name and the filename in the list.

Fixes syl20bnr/spacemacs#2431
This commit is contained in:
Travis B. Hartwell 2015-07-29 20:21:31 -06:00 committed by syl20bnr
parent 7564d33e0a
commit 4c646a1a0c
1 changed files with 17 additions and 1 deletions

View File

@ -482,6 +482,22 @@ HPADDING is the horizontal spacing betwee the content line and the frame border.
(abbreviate-file-name el)))
list)))
(defun spacemacs-buffer//insert-bookmark-list (list-display-name list)
(when (car list)
(insert list-display-name)
(mapc (lambda (el)
(insert "\n ")
(widget-create 'push-button
:action `(lambda (&rest ignore) (bookmark-jump ,el))
:mouse-face 'highlight
:follow-link "\C-m"
:button-prefix ""
:button-suffix ""
:format "%[%t%]"
(format "%s - %s" el (abbreviate-file-name
(bookmark-get-filename el)))))
list)))
(defun spacemacs-buffer/insert-startupify-lists ()
(interactive)
(with-current-buffer (get-buffer-create "*spacemacs*")
@ -499,7 +515,7 @@ HPADDING is the horizontal spacing betwee the content line and the frame border.
(insert list-separator)))
((eq el 'bookmarks)
(helm-mode)
(when (spacemacs-buffer//insert-file-list "Bookmarks:" (mapcar 'bookmark-get-filename (bookmark-all-names)))
(when (spacemacs-buffer//insert-bookmark-list "Bookmarks:" (bookmark-all-names))
(spacemacs//insert--shortcut "m" "Bookmarks:")
(insert list-separator)))
((eq el 'projects)