[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r108568: * lisp/help-mode.el (help-bo
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r108568: * lisp/help-mode.el (help-bookmark-make-record, help-bookmark-jump): New funs. |
Date: |
Mon, 11 Jun 2012 21:03:10 -0400 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 108568
author: Drew Adams <address@hidden>
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Mon 2012-06-11 21:03:10 -0400
message:
* lisp/help-mode.el (help-bookmark-make-record, help-bookmark-jump): New funs.
(help-mode): Use them.
modified:
lisp/ChangeLog
lisp/help-mode.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2012-06-11 21:07:58 +0000
+++ b/lisp/ChangeLog 2012-06-12 01:03:10 +0000
@@ -1,3 +1,9 @@
+2012-06-12 Drew Adams <address@hidden>
+
+ * help-mode.el (help-bookmark-make-record, help-bookmark-jump):
+ New functions.
+ (help-mode): Use them.
+
2012-06-11 Glenn Morris <address@hidden>
* progmodes/fortran.el (fortran-font-lock-keywords-3):
=== modified file 'lisp/help-mode.el'
--- a/lisp/help-mode.el 2012-06-08 04:23:26 +0000
+++ b/lisp/help-mode.el 2012-06-12 01:03:10 +0000
@@ -267,6 +267,8 @@
'help-function 'customize-create-theme
'help-echo (purecopy "mouse-2, RET: edit this theme file"))
+(defvar bookmark-make-record-function)
+
;;;###autoload
(define-derived-mode help-mode special-mode "Help"
"Major mode for viewing help text and navigating references in it.
@@ -274,7 +276,9 @@
Commands:
\\{help-mode-map}"
(set (make-local-variable 'revert-buffer-function)
- 'help-mode-revert-buffer))
+ 'help-mode-revert-buffer)
+ (set (make-local-variable 'bookmark-make-record-function)
+ 'help-bookmark-make-record))
;;;###autoload
(defun help-mode-setup ()
@@ -791,6 +795,36 @@
(with-output-to-temp-buffer (help-buffer)
(insert string)))
+
+;; Bookmark support
+
+(declare-function bookmark-prop-get "bookmark" (bookmark prop))
+
+(defun help-bookmark-make-record ()
+ "Create and return a help-mode bookmark record.
+Implements `bookmark-make-record-function' for help-mode buffers."
+ (unless (car help-xref-stack-item)
+ (error "Cannot create bookmark - help command not known"))
+ `(,@(bookmark-make-record-default 'NO-FILE 'NO-CONTEXT)
+ (buffer-name . "*Help*")
+ (help-fn . ,(car help-xref-stack-item))
+ (help-arg . ,(cadr help-xref-stack-item))
+ (position . ,(point))
+ (handler . help-bookmark-jump)))
+
+;;;###autoload
+(defun help-bookmark-jump (bookmark)
+ "Jump to help-mode bookmark BOOKMARK.
+Handler function for record returned by `help-bookmark-make-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))
+ (position (bookmark-prop-get bookmark 'position)))
+ (funcall help-fn help-arg)
+ (pop-to-buffer "*Help*")
+ (goto-char position)))
+
+
(provide 'help-mode)
;;; help-mode.el ends here
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r108568: * lisp/help-mode.el (help-bookmark-make-record, help-bookmark-jump): New funs.,
Stefan Monnier <=