Mercurial > emacs
comparison lisp/info.el @ 85921:1915d983e65a
(Info-revert-buffer-function): New func.
(Info-mode): Arrange to use it for reverting.
author | Thien-Thi Nguyen <ttn@gnuvola.org> |
---|---|
date | Sun, 04 Nov 2007 12:01:06 +0000 |
parents | 73eb55bef5f6 |
children | cdd30283527d 880960b70474 |
comparison
equal
deleted
inserted
replaced
85920:e5cfe61bd903 | 85921:1915d983e65a |
---|---|
704 ;; If called on a non-file buffer, make a fake file name. | 704 ;; If called on a non-file buffer, make a fake file name. |
705 (concat default-directory (buffer-name)))) | 705 (concat default-directory (buffer-name)))) |
706 (Info-find-node-2 nil nodename)) | 706 (Info-find-node-2 nil nodename)) |
707 | 707 |
708 ;; It's perhaps a bit nasty to kill the *info* buffer to force a re-read, | 708 ;; It's perhaps a bit nasty to kill the *info* buffer to force a re-read, |
709 ;; but at least it keeps this routine (which is only for the benefit of | 709 ;; but at least it keeps this routine (which is for makeinfo-buffer and |
710 ;; makeinfo-buffer) out of the way of normal operations. | 710 ;; Info-revert-buffer-function) out of the way of normal operations. |
711 ;; | 711 ;; |
712 (defun Info-revert-find-node (filename nodename) | 712 (defun Info-revert-find-node (filename nodename) |
713 "Go to an Info node FILENAME and NODENAME, re-reading disk contents. | 713 "Go to an Info node FILENAME and NODENAME, re-reading disk contents. |
714 When *info* is already displaying FILENAME and NODENAME, the window position | 714 When *info* is already displaying FILENAME and NODENAME, the window position |
715 is preserved, if possible." | 715 is preserved, if possible." |
736 (forward-line pline) | 736 (forward-line pline) |
737 (move-to-column pcolumn)) | 737 (move-to-column pcolumn)) |
738 ;; only add to the history when coming from a different file+node | 738 ;; only add to the history when coming from a different file+node |
739 (if new-history | 739 (if new-history |
740 (setq Info-history (cons new-history Info-history)))))) | 740 (setq Info-history (cons new-history Info-history)))))) |
741 | |
742 (defun Info-revert-buffer-function (ignore-auto noconfirm) | |
743 (when (or noconfirm (y-or-n-p "Revert info buffer? ")) | |
744 (Info-revert-find-node Info-current-file Info-current-node) | |
745 (message "Reverted %s" Info-current-file))) | |
741 | 746 |
742 (defun Info-find-in-tag-table-1 (marker regexp case-fold) | 747 (defun Info-find-in-tag-table-1 (marker regexp case-fold) |
743 "Find a node in a tag table. | 748 "Find a node in a tag table. |
744 MARKER specifies the buffer and position to start searching at. | 749 MARKER specifies the buffer and position to start searching at. |
745 REGEXP is a regular expression matching nodes or references. Its first | 750 REGEXP is a regular expression matching nodes or references. Its first |
3351 With a zero prefix arg, put the name inside a function call to `info'." | 3356 With a zero prefix arg, put the name inside a function call to `info'." |
3352 (interactive "P") | 3357 (interactive "P") |
3353 (unless Info-current-node | 3358 (unless Info-current-node |
3354 (error "No current Info node")) | 3359 (error "No current Info node")) |
3355 (let ((node (if (stringp Info-current-file) | 3360 (let ((node (if (stringp Info-current-file) |
3356 (concat "(" (file-name-nondirectory Info-current-file) ")" | 3361 (concat "(" (file-name-nondirectory Info-current-file) ") " |
3357 Info-current-node)))) | 3362 Info-current-node)))) |
3358 (if (zerop (prefix-numeric-value arg)) | 3363 (if (zerop (prefix-numeric-value arg)) |
3359 (setq node (concat "(info \"" node "\")"))) | 3364 (setq node (concat "(info \"" node "\")"))) |
3360 (unless (stringp Info-current-file) | 3365 (unless (stringp Info-current-file) |
3361 (setq node (format "(Info-find-node '%S '%S)" | 3366 (setq node (format "(Info-find-node '%S '%S)" |
3476 'Info-isearch-wrap) | 3481 'Info-isearch-wrap) |
3477 (set (make-local-variable 'isearch-push-state-function) | 3482 (set (make-local-variable 'isearch-push-state-function) |
3478 'Info-isearch-push-state) | 3483 'Info-isearch-push-state) |
3479 (set (make-local-variable 'search-whitespace-regexp) | 3484 (set (make-local-variable 'search-whitespace-regexp) |
3480 Info-search-whitespace-regexp) | 3485 Info-search-whitespace-regexp) |
3486 (set (make-local-variable 'revert-buffer-function) | |
3487 'Info-revert-buffer-function) | |
3481 (Info-set-mode-line) | 3488 (Info-set-mode-line) |
3482 (run-mode-hooks 'Info-mode-hook)) | 3489 (run-mode-hooks 'Info-mode-hook)) |
3483 | 3490 |
3484 ;; When an Info buffer is killed, make sure the associated tags buffer | 3491 ;; When an Info buffer is killed, make sure the associated tags buffer |
3485 ;; is killed too. | 3492 ;; is killed too. |