From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: torys.anderson@gmail.com (Tory S. Anderson) Newsgroups: gmane.emacs.help Subject: Re: Bookmark a PDF, open in external program Date: Sat, 31 Jan 2015 13:49:02 -0500 Message-ID: <87d25ueqg1.fsf@gmail.com> References: <87lhkiewjy.fsf@gmail.com> <790c44d6-43b0-496b-8a49-29acf0ea8de0@default> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1422730161 20170 80.91.229.3 (31 Jan 2015 18:49:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 31 Jan 2015 18:49:21 +0000 (UTC) Cc: emacs list To: Drew Adams Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Jan 31 19:49:21 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YHd6e-0007QU-ND for geh-help-gnu-emacs@m.gmane.org; Sat, 31 Jan 2015 19:49:20 +0100 Original-Received: from localhost ([::1]:42562 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YHd6d-0003BX-Ve for geh-help-gnu-emacs@m.gmane.org; Sat, 31 Jan 2015 13:49:19 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54434) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YHd6R-00035P-A7 for help-gnu-emacs@gnu.org; Sat, 31 Jan 2015 13:49:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YHd6P-00060H-7M for help-gnu-emacs@gnu.org; Sat, 31 Jan 2015 13:49:07 -0500 Original-Received: from mail-yk0-x22a.google.com ([2607:f8b0:4002:c07::22a]:44760) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YHd6P-00060C-1I for help-gnu-emacs@gnu.org; Sat, 31 Jan 2015 13:49:05 -0500 Original-Received: by mail-yk0-f170.google.com with SMTP id q9so19411406ykb.1 for ; Sat, 31 Jan 2015 10:49:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=pC6fwcVSJo5CDiSRJC1zRlUWsdY4zHeSIaghadqLrmU=; b=ZdwT8qRJVR+zIMUel3IdMEOW9uu6LcoP71tJAqdUGTzA9q2Mr4M5DPy8QasYQ6FXo2 Eum90i66AMug57sphsftZZB0A1QURqZ4RL6k0/TAOYcJnntvjFuz5eAxEbcpDeU7ea0v pbzNTVl8Y1O1S69UZDrLqx8iUEcR2TIQ2AbHvYPeWvgidl2agH3aIoLORcmUtHZ7n0ap 3s9MFZ3jkGtJdsp97Wp5YWIbUXyN/xXduHuXg5FY4fI3yYHT5BJQpCo+wy7rYLB9GjG7 rlmPBkDVRcy18L9A4U2jU6p6A3lNPHKDNHnsHQ1244F/Ho6n+ppbX3XuB+b06GvppOb5 v1pQ== X-Received: by 10.236.25.7 with SMTP id y7mr5756488yhy.62.1422730144385; Sat, 31 Jan 2015 10:49:04 -0800 (PST) Original-Received: from localhost.localdomain ([2601:0:a000:4a1:ee55:f9ff:feb5:5589]) by mx.google.com with ESMTPSA id 68sm8851124yhg.21.2015.01.31.10.49.03 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 31 Jan 2015 10:49:03 -0800 (PST) In-Reply-To: <790c44d6-43b0-496b-8a49-29acf0ea8de0@default> (Drew Adams's message of "Sat, 31 Jan 2015 10:31:59 -0800 (PST)") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4002:c07::22a X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:102401 Archived-At: Excellent answer. Thanks, Drew. Drew Adams writes: >> 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