1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-24 07:20:37 +00:00

Summary: Add bookmark support for man, woman and gnus-summary.

* woman.el (woman-bookmark-make-record, woman-bookmark-jump):
New functions.
(woman-mode): Setup bookmark support.
* man.el (man-set-default-bookmark-title, man-bookmark-make-record)
(man-bookmark-jump): New functions.
(Man-mode): Setup bookmark support.
* gnus-sum.el (gnus-summary-bookmark-make-record)
(gnus-summary-bookmark-jump): New functions.
(gnus-summary-mode): Setup bookmark support.
This commit is contained in:
Thierry Volpiatto 2010-04-12 11:17:29 -04:00 committed by Stefan Monnier
parent 4794a58232
commit 45be326afc
5 changed files with 129 additions and 12 deletions

View File

@ -1,3 +1,13 @@
2010-04-12 Thierry Volpiatto <thierry.volpiatto@gmail.com>
* woman.el (woman-bookmark-make-record, woman-bookmark-jump):
New functions.
(woman-mode): Setup bookmark support.
* man.el (man-set-default-bookmark-title, man-bookmark-make-record)
(man-bookmark-jump): New functions.
(Man-mode): Setup bookmark support.
2010-04-10 Jari Aalto <jari.aalto@cante.net>
* comint.el (comint-password-prompt-regexp): Use regexp-opt, and
@ -13,10 +23,9 @@
* net/tramp.el (tramp-completion-function-alist)
(tramp-file-name-regexp, tramp-chunksize)
(tramp-local-coding-commands, tramp-remote-coding-commands): Fix
docstring.
(tramp-remote-process-environment): Use `format' instead of
`concat'.
(tramp-local-coding-commands, tramp-remote-coding-commands):
Fix docstring.
(tramp-remote-process-environment): Use `format' instead of `concat'.
(tramp-handle-directory-files-and-attributes)
(tramp-get-remote-path): Use `copy-tree'.
(tramp-handle-file-name-all-completions): Backward/ XEmacs
@ -24,11 +33,11 @@
`read-file-name-completion-ignore-case' does not exist.
(tramp-do-copy-or-rename-file-directly): Do not use
`tramp-handle-file-remote-p'.
(tramp-do-copy-or-rename-file-out-of-band): Use
`tramp-compat-delete-directory'.
(tramp-do-copy-or-rename-file-out-of-band):
Use `tramp-compat-delete-directory'.
(tramp-do-copy-or-rename-file-out-of-band)
(tramp-compute-multi-hops, tramp-maybe-open-connection): Use
`format-spec-make'.
(tramp-compute-multi-hops, tramp-maybe-open-connection):
Use `format-spec-make'.
(tramp-find-foreign-file-name-handler)
(tramp-advice-make-auto-save-file-name)
(tramp-set-auto-save-file-modes): Remove superfluous check for
@ -38,8 +47,8 @@
(tramp-check-for-regexp): Use (forward-line 1).
(tramp-set-auto-save-file-modes): Adapt version check.
* net/tramp-compat.el (tramp-advice-file-expand-wildcards): Wrap
call of `featurep' for 2nd argument.
* net/tramp-compat.el (tramp-advice-file-expand-wildcards):
Wrap call of `featurep' for 2nd argument.
(tramp-compat-make-temp-file): Simplify fallback implementation.
(tramp-compat-copy-tree): Remove function.
(tramp-compat-delete-directory): Provide implementation for older
@ -69,8 +78,8 @@
Add --author support to git commit.
* vc-git.el (vc-git-checkin): Pass extra-args to the commit command.
(vc-git-log-edit-mode): New minor mode.
(log-edit-mode, log-edit-extra-flags, log-edit-mode): New
declarations.
(log-edit-mode, log-edit-extra-flags, log-edit-mode):
New declarations.
2010-04-09 Eric Raymond <esr@snark.thyrsus.com>

View File

@ -1,3 +1,9 @@
2010-04-12 Thierry Volpiatto <thierry.volpiatto@gmail.com>
* gnus-sum.el (gnus-summary-bookmark-make-record)
(gnus-summary-bookmark-jump): New functions.
(gnus-summary-mode): Setup bookmark support.
2010-04-01 Andreas Schwab <schwab@linux-m68k.org>
* mm-uu.el (mm-uu-pgp-signed-extract-1): Use buffer-file-coding-system

View File

@ -3072,6 +3072,9 @@ The following commands are available:
(gnus-run-mode-hooks 'gnus-summary-mode-hook)
(turn-on-gnus-mailing-list-mode)
(mm-enable-multibyte)
;; Bookmark support.
(set (make-local-variable 'bookmark-make-record-function)
'gnus-summary-bookmark-make-record)
(gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
(gnus-update-summary-mark-positions))
@ -12640,6 +12643,38 @@ If ALL is a number, fetch this number of articles."
(gnus-summary-limit (gnus-sorted-nunion old new))))
(gnus-summary-position-point)))
;;; BOOKMARK support for GNUS.
(defun gnus-summary-bookmark-make-record ()
"Make a bookmark entry for a Gnus buffer."
(require 'gnus)
(unless (and (eq major-mode 'gnus-summary-mode) gnus-article-current)
(error "Please retry from the Gnus summary buffer")) ;[1]
(let* ((subject (elt (gnus-summary-article-header) 1))
(grp (car gnus-article-current))
(art (cdr gnus-article-current))
(head (gnus-summary-article-header art))
(id (mail-header-id head)))
`(,subject
,@(bookmark-make-record-default 'point-only)
(group . ,grp) (article . ,art)
(message-id . ,id) (handler . gnus-summary-bookmark-jump))))
(defun gnus-summary-bookmark-jump (bookmark)
"Handler function for record returned by `gnus-summary-bookmark-make-record'.
BOOKMARK is a bookmark name or a bookmark record."
(let ((group (bookmark-prop-get bookmark 'group))
(article (bookmark-prop-get bookmark 'article))
(id (bookmark-prop-get bookmark 'message-id))
buf)
(gnus-fetch-group group (list article))
(gnus-summary-insert-cached-articles)
(gnus-summary-goto-article id nil 'force)
(setq buf (current-buffer))
(bookmark-default-handler
`("" (buffer . ,buf) . ,(bookmark-get-bookmark-record bookmark)))))
(gnus-summary-make-all-marking-commands)
(gnus-ems-redefine)

View File

@ -221,6 +221,11 @@ the associated section number."
:type '(repeat string)
:group 'man)
(defcustom Man-name-local-regexp "^NOM$"
"*The translation of the uppercase word NAME in your language.
Used in `bookmark-set' to get the default bookmark name."
:type 'string :group 'bookmark)
(defvar manual-program "man"
"The name of the program that produces man pages.")
@ -1325,6 +1330,9 @@ The following key bindings are currently in effect in the buffer:
(setq imenu-generic-expression (list (list nil Man-heading-regexp 0)))
(set (make-local-variable 'outline-regexp) Man-heading-regexp)
(set (make-local-variable 'outline-level) (lambda () 1))
;; Bookmark support.
(set (make-local-variable 'bookmark-make-record-function)
'man-bookmark-make-record)
(Man-build-page-list)
(Man-strip-page-headers)
(Man-unindent)
@ -1659,6 +1667,44 @@ Specify which REFERENCE to use; default is based on word at point."
(setq path nil))
(setq complete-path nil)))
complete-path))
;;; Bookmark Man Support
(defun man-set-default-bookmark-title ()
"Set default bookmark title for Man or woman page based \
on NAME or `Man-name-local-regexp' entry."
(save-excursion
(goto-char (point-min))
(when (or (re-search-forward Man-name-local-regexp nil t)
(re-search-forward "^NAME$" nil t))
(forward-line 1)
(unless (> (skip-chars-forward " ") 0)
(skip-chars-forward "\t"))
(buffer-substring-no-properties (point) (line-end-position)))))
(defun man-bookmark-make-record ()
"Make a bookmark entry for a Man buffer."
`(,(man-set-default-bookmark-title)
,@(bookmark-make-record-default 'point-only)
(buffer-name . ,(buffer-name (current-buffer)))
(handler . man-bookmark-jump)))
(defun man-bookmark-jump (bookmark)
"Default bookmark handler for Man buffers."
(let* ((buf (bookmark-prop-get bookmark 'buffer-name))
(buf-lst (split-string buf))
(node (replace-regexp-in-string "\*" "" (car (last buf-lst))))
(ind (when (> (length buf-lst) 2) (second buf-lst)))
(Man-notify-method (case bookmark-jump-display-function
('switch-to-buffer 'pushy)
('switch-to-buffer-other-window 'friendly)
('display-buffer 'quiet)
(t 'friendly))))
(man (if ind (format "%s(%s)" node ind) node))
(while (get-process "man") (sit-for 1))
(bookmark-default-handler
`("" (buffer . ,buf) . ,(bookmark-get-bookmark-record bookmark)))))
;; Init the man package variables, if not already done.
(Man-init-defvars)

View File

@ -1934,6 +1934,9 @@ See `Man-mode' for additional details."
;; `make-local-variable' in case imenu not yet loaded!
woman-imenu-generic-expression)
(set (make-local-variable 'imenu-space-replacement) " ")
;; Bookmark support.
(set (make-local-variable 'bookmark-make-record-function)
'woman-bookmark-make-record)
;; For reformat ...
;; necessary when reformatting a file in its old buffer:
(setq imenu--last-menubar-index-alist nil)
@ -4516,6 +4519,24 @@ logging the message."
(recenter 0))))))))
nil) ; for woman-file-readable-p etc.
;;; Bookmark Woman support.
(defun woman-bookmark-make-record ()
"Make a bookmark entry for a Woman buffer."
`(,(man-set-default-bookmark-title)
,@(bookmark-make-record-default 'point-only)
(filename . ,woman-last-file-name)
(handler . woman-bookmark-jump)))
(defun woman-bookmark-jump (bookmark)
"Default bookmark handler for Woman buffers."
(let* ((file (bookmark-prop-get bookmark 'filename))
(buf (save-window-excursion
(woman-find-file file) (current-buffer))))
(bookmark-default-handler
`("" (buffer . ,buf) . ,(bookmark-get-bookmark-record bookmark)))))
(provide 'woman)
;; arch-tag: eea35e90-552f-4712-a94b-d9ffd3db7651