aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/info.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/info.el')
-rw-r--r--lisp/info.el90
1 files changed, 70 insertions, 20 deletions
diff --git a/lisp/info.el b/lisp/info.el
index c36554e6a7a..b34fd013df3 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -1379,6 +1379,43 @@ If FORK is a string, it is the name to use for the new buffer."
1379 1379
1380(defvar Info-read-node-completion-table) 1380(defvar Info-read-node-completion-table)
1381 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.
1384PATH-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
1382;; This function is used as the "completion table" while reading a node name. 1419;; This function is used as the "completion table" while reading a node name.
1383;; It does completion using the alist in Info-read-node-completion-table 1420;; It does completion using the alist in Info-read-node-completion-table
1384;; unless STRING starts with an open-paren. 1421;; unless STRING starts with an open-paren.
@@ -1389,15 +1426,16 @@ If FORK is a string, it is the name to use for the new buffer."
1389 (let ((file (substring string 1))) 1426 (let ((file (substring string 1)))
1390 (cond 1427 (cond
1391 ((eq code nil) 1428 ((eq code nil)
1392 (let ((comp (try-completion file 'locate-file-completion 1429 (let ((comp (try-completion file 'Info-read-node-name-2
1393 (cons Info-directory-list 1430 (cons Info-directory-list
1394 (mapcar 'car Info-suffix-list))))) 1431 (mapcar 'car Info-suffix-list)))))
1395 (cond 1432 (cond
1396 ((eq comp t) (concat string ")")) 1433 ((eq comp t) (concat string ")"))
1397 (comp (concat "(" comp))))) 1434 (comp (concat "(" comp)))))
1398 ((eq code t) (all-completions file 'locate-file-completion 1435 ((eq code t)
1399 (cons Info-directory-list 1436 (all-completions file 'Info-read-node-name-2
1400 (mapcar 'car Info-suffix-list)))) 1437 (cons Info-directory-list
1438 (mapcar 'car Info-suffix-list))))
1401 (t nil)))) 1439 (t nil))))
1402 ;; If a file name was given, then any node is fair game. 1440 ;; If a file name was given, then any node is fair game.
1403 ((string-match "\\`(" string) 1441 ((string-match "\\`(" string)
@@ -1413,6 +1451,10 @@ If FORK is a string, it is the name to use for the new buffer."
1413 (t 1451 (t
1414 (test-completion string Info-read-node-completion-table predicate)))) 1452 (test-completion string Info-read-node-completion-table predicate))))
1415 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
1416(defun Info-read-node-name (prompt &optional default) 1458(defun Info-read-node-name (prompt &optional default)
1417 (let* ((completion-ignore-case t) 1459 (let* ((completion-ignore-case t)
1418 (Info-read-node-completion-table (Info-build-node-completions)) 1460 (Info-read-node-completion-table (Info-build-node-completions))
@@ -3482,29 +3524,37 @@ the variable `Info-file-list-for-emacs'."
3482 (t 3524 (t
3483 (Info-goto-emacs-command-node command))))) 3525 (Info-goto-emacs-command-node command)))))
3484 3526
3485(defface Info-title-1-face 3527(defface info-title-1
3486 '((((type tty pc) (class color)) :foreground "yellow" :weight bold) 3528 '((((type tty pc) (class color)) :foreground "green" :weight bold)
3487 (t :height 1.2 :inherit Info-title-2-face)) 3529 (t :height 1.2 :inherit info-title-2))
3488 "Face for Info titles at level 1." 3530 "Face for info titles at level 1."
3489 :group 'info) 3531 :group 'info)
3532;; backward-compatibility alias
3533(put 'Info-title-1-face 'face-alias 'info-title-1)
3490 3534
3491(defface Info-title-2-face 3535(defface info-title-2
3492 '((((type tty pc) (class color)) :foreground "lightblue" :weight bold) 3536 '((((type tty pc) (class color)) :foreground "lightblue" :weight bold)
3493 (t :height 1.2 :inherit Info-title-3-face)) 3537 (t :height 1.2 :inherit info-title-3))
3494 "Face for Info titles at level 2." 3538 "Face for info titles at level 2."
3495 :group 'info) 3539 :group 'info)
3540;; backward-compatibility alias
3541(put 'Info-title-2-face 'face-alias 'info-title-2)
3496 3542
3497(defface Info-title-3-face 3543(defface info-title-3
3498 '((((type tty pc) (class color)) :weight bold) 3544 '((((type tty pc) (class color)) :weight bold)
3499 (t :height 1.2 :inherit Info-title-4-face)) 3545 (t :height 1.2 :inherit info-title-4))
3500 "Face for Info titles at level 3." 3546 "Face for info titles at level 3."
3501 :group 'info) 3547 :group 'info)
3548;; backward-compatibility alias
3549(put 'Info-title-3-face 'face-alias 'info-title-3)
3502 3550
3503(defface Info-title-4-face 3551(defface info-title-4
3504 '((((type tty pc) (class color)) :weight bold) 3552 '((((type tty pc) (class color)) :weight bold)
3505 (t :weight bold :inherit variable-pitch)) 3553 (t :weight bold :inherit variable-pitch))
3506 "Face for Info titles at level 4." 3554 "Face for info titles at level 4."
3507 :group 'info) 3555 :group 'info)
3556;; backward-compatibility alias
3557(put 'Info-title-4-face 'face-alias 'info-title-4)
3508 3558
3509(defface info-menu-header 3559(defface info-menu-header
3510 '((((type tty pc)) 3560 '((((type tty pc))
@@ -3644,10 +3694,10 @@ Preserve text properties."
3644 nil t) 3694 nil t)
3645 (let* ((c (preceding-char)) 3695 (let* ((c (preceding-char))
3646 (face 3696 (face
3647 (cond ((= c ?*) 'Info-title-1-face) 3697 (cond ((= c ?*) 'info-title-1)
3648 ((= c ?=) 'Info-title-2-face) 3698 ((= c ?=) 'info-title-2)
3649 ((= c ?-) 'Info-title-3-face) 3699 ((= c ?-) 'info-title-3)
3650 (t 'Info-title-4-face)))) 3700 (t 'info-title-4))))
3651 (put-text-property (match-beginning 1) (match-end 1) 3701 (put-text-property (match-beginning 1) (match-end 1)
3652 'font-lock-face face)) 3702 'font-lock-face face))
3653 ;; This is a serious problem for trying to handle multiple 3703 ;; This is a serious problem for trying to handle multiple