Quantcast
Viewing all articles
Browse latest Browse all 20

Emacs as my default pdf viewer

In the last week, I’ve switched over to using emacs for pdf viewing (reading) via doc-view because I noticed “C-v” and “M-v” did not do what I want in Document Viewer aka Evince ;). At least with OpenOffice, I could remap the navigation keys; not so with Evince. I usually open the pdf files in emacs via dired, but I’m loving it so much that I want it to be the default viewer on my system, i.e., double clicking files in Nautilus. I created the following bash script and set it as the default pdf viewer on my Ubuntu machine.

 <pre class="src src-sh"><span style="color: #ff4500;">#</span><span style="color: #ff4500;">! /bin/</span><span style="color: #00ffff;">bash</span>

nohup emacs -q –no-site-file –eval “(set-scroll-bar-mode ‘right)” –eval “(set-background-color \”black\”)” –eval “(x-send-client-message nil 0 nil \”_NET_WM_STATE\” 32 ‘(2 \”_NET_WM_STATE_MAXIMIZED_HORZ\” 0))” –eval “(x-send-client-message nil 0 nil \”_NET_WM_STATE\” 32 ‘(2 \”_NET_WM_STATE_MAXIMIZED_VERT\” 0))” –eval “(tool-bar-mode -1)” –eval “(setq doc-view-resolution 160)” –eval “(require ‘doc-view)” –eval “(define-key doc-view-mode-map (kbd \”C-v\”) ‘doc-view-scroll-up-or-next-page)” –eval “(define-key doc-view-mode-map (kbd \”M-v\”) ‘doc-view-scroll-down-or-previous-page)” –eval “(setq doc-view-continuous t)” “$@” 1> /dev/null 2>&1 &

Feel free to modify my custom settings in the script.

When I give talks using pdf slides, I just have to open the files manually in Evince or Acroread.


Viewing all articles
Browse latest Browse all 20

Trending Articles