/[emacs]/emacs/lisp/info.el
ViewVC logotype

Diff of /emacs/lisp/info.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.429 by jurta, Mon Jun 6 12:26:07 2005 UTC revision 1.430 by rms, Mon Jun 6 12:47:51 2005 UTC
# Line 1379  If FORK is a string, it is the name to u Line 1379  If FORK is a string, it is the name to u
1379    
1380  (defvar Info-read-node-completion-table)  (defvar Info-read-node-completion-table)
1381    
1382    (defun Info-read-node-name-2 (string path-and-suffixes action)
1383      "Virtual completion table for file names input in Info node names.
1384    PATH-AND-SUFFIXES is a pair of lists, (DIRECTORIES . SUFFIXES)."
1385      (let* ((names nil)
1386             (suffixes (remove "" (cdr path-and-suffixes)))
1387             (suffix (concat (regexp-opt suffixes t) "\\'"))
1388             (string-dir (file-name-directory string))
1389             (dirs
1390              (if (file-name-absolute-p string)
1391                  (list (file-name-directory string))
1392                (car path-and-suffixes))))
1393        (dolist (dir dirs)
1394          (unless dir
1395            (setq dir default-directory))
1396          (if string-dir (setq dir (expand-file-name string-dir dir)))
1397          (when (file-directory-p dir)
1398            (dolist (file (file-name-all-completions
1399                           (file-name-nondirectory string) dir))
1400              ;; If the file name has no suffix or a standard suffix,
1401              ;; include it.
1402              (and (or (null (file-name-extension file))
1403                       (string-match suffix file))
1404                   ;; But exclude subfiles of split info files.
1405                   (not (string-match "-[0-9]+\\'" file))
1406                   ;; And exclude backup files.
1407                   (not (string-match "~\\'" file))
1408                   (push (if string-dir (concat string-dir file) file) names))
1409              ;; If the file name ends in a standard suffix,
1410              ;; add the unsuffixed name as a completion option.
1411              (when (string-match suffix file)
1412                (setq file (substring file 0 (match-beginning 0)))
1413                (push (if string-dir (concat string-dir file) file) names)))))
1414        (cond
1415         ((eq action t) (all-completions string names))
1416         ((null action) (try-completion string names))
1417         (t (test-completion string names)))))
1418    
1419  ;; This function is used as the "completion table" while reading a node name.  ;; This function is used as the "completion table" while reading a node name.
1420  ;; It does completion using the alist in Info-read-node-completion-table  ;; It does completion using the alist in Info-read-node-completion-table
1421  ;; unless STRING starts with an open-paren.  ;; unless STRING starts with an open-paren.
# Line 1389  If FORK is a string, it is the name to u Line 1426  If FORK is a string, it is the name to u
1426      (let ((file (substring string 1)))      (let ((file (substring string 1)))
1427        (cond        (cond
1428         ((eq code nil)         ((eq code nil)
1429          (let ((comp (try-completion file 'locate-file-completion          (let ((comp (try-completion file 'Info-read-node-name-2
1430                                      (cons Info-directory-list                                      (cons Info-directory-list
1431                                            (mapcar 'car Info-suffix-list)))))                                            (mapcar 'car Info-suffix-list)))))
1432            (cond            (cond
1433             ((eq comp t) (concat string ")"))             ((eq comp t) (concat string ")"))
1434             (comp (concat "(" comp)))))             (comp (concat "(" comp)))))
1435         ((eq code t) (all-completions file 'locate-file-completion         ((eq code t)
1436                                       (cons Info-directory-list          (all-completions file 'Info-read-node-name-2
1437                                             (mapcar 'car Info-suffix-list))))                           (cons Info-directory-list
1438                                   (mapcar 'car Info-suffix-list))))
1439         (t nil))))         (t nil))))
1440     ;; If a file name was given, then any node is fair game.     ;; If a file name was given, then any node is fair game.
1441     ((string-match "\\`(" string)     ((string-match "\\`(" string)
# Line 1413  If FORK is a string, it is the name to u Line 1451  If FORK is a string, it is the name to u
1451     (t     (t
1452      (test-completion string Info-read-node-completion-table predicate))))      (test-completion string Info-read-node-completion-table predicate))))
1453    
1454    ;; Arrange to highlight the proper letters in the completion list buffer.
1455    (put 'Info-read-node-name-1 'completion-base-size-function
1456         (lambda () 1))
1457    
1458  (defun Info-read-node-name (prompt &optional default)  (defun Info-read-node-name (prompt &optional default)
1459    (let* ((completion-ignore-case t)    (let* ((completion-ignore-case t)
1460           (Info-read-node-completion-table (Info-build-node-completions))           (Info-read-node-completion-table (Info-build-node-completions))

Legend:
Removed from v.1.429  
changed lines
  Added in v.1.430

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26