Mercurial > emacs
comparison lisp/info.el @ 57770:c7ff2d3a33ee
(Info-file-list-for-emacs): Add ("Info" . "info")
to search `Info-...' commands in `info' manual.
(Info-goto-emacs-command-node, Info-goto-emacs-key-command-node):
Add 'info-file "emacs" property.
(Info-find-emacs-command-nodes): Fix index line number regexp.
Set real line number (instead of fake 0) in first element of the
returned list.
(Info-goto-emacs-command-node): Use line number of first element
to set point in the first found Info node.
author | Juri Linkov <juri@jurta.org> |
---|---|
date | Thu, 28 Oct 2004 09:01:13 +0000 |
parents | d8b07169ce26 |
children | 117144126cd9 e24e2e78deda |
comparison
equal
deleted
inserted
replaced
57769:e663f6b659a6 | 57770:c7ff2d3a33ee |
---|---|
1978 (if index-node | 1978 (if index-node |
1979 (setq Info-point-loc | 1979 (setq Info-point-loc |
1980 (if (match-beginning 5) | 1980 (if (match-beginning 5) |
1981 (string-to-number (match-string 5)) | 1981 (string-to-number (match-string 5)) |
1982 (buffer-substring (match-beginning 0) (1- (match-beginning 1))))) | 1982 (buffer-substring (match-beginning 0) (1- (match-beginning 1))))) |
1983 ;;; Comment out the next line to use names of cross-references: | 1983 ;;; Uncomment next line to use names of cross-references in non-index nodes: |
1984 ;;; (setq Info-point-loc | 1984 ;;; (setq Info-point-loc |
1985 ;;; (buffer-substring (match-beginning 0) (1- (match-beginning 1)))) | 1985 ;;; (buffer-substring (match-beginning 0) (1- (match-beginning 1)))) |
1986 ) | 1986 ) |
1987 (replace-regexp-in-string | 1987 (replace-regexp-in-string |
1988 "[ \n]+" " " | 1988 "[ \n]+" " " |
3212 (and (marker-position Info-tag-table-marker) | 3212 (and (marker-position Info-tag-table-marker) |
3213 (buffer-modified-p) | 3213 (buffer-modified-p) |
3214 (message "Tags may have changed. Use Info-tagify if necessary"))) | 3214 (message "Tags may have changed. Use Info-tagify if necessary"))) |
3215 | 3215 |
3216 (defvar Info-file-list-for-emacs | 3216 (defvar Info-file-list-for-emacs |
3217 '("ediff" "eudc" "forms" "gnus" "info" ("mh" . "mh-e") | 3217 '("ediff" "eudc" "forms" "gnus" "info" ("Info" . "info") ("mh" . "mh-e") |
3218 "sc" "message" ("dired" . "dired-x") "viper" "vip" "idlwave" | 3218 "sc" "message" ("dired" . "dired-x") "viper" "vip" "idlwave" |
3219 ("c" . "ccmode") ("c++" . "ccmode") ("objc" . "ccmode") | 3219 ("c" . "ccmode") ("c++" . "ccmode") ("objc" . "ccmode") |
3220 ("java" . "ccmode") ("idl" . "ccmode") ("pike" . "ccmode") | 3220 ("java" . "ccmode") ("idl" . "ccmode") ("pike" . "ccmode") |
3221 ("skeleton" . "autotype") ("auto-insert" . "autotype") | 3221 ("skeleton" . "autotype") ("auto-insert" . "autotype") |
3222 ("copyright" . "autotype") ("executable" . "autotype") | 3222 ("copyright" . "autotype") ("executable" . "autotype") |
3243 "Return a list of locations documenting COMMAND. | 3243 "Return a list of locations documenting COMMAND. |
3244 The `info-file' property of COMMAND says which Info manual to search. | 3244 The `info-file' property of COMMAND says which Info manual to search. |
3245 If COMMAND has no property, the variable `Info-file-list-for-emacs' | 3245 If COMMAND has no property, the variable `Info-file-list-for-emacs' |
3246 defines heuristics for which Info manual to try. | 3246 defines heuristics for which Info manual to try. |
3247 The locations are of the format used in `Info-history', i.e. | 3247 The locations are of the format used in `Info-history', i.e. |
3248 \(FILENAME NODENAME BUFFERPOS\)." | 3248 \(FILENAME NODENAME BUFFERPOS\), where BUFFERPOS is the line number |
3249 (let ((where '()) | 3249 in the first element of the returned list (which is treated specially in |
3250 `Info-goto-emacs-command-node'), and 0 for the rest elements of a list." | |
3251 (let ((where '()) line-number | |
3250 (cmd-desc (concat "^\\* +" (regexp-quote (symbol-name command)) | 3252 (cmd-desc (concat "^\\* +" (regexp-quote (symbol-name command)) |
3251 "\\( <[0-9]+>\\)?:\\s *\\(.*\\)\\." | 3253 "\\( <[0-9]+>\\)?:\\s *\\(.*\\)\\." |
3252 "\\([ \t]*(line[ \t]*[0-9]*)\\)?$")) | 3254 "\\(?:[ \t\n]+(line +\\([0-9]+\\))\\)?")) |
3253 (info-file "emacs")) ;default | 3255 (info-file "emacs")) ;default |
3254 ;; Determine which info file this command is documented in. | 3256 ;; Determine which info file this command is documented in. |
3255 (if (get command 'info-file) | 3257 (if (get command 'info-file) |
3256 (setq info-file (get command 'info-file)) | 3258 (setq info-file (get command 'info-file)) |
3257 ;; If it doesn't say explicitly, test its name against | 3259 ;; If it doesn't say explicitly, test its name against |
3286 (while (re-search-forward cmd-desc nil t) | 3288 (while (re-search-forward cmd-desc nil t) |
3287 (setq where | 3289 (setq where |
3288 (cons (list Info-current-file | 3290 (cons (list Info-current-file |
3289 (match-string-no-properties 2) | 3291 (match-string-no-properties 2) |
3290 0) | 3292 0) |
3291 where))) | 3293 where)) |
3294 (setq line-number (and (match-beginning 3) | |
3295 (string-to-number (match-string 3))))) | |
3292 (and (setq nodes (cdr nodes) node (car nodes)))) | 3296 (and (setq nodes (cdr nodes) node (car nodes)))) |
3293 (Info-goto-node node))) | 3297 (Info-goto-node node))) |
3294 where)) | 3298 (if (and line-number where) |
3295 | 3299 (cons (list (nth 0 (car where)) (nth 1 (car where)) line-number) |
3300 (cdr where)) | |
3301 where))) | |
3302 | |
3303 ;;;###autoload (put 'Info-goto-emacs-command-node 'info-file "emacs") | |
3296 ;;;###autoload | 3304 ;;;###autoload |
3297 (defun Info-goto-emacs-command-node (command) | 3305 (defun Info-goto-emacs-command-node (command) |
3298 "Go to the Info node in the Emacs manual for command COMMAND. | 3306 "Go to the Info node in the Emacs manual for command COMMAND. |
3299 The command is found by looking up in Emacs manual's indices | 3307 The command is found by looking up in Emacs manual's indices |
3300 or in another manual found via COMMAND's `info-file' property or | 3308 or in another manual found via COMMAND's `info-file' property or |
3314 (info)) | 3322 (info)) |
3315 (or (eq major-mode 'Info-mode) (pop-to-buffer "*info*")) | 3323 (or (eq major-mode 'Info-mode) (pop-to-buffer "*info*")) |
3316 ;; Bind Info-history to nil, to prevent the last Index node | 3324 ;; Bind Info-history to nil, to prevent the last Index node |
3317 ;; visited by Info-find-emacs-command-nodes from being | 3325 ;; visited by Info-find-emacs-command-nodes from being |
3318 ;; pushed onto the history. | 3326 ;; pushed onto the history. |
3319 (let ((Info-history nil) (Info-history-list nil)) | 3327 (let ((Info-history nil) (Info-history-list nil) |
3320 (Info-find-node (car (car where)) | 3328 (line-number (nth 2 (car where)))) |
3321 (car (cdr (car where))))) | 3329 (Info-find-node (nth 0 (car where)) (nth 1 (car where))) |
3330 (if (and (integerp line-number) (> line-number 0)) | |
3331 (forward-line (1- line-number)))) | |
3322 (if (> num-matches 1) | 3332 (if (> num-matches 1) |
3323 (progn | 3333 (progn |
3324 ;; (car where) will be pushed onto Info-history | 3334 ;; (car where) will be pushed onto Info-history |
3325 ;; when/if they go to another node. Put the other | 3335 ;; when/if they go to another node. Put the other |
3326 ;; nodes that were found on the history. | 3336 ;; nodes that were found on the history. |
3330 (if (> num-matches 2) "ies" "y") | 3340 (if (> num-matches 2) "ies" "y") |
3331 (substitute-command-keys "\\[Info-last]") | 3341 (substitute-command-keys "\\[Info-last]") |
3332 (if (> num-matches 2) "them" "it"))))) | 3342 (if (> num-matches 2) "them" "it"))))) |
3333 (error "Couldn't find documentation for %s" command)))) | 3343 (error "Couldn't find documentation for %s" command)))) |
3334 | 3344 |
3345 ;;;###autoload (put 'Info-goto-emacs-key-command-node 'info-file "emacs") | |
3335 ;;;###autoload | 3346 ;;;###autoload |
3336 (defun Info-goto-emacs-key-command-node (key) | 3347 (defun Info-goto-emacs-key-command-node (key) |
3337 "Go to the node in the Emacs manual which describes the command bound to KEY. | 3348 "Go to the node in the Emacs manual which describes the command bound to KEY. |
3338 KEY is a string. | 3349 KEY is a string. |
3339 Interactively, if the binding is `execute-extended-command', a command is read. | 3350 Interactively, if the binding is `execute-extended-command', a command is read. |