aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2005-11-25 16:35:34 +0000
committerChong Yidong2005-11-25 16:35:34 +0000
commitd590dbd27aaa027516abf9af350868427ad69540 (patch)
tree5a500f722e9e65771dffbbaef4f5ba98a2c6372c
parente5ad37ee8d4044d0feeecd97aca2b254b835c1d1 (diff)
downloademacs-d590dbd27aaa027516abf9af350868427ad69540.tar.gz
emacs-d590dbd27aaa027516abf9af350868427ad69540.zip
* info.el (Info-on-current-buffer): Record actual filename in
Info-current-file, instead of t, or a fake filename if a non-file buffer. Make autoload. (Info-find-node, Info-revert-find-node): No need to check for Info-current-file nil. (Info-set-mode-line, Info-up, Info-copy-current-node-name): Info-current-file is now never `t'. (Info-fontify-node): Many simplifications due to Info-current-file always being valid. Use Info-find-file to find node filename.
-rw-r--r--lisp/ChangeLog12
-rw-r--r--lisp/info.el80
2 files changed, 41 insertions, 51 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index a295c279de0..20abececa7b 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,15 @@
12005-11-25 Chong Yidong <cyd@stupidchicken.com>
2
3 * info.el (Info-on-current-buffer): Record actual filename in
4 Info-current-file, instead of t, or a fake filename if a non-file
5 buffer. Make autoload.
6 (Info-find-node, Info-revert-find-node): No need to check for
7 Info-current-file nil.
8 (Info-set-mode-line, Info-up, Info-copy-current-node-name):
9 Info-current-file is now never `t'.
10 (Info-fontify-node): Many simplifications due to Info-current-file
11 always being valid. Use Info-find-file to find node filename.
12
12005-11-25 David Kastrup <dak@gnu.org> 132005-11-25 David Kastrup <dak@gnu.org>
2 14
3 * longlines.el (longlines-wrap-line): Reorder wrapping to "insert 15 * longlines.el (longlines-wrap-line): Reorder wrapping to "insert
diff --git a/lisp/info.el b/lisp/info.el
index d5296364254..90964a61a2f 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -290,8 +290,7 @@ with wrapping around the current Info node."
290(defvar Info-current-file nil 290(defvar Info-current-file nil
291 "Info file that Info is now looking at, or nil. 291 "Info file that Info is now looking at, or nil.
292This is the name that was specified in Info, not the actual file name. 292This is the name that was specified in Info, not the actual file name.
293It doesn't contain directory names or file name extensions added by Info. 293It doesn't contain directory names or file name extensions added by Info.")
294Can also be t when using `Info-on-current-buffer'.")
295 294
296(defvar Info-current-subfile nil 295(defvar Info-current-subfile nil
297 "Info subfile that is actually in the *info* buffer now. 296 "Info subfile that is actually in the *info* buffer now.
@@ -691,12 +690,13 @@ it says do not attempt further (recursive) error recovery."
691 ;; Go into Info buffer. 690 ;; Go into Info buffer.
692 (or (eq major-mode 'Info-mode) (pop-to-buffer "*info*")) 691 (or (eq major-mode 'Info-mode) (pop-to-buffer "*info*"))
693 ;; Record the node we are leaving. 692 ;; Record the node we are leaving.
694 (if (and Info-current-file (not no-going-back)) 693 (if (not no-going-back)
695 (setq Info-history 694 (setq Info-history
696 (cons (list Info-current-file Info-current-node (point)) 695 (cons (list Info-current-file Info-current-node (point))
697 Info-history))) 696 Info-history)))
698 (Info-find-node-2 filename nodename no-going-back)) 697 (Info-find-node-2 filename nodename no-going-back))
699 698
699;;;###autoload
700(defun Info-on-current-buffer (&optional nodename) 700(defun Info-on-current-buffer (&optional nodename)
701 "Use the `Info-mode' to browse the current Info buffer. 701 "Use the `Info-mode' to browse the current Info buffer.
702If a prefix arg is provided, it queries for the NODENAME which 702If a prefix arg is provided, it queries for the NODENAME which
@@ -708,7 +708,10 @@ else defaults to \"Top\"."
708 (unless nodename (setq nodename "Top")) 708 (unless nodename (setq nodename "Top"))
709 (info-initialize) 709 (info-initialize)
710 (Info-mode) 710 (Info-mode)
711 (set (make-local-variable 'Info-current-file) t) 711 (set (make-local-variable 'Info-current-file)
712 (or buffer-file-name
713 ;; If called on a non-file buffer, make a fake file name.
714 (concat default-directory (buffer-name))))
712 (Info-find-node-2 nil nodename)) 715 (Info-find-node-2 nil nodename))
713 716
714;; It's perhaps a bit nasty to kill the *info* buffer to force a re-read, 717;; It's perhaps a bit nasty to kill the *info* buffer to force a re-read,
@@ -726,8 +729,7 @@ is preserved, if possible."
726 (pline (count-lines (point-min) (line-beginning-position))) 729 (pline (count-lines (point-min) (line-beginning-position)))
727 (wline (count-lines (point-min) (window-start))) 730 (wline (count-lines (point-min) (window-start)))
728 (old-history Info-history) 731 (old-history Info-history)
729 (new-history (and Info-current-file 732 (new-history (list Info-current-file Info-current-node (point))))
730 (list Info-current-file Info-current-node (point)))))
731 (kill-buffer (current-buffer)) 733 (kill-buffer (current-buffer))
732 (Info-find-node filename nodename) 734 (Info-find-node filename nodename)
733 (setq Info-history old-history) 735 (setq Info-history old-history)
@@ -1400,12 +1402,10 @@ any double quotes or backslashes must be escaped (\\\",\\\\)."
1400 (nconc (propertized-buffer-identification "%b") 1402 (nconc (propertized-buffer-identification "%b")
1401 (list 1403 (list
1402 (concat " (" 1404 (concat " ("
1403 (file-name-nondirectory 1405 (if Info-current-file
1404 (if (stringp Info-current-file) 1406 (file-name-nondirectory Info-current-file)
1405 Info-current-file 1407 " ")
1406 (or buffer-file-name ""))) 1408 ") " (or Info-current-node ""))))))
1407 ") "
1408 (or Info-current-node ""))))))
1409 1409
1410;; Go to an Info node specified with a filename-and-nodename string 1410;; Go to an Info node specified with a filename-and-nodename string
1411;; of the sort that is found in pointers in nodes. 1411;; of the sort that is found in pointers in nodes.
@@ -1884,7 +1884,7 @@ If SAME-FILE is non-nil, do not move to a different Info file."
1884 (let ((old-node Info-current-node) 1884 (let ((old-node Info-current-node)
1885 (old-file Info-current-file) 1885 (old-file Info-current-file)
1886 (node (Info-extract-pointer "up")) p) 1886 (node (Info-extract-pointer "up")) p)
1887 (and (or same-file (not (stringp Info-current-file))) 1887 (and same-file
1888 (string-match "^(" node) 1888 (string-match "^(" node)
1889 (error "Up node is in another Info file")) 1889 (error "Up node is in another Info file"))
1890 (Info-goto-node node) 1890 (Info-goto-node node)
@@ -3266,12 +3266,8 @@ With a zero prefix arg, put the name inside a function call to `info'."
3266 (interactive "P") 3266 (interactive "P")
3267 (unless Info-current-node 3267 (unless Info-current-node
3268 (error "No current Info node")) 3268 (error "No current Info node"))
3269 (let ((node (concat "(" (file-name-nondirectory 3269 (let ((node (concat "(" (file-name-nondirectory Info-current-file) ")"
3270 (or (and (stringp Info-current-file) 3270 Info-current-node)))
3271 Info-current-file)
3272 buffer-file-name
3273 ""))
3274 ")" Info-current-node)))
3275 (if (zerop (prefix-numeric-value arg)) 3271 (if (zerop (prefix-numeric-value arg))
3276 (setq node (concat "(info \"" node "\")"))) 3272 (setq node (concat "(info \"" node "\")")))
3277 (kill-new node) 3273 (kill-new node)
@@ -3804,28 +3800,19 @@ the variable `Info-file-list-for-emacs'."
3804 (and (not (equal (match-string 4) "")) 3800 (and (not (equal (match-string 4) ""))
3805 (match-string 4)) 3801 (match-string 4))
3806 (match-string 2))))) 3802 (match-string 2)))))
3807 (file (file-name-nondirectory 3803 (file Info-current-file)
3808 (if Info-current-file
3809 (if (stringp Info-current-file)
3810 Info-current-file
3811 (buffer-file-name)))))
3812 (hl Info-history-list) 3804 (hl Info-history-list)
3813 res) 3805 res)
3814 (if (string-match "(\\([^)]+\\))\\([^)]*\\)" node) 3806 (if (string-match "(\\([^)]+\\))\\([^)]*\\)" node)
3815 (setq file (file-name-nondirectory 3807 (setq file (Info-find-file (match-string 1 node))
3816 (match-string 1 node))
3817 node (if (equal (match-string 2 node) "") 3808 node (if (equal (match-string 2 node) "")
3818 "Top" 3809 "Top"
3819 (match-string 2 node)))) 3810 (match-string 2 node))))
3820 (while hl 3811 (while hl
3821 (if (and (string-equal node (nth 1 (car hl))) 3812 (if (and (string-equal node (nth 1 (car hl)))
3822 (or (and (eq t Info-current-file) 3813 (string-equal file (nth 0 (car hl))))
3823 (eq t (nth 0 (car hl)))) 3814 (setq res (car hl) hl nil)
3824 (string-equal file 3815 (setq hl (cdr hl))))
3825 (file-name-nondirectory
3826 (nth 0 (car hl))))))
3827 (setq res (car hl) hl nil)
3828 (setq hl (cdr hl))))
3829 res))) 'info-xref-visited 'info-xref)) 3816 res))) 'info-xref-visited 'info-xref))
3830 ;; For multiline ref, unfontify newline and surrounding whitespace 3817 ;; For multiline ref, unfontify newline and surrounding whitespace
3831 (save-excursion 3818 (save-excursion
@@ -3918,28 +3905,19 @@ the variable `Info-file-list-for-emacs'."
3918 (let ((node (if (equal (match-string 3) "") 3905 (let ((node (if (equal (match-string 3) "")
3919 (match-string 1) 3906 (match-string 1)
3920 (match-string 3))) 3907 (match-string 3)))
3921 (file (file-name-nondirectory 3908 (file Info-current-file)
3922 (if Info-current-file
3923 (if (stringp Info-current-file)
3924 Info-current-file
3925 (buffer-file-name)))))
3926 (hl Info-history-list) 3909 (hl Info-history-list)
3927 res) 3910 res)
3928 (if (string-match "(\\([^)]+\\))\\([^)]*\\)" node) 3911 (if (string-match "(\\([^)]+\\))\\([^)]*\\)" node)
3929 (setq file (file-name-nondirectory 3912 (setq file (Info-find-file (match-string 1 node))
3930 (match-string 1 node))
3931 node (if (equal (match-string 2 node) "") 3913 node (if (equal (match-string 2 node) "")
3932 "Top" 3914 "Top"
3933 (match-string 2 node)))) 3915 (match-string 2 node))))
3934 (while hl 3916 (while hl
3935 (if (and (string-equal node (nth 1 (car hl))) 3917 (if (and (string-equal node (nth 1 (car hl)))
3936 (or (and (eq t Info-current-file) 3918 (string-equal file (nth 0 (car hl))))
3937 (eq t (nth 0 (car hl)))) 3919 (setq res (car hl) hl nil)
3938 (string-equal file 3920 (setq hl (cdr hl))))
3939 (file-name-nondirectory
3940 (nth 0 (car hl))))))
3941 (setq res (car hl) hl nil)
3942 (setq hl (cdr hl))))
3943 res))) 'info-xref-visited 'info-xref))) 3921 res))) 'info-xref-visited 'info-xref)))
3944 (when (and not-fontified-p (memq Info-hide-note-references '(t hide))) 3922 (when (and not-fontified-p (memq Info-hide-note-references '(t hide)))
3945 (put-text-property (match-beginning 2) (1- (match-end 6)) 3923 (put-text-property (match-beginning 2) (1- (match-end 6))