Mercurial > hg > xemacs-beta
diff lisp/info.el @ 438:84b14dcb0985 r21-2-27
Import from CVS: tag r21-2-27
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:32:25 +0200 |
parents | 3ecd8885ac67 |
children | 8de8e3f6228a |
line wrap: on
line diff
--- a/lisp/info.el Mon Aug 13 11:31:26 2007 +0200 +++ b/lisp/info.el Mon Aug 13 11:32:25 2007 +0200 @@ -437,9 +437,15 @@ "List of directories to search for Info documentation files. The first directory in this list, the \"dir\" file there will become -the (dir)Top node of the Info documentation tree. If you wish to -modify the info search path, use `M-x customize-variable, -Info-directory-list' to do so.") +the (dir)Top node of the Info documentation tree. + +Note: DO NOT use the `customize' interface to change the value of this +variable. Its value is created dynamically on each startup, depending +on XEmacs packages installed on the system. If you want to change the +search path, make the needed modifications on the variable's value +from .emacs. For instance: + + (setq Info-directory-list (cons \"~/info\" Info-directory-list))") (defcustom Info-localdir-heading-regexp "^Locally installed XEmacs Packages:?" @@ -1489,12 +1495,10 @@ (or (equal tag "") (Info-find-node nil (format "<<%s>>" tag))))) ;;;###autoload -(defun Info-visit-file () +(defun Info-visit-file (file) "Directly visit an info file." - (interactive) - (let* ((insert-default-directory nil) - (file (read-file-name "Goto Info file: " "" ""))) - (or (equal file "") (Info-find-node (expand-file-name file) "Top")))) + (interactive "fVisit Info file: ") + (Info-find-node (expand-file-name file) "Top")) (defun Info-restore-point (&optional always) "Restore point to same location it had last time we were in this node." @@ -1513,13 +1517,33 @@ (set-window-start (get-buffer-window (current-buffer)) (+ (nth 2 entry) (point-min))))) +(defvar Info-read-node-completion-table) + +;; This function is used as the "completion table" while reading a node name. +;; It does completion using the alist in Info-read-node-completion-table +;; unless STRING starts with an open-paren. +(defun Info-read-node-name-1 (string predicate code) + (let ((no-completion (and (> (length string) 0) (eq (aref string 0) ?\()))) + (cond ((eq code nil) + (if no-completion + string + (try-completion string Info-read-node-completion-table predicate))) + ((eq code t) + (if no-completion + nil + (all-completions string Info-read-node-completion-table predicate))) + ((eq code 'lambda) + (if no-completion + t + (assoc string Info-read-node-completion-table)))))) + (defun Info-read-node-name (prompt &optional default) (Info-setup-initial) (let* ((completion-ignore-case t) - (nodename (completing-read prompt - (Info-build-node-completions) - nil nil nil - 'Info-minibuffer-history))) + (Info-read-node-completion-table (Info-build-node-completions)) + (nodename (completing-read prompt 'Info-read-node-name-1 + nil t nil 'Info-minibuffer-history + default))) (if (equal nodename "") (or default (Info-read-node-name prompt)) @@ -1576,10 +1600,14 @@ ;;;###autoload (defun Info-search (regexp) "Search for REGEXP, starting from point, and select node it's found in." - (interactive "sSearch (regexp): ") - (if (equal regexp "") - (setq regexp Info-last-search) - (setq Info-last-search regexp)) + (interactive (list + (read-from-minibuffer + (if Info-last-search + (format "Search (regexp, default %s): " + Info-last-search) + "Search (regexp): ") + nil nil nil nil nil Info-last-search))) + (setq Info-last-search regexp) (with-search-caps-disable-folding regexp t (let ((found ()) (onode Info-current-node) @@ -1666,7 +1694,7 @@ (skip-chars-forward (concat (or allowedchars "^,\t\n") "(")) (if (looking-at "(") (skip-chars-forward "^)"))) - (skip-chars-backward " ") + (skip-chars-backward " .") (point)))) (defun Info-next (&optional n) @@ -1761,7 +1789,8 @@ default ") ") "Follow reference named: ") completions nil t nil - 'Info-minibuffer-history))) + 'Info-minibuffer-history + default))) (if (and (string= item "") default) (list default) (list item))) @@ -1845,7 +1874,19 @@ (if (looking-at ":") (buffer-substring beg (1- (point))) (skip-chars-forward " \t\n") - (Info-following-node-name (if multi-line "^.,\t" "^.,\t\n")))) + ;; Kludge. + ;; Allow dots in node name not followed by whitespace. + (re-search-forward + (concat "\\(([^)]+)[^." + (if multi-line "" "\n") + "]*\\|\\([^.,\t" + (if multi-line "" "\n") + ;; We consider dots followed by newline as + ;; end of nodename even if multil-line. + ;; Also stops at .). It is generated by @pxref. + ;; Skips sequential dots. + "]\\|\\.+[^ \t\n)]\\)+\\)")) + (match-string 1))) (while (setq i (string-match "\n" str i)) (aset str i ?\ )) str)) @@ -1888,7 +1929,8 @@ default) "Menu item: ") completions nil t nil - 'Info-minibuffer-history))) + 'Info-minibuffer-history + default))) ;; we rely on the fact that completing-read accepts an input ;; of "" even when the require-match argument is true and "" ;; is not a valid possibility @@ -2095,7 +2137,7 @@ (interactive "sIndex topic: ") (let ((pattern (format "\n\\* \\([^\n:]*%s[^\n:]*\\):[ \t]*%s" (regexp-quote topic) - "\\([^.\n]*\\)\\.[ t]*\\([0-9]*\\)")) + "\\(.*\\)\\.[ t]*\\([0-9]*\\)$")) node) (message "Searching index for `%s'..." topic) (Info-goto-node "Top")