comparison lisp/info.el @ 11527:7956811d4d9a

(info-insert-file-contents): Set default-directory around call to shell-command-on-region. (Info-find-node, Info-restore-point, Info-search, Info-forward-node, Info-backward-node): Use string-equal, not equal, to compare node names.
author Richard M. Stallman <rms@gnu.org>
date Mon, 24 Apr 1995 15:31:19 +0000
parents bf32108711c6
children 7f357fe2cda5
comparison
equal deleted inserted replaced
11526:885c533e786e 11527:7956811d4d9a
162 (jka-compr-installed-p) 162 (jka-compr-installed-p)
163 (jka-compr-get-compression-info fullname)) 163 (jka-compr-get-compression-info fullname))
164 (setq decoder nil)) 164 (setq decoder nil))
165 (insert-file-contents fullname visit) 165 (insert-file-contents fullname visit)
166 (if decoder 166 (if decoder
167 (let ((buffer-read-only nil)) 167 (let ((buffer-read-only nil)
168 (default-directory (file-directory fullname)))
168 (shell-command-on-region (point-min) (point-max) decoder t))))) 169 (shell-command-on-region (point-min) (point-max) decoder t)))))
169 170
170 ;;;###autoload (add-hook 'same-window-buffer-names "*info*") 171 ;;;###autoload (add-hook 'same-window-buffer-names "*info*")
171 172
172 ;;;###autoload 173 ;;;###autoload
276 (set-buffer-modified-p nil) 277 (set-buffer-modified-p nil)
277 ;; See whether file has a tag table. Record the location if yes. 278 ;; See whether file has a tag table. Record the location if yes.
278 (set-marker Info-tag-table-marker nil) 279 (set-marker Info-tag-table-marker nil)
279 (goto-char (point-max)) 280 (goto-char (point-max))
280 (forward-line -8) 281 (forward-line -8)
281 (or (equal nodename "*") 282 ;; Use string-equal, not equal, to ignore text props.
283 (or (string-equal nodename "*")
282 (not (search-forward "\^_\nEnd tag table\n" nil t)) 284 (not (search-forward "\^_\nEnd tag table\n" nil t))
283 (let (pos) 285 (let (pos)
284 ;; We have a tag table. Find its beginning. 286 ;; We have a tag table. Find its beginning.
285 ;; Is this an indirect file? 287 ;; Is this an indirect file?
286 (search-backward "\nTag table:\n") 288 (search-backward "\nTag table:\n")
301 (match-end 0)))) 303 (match-end 0))))
302 (set-marker Info-tag-table-marker pos)))) 304 (set-marker Info-tag-table-marker pos))))
303 (setq Info-current-file 305 (setq Info-current-file
304 (if (eq filename t) "dir" 306 (if (eq filename t) "dir"
305 (file-name-sans-versions buffer-file-name))))) 307 (file-name-sans-versions buffer-file-name)))))
306 (if (equal nodename "*") 308 ;; Use string-equal, not equal, to ignore text props.
309 (if (string-equal nodename "*")
307 (progn (setq Info-current-node nodename) 310 (progn (setq Info-current-node nodename)
308 (Info-set-mode-line)) 311 (Info-set-mode-line))
309 ;; Search file for a suitable node. 312 ;; Search file for a suitable node.
310 (let ((guesspos (point-min)) 313 (let ((guesspos (point-min))
311 (regexp (concat "Node: *" (regexp-quote nodename) " *[,\t\n\177]"))) 314 (regexp (concat "Node: *" (regexp-quote nodename) " *[,\t\n\177]")))
635 638
636 (defun Info-restore-point (hl) 639 (defun Info-restore-point (hl)
637 "If this node has been visited, restore the point value when we left." 640 "If this node has been visited, restore the point value when we left."
638 (while hl 641 (while hl
639 (if (and (equal (nth 0 (car hl)) Info-current-file) 642 (if (and (equal (nth 0 (car hl)) Info-current-file)
640 (equal (nth 1 (car hl)) Info-current-node)) 643 ;; Use string-equal, not equal, to ignore text props.
644 (string-equal (nth 1 (car hl)) Info-current-node))
641 (progn 645 (progn
642 (goto-char (nth 2 (car hl))) 646 (goto-char (nth 2 (car hl)))
643 (setq hl nil)) ;terminate the while at next iter 647 (setq hl nil)) ;terminate the while at next iter
644 (setq hl (cdr hl))))) 648 (setq hl (cdr hl)))))
645 649
704 (goto-char opoint) 708 (goto-char opoint)
705 (Info-select-node))))) 709 (Info-select-node)))))
706 (widen) 710 (widen)
707 (goto-char found) 711 (goto-char found)
708 (Info-select-node) 712 (Info-select-node)
709 (or (and (equal onode Info-current-node) 713 ;; Use string-equal, not equal, to ignore text props.
714 (or (and (string-equal onode Info-current-node)
710 (equal ofile Info-current-file)) 715 (equal ofile Info-current-file))
711 (setq Info-history (cons (list ofile onode opoint) 716 (setq Info-history (cons (list ofile onode opoint)
712 Info-history))))) 717 Info-history)))))
713 718
714 ;; Extract the value of the node-pointer named NAME. 719 ;; Extract the value of the node-pointer named NAME.
1030 t) 1035 t)
1031 ((save-excursion (search-backward "next:" nil t)) 1036 ((save-excursion (search-backward "next:" nil t))
1032 (Info-next) 1037 (Info-next)
1033 t) 1038 t)
1034 ((and (save-excursion (search-backward "up:" nil t)) 1039 ((and (save-excursion (search-backward "up:" nil t))
1035 (not (equal (downcase (Info-extract-pointer "up")) "top"))) 1040 ;; Use string-equal, not equal, to ignore text props.
1041 (not (string-equal (downcase (Info-extract-pointer "up"))
1042 "top")))
1036 (let ((old-node Info-current-node)) 1043 (let ((old-node Info-current-node))
1037 (Info-up) 1044 (Info-up)
1038 (let (Info-history success) 1045 (let (Info-history success)
1039 (unwind-protect 1046 (unwind-protect
1040 (setq success (Info-forward-node t no-error)) 1047 (setq success (Info-forward-node t no-error))
1048 (let ((prevnode (Info-extract-pointer "prev[ious]*" t)) 1055 (let ((prevnode (Info-extract-pointer "prev[ious]*" t))
1049 (upnode (Info-extract-pointer "up" t))) 1056 (upnode (Info-extract-pointer "up" t)))
1050 (cond ((and upnode (string-match "(" upnode)) 1057 (cond ((and upnode (string-match "(" upnode))
1051 (error "First node in file")) 1058 (error "First node in file"))
1052 ((and upnode (or (null prevnode) 1059 ((and upnode (or (null prevnode)
1053 (equal (downcase prevnode) (downcase upnode)))) 1060 ;; Use string-equal, not equal,
1061 ;; to ignore text properties.
1062 (string-equal (downcase prevnode)
1063 (downcase upnode))))
1054 (Info-up)) 1064 (Info-up))
1055 (prevnode 1065 (prevnode
1056 ;; If we move back at the same level, 1066 ;; If we move back at the same level,
1057 ;; go down to find the last subnode*. 1067 ;; go down to find the last subnode*.
1058 (Info-prev) 1068 (Info-prev)