From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.help Subject: RE: Bookmark a PDF, open in external program Date: Sat, 31 Jan 2015 10:31:59 -0800 (PST) Message-ID: <790c44d6-43b0-496b-8a49-29acf0ea8de0@default> References: <87lhkiewjy.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1422729171 5713 80.91.229.3 (31 Jan 2015 18:32:51 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 31 Jan 2015 18:32:51 +0000 (UTC) To: torys.anderson@gmail.com, emacs list Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Jan 31 19:32:47 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 1YHcqc-0004Ym-EC for geh-help-gnu-emacs@m.gmane.org; Sat, 31 Jan 2015 19:32:46 +0100 Original-Received: from localhost ([::1]:42523 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YHcqb-0007W1-NI for geh-help-gnu-emacs@m.gmane.org; Sat, 31 Jan 2015 13:32:45 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52214) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YHcqL-0007SJ-Uk for help-gnu-emacs@gnu.org; Sat, 31 Jan 2015 13:32:34 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YHcqG-0001V6-Pl for help-gnu-emacs@gnu.org; Sat, 31 Jan 2015 13:32:29 -0500 Original-Received: from userp1040.oracle.com ([156.151.31.81]:44703) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YHcqG-0001TF-JC for help-gnu-emacs@gnu.org; Sat, 31 Jan 2015 13:32:24 -0500 Original-Received: from ucsinet22.oracle.com (ucsinet22.oracle.com [156.151.31.94]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t0VIWIZp006240 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 31 Jan 2015 18:32:19 GMT Original-Received: from aserz7022.oracle.com (aserz7022.oracle.com [141.146.126.231]) by ucsinet22.oracle.com (8.14.5+Sun/8.14.5) with ESMTP id t0VIWGFm028304 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Sat, 31 Jan 2015 18:32:17 GMT Original-Received: from abhmp0015.oracle.com (abhmp0015.oracle.com [141.146.116.21]) by aserz7022.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id t0VIWGff018941; Sat, 31 Jan 2015 18:32:16 GMT In-Reply-To: <87lhkiewjy.fsf@gmail.com> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.8.2 (807160) [OL 12.0.6691.5000 (x86)] X-Source-IP: ucsinet22.oracle.com [156.151.31.94] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 156.151.31.81 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:102400 Archived-At: > I use the Bookmarks+ module (perhaps not relevant). I also frequently rea= d > 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. An= y > 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'.=20 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#BookmarkingFilesYouCannotVisitW= ithEmacs * Using MS Windows file associations: http://www.emacswiki.org/emacs/BookmarkPlus#WindowsFileAssociations