comparison lisp/packages/info.el @ 183:e121b013d1f0 r20-3b18

Import from CVS: tag r20-3b18
author cvs
date Mon, 13 Aug 2007 09:54:23 +0200
parents bfd6434d15b3
children 3d6bfa290dbd
comparison
equal deleted inserted replaced
182:f07455f06202 183:e121b013d1f0
368 :group 'info) 368 :group 'info)
369 369
370 (defcustom Info-default-directory-list nil 370 (defcustom Info-default-directory-list nil
371 "*List of default directories to search for Info documentation 371 "*List of default directories to search for Info documentation
372 files. This value is used as the default for `Info-directory-list'. 372 files. This value is used as the default for `Info-directory-list'.
373 It is set in startup.el." 373 It is set in startup.el. The first directory in this list must
374 contain a `dir' file that will become the basis for the toplevel Info
375 directory."
374 :type '(repeat directory) 376 :type '(repeat directory)
375 :group 'info) 377 :group 'info)
376 378
377 (defcustom Info-additional-directory-list nil 379 (defcustom Info-additional-directory-list nil
378 "List of additional directories to search for Info documentation 380 "List of additional directories to search for Info documentation
391 (setq idx (or (string-match path-separator path) (length path)) 393 (setq idx (or (string-match path-separator path) (length path))
392 list (cons (substring path 0 idx) list) 394 list (cons (substring path 0 idx) list)
393 path (substring path (min (1+ idx) 395 path (substring path (min (1+ idx)
394 (length path))))) 396 (length path)))))
395 (nreverse list)) 397 (nreverse list))
396 Info-default-directory-list)) 398 (reverse Info-default-directory-list)))
397 "List of directories to search for Info documentation files. 399 "List of directories to search for Info documentation files.
398 Default is to use the environment variable INFOPATH if it exists, 400 Default is to use the environment variable INFOPATH if it exists,
399 else to use Info-default-directory-list.") 401 else to use Info-default-directory-list.")
400 402
401 ;; Is this right for NT? .zip, with -c for to stdout, right? 403 ;; Is this right for NT? .zip, with -c for to stdout, right?
810 (set-buffer info-buffer) 812 (set-buffer info-buffer)
811 (goto-char (point-max)) 813 (goto-char (point-max))
812 (cond 814 (cond
813 ((re-search-backward "^ *\\* *Locals *: *\n" nil t) 815 ((re-search-backward "^ *\\* *Locals *: *\n" nil t)
814 (delete-region (match-beginning 0) (match-end 0))) 816 (delete-region (match-beginning 0) (match-end 0)))
815 ((re-search-backward "^Local" nil t) 817 ((re-search-backward "^[ \t]*Local" nil t)
816 (end-of-line)) 818 ;; This is for people who underline topic headings with
819 ;; equal signs or dashes.
820 (when (save-excursion
821 (forward-line 1)
822 (beginning-of-line)
823 (looking-at "^[ \t]*[-=]+"))
824 (forward-line 1))
825 (forward-line 1)
826 (beginning-of-line))
817 (t (search-backward "\^L" nil t))) 827 (t (search-backward "\^L" nil t)))
818 ;; Insert menu part of the file 828 ;; Insert menu part of the file
819 (let* ((pt (point)) 829 (let* ((pt (point))
820 (len (length (buffer-string nil nil other)))) 830 (len (length (buffer-string nil nil other))))
821 (insert "\n" (buffer-string nil nil other)) 831 (insert (buffer-string nil nil other))
822 (goto-char (+ pt len)) 832 (goto-char (+ pt len))
823 (save-excursion 833 (save-excursion
824 (goto-char pt) 834 (goto-char pt)
825 (if (search-forward "* menu:" (+ pt len) t) 835 (if (search-forward "* menu:" (+ pt len) t)
826 (progn 836 (progn
1057 (substring name 0 -5) 1067 (substring name 0 -5)
1058 name)) 1068 name))
1059 "") 1069 "")
1060 ")" 1070 ")"
1061 (or Info-current-node "")))))) 1071 (or Info-current-node ""))))))
1062 1072
1063 ;; Go to an info node specified with a filename-and-nodename string 1073 ;; Go to an info node specified with a filename-and-nodename string
1064 ;; of the sort that is found in pointers in nodes. 1074 ;; of the sort that is found in pointers in nodes.
1065 1075
1066 ;;;###autoload 1076 ;;;###autoload
1067 (defun Info-goto-node (nodename &optional no-going-back tryfile) 1077 (defun Info-goto-node (nodename &optional no-going-back tryfile)
1247 (goto-char found) 1257 (goto-char found)
1248 (Info-select-node) 1258 (Info-select-node)
1249 (or (and (equal onode Info-current-node) 1259 (or (and (equal onode Info-current-node)
1250 (equal ofile Info-current-file)) 1260 (equal ofile Info-current-file))
1251 (Info-history-add ofile onode opoint))))) 1261 (Info-history-add ofile onode opoint)))))
1252 1262
1253
1254 ;; Extract the value of the node-pointer named NAME. 1263 ;; Extract the value of the node-pointer named NAME.
1255 ;; If there is none, use ERRORNAME in the error message; 1264 ;; If there is none, use ERRORNAME in the error message;
1256 ;; if ERRORNAME is nil, just return nil. 1265 ;; if ERRORNAME is nil, just return nil.
1257 (defun Info-extract-pointer (name &optional errorname) 1266 (defun Info-extract-pointer (name &optional errorname)
1258 (save-excursion 1267 (save-excursion
1336 1345
1337 (defun Info-directory () 1346 (defun Info-directory ()
1338 "Go to the Info directory node." 1347 "Go to the Info directory node."
1339 (interactive) 1348 (interactive)
1340 (Info-find-node "dir" "top")) 1349 (Info-find-node "dir" "top"))
1341 1350
1342 (defun Info-follow-reference (footnotename) 1351 (defun Info-follow-reference (footnotename)
1343 "Follow cross reference named NAME to the node it refers to. 1352 "Follow cross reference named NAME to the node it refers to.
1344 NAME may be an abbreviation of the reference name." 1353 NAME may be an abbreviation of the reference name."
1345 (interactive 1354 (interactive
1346 (let ((completion-ignore-case t) 1355 (let ((completion-ignore-case t)
2058 (delete-region (match-beginning 0) (match-end 0)) 2067 (delete-region (match-beginning 0) (match-end 0))
2059 (goto-char end)) 2068 (goto-char end))
2060 (or (equal tag "") 2069 (or (equal tag "")
2061 (insert "<<" tag ">>")))) 2070 (insert "<<" tag ">>"))))
2062 (Info-cease-annotate)) 2071 (Info-cease-annotate))
2063 2072
2064
2065 (defun Info-exit () 2073 (defun Info-exit ()
2066 "Exit Info by selecting some other buffer." 2074 "Exit Info by selecting some other buffer."
2067 (interactive) 2075 (interactive)
2068 (if Info-standalone 2076 (if Info-standalone
2069 (save-buffers-kill-emacs) 2077 (save-buffers-kill-emacs)
2228 (setq event (event-point event)))) 2236 (setq event (event-point event))))
2229 (let* ((data (Info-find-nearest-node event)) 2237 (let* ((data (Info-find-nearest-node event))
2230 (name (nth 1 (nth 1 data)))) 2238 (name (nth 1 (nth 1 data))))
2231 (and name (nth 1 data)))) 2239 (and name (nth 1 data))))
2232 (error nil))) 2240 (error nil)))
2233
2234 2241
2235 (defvar Info-mode-map nil 2242 (defvar Info-mode-map nil
2236 "Keymap containing Info commands.") 2243 "Keymap containing Info commands.")
2237 (if Info-mode-map 2244 (if Info-mode-map
2238 nil 2245 nil
2290 ;; XEmacs addition 2297 ;; XEmacs addition
2291 (define-key Info-mode-map 'backspace 'Info-scroll-prev) 2298 (define-key Info-mode-map 'backspace 'Info-scroll-prev)
2292 (define-key Info-mode-map 'delete 'Info-scroll-prev) 2299 (define-key Info-mode-map 'delete 'Info-scroll-prev)
2293 (define-key Info-mode-map 'button2 'Info-follow-clicked-node) 2300 (define-key Info-mode-map 'button2 'Info-follow-clicked-node)
2294 (define-key Info-mode-map 'button3 'Info-select-node-menu)) 2301 (define-key Info-mode-map 'button3 'Info-select-node-menu))
2295
2296 2302
2297 ;; Info mode is suitable only for specially formatted data. 2303 ;; Info mode is suitable only for specially formatted data.
2298 (put 'info-mode 'mode-class 'special) 2304 (put 'info-mode 'mode-class 'special)
2299 2305
2300 (defun Info-mode () 2306 (defun Info-mode ()
2469 (match-beginning 1) 2475 (match-beginning 1)
2470 (match-end 1)) 2476 (match-end 1))
2471 0) 2477 0)
2472 where))) 2478 where)))
2473 where))) 2479 where)))
2474
2475 2480
2476 ;;; fontification and mousability for info 2481 ;;; fontification and mousability for info
2477 2482
2478 (defun Info-highlight-region (start end face) 2483 (defun Info-highlight-region (start end face)
2479 (let ((extent nil) 2484 (let ((extent nil)
2695 Info-up 2700 Info-up
2696 t 2701 t
2697 "Up entry to enclosing section"] 2702 "Up entry to enclosing section"]
2698 ))) 2703 )))
2699 ;)) 2704 ;))
2700
2701 2705
2702 (provide 'info) 2706 (provide 'info)
2703 2707
2704 (run-hooks 'Info-load-hook) 2708 (run-hooks 'Info-load-hook)
2705 2709