Mercurial > emacs
comparison lisp/info.el @ 45014:a590e8ab89d0
(Info-find-in-tag-table-1, Info-read-subfile): Use point-min.
(Info-read-node-name-1): Complete file names.
(Info-complete-menu-item): Don't cons unnecessarily.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Tue, 30 Apr 2002 02:08:56 +0000 |
parents | c4bbb272c48d |
children | f2355d13fe23 |
comparison
equal
deleted
inserted
replaced
45013:564222cd2e88 | 45014:a590e8ab89d0 |
---|---|
537 | 537 |
538 ;; Search tag table | 538 ;; Search tag table |
539 (beginning-of-line) | 539 (beginning-of-line) |
540 (when (re-search-forward regexp nil t) | 540 (when (re-search-forward regexp nil t) |
541 (list (string-equal "Ref:" (match-string 1)) | 541 (list (string-equal "Ref:" (match-string 1)) |
542 (1+ (read (current-buffer))) | 542 (+ (point-min) (read (current-buffer))) |
543 major-mode))))) | 543 major-mode))))) |
544 | 544 |
545 (defun Info-find-in-tag-table (marker regexp) | 545 (defun Info-find-in-tag-table (marker regexp) |
546 "Find a node in a tag table. | 546 "Find a node in a tag table. |
547 MARKER specifies the buffer and position to start searching at. | 547 MARKER specifies the buffer and position to start searching at. |
927 (if (not (eolp)) | 927 (if (not (eolp)) |
928 (let ((beg (point)) | 928 (let ((beg (point)) |
929 thisfilepos thisfilename) | 929 thisfilepos thisfilename) |
930 (search-forward ": ") | 930 (search-forward ": ") |
931 (setq thisfilename (buffer-substring beg (- (point) 2))) | 931 (setq thisfilename (buffer-substring beg (- (point) 2))) |
932 (setq thisfilepos (read (current-buffer))) | 932 (setq thisfilepos (+ (point-min) (read (current-buffer)))) |
933 ;; read in version 19 stops at the end of number. | 933 ;; read in version 19 stops at the end of number. |
934 ;; Advance to the next line. | 934 ;; Advance to the next line. |
935 (forward-line 1) | 935 (forward-line 1) |
936 (if (> thisfilepos nodepos) | 936 (if (> thisfilepos nodepos) |
937 (throw 'foo t)) | 937 (throw 'foo t)) |
1072 | 1072 |
1073 ;; This function is used as the "completion table" while reading a node name. | 1073 ;; This function is used as the "completion table" while reading a node name. |
1074 ;; It does completion using the alist in Info-read-node-completion-table | 1074 ;; It does completion using the alist in Info-read-node-completion-table |
1075 ;; unless STRING starts with an open-paren. | 1075 ;; unless STRING starts with an open-paren. |
1076 (defun Info-read-node-name-1 (string predicate code) | 1076 (defun Info-read-node-name-1 (string predicate code) |
1077 (let ((no-completion (and (> (length string) 0) (eq (aref string 0) ?\()))) | 1077 (cond |
1078 (cond ((eq code nil) | 1078 ;; First complete embedded file names. |
1079 (if no-completion | 1079 ((string-match "\\`([^)]*\\'" string) |
1080 string | 1080 (let ((file (substring string 1))) |
1081 (try-completion string Info-read-node-completion-table predicate))) | 1081 (cond |
1082 ((eq code t) | 1082 ((eq code nil) |
1083 (if no-completion | 1083 (let ((comp (try-completion file 'locate-file-completion |
1084 nil | 1084 (cons Info-directory-list |
1085 (all-completions string Info-read-node-completion-table predicate))) | 1085 (mapcar 'car Info-suffix-list))))) |
1086 ((eq code 'lambda) | 1086 (cond |
1087 (if no-completion | 1087 ((eq comp t) (concat string ")")) |
1088 t | 1088 (comp (concat "(" comp))))) |
1089 (assoc string Info-read-node-completion-table)))))) | 1089 ((eq code t) (all-completions file 'locate-file-completion |
1090 (cons Info-directory-list | |
1091 (mapcar 'car Info-suffix-list)))) | |
1092 (t nil)))) | |
1093 ;; If a file name was given, then any node is fair game. | |
1094 ((string-match "\\`(" string) | |
1095 (cond | |
1096 ((eq code nil) string) | |
1097 ((eq code t) nil) | |
1098 (t t))) | |
1099 ;; Otherwise use Info-read-node-completion-table. | |
1100 ((eq code nil) | |
1101 (try-completion string Info-read-node-completion-table predicate)) | |
1102 ((eq code t) | |
1103 (all-completions string Info-read-node-completion-table predicate)) | |
1104 (t | |
1105 (test-completion string Info-read-node-completion-table predicate)))) | |
1090 | 1106 |
1091 (defun Info-read-node-name (prompt &optional default) | 1107 (defun Info-read-node-name (prompt &optional default) |
1092 (let* ((completion-ignore-case t) | 1108 (let* ((completion-ignore-case t) |
1093 (Info-read-node-completion-table (Info-build-node-completions)) | 1109 (Info-read-node-completion-table (Info-build-node-completions)) |
1094 (nodename (completing-read prompt 'Info-read-node-name-1 nil t))) | 1110 (nodename (completing-read prompt 'Info-read-node-name-1 nil t))) |
1441 (setq completions (nth 4 Info-complete-cache)) | 1457 (setq completions (nth 4 Info-complete-cache)) |
1442 ;; The cache can't be used. | 1458 ;; The cache can't be used. |
1443 (while | 1459 (while |
1444 (progn | 1460 (progn |
1445 (while (re-search-forward pattern nil t) | 1461 (while (re-search-forward pattern nil t) |
1446 (push (cons (match-string-no-properties 1) | 1462 (push (match-string-no-properties 1) |
1447 (match-beginning 1)) | |
1448 completions)) | 1463 completions)) |
1449 ;; Check subsequent nodes if applicable. | 1464 ;; Check subsequent nodes if applicable. |
1450 (and Info-complete-next-re | 1465 (and Info-complete-next-re |
1451 (setq nextnode (Info-extract-pointer "next" t)) | 1466 (setq nextnode (Info-extract-pointer "next" t)) |
1452 (string-match Info-complete-next-re nextnode))) | 1467 (string-match Info-complete-next-re nextnode))) |