diff options
author | Jose Antonio Ortega Ruiz <jao@imladris.local> | 2017-09-28 23:15:13 +0200 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@imladris.local> | 2017-09-28 23:15:13 +0200 |
commit | a76383dd015cef22f55b3e97a45eed0f273d204c (patch) | |
tree | e2332eda075b2510f9576d485a8b8fa3ae9db553 | |
parent | a49c822c0f868a3ec8ecfc66dae2940a7a5a4477 (diff) | |
download | elibs-a76383dd015cef22f55b3e97a45eed0f273d204c.tar.gz elibs-a76383dd015cef22f55b3e97a45eed0f273d204c.tar.bz2 |
doc view tweaks
-rw-r--r-- | misc/jao-doc-view.el | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/misc/jao-doc-view.el b/misc/jao-doc-view.el index 9f683d7..b90a397 100644 --- a/misc/jao-doc-view.el +++ b/misc/jao-doc-view.el @@ -59,13 +59,14 @@ (remhash k ht))) ht)))) -(defun jao-doc-view--goto-bmk () +(defun jao-doc-view-goto-bmk () (interactive) - (let ((p (gethash (expand-file-name (buffer-file-name)) - (jao-doc-view--current-bmks) - 1))) - (when (and (numberp p) (> p 1)) - (ignore-errors (pdf-view-goto-page p))))) + (when (eq major-mode 'pdf-view-mode) + (let* ((bmks (jao-doc-view--current-bmks)) + (fname (buffer-file-name)) + (p (when fname (gethash (expand-file-name fname) bmks 1)))) + (when (and (numberp p) (> p 1)) + (ignore-errors (pdf-view-goto-page p)))))) (defun jao-doc-view-open (file) (let* ((buffs (buffer-list)) @@ -92,8 +93,7 @@ (jao-doc-view--current-bmks))) (defun jao-doc-view--save-bmk (&rest ignored) - (when (or (eq major-mode 'doc-view-mode) - (eq major-mode 'pdf-view-mode)) + (when (eq major-mode 'pdf-view-mode) (ignore-errors (puthash (buffer-file-name) (max (pdf-view-current-page) 1) @@ -120,10 +120,8 @@ (defun jao-doc-view-install () (jao-doc-view--current-bmks) (add-hook 'kill-buffer-hook 'jao-doc-view--save-bmk) - (add-hook 'kill-buffer-hook 'jao-doc-view--save-session-1) - (add-hook 'kill-emacs-hook 'jao-doc-view-save-session) - (add-hook 'pdf-view-mode-hook 'jao-doc-view--goto-bmk t) - (add-hook 'pdf-view-mode-hook 'jao-doc-view-save-session t)) + (add-hook 'kill-buffer-hook 'jao-doc-view--save-session-1 t) + (add-hook 'kill-emacs-hook 'jao-doc-view-save-session)) |