From: Drew Adams <drew.adams@oracle.com>
To: torys.anderson@gmail.com, emacs list <help-gnu-emacs@gnu.org>
Subject: RE: Bookmark a PDF, open in external program
Date: Sat, 31 Jan 2015 10:31:59 -0800 (PST) [thread overview]
Message-ID: <790c44d6-43b0-496b-8a49-29acf0ea8de0@default> (raw)
In-Reply-To: <87lhkiewjy.fsf@gmail.com>
> I use the Bookmarks+ module (perhaps not relevant). I also frequently read
> PDFs. But when I bookmark a PDF, jumping to it causes it to open within
> emacs, rather than with my system default viewer. There are many people
> asking similar questions online but the answers don't seem to fit; I can't
> use the dired solution of `!` to execute a shell command in this case. Any
> tips?
Since you use Bookmark+ the answer is yes, you can easily open
a bookmark that targets a PDF file using any application you like,
and you have several possibilities:
You can use option `bmkp-default-handlers-for-file-types' to
control which operation (bookmark handler) to use by default,
for which file types (e.g. PDF).
`M-x customize-option bmkp-default-handlers-for-file-types'
This is a set of associations (an alist), with each key being
a regexp matching file names, and with each associated value
being a Lisp sexp that evaluates to either a shell command
(a string) or an Emacs function (a symbol or lambda form).
You can think of `bmkp-default-handlers-for-file-types' as
somewhat analogous to `auto-mode-alist'. But it maps file-name
patterns to file actions instead of mapping them to buffer
modes. And it has an effect only when you use certain commands.
The default value of `bmkp-default-handlers-for-file-types'
is taken from the value of `dired-guess-shell-alist-user', so
you can, if you prefer, just customize that option. (That
option comes from standard library `dired-x.el'.)
If `bmkp-default-handlers-for-file-types' specifies no
matching association for a given file, and if option
`bmkp-guess-default-handler-for-file-flag' is non-nil,
then Bookmark+ guesses a shell command to use. It uses
`dired-guess-shell-alist-default' (first) and your mailcap
entries (second) to guess.
A bookmark that was created for a file without visiting it
(e.g., using `C-x p c f' or `C-x p c a') has its `file-handler'
property set automatically to the handler specified for its
type by `bmkp-default-handlers-for-file-types'.
If you are on MS Windows, then, in _addition_ to what is
said above:
* In the `*Bookmark List*' display you can use any of these to
open bookmarks using associated Windows `Open' applications:
`M-RET' - `bmkp-bmenu-w32-open': this bookmark (on this line)
`M-mouse-2' - `bmkp-bmenu-w32-open-with-mouse': clicked bookmark
`M-o' - `bmkp-bmenu-w32-jump-to-marked': this bookmark &
marked bookmarks
You can still associate particular bookmarks or file types
with particular shell commands or other programs, via option
`bmkp-default-handlers-for-file-types'.
But you can also take advantage of the file associations
that are defined outside Emacs, for Windows. You can thus
have two different associations for the same file type and
use either of them whenever you want.
* If you associate action `w32-browser' with a file type in
`bmkp-default-handlers-for-file-types' then you can use
command `bmkp-w32-browser-jump' (not bound to a key by
default) anytime to open a file of that type using the
Windows `Open' action.
* You can use command `bmkp-jump-to-type' (`C-x j :') and
input `w32-browser' as the bookmark type, to limit completion
candidates to bookmarks that are associated with `w32-browser'.
This is all covered in the Bookmark+ doc:
* All of the doc: http://www.emacswiki.org/emacs/BookmarkPlus
* `bmkp-default-handlers-for-file-types':
http://www.emacswiki.org/emacs/BookmarkPlus#BookmarkingFilesYouCannotVisitWithEmacs
* Using MS Windows file associations:
http://www.emacswiki.org/emacs/BookmarkPlus#WindowsFileAssociations
next prev parent reply other threads:[~2015-01-31 18:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-31 16:37 Bookmark a PDF, open in external program Tory S. Anderson
2015-01-31 18:31 ` Drew Adams [this message]
2015-01-31 18:49 ` Tory S. Anderson
2015-02-10 18:50 ` Tory S. Anderson
2015-02-10 21:15 ` Drew Adams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=790c44d6-43b0-496b-8a49-29acf0ea8de0@default \
--to=drew.adams@oracle.com \
--cc=help-gnu-emacs@gnu.org \
--cc=torys.anderson@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).