Skip to content

Instantly share code, notes, and snippets.

@spacebat
Created May 2, 2013 08:40
Show Gist options
  • Select an option

  • Save spacebat/5500966 to your computer and use it in GitHub Desktop.

Select an option

Save spacebat/5500966 to your computer and use it in GitHub Desktop.
(require 'bookmark)
(defvar my-doc-view-bookmark-push-p nil
"Whether to push automatic doc-view bookmarks, or clobber them.")
(defun my-doc-view-open-handler ()
(bookmark-jump (buffer-name)))
(defun my-doc-view-save-handler ()
(if (eq major-mode 'doc-view-mode)
(bookmark-set (buffer-name) my-doc-view-bookmark-push-p)))
(unless (get 'bookmark-save-flag 'customized-value)
(setq bookmark-save-flag 1))
(add-hook 'doc-view-mode-hook 'my-doc-view-open-handler)
(add-hook 'kill-buffer-hook 'my-doc-view-save-handler)
;; ensure we've loaded the bookmarks
(bookmark-maybe-load-default-file)
(provide 'my-doc-view-config)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment