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: Can't add bookmarks for help pages Date: Sat, 9 Jun 2012 13:48:50 -0700 Message-ID: <3A6246CED9214924911024C0C02DAC53@us.oracle.com> References: <1339265373.4350.YahooMailClassic@web121506.mail.ne1.yahoo.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1339274957 18179 80.91.229.3 (9 Jun 2012 20:49:17 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 9 Jun 2012 20:49:17 +0000 (UTC) To: "'Kelly Dean'" , Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Jun 09 22:49:16 2012 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 1SdSaw-0001Um-Nd for geh-help-gnu-emacs@m.gmane.org; Sat, 09 Jun 2012 22:49:14 +0200 Original-Received: from localhost ([::1]:34643 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SdSaw-0007YZ-F7 for geh-help-gnu-emacs@m.gmane.org; Sat, 09 Jun 2012 16:49:14 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:33369) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SdSar-0007YQ-P6 for help-gnu-emacs@gnu.org; Sat, 09 Jun 2012 16:49:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SdSap-0007Kl-Iv for help-gnu-emacs@gnu.org; Sat, 09 Jun 2012 16:49:09 -0400 Original-Received: from acsinet15.oracle.com ([141.146.126.227]:27408) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SdSap-0007KD-Ct for help-gnu-emacs@gnu.org; Sat, 09 Jun 2012 16:49:07 -0400 Original-Received: from ucsinet21.oracle.com (ucsinet21.oracle.com [156.151.31.93]) by acsinet15.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id q59Kn138000304 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 9 Jun 2012 20:49:02 GMT Original-Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156]) by ucsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id q59Kn0Tt002235 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 9 Jun 2012 20:49:00 GMT Original-Received: from abhmt117.oracle.com (abhmt117.oracle.com [141.146.116.69]) by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id q59KmxDx007894; Sat, 9 Jun 2012 15:49:00 -0500 Original-Received: from dradamslap1 (/10.159.219.243) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 09 Jun 2012 13:48:59 -0700 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <1339265373.4350.YahooMailClassic@web121506.mail.ne1.yahoo.com> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Thread-Index: Ac1Gawth095JLC+tR6e0Ecaf26rmPwAABQWA X-Source-IP: ucsinet21.oracle.com [156.151.31.93] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1) X-Received-From: 141.146.126.227 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:85182 Archived-At: > Emacs lets me add bookmarks for man and info pages, but not > for help pages (it says "Buffer not visiting a file or > directory"). Not letting me bookmark help pages isn't user-friendly. What do you mean by a help page? Do you mean the output, in buffer *Help*, from a help command/key such as `C-h f' or `C-h v'? If so, then no, normally you cannot bookmark that - but see below. With Bookmark+ [*] you can bookmark a buffer that is not associated with a file, but except for certain predefined buffer types, such as Info and Dired, to jump to the bookmark later that buffer must already be present (live). And it must already have the text that you expect. So that won't help you here, not right out of the box. But it's easy enough to do. You just need to define your own new bookmark type for it. To do that you need to define two functions: 1. A function that creates the bookmark record for that type. 2. A handler function the DTRT when you "jump" to the bookmark. Here's how: (defun my-make-help-record () "Create and return a `*Help*' bookmark record." (unless (car help-xref-stack-item) (error "Cannot create bookmark - help command not known")) `(,@(bookmark-make-record-default 'NO-FILE 'NO-CONTEXT) (filename . ,bmkp-non-file-filename) (buffer-name . "*Help*") (help-fn . ,(car help-xref-stack-item)) (help-arg . ,(cadr help-xref-stack-item)) (handler . my-jump-help-bookmark))) (defun my-jump-help-bookmark (bookmark) "Jump to `*Help*' bookmark BOOKMARK. Handler function for record returned by `my-make-help-record'. BOOKMARK is a bookmark name or a bookmark record." (let ((help-fn (bookmark-prop-get bookmark 'help-fn)) (help-arg (bookmark-prop-get bookmark 'help-arg))) (funcall help-fn help-arg))) (add-hook 'help-mode-hook #'(lambda () (set (make-local-variable 'bookmark-make-record-function) 'my-make-help-record))) Then, whenever you are in buffer `*Help*', the normal bookmark-setting key, `C-x r m', creates a bookmark that will show that same help text in `*Help*' when you jump to it. It just calls the same help command with the same argument. E.g., if you used `C-h f forward-char' and you then set a bookmark in `*Help*', then jumping to it later would show again the help for function `forward-char', with the cursor at the same spot. But why would you want such a bookmark type (assuming this was what you had in mind)? Why not just use the help commands? Why would you want a bookmark for a specific bit of help text (e.g. for a specific variable), rather than just use a general command that works for any argument (e.g. any variable name)? Probably I'm missing what you really want to do. [*] http://www.emacswiki.org/cgi-bin/wiki/BookmarkPlus