aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Volpiatto2010-04-12 11:17:29 -0400
committerStefan Monnier2010-04-12 11:17:29 -0400
commit45be326afc57551050f71b07cb40752a8dfa2aa3 (patch)
treeb00795acf1ffb50b5e8730a8c111bdd7e962961b
parent4794a58232a4a31d628ac6a145dd1113c0ade6fd (diff)
downloademacs-45be326afc57551050f71b07cb40752a8dfa2aa3.tar.gz
emacs-45be326afc57551050f71b07cb40752a8dfa2aa3.zip
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.
-rw-r--r--lisp/ChangeLog33
-rw-r--r--lisp/gnus/ChangeLog6
-rw-r--r--lisp/gnus/gnus-sum.el35
-rw-r--r--lisp/man.el46
-rw-r--r--lisp/woman.el21
5 files changed, 129 insertions, 12 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 8bf9dcd4607..545ce63780f 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,13 @@
12010-04-12 Thierry Volpiatto <thierry.volpiatto@gmail.com>
2
3 * woman.el (woman-bookmark-make-record, woman-bookmark-jump):
4 New functions.
5 (woman-mode): Setup bookmark support.
6
7 * man.el (man-set-default-bookmark-title, man-bookmark-make-record)
8 (man-bookmark-jump): New functions.
9 (Man-mode): Setup bookmark support.
10
12010-04-10 Jari Aalto <jari.aalto@cante.net> 112010-04-10 Jari Aalto <jari.aalto@cante.net>
2 12
3 * comint.el (comint-password-prompt-regexp): Use regexp-opt, and 13 * comint.el (comint-password-prompt-regexp): Use regexp-opt, and
@@ -13,10 +23,9 @@
13 23
14 * net/tramp.el (tramp-completion-function-alist) 24 * net/tramp.el (tramp-completion-function-alist)
15 (tramp-file-name-regexp, tramp-chunksize) 25 (tramp-file-name-regexp, tramp-chunksize)
16 (tramp-local-coding-commands, tramp-remote-coding-commands): Fix 26 (tramp-local-coding-commands, tramp-remote-coding-commands):
17 docstring. 27 Fix docstring.
18 (tramp-remote-process-environment): Use `format' instead of 28 (tramp-remote-process-environment): Use `format' instead of `concat'.
19 `concat'.
20 (tramp-handle-directory-files-and-attributes) 29 (tramp-handle-directory-files-and-attributes)
21 (tramp-get-remote-path): Use `copy-tree'. 30 (tramp-get-remote-path): Use `copy-tree'.
22 (tramp-handle-file-name-all-completions): Backward/ XEmacs 31 (tramp-handle-file-name-all-completions): Backward/ XEmacs
@@ -24,11 +33,11 @@
24 `read-file-name-completion-ignore-case' does not exist. 33 `read-file-name-completion-ignore-case' does not exist.
25 (tramp-do-copy-or-rename-file-directly): Do not use 34 (tramp-do-copy-or-rename-file-directly): Do not use
26 `tramp-handle-file-remote-p'. 35 `tramp-handle-file-remote-p'.
27 (tramp-do-copy-or-rename-file-out-of-band): Use 36 (tramp-do-copy-or-rename-file-out-of-band):
28 `tramp-compat-delete-directory'. 37 Use `tramp-compat-delete-directory'.
29 (tramp-do-copy-or-rename-file-out-of-band) 38 (tramp-do-copy-or-rename-file-out-of-band)
30 (tramp-compute-multi-hops, tramp-maybe-open-connection): Use 39 (tramp-compute-multi-hops, tramp-maybe-open-connection):
31 `format-spec-make'. 40 Use `format-spec-make'.
32 (tramp-find-foreign-file-name-handler) 41 (tramp-find-foreign-file-name-handler)
33 (tramp-advice-make-auto-save-file-name) 42 (tramp-advice-make-auto-save-file-name)
34 (tramp-set-auto-save-file-modes): Remove superfluous check for 43 (tramp-set-auto-save-file-modes): Remove superfluous check for
@@ -38,8 +47,8 @@
38 (tramp-check-for-regexp): Use (forward-line 1). 47 (tramp-check-for-regexp): Use (forward-line 1).
39 (tramp-set-auto-save-file-modes): Adapt version check. 48 (tramp-set-auto-save-file-modes): Adapt version check.
40 49
41 * net/tramp-compat.el (tramp-advice-file-expand-wildcards): Wrap 50 * net/tramp-compat.el (tramp-advice-file-expand-wildcards):
42 call of `featurep' for 2nd argument. 51 Wrap call of `featurep' for 2nd argument.
43 (tramp-compat-make-temp-file): Simplify fallback implementation. 52 (tramp-compat-make-temp-file): Simplify fallback implementation.
44 (tramp-compat-copy-tree): Remove function. 53 (tramp-compat-copy-tree): Remove function.
45 (tramp-compat-delete-directory): Provide implementation for older 54 (tramp-compat-delete-directory): Provide implementation for older
@@ -69,8 +78,8 @@
69 Add --author support to git commit. 78 Add --author support to git commit.
70 * vc-git.el (vc-git-checkin): Pass extra-args to the commit command. 79 * vc-git.el (vc-git-checkin): Pass extra-args to the commit command.
71 (vc-git-log-edit-mode): New minor mode. 80 (vc-git-log-edit-mode): New minor mode.
72 (log-edit-mode, log-edit-extra-flags, log-edit-mode): New 81 (log-edit-mode, log-edit-extra-flags, log-edit-mode):
73 declarations. 82 New declarations.
74 83
752010-04-09 Eric Raymond <esr@snark.thyrsus.com> 842010-04-09 Eric Raymond <esr@snark.thyrsus.com>
76 85
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index e418c5f9f5a..47cf6997d60 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,9 @@
12010-04-12 Thierry Volpiatto <thierry.volpiatto@gmail.com>
2
3 * gnus-sum.el (gnus-summary-bookmark-make-record)
4 (gnus-summary-bookmark-jump): New functions.
5 (gnus-summary-mode): Setup bookmark support.
6
12010-04-01 Andreas Schwab <schwab@linux-m68k.org> 72010-04-01 Andreas Schwab <schwab@linux-m68k.org>
2 8
3 * mm-uu.el (mm-uu-pgp-signed-extract-1): Use buffer-file-coding-system 9 * mm-uu.el (mm-uu-pgp-signed-extract-1): Use buffer-file-coding-system
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el
index 608224e436d..a8e612856a0 100644
--- a/lisp/gnus/gnus-sum.el
+++ b/lisp/gnus/gnus-sum.el
@@ -3072,6 +3072,9 @@ The following commands are available:
3072 (gnus-run-mode-hooks 'gnus-summary-mode-hook) 3072 (gnus-run-mode-hooks 'gnus-summary-mode-hook)
3073 (turn-on-gnus-mailing-list-mode) 3073 (turn-on-gnus-mailing-list-mode)
3074 (mm-enable-multibyte) 3074 (mm-enable-multibyte)
3075 ;; Bookmark support.
3076 (set (make-local-variable 'bookmark-make-record-function)
3077 'gnus-summary-bookmark-make-record)
3075 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy) 3078 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
3076 (gnus-update-summary-mark-positions)) 3079 (gnus-update-summary-mark-positions))
3077 3080
@@ -12640,6 +12643,38 @@ If ALL is a number, fetch this number of articles."
12640 (gnus-summary-limit (gnus-sorted-nunion old new)))) 12643 (gnus-summary-limit (gnus-sorted-nunion old new))))
12641 (gnus-summary-position-point))) 12644 (gnus-summary-position-point)))
12642 12645
12646;;; BOOKMARK support for GNUS.
12647
12648(defun gnus-summary-bookmark-make-record ()
12649 "Make a bookmark entry for a Gnus buffer."
12650 (require 'gnus)
12651 (unless (and (eq major-mode 'gnus-summary-mode) gnus-article-current)
12652 (error "Please retry from the Gnus summary buffer")) ;[1]
12653 (let* ((subject (elt (gnus-summary-article-header) 1))
12654 (grp (car gnus-article-current))
12655 (art (cdr gnus-article-current))
12656 (head (gnus-summary-article-header art))
12657 (id (mail-header-id head)))
12658 `(,subject
12659 ,@(bookmark-make-record-default 'point-only)
12660 (group . ,grp) (article . ,art)
12661 (message-id . ,id) (handler . gnus-summary-bookmark-jump))))
12662
12663
12664(defun gnus-summary-bookmark-jump (bookmark)
12665 "Handler function for record returned by `gnus-summary-bookmark-make-record'.
12666BOOKMARK is a bookmark name or a bookmark record."
12667 (let ((group (bookmark-prop-get bookmark 'group))
12668 (article (bookmark-prop-get bookmark 'article))
12669 (id (bookmark-prop-get bookmark 'message-id))
12670 buf)
12671 (gnus-fetch-group group (list article))
12672 (gnus-summary-insert-cached-articles)
12673 (gnus-summary-goto-article id nil 'force)
12674 (setq buf (current-buffer))
12675 (bookmark-default-handler
12676 `("" (buffer . ,buf) . ,(bookmark-get-bookmark-record bookmark)))))
12677
12643(gnus-summary-make-all-marking-commands) 12678(gnus-summary-make-all-marking-commands)
12644 12679
12645(gnus-ems-redefine) 12680(gnus-ems-redefine)
diff --git a/lisp/man.el b/lisp/man.el
index 8eb5f73e245..0402c08522d 100644
--- a/lisp/man.el
+++ b/lisp/man.el
@@ -221,6 +221,11 @@ the associated section number."
221 :type '(repeat string) 221 :type '(repeat string)
222 :group 'man) 222 :group 'man)
223 223
224(defcustom Man-name-local-regexp "^NOM$"
225 "*The translation of the uppercase word NAME in your language.
226Used in `bookmark-set' to get the default bookmark name."
227 :type 'string :group 'bookmark)
228
224(defvar manual-program "man" 229(defvar manual-program "man"
225 "The name of the program that produces man pages.") 230 "The name of the program that produces man pages.")
226 231
@@ -1325,6 +1330,9 @@ The following key bindings are currently in effect in the buffer:
1325 (setq imenu-generic-expression (list (list nil Man-heading-regexp 0))) 1330 (setq imenu-generic-expression (list (list nil Man-heading-regexp 0)))
1326 (set (make-local-variable 'outline-regexp) Man-heading-regexp) 1331 (set (make-local-variable 'outline-regexp) Man-heading-regexp)
1327 (set (make-local-variable 'outline-level) (lambda () 1)) 1332 (set (make-local-variable 'outline-level) (lambda () 1))
1333 ;; Bookmark support.
1334 (set (make-local-variable 'bookmark-make-record-function)
1335 'man-bookmark-make-record)
1328 (Man-build-page-list) 1336 (Man-build-page-list)
1329 (Man-strip-page-headers) 1337 (Man-strip-page-headers)
1330 (Man-unindent) 1338 (Man-unindent)
@@ -1659,6 +1667,44 @@ Specify which REFERENCE to use; default is based on word at point."
1659 (setq path nil)) 1667 (setq path nil))
1660 (setq complete-path nil))) 1668 (setq complete-path nil)))
1661 complete-path)) 1669 complete-path))
1670
1671;;; Bookmark Man Support
1672
1673(defun man-set-default-bookmark-title ()
1674 "Set default bookmark title for Man or woman page based \
1675on NAME or `Man-name-local-regexp' entry."
1676 (save-excursion
1677 (goto-char (point-min))
1678 (when (or (re-search-forward Man-name-local-regexp nil t)
1679 (re-search-forward "^NAME$" nil t))
1680 (forward-line 1)
1681 (unless (> (skip-chars-forward " ") 0)
1682 (skip-chars-forward "\t"))
1683 (buffer-substring-no-properties (point) (line-end-position)))))
1684
1685(defun man-bookmark-make-record ()
1686 "Make a bookmark entry for a Man buffer."
1687 `(,(man-set-default-bookmark-title)
1688 ,@(bookmark-make-record-default 'point-only)
1689 (buffer-name . ,(buffer-name (current-buffer)))
1690 (handler . man-bookmark-jump)))
1691
1692(defun man-bookmark-jump (bookmark)
1693 "Default bookmark handler for Man buffers."
1694 (let* ((buf (bookmark-prop-get bookmark 'buffer-name))
1695 (buf-lst (split-string buf))
1696 (node (replace-regexp-in-string "\*" "" (car (last buf-lst))))
1697 (ind (when (> (length buf-lst) 2) (second buf-lst)))
1698 (Man-notify-method (case bookmark-jump-display-function
1699 ('switch-to-buffer 'pushy)
1700 ('switch-to-buffer-other-window 'friendly)
1701 ('display-buffer 'quiet)
1702 (t 'friendly))))
1703 (man (if ind (format "%s(%s)" node ind) node))
1704 (while (get-process "man") (sit-for 1))
1705 (bookmark-default-handler
1706 `("" (buffer . ,buf) . ,(bookmark-get-bookmark-record bookmark)))))
1707
1662 1708
1663;; Init the man package variables, if not already done. 1709;; Init the man package variables, if not already done.
1664(Man-init-defvars) 1710(Man-init-defvars)
diff --git a/lisp/woman.el b/lisp/woman.el
index 79d6d84aff1..97d65e422de 100644
--- a/lisp/woman.el
+++ b/lisp/woman.el
@@ -1934,6 +1934,9 @@ See `Man-mode' for additional details."
1934 ;; `make-local-variable' in case imenu not yet loaded! 1934 ;; `make-local-variable' in case imenu not yet loaded!
1935 woman-imenu-generic-expression) 1935 woman-imenu-generic-expression)
1936 (set (make-local-variable 'imenu-space-replacement) " ") 1936 (set (make-local-variable 'imenu-space-replacement) " ")
1937 ;; Bookmark support.
1938 (set (make-local-variable 'bookmark-make-record-function)
1939 'woman-bookmark-make-record)
1937 ;; For reformat ... 1940 ;; For reformat ...
1938 ;; necessary when reformatting a file in its old buffer: 1941 ;; necessary when reformatting a file in its old buffer:
1939 (setq imenu--last-menubar-index-alist nil) 1942 (setq imenu--last-menubar-index-alist nil)
@@ -4516,6 +4519,24 @@ logging the message."
4516 (recenter 0)))))))) 4519 (recenter 0))))))))
4517 nil) ; for woman-file-readable-p etc. 4520 nil) ; for woman-file-readable-p etc.
4518 4521
4522;;; Bookmark Woman support.
4523
4524(defun woman-bookmark-make-record ()
4525 "Make a bookmark entry for a Woman buffer."
4526 `(,(man-set-default-bookmark-title)
4527 ,@(bookmark-make-record-default 'point-only)
4528 (filename . ,woman-last-file-name)
4529 (handler . woman-bookmark-jump)))
4530
4531
4532(defun woman-bookmark-jump (bookmark)
4533 "Default bookmark handler for Woman buffers."
4534 (let* ((file (bookmark-prop-get bookmark 'filename))
4535 (buf (save-window-excursion
4536 (woman-find-file file) (current-buffer))))
4537 (bookmark-default-handler
4538 `("" (buffer . ,buf) . ,(bookmark-get-bookmark-record bookmark)))))
4539
4519(provide 'woman) 4540(provide 'woman)
4520 4541
4521;; arch-tag: eea35e90-552f-4712-a94b-d9ffd3db7651 4542;; arch-tag: eea35e90-552f-4712-a94b-d9ffd3db7651