Mercurial > emacs
comparison lisp/info.el @ 29446:009f1caf830f
Bind case-fold-search to t when searching in case
a user sets it to nil in a hook.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Mon, 05 Jun 2000 19:22:40 +0000 |
parents | 935f96194020 |
children | f1b4be7fce6d |
comparison
equal
deleted
inserted
replaced
29445:cb3ad8f8f0ed | 29446:009f1caf830f |
---|---|
352 ;; want to use the results of re-search-backward. | 352 ;; want to use the results of re-search-backward. |
353 | 353 |
354 ;; The return value is the value of point at the beginning of matching | 354 ;; The return value is the value of point at the beginning of matching |
355 ;; REGERXP, if the function succeeds, nil otherwise. | 355 ;; REGERXP, if the function succeeds, nil otherwise. |
356 (defun Info-node-at-bob-matching (regexp) | 356 (defun Info-node-at-bob-matching (regexp) |
357 (and (bobp) ; are we at beginning of buffer? | 357 (and (bobp) ; are we at beginning of buffer? |
358 (looking-at "\^_") ; does it begin with node delimiter? | 358 (looking-at "\^_") ; does it begin with node delimiter? |
359 (let (beg) | 359 (let (beg) |
360 (forward-line 1) | 360 (forward-line 1) |
361 (setq beg (point)) | 361 (setq beg (point)) |
362 (forward-line 1) ; does the line after delimiter match REGEXP? | 362 (forward-line 1) ; does the line after delimiter match REGEXP? |
363 (re-search-backward regexp beg t)))) | 363 (re-search-backward regexp beg t)))) |
364 | 364 |
365 ;; Go to an info node specified as separate filename and nodename. | 365 ;; Go to an info node specified as separate filename and nodename. |
366 ;; no-going-back is non-nil if recovering from an error in this function; | 366 ;; no-going-back is non-nil if recovering from an error in this function; |
367 ;; it says do not attempt further (recursive) error recovery. | 367 ;; it says do not attempt further (recursive) error recovery. |
684 (insert-buffer buffer) | 684 (insert-buffer buffer) |
685 | 685 |
686 ;; Look at each of the other buffers one by one. | 686 ;; Look at each of the other buffers one by one. |
687 (while others | 687 (while others |
688 (let ((other (car others)) | 688 (let ((other (car others)) |
689 ;; Bind this in case the user sets it to nil. | |
690 (case-fold-search t) | |
689 this-buffer-nodes) | 691 this-buffer-nodes) |
690 ;; In each, find all the menus. | 692 ;; In each, find all the menus. |
691 (save-excursion | 693 (save-excursion |
692 (set-buffer other) | 694 (set-buffer other) |
693 (goto-char (point-min)) | 695 (goto-char (point-min)) |
710 (if (assoc-ignore-case "top" this-buffer-nodes) | 712 (if (assoc-ignore-case "top" this-buffer-nodes) |
711 (setq nodes (nconc this-buffer-nodes nodes)) | 713 (setq nodes (nconc this-buffer-nodes nodes)) |
712 (setq problems t) | 714 (setq problems t) |
713 (message "No `top' node in %s" Info-dir-file-name)))) | 715 (message "No `top' node in %s" Info-dir-file-name)))) |
714 (setq others (cdr others))) | 716 (setq others (cdr others))) |
715 ;; Add to the main menu a menu item for each other node. | 717 ;; Add to the main menu a menu item for each other node. |
716 (re-search-forward "^\\* Menu:") | 718 (let ((case-fold-search t) |
719 (re-search-forward "^\\* Menu:"))) | |
717 (forward-line 1) | 720 (forward-line 1) |
718 (let ((menu-items '("top")) | 721 (let ((menu-items '("top")) |
719 (nodes nodes) | 722 (nodes nodes) |
720 (case-fold-search t) | 723 (case-fold-search t) |
721 (end (save-excursion (search-forward "\^_" nil t) (point)))) | 724 (end (save-excursion (search-forward "\^_" nil t) (point)))) |
732 (setq menu-items (cons nodename menu-items)))))) | 735 (setq menu-items (cons nodename menu-items)))))) |
733 (setq nodes (cdr nodes)))) | 736 (setq nodes (cdr nodes)))) |
734 ;; Now take each node of each of the other buffers | 737 ;; Now take each node of each of the other buffers |
735 ;; and merge it into the main buffer. | 738 ;; and merge it into the main buffer. |
736 (while nodes | 739 (while nodes |
737 (let ((nodename (car (car nodes)))) | 740 (let ((case-fold-search t) |
741 (nodename (car (car nodes)))) | |
738 (goto-char (point-min)) | 742 (goto-char (point-min)) |
739 ;; Find the like-named node in the main buffer. | 743 ;; Find the like-named node in the main buffer. |
740 (if (re-search-forward (concat "^\^_.*\n.*Node: " | 744 (if (re-search-forward (concat "^\^_.*\n.*Node: " |
741 (regexp-quote nodename) | 745 (regexp-quote nodename) |
742 "[,\n\t]") | 746 "[,\n\t]") |
815 ;; Select the info node that point is in. | 819 ;; Select the info node that point is in. |
816 (defun Info-select-node () | 820 (defun Info-select-node () |
817 ;; Bind this in case the user sets it to nil. | 821 ;; Bind this in case the user sets it to nil. |
818 (let ((case-fold-search t)) | 822 (let ((case-fold-search t)) |
819 (save-excursion | 823 (save-excursion |
820 ;; Find beginning of node. | 824 ;; Find beginning of node. |
821 (if (search-backward "\n\^_" nil 'move) | 825 (if (search-backward "\n\^_" nil 'move) |
822 (forward-line 2) | 826 (forward-line 2) |
823 (if (looking-at "\^_") | 827 (if (looking-at "\^_") |
824 (forward-line 1) | 828 (forward-line 1) |
825 (signal 'search-failed (list "\n\^_")))) | 829 (signal 'search-failed (list "\n\^_")))) |
826 ;; Get nodename spelled as it is in the node. | 830 ;; Get nodename spelled as it is in the node. |
827 (re-search-forward "Node:[ \t]*") | 831 (re-search-forward "Node:[ \t]*") |
828 (setq Info-current-node | 832 (setq Info-current-node |
829 (buffer-substring-no-properties (point) | 833 (buffer-substring-no-properties (point) |
830 (progn | 834 (progn |
831 (skip-chars-forward "^,\t\n") | 835 (skip-chars-forward "^,\t\n") |
832 (point)))) | 836 (point)))) |
833 (Info-set-mode-line) | 837 (Info-set-mode-line) |
834 ;; Find the end of it, and narrow. | 838 ;; Find the end of it, and narrow. |
835 (beginning-of-line) | 839 (beginning-of-line) |
836 (let (active-expression) | 840 (let (active-expression) |
837 (narrow-to-region (point) | 841 (narrow-to-region (point) |
838 (if (re-search-forward "\n[\^_\f]" nil t) | 842 (if (re-search-forward "\n[\^_\f]" nil t) |
839 (prog1 | 843 (prog1 |
840 (1- (point)) | 844 (1- (point)) |
841 (if (looking-at "[\n\^_\f]*execute: ") | 845 (if (looking-at "[\n\^_\f]*execute: ") |
842 (progn | 846 (progn |
843 (goto-char (match-end 0)) | 847 (goto-char (match-end 0)) |
844 (setq active-expression | 848 (setq active-expression |
845 (read (current-buffer)))))) | 849 (read (current-buffer)))))) |
846 (point-max))) | 850 (point-max))) |
847 (if Info-enable-active-nodes (eval active-expression)) | 851 (if Info-enable-active-nodes (eval active-expression)) |
848 (if Info-fontify (Info-fontify-node)) | 852 (if Info-fontify (Info-fontify-node)) |
849 (run-hooks 'Info-selection-hook))))) | 853 (run-hooks 'Info-selection-hook))))) |
850 | 854 |
851 (defun Info-set-mode-line () | 855 (defun Info-set-mode-line () |
852 (setq mode-line-buffer-identification | 856 (setq mode-line-buffer-identification |
853 (concat | 857 (concat |
854 " Info: (" | 858 " Info: (" |
868 If FORK is non-nil, show the node in a new info buffer. | 872 If FORK is non-nil, show the node in a new info buffer. |
869 If FORK is a string, it is the name to use for the new buffer." | 873 If FORK is a string, it is the name to use for the new buffer." |
870 (interactive (list (Info-read-node-name "Goto node: ") current-prefix-arg)) | 874 (interactive (list (Info-read-node-name "Goto node: ") current-prefix-arg)) |
871 (info-initialize) | 875 (info-initialize) |
872 (if fork | 876 (if fork |
873 (set-buffer | 877 (set-buffer |
874 (clone-buffer (concat "*info-" (if (stringp fork) fork nodename) "*") t))) | 878 (clone-buffer (concat "*info-" (if (stringp fork) fork nodename) "*") t))) |
875 (let (filename) | 879 (let (filename) |
876 (string-match "\\s *\\((\\s *\\([^\t)]*\\)\\s *)\\s *\\|\\)\\(.*\\)" | 880 (string-match "\\s *\\((\\s *\\([^\t)]*\\)\\s *)\\s *\\|\\)\\(.*\\)" |
877 nodename) | 881 nodename) |
878 (setq filename (if (= (match-beginning 1) (match-end 1)) | 882 (setq filename (if (= (match-beginning 1) (match-end 1)) |
879 "" | 883 "" |
984 (if (null Info-current-subfile) | 988 (if (null Info-current-subfile) |
985 (progn (re-search-forward regexp) (setq found (point))) | 989 (progn (re-search-forward regexp) (setq found (point))) |
986 (condition-case err | 990 (condition-case err |
987 (progn (re-search-forward regexp) (setq found (point))) | 991 (progn (re-search-forward regexp) (setq found (point))) |
988 (search-failed nil))))) | 992 (search-failed nil))))) |
989 (if (not found) ;can only happen in subfile case -- else would have erred | 993 (if (not found) ;can only happen in subfile case -- else would have erred |
990 (unwind-protect | 994 (unwind-protect |
991 (let ((list ())) | 995 (let ((list ())) |
992 (save-excursion | 996 (save-excursion |
993 (set-buffer (marker-buffer Info-tag-table-marker)) | 997 (set-buffer (marker-buffer Info-tag-table-marker)) |
994 (goto-char (point-min)) | 998 (goto-char (point-min)) |
1023 (if (not found) | 1027 (if (not found) |
1024 (progn (Info-read-subfile osubfile) | 1028 (progn (Info-read-subfile osubfile) |
1025 (goto-char opoint) | 1029 (goto-char opoint) |
1026 (Info-select-node) | 1030 (Info-select-node) |
1027 (set-window-start (selected-window) ostart))))) | 1031 (set-window-start (selected-window) ostart))))) |
1028 (widen) | 1032 (widen) |
1029 (goto-char found) | 1033 (goto-char found) |
1030 (Info-select-node) | 1034 (Info-select-node) |
1031 ;; Use string-equal, not equal, to ignore text props. | 1035 ;; Use string-equal, not equal, to ignore text props. |
1032 (or (and (string-equal onode Info-current-node) | 1036 (or (and (string-equal onode Info-current-node) |
1033 (equal ofile Info-current-file)) | 1037 (equal ofile Info-current-file)) |
1034 (setq Info-history (cons (list ofile onode opoint) | 1038 (setq Info-history (cons (list ofile onode opoint) |
1035 Info-history)))))) | 1039 Info-history)))))) |
1036 | 1040 |
1037 ;; Extract the value of the node-pointer named NAME. | 1041 ;; Extract the value of the node-pointer named NAME. |
1038 ;; If there is none, use ERRORNAME in the error message; | 1042 ;; If there is none, use ERRORNAME in the error message; |
1039 ;; if ERRORNAME is nil, just return nil. | 1043 ;; if ERRORNAME is nil, just return nil. |
1040 (defun Info-extract-pointer (name &optional errorname) | 1044 (defun Info-extract-pointer (name &optional errorname) |
1218 ;; (setq list (cdr list)))) | 1222 ;; (setq list (cdr list)))) |
1219 | 1223 |
1220 (defvar Info-complete-menu-buffer) | 1224 (defvar Info-complete-menu-buffer) |
1221 | 1225 |
1222 (defun Info-complete-menu-item (string predicate action) | 1226 (defun Info-complete-menu-item (string predicate action) |
1223 (let ((case-fold-search t)) | 1227 (let ((completion-ignore-case t) |
1228 (case-fold-search t)) | |
1224 (cond ((eq action nil) | 1229 (cond ((eq action nil) |
1225 (let (completions | 1230 (let (completions |
1226 (pattern (concat "\n\\* +\\(" | 1231 (pattern (concat "\n\\* +\\(" |
1227 (regexp-quote string) | 1232 (regexp-quote string) |
1228 "[^:\t\n]*\\):"))) | 1233 "[^:\t\n]*\\):"))) |
1269 (let ((completions '()) | 1274 (let ((completions '()) |
1270 ;; If point is within a menu item, use that item as the default | 1275 ;; If point is within a menu item, use that item as the default |
1271 (default nil) | 1276 (default nil) |
1272 (p (point)) | 1277 (p (point)) |
1273 beg | 1278 beg |
1274 (last nil)) | 1279 (last nil) |
1280 (case-fold-search t)) | |
1275 (save-excursion | 1281 (save-excursion |
1276 (goto-char (point-min)) | 1282 (goto-char (point-min)) |
1277 (if (not (search-forward "\n* menu:" nil t)) | 1283 (if (not (search-forward "\n* menu:" nil t)) |
1278 (error "No menu in this node")) | 1284 (error "No menu in this node")) |
1279 (setq beg (point)) | 1285 (setq beg (point)) |
1288 (setq item (let ((completion-ignore-case t) | 1294 (setq item (let ((completion-ignore-case t) |
1289 (Info-complete-menu-buffer (current-buffer))) | 1295 (Info-complete-menu-buffer (current-buffer))) |
1290 (completing-read (if default | 1296 (completing-read (if default |
1291 (format "Menu item (default %s): " | 1297 (format "Menu item (default %s): " |
1292 default) | 1298 default) |
1293 "Menu item: ") | 1299 "Menu item: ") |
1294 'Info-complete-menu-item nil t))) | 1300 'Info-complete-menu-item nil t))) |
1295 ;; we rely on the fact that completing-read accepts an input | 1301 ;; we rely on the fact that completing-read accepts an input |
1296 ;; of "" even when the require-match argument is true and "" | 1302 ;; of "" even when the require-match argument is true and "" |
1297 ;; is not a valid possibility | 1303 ;; is not a valid possibility |
1298 (if (string= item "") | 1304 (if (string= item "") |
1299 (if default | 1305 (if default |
1300 (setq item default) | 1306 (setq item default) |
1301 ;; ask again | 1307 ;; ask again |
1302 (setq item nil)))) | 1308 (setq item nil)))) |
1303 (list item current-prefix-arg)))) | 1309 (list item current-prefix-arg)))) |
1304 ;; there is a problem here in that if several menu items have the same | 1310 ;; there is a problem here in that if several menu items have the same |
1305 ;; name you can only go to the node of the first with this command. | 1311 ;; name you can only go to the node of the first with this command. |
1306 (Info-goto-node (Info-extract-menu-item menu-item) (if fork menu-item))) | 1312 (Info-goto-node (Info-extract-menu-item menu-item) (if fork menu-item))) |
1307 | 1313 |
1308 (defun Info-extract-menu-item (menu-item) | 1314 (defun Info-extract-menu-item (menu-item) |
1309 (setq menu-item (regexp-quote menu-item)) | 1315 (setq menu-item (regexp-quote menu-item)) |
1310 (let ((case-fold-search t)) | 1316 (let ((case-fold-search t)) |
1311 (save-excursion | 1317 (save-excursion |
1312 (goto-char (point-min)) | 1318 (let ((case-fold-search t)) |
1313 (or (search-forward "\n* menu:" nil t) | 1319 (goto-char (point-min)) |
1314 (error "No menu in this node")) | 1320 (or (search-forward "\n* menu:" nil t) |
1315 (or (re-search-forward (concat "\n\\* +" menu-item ":") nil t) | 1321 (error "No menu in this node")) |
1316 (re-search-forward (concat "\n\\* +" menu-item) nil t) | 1322 (or (re-search-forward (concat "\n\\* +" menu-item ":") nil t) |
1317 (error "No such item in menu")) | 1323 (re-search-forward (concat "\n\\* +" menu-item) nil t) |
1318 (beginning-of-line) | 1324 (error "No such item in menu")) |
1319 (forward-char 2) | 1325 (beginning-of-line) |
1320 (Info-extract-menu-node-name)))) | 1326 (forward-char 2) |
1327 (Info-extract-menu-node-name))))) | |
1321 | 1328 |
1322 ;; If COUNT is nil, use the last item in the menu. | 1329 ;; If COUNT is nil, use the last item in the menu. |
1323 (defun Info-extract-menu-counting (count) | 1330 (defun Info-extract-menu-counting (count) |
1324 (let ((case-fold-search t)) | 1331 (let ((case-fold-search t)) |
1325 (save-excursion | 1332 (save-excursion |
1326 (goto-char (point-min)) | 1333 (let ((case-fold-search t)) |
1327 (or (search-forward "\n* menu:" nil t) | 1334 (goto-char (point-min)) |
1328 (error "No menu in this node")) | 1335 (or (search-forward "\n* menu:" nil t) |
1329 (if count | 1336 (error "No menu in this node")) |
1330 (or (search-forward "\n* " nil t count) | 1337 (if count |
1331 (error "Too few items in menu")) | 1338 (or (search-forward "\n* " nil t count) |
1332 (while (search-forward "\n* " nil t) | 1339 (error "Too few items in menu")) |
1333 nil)) | 1340 (while (search-forward "\n* " nil t) |
1334 (Info-extract-menu-node-name)))) | 1341 nil)) |
1342 (Info-extract-menu-node-name))))) | |
1335 | 1343 |
1336 (defun Info-nth-menu-item () | 1344 (defun Info-nth-menu-item () |
1337 "Go to the node of the Nth menu item. | 1345 "Go to the node of the Nth menu item. |
1338 N is the digit argument used to invoke this command." | 1346 N is the digit argument used to invoke this command." |
1339 (interactive) | 1347 (interactive) |
1348 | 1356 |
1349 (defun Info-final-node () | 1357 (defun Info-final-node () |
1350 "Go to the final node in this file." | 1358 "Go to the final node in this file." |
1351 (interactive) | 1359 (interactive) |
1352 (Info-goto-node "Top") | 1360 (Info-goto-node "Top") |
1353 (let (Info-history) | 1361 (let ((Info-history nil) |
1362 (case-fold-search t)) | |
1354 ;; Go to the last node in the menu of Top. | 1363 ;; Go to the last node in the menu of Top. |
1355 (Info-goto-node (Info-extract-menu-counting nil)) | 1364 (Info-goto-node (Info-extract-menu-counting nil)) |
1356 ;; If the last node in the menu is not last in pointer structure, | 1365 ;; If the last node in the menu is not last in pointer structure, |
1357 ;; move forward until we can't go any farther. | 1366 ;; move forward until we can't go any farther. |
1358 (while (Info-forward-node t t) nil) | 1367 (while (Info-forward-node t t) nil) |
1364 (defun Info-forward-node (&optional not-down no-error) | 1373 (defun Info-forward-node (&optional not-down no-error) |
1365 "Go forward one node, considering all nodes as forming one sequence." | 1374 "Go forward one node, considering all nodes as forming one sequence." |
1366 (interactive) | 1375 (interactive) |
1367 (goto-char (point-min)) | 1376 (goto-char (point-min)) |
1368 (forward-line 1) | 1377 (forward-line 1) |
1369 ;; three possibilities, in order of priority: | 1378 (let ((case-fold-search t)) |
1370 ;; 1. next node is in a menu in this node (but not in an index) | 1379 ;; three possibilities, in order of priority: |
1371 ;; 2. next node is next at same level | 1380 ;; 1. next node is in a menu in this node (but not in an index) |
1372 ;; 3. next node is up and next | 1381 ;; 2. next node is next at same level |
1373 (cond ((and (not not-down) | 1382 ;; 3. next node is up and next |
1374 (save-excursion (search-forward "\n* menu:" nil t)) | 1383 (cond ((and (not not-down) |
1375 (not (string-match "\\<index\\>" Info-current-node))) | 1384 (save-excursion (search-forward "\n* menu:" nil t)) |
1376 (Info-goto-node (Info-extract-menu-counting 1)) | 1385 (not (string-match "\\<index\\>" Info-current-node))) |
1377 t) | 1386 (Info-goto-node (Info-extract-menu-counting 1)) |
1378 ((save-excursion (search-backward "next:" nil t)) | 1387 t) |
1379 (Info-next) | 1388 ((save-excursion (search-backward "next:" nil t)) |
1380 t) | 1389 (Info-next) |
1381 ((and (save-excursion (search-backward "up:" nil t)) | 1390 t) |
1382 ;; Use string-equal, not equal, to ignore text props. | 1391 ((and (save-excursion (search-backward "up:" nil t)) |
1383 (not (string-equal (downcase (Info-extract-pointer "up")) | 1392 ;; Use string-equal, not equal, to ignore text props. |
1384 "top"))) | 1393 (not (string-equal (downcase (Info-extract-pointer "up")) |
1385 (let ((old-node Info-current-node)) | 1394 "top"))) |
1386 (Info-up) | 1395 (let ((old-node Info-current-node)) |
1387 (let (Info-history success) | 1396 (Info-up) |
1388 (unwind-protect | 1397 (let (Info-history success) |
1389 (setq success (Info-forward-node t no-error)) | 1398 (unwind-protect |
1390 (or success (Info-goto-node old-node)))))) | 1399 (setq success (Info-forward-node t no-error)) |
1391 (no-error nil) | 1400 (or success (Info-goto-node old-node)))))) |
1392 (t (error "No pointer forward from this node")))) | 1401 (no-error nil) |
1402 (t (error "No pointer forward from this node"))))) | |
1393 | 1403 |
1394 (defun Info-backward-node () | 1404 (defun Info-backward-node () |
1395 "Go backward one node, considering all nodes as forming one sequence." | 1405 "Go backward one node, considering all nodes as forming one sequence." |
1396 (interactive) | 1406 (interactive) |
1397 (let ((prevnode (Info-extract-pointer "prev[ious]*" t)) | 1407 (let ((prevnode (Info-extract-pointer "prev[ious]*" t)) |
1398 (upnode (Info-extract-pointer "up" t))) | 1408 (upnode (Info-extract-pointer "up" t)) |
1409 (case-fold-search t)) | |
1399 (cond ((and upnode (string-match "(" upnode)) | 1410 (cond ((and upnode (string-match "(" upnode)) |
1400 (error "First node in file")) | 1411 (error "First node in file")) |
1401 ((and upnode (or (null prevnode) | 1412 ((and upnode (or (null prevnode) |
1402 ;; Use string-equal, not equal, | 1413 ;; Use string-equal, not equal, |
1403 ;; to ignore text properties. | 1414 ;; to ignore text properties. |
1422 (save-buffers-kill-emacs) | 1433 (save-buffers-kill-emacs) |
1423 (quit-window))) | 1434 (quit-window))) |
1424 | 1435 |
1425 (defun Info-next-menu-item () | 1436 (defun Info-next-menu-item () |
1426 (interactive) | 1437 (interactive) |
1427 (let ((node | 1438 ;; Bind this in case the user sets it to nil. |
1428 (save-excursion | 1439 (let* ((case-fold-search t) |
1429 (forward-line -1) | 1440 (node |
1430 (search-forward "\n* menu:" nil t) | 1441 (save-excursion |
1431 (and (search-forward "\n* " nil t) | 1442 (forward-line -1) |
1432 (Info-extract-menu-node-name))))) | 1443 (search-forward "\n* menu:" nil t) |
1444 (and (search-forward "\n* " nil t) | |
1445 (Info-extract-menu-node-name))))) | |
1433 (if node (Info-goto-node node) | 1446 (if node (Info-goto-node node) |
1434 (error "No more items in menu")))) | 1447 (error "No more items in menu")))) |
1435 | 1448 |
1436 (defun Info-last-menu-item () | 1449 (defun Info-last-menu-item () |
1437 (interactive) | 1450 (interactive) |
1438 (save-excursion | 1451 (save-excursion |
1439 (forward-line 1) | 1452 (forward-line 1) |
1440 (let ((beg (save-excursion | 1453 ;; Bind this in case the user sets it to nil. |
1441 (and (search-backward "\n* menu:" nil t) | 1454 (let* ((case-fold-search t) |
1442 (point))))) | 1455 (beg (save-excursion |
1456 (and (search-backward "\n* menu:" nil t) | |
1457 (point))))) | |
1443 (or (and beg (search-backward "\n* " beg t)) | 1458 (or (and beg (search-backward "\n* " beg t)) |
1444 (error "No previous items in menu"))) | 1459 (error "No previous items in menu"))) |
1445 (Info-goto-node (save-excursion | 1460 (Info-goto-node (save-excursion |
1446 (goto-char (match-end 0)) | 1461 (goto-char (match-end 0)) |
1447 (Info-extract-menu-node-name))))) | 1462 (Info-extract-menu-node-name))))) |
1489 ;; so we can scroll back through it. | 1504 ;; so we can scroll back through it. |
1490 (goto-char (point-max)))) | 1505 (goto-char (point-max)))) |
1491 (recenter -1)) | 1506 (recenter -1)) |
1492 ((Info-no-error (Info-up t)) | 1507 ((Info-no-error (Info-up t)) |
1493 (goto-char (point-min)) | 1508 (goto-char (point-min)) |
1494 (or (search-forward "\n* Menu:" nil t) | 1509 (let ((case-fold-search t)) |
1495 (goto-char (point-max)))) | 1510 (or (search-forward "\n* Menu:" nil t) |
1511 (goto-char (point-max))))) | |
1496 (t (error "No previous nodes")))) | 1512 (t (error "No previous nodes")))) |
1497 | 1513 |
1498 (defun Info-scroll-up () | 1514 (defun Info-scroll-up () |
1499 "Scroll one screenful forward in Info, considering all nodes as one sequence. | 1515 "Scroll one screenful forward in Info, considering all nodes as one sequence. |
1500 Once you scroll far enough in a node that its menu appears on the screen | 1516 Once you scroll far enough in a node that its menu appears on the screen |
1508 | 1524 |
1509 (interactive) | 1525 (interactive) |
1510 (if (or (< (window-start) (point-min)) | 1526 (if (or (< (window-start) (point-min)) |
1511 (> (window-start) (point-max))) | 1527 (> (window-start) (point-max))) |
1512 (set-window-start (selected-window) (point))) | 1528 (set-window-start (selected-window) (point))) |
1513 (let ((virtual-end (save-excursion | 1529 (let* ((case-fold-search t) |
1514 (goto-char (point-min)) | 1530 (virtual-end (save-excursion |
1515 (if (search-forward "\n* Menu:" nil t) | 1531 (goto-char (point-min)) |
1516 (point) | 1532 (if (search-forward "\n* Menu:" nil t) |
1517 (point-max))))) | 1533 (point) |
1534 (point-max))))) | |
1518 (if (or (< virtual-end (window-start)) | 1535 (if (or (< virtual-end (window-start)) |
1519 (pos-visible-in-window-p virtual-end)) | 1536 (pos-visible-in-window-p virtual-end)) |
1520 (Info-next-preorder) | 1537 (Info-next-preorder) |
1521 (scroll-up)))) | 1538 (scroll-up)))) |
1522 | 1539 |
1527 previous node or back up to the parent node." | 1544 previous node or back up to the parent node." |
1528 (interactive) | 1545 (interactive) |
1529 (if (or (< (window-start) (point-min)) | 1546 (if (or (< (window-start) (point-min)) |
1530 (> (window-start) (point-max))) | 1547 (> (window-start) (point-max))) |
1531 (set-window-start (selected-window) (point))) | 1548 (set-window-start (selected-window) (point))) |
1532 (let* ((current-point (point)) | 1549 (let* ((case-fold-search t) |
1550 (current-point (point)) | |
1533 (virtual-end (save-excursion | 1551 (virtual-end (save-excursion |
1534 (beginning-of-line) | 1552 (beginning-of-line) |
1535 (setq current-point (point)) | 1553 (setq current-point (point)) |
1536 (goto-char (point-min)) | 1554 (goto-char (point-min)) |
1537 (search-forward "\n* Menu:" | 1555 (search-forward "\n* Menu:" |
1652 (list (car Info-index-alternatives))) | 1670 (list (car Info-index-alternatives))) |
1653 num (1- num))) | 1671 num (1- num))) |
1654 (Info-goto-node (nth 1 (car Info-index-alternatives))) | 1672 (Info-goto-node (nth 1 (car Info-index-alternatives))) |
1655 (if (> (nth 3 (car Info-index-alternatives)) 0) | 1673 (if (> (nth 3 (car Info-index-alternatives)) 0) |
1656 (forward-line (nth 3 (car Info-index-alternatives))) | 1674 (forward-line (nth 3 (car Info-index-alternatives))) |
1657 (forward-line 3) ; don't search in headers | 1675 (forward-line 3) ; don't search in headers |
1658 (let ((name (car (car Info-index-alternatives)))) | 1676 (let ((name (car (car Info-index-alternatives)))) |
1659 (Info-find-index-name name))) | 1677 (Info-find-index-name name))) |
1660 (message "Found `%s' in %s. %s" | 1678 (message "Found `%s' in %s. %s" |
1661 (car (car Info-index-alternatives)) | 1679 (car (car Info-index-alternatives)) |
1662 (nth 2 (car Info-index-alternatives)) | 1680 (nth 2 (car Info-index-alternatives)) |
1855 (condition-case nil | 1873 (condition-case nil |
1856 (Info-extract-pointer item) | 1874 (Info-extract-pointer item) |
1857 (error nil))) | 1875 (error nil))) |
1858 | 1876 |
1859 (easy-menu-define Info-mode-menu Info-mode-map | 1877 (easy-menu-define Info-mode-menu Info-mode-map |
1860 "Menu for info files." | 1878 "Menu for info files." |
1861 '("Info" | 1879 '("Info" |
1862 ["Up" Info-up (Info-check-pointer "up") | 1880 ["Up" Info-up (Info-check-pointer "up") |
1863 :help "Go up in the Info tree"] | 1881 :help "Go up in the Info tree"] |
1864 ["Next" Info-next (Info-check-pointer "next") | 1882 ["Next" Info-next (Info-check-pointer "next") |
1865 :help "Go to the next node"] | 1883 :help "Go to the next node"] |
1866 ["Previous" Info-prev (Info-check-pointer "prev[ious]*") | 1884 ["Previous" Info-prev (Info-check-pointer "prev[ious]*") |
1867 :help "Go to the previous node"] | 1885 :help "Go to the previous node"] |
1868 ["Backward" Info-backward-node t | 1886 ["Backward" Info-backward-node t |
1869 :help "Go backward one node, considering all as a sequence"] | 1887 :help "Go backward one node, considering all as a sequence"] |
1870 ["Forward" Info-forward-node t | 1888 ["Forward" Info-forward-node t |
1871 :help "Go forward one node, considering all as a sequence"] | 1889 :help "Go forward one node, considering all as a sequence"] |
1872 ["Top" Info-top-node t | 1890 ["Top" Info-top-node t |
1873 :help "Go to top node of file"] | 1891 :help "Go to top node of file"] |
1874 ["Final node" Info-final-node t | 1892 ["Final node" Info-final-node t |
1875 :help "Go to final node in this file"] | 1893 :help "Go to final node in this file"] |
1876 ("Menu item" ["You should never see this" report-emacs-bug t]) | 1894 ("Menu item" ["You should never see this" report-emacs-bug t]) |
1877 ("Reference" ["You should never see this" report-emacs-bug t]) | 1895 ("Reference" ["You should never see this" report-emacs-bug t]) |
1878 ["Search..." Info-search t | 1896 ["Search..." Info-search t |
1879 :help "Search for regular expression in this Info file"] | 1897 :help "Search for regular expression in this Info file"] |
1880 ["Goto node..." Info-goto-node t | 1898 ["Goto node..." Info-goto-node t |
1881 :help "Go to a named node]"] | 1899 :help "Go to a named node]"] |
1882 ["Last" Info-last Info-history | 1900 ["Last" Info-last Info-history |
1883 :help "Go to the last node you were at"] | 1901 :help "Go to the last node you were at"] |
1884 ("Index..." | 1902 ("Index..." |
1885 ["Lookup a String" Info-index t | 1903 ["Lookup a String" Info-index t |
1886 :help "Look for a string in the index items"] | 1904 :help "Look for a string in the index items"] |
1887 ["Next Matching Item" Info-index-next t | 1905 ["Next Matching Item" Info-index-next t |
1888 :help "Look for another occurrence of previous item"]) | 1906 :help "Look for another occurrence of previous item"]) |
1889 ["Exit" Info-exit t])) | 1907 ["Exit" Info-exit t])) |
1890 | 1908 |
1891 (defvar Info-menu-last-node nil) | 1909 (defvar Info-menu-last-node nil) |
1892 ;; Last node the menu was created for. | 1910 ;; Last node the menu was created for. |
1893 ;; Value is a list, (FILE-NAME NODE-NAME). | 1911 ;; Value is a list, (FILE-NAME NODE-NAME). |
1894 | 1912 |
2081 (interactive) | 2099 (interactive) |
2082 (or Info-enable-edit | 2100 (or Info-enable-edit |
2083 (error "Editing info nodes is not enabled")) | 2101 (error "Editing info nodes is not enabled")) |
2084 (Info-edit-mode) | 2102 (Info-edit-mode) |
2085 (message "%s" (substitute-command-keys | 2103 (message "%s" (substitute-command-keys |
2086 "Editing: Type \\<Info-edit-map>\\[Info-cease-edit] to return to info"))) | 2104 "Editing: Type \\<Info-edit-map>\\[Info-cease-edit] to return to info"))) |
2087 | 2105 |
2088 (defun Info-cease-edit () | 2106 (defun Info-cease-edit () |
2089 "Finish editing Info node; switch back to Info proper." | 2107 "Finish editing Info node; switch back to Info proper." |
2090 (interactive) | 2108 (interactive) |
2091 ;; Do this first, so nothing has changed if user C-g's at query. | 2109 ;; Do this first, so nothing has changed if user C-g's at query. |
2147 (Info-find-node info-file "Index"))) | 2165 (Info-find-node info-file "Index"))) |
2148 ;; Take the index node off the Info history. | 2166 ;; Take the index node off the Info history. |
2149 (setq Info-history (cdr Info-history)) | 2167 (setq Info-history (cdr Info-history)) |
2150 (goto-char (point-max)) | 2168 (goto-char (point-max)) |
2151 (while (re-search-backward cmd-desc nil t) | 2169 (while (re-search-backward cmd-desc nil t) |
2152 (setq where (cons (list Info-current-file | 2170 (setq where (cons (list Info-current-file |
2153 (match-string-no-properties 1) | 2171 (match-string-no-properties 1) |
2154 0) | 2172 0) |
2155 where))) | 2173 where))) |
2156 where))) | 2174 where))) |
2157 | 2175 |
2158 ;;;###autoload | 2176 ;;;###autoload |
2159 (defun Info-goto-emacs-command-node (command) | 2177 (defun Info-goto-emacs-command-node (command) |
2160 "Go to the Info node in the Emacs manual for command COMMAND. | 2178 "Go to the Info node in the Emacs manual for command COMMAND. |
2249 'face 'info-xref) | 2267 'face 'info-xref) |
2250 (put-text-property (match-beginning 2) (match-end 2) | 2268 (put-text-property (match-beginning 2) (match-end 2) |
2251 'mouse-face 'highlight)))) | 2269 'mouse-face 'highlight)))) |
2252 (goto-char (point-min)) | 2270 (goto-char (point-min)) |
2253 (while (re-search-forward "\n\\([^ \t\n].+\\)\n\\(\\*+\\|=+\\|-+\\)$" | 2271 (while (re-search-forward "\n\\([^ \t\n].+\\)\n\\(\\*+\\|=+\\|-+\\)$" |
2254 nil t) | 2272 nil t) |
2255 (let ((c (preceding-char)) | 2273 (let ((c (preceding-char)) |
2256 face) | 2274 face) |
2257 (cond ((= c ?*) (setq face 'Info-title-1-face)) | 2275 (cond ((= c ?*) (setq face 'Info-title-1-face)) |
2258 ((= c ?=) (setq face 'Info-title-2-face)) | 2276 ((= c ?=) (setq face 'Info-title-2-face)) |
2259 (t (setq face 'Info-title-3-face))) | 2277 (t (setq face 'Info-title-3-face))) |
2279 ;; Don't take time to annotate huge menus | 2297 ;; Don't take time to annotate huge menus |
2280 (< (- (point-max) (point)) Info-fontify-maximum-menu-size)) | 2298 (< (- (point-max) (point)) Info-fontify-maximum-menu-size)) |
2281 (let ((n 0)) | 2299 (let ((n 0)) |
2282 (while (re-search-forward "^\\* +\\([^:\t\n]*\\):" nil t) | 2300 (while (re-search-forward "^\\* +\\([^:\t\n]*\\):" nil t) |
2283 (setq n (1+ n)) | 2301 (setq n (1+ n)) |
2284 (if (memq n '(5 9)) ; visual aids to help with 1-9 keys | 2302 (if (memq n '(5 9)) ; visual aids to help with 1-9 keys |
2285 (put-text-property (match-beginning 0) | 2303 (put-text-property (match-beginning 0) |
2286 (1+ (match-beginning 0)) | 2304 (1+ (match-beginning 0)) |
2287 'face 'info-menu-5)) | 2305 'face 'info-menu-5)) |
2288 (put-text-property (match-beginning 1) (match-end 1) | 2306 (put-text-property (match-beginning 1) (match-end 1) |
2289 'face 'info-xref) | 2307 'face 'info-xref) |
2392 nil)))) | 2410 nil)))) |
2393 | 2411 |
2394 (defun Info-speedbar-goto-node (text node indent) | 2412 (defun Info-speedbar-goto-node (text node indent) |
2395 "When user clicks on TEXT, goto an info NODE. | 2413 "When user clicks on TEXT, goto an info NODE. |
2396 The INDENT level is ignored." | 2414 The INDENT level is ignored." |
2397 (select-frame speedbar-attached-frame) | 2415 (select-frame speedbar-attached-frame) |
2398 (let* ((buff (or (get-buffer "*info*") | 2416 (let* ((buff (or (get-buffer "*info*") |
2399 (progn (info) (get-buffer "*info*")))) | 2417 (progn (info) (get-buffer "*info*")))) |
2400 (bwin (get-buffer-window buff 0))) | 2418 (bwin (get-buffer-window buff 0))) |
2401 (if bwin | 2419 (if bwin |
2402 (progn | 2420 (progn |
2403 (select-window bwin) | 2421 (select-window bwin) |
2404 (raise-frame (window-frame bwin))) | 2422 (raise-frame (window-frame bwin))) |
2405 (if speedbar-power-click | 2423 (if speedbar-power-click |
2406 (let ((pop-up-frames t)) (select-window (display-buffer buff))) | 2424 (let ((pop-up-frames t)) (select-window (display-buffer buff))) |
2407 (select-frame speedbar-attached-frame) | 2425 (select-frame speedbar-attached-frame) |
2408 (switch-to-buffer buff))) | 2426 (switch-to-buffer buff))) |
2409 (let ((junk (string-match "^(\\([^)]+\\))\\([^.]+\\)$" node)) | 2427 (let ((junk (string-match "^(\\([^)]+\\))\\([^.]+\\)$" node)) |
2410 (file (match-string 1 node)) | 2428 (file (match-string 1 node)) |
2411 (node (match-string 2 node))) | 2429 (node (match-string 2 node))) |
2412 (Info-find-node file node) | 2430 (Info-find-node file node) |
2413 ;; If we do a find-node, and we were in info mode, restore | 2431 ;; If we do a find-node, and we were in info mode, restore |
2414 ;; the old default method. Once we are in info mode, it makes | 2432 ;; the old default method. Once we are in info mode, it makes |
2415 ;; sense to return to whatever method the user was using before. | 2433 ;; sense to return to whatever method the user was using before. |
2416 (if (string= speedbar-initial-expansion-list-name "Info") | 2434 (if (string= speedbar-initial-expansion-list-name "Info") |
2417 (speedbar-change-initial-expansion-list | 2435 (speedbar-change-initial-expansion-list |
2418 speedbar-previously-used-expansion-list-name))))) | 2436 speedbar-previously-used-expansion-list-name))))) |
2419 | 2437 |
2420 (defun Info-speedbar-expand-node (text token indent) | 2438 (defun Info-speedbar-expand-node (text token indent) |
2421 "Expand the node the user clicked on. | 2439 "Expand the node the user clicked on. |
2422 TEXT is the text of the button we clicked on, a + or - item. | 2440 TEXT is the text of the button we clicked on, a + or - item. |
2423 TOKEN is data related to this node (NAME . FILE). | 2441 TOKEN is data related to this node (NAME . FILE). |
2424 INDENT is the current indentation depth." | 2442 INDENT is the current indentation depth." |
2425 (cond ((string-match "+" text) ;we have to expand this file | 2443 (cond ((string-match "+" text) ;we have to expand this file |
2426 (speedbar-change-expand-button-char ?-) | 2444 (speedbar-change-expand-button-char ?-) |
2427 (if (speedbar-with-writable | 2445 (if (speedbar-with-writable |
2428 (save-excursion | 2446 (save-excursion |
2429 (end-of-line) (forward-char 1) | 2447 (end-of-line) (forward-char 1) |
2430 (Info-speedbar-hierarchy-buttons nil (1+ indent) token))) | 2448 (Info-speedbar-hierarchy-buttons nil (1+ indent) token))) |
2431 (speedbar-change-expand-button-char ?-) | 2449 (speedbar-change-expand-button-char ?-) |
2432 (speedbar-change-expand-button-char ??))) | 2450 (speedbar-change-expand-button-char ??))) |
2433 ((string-match "-" text) ;we have to contract this node | 2451 ((string-match "-" text) ;we have to contract this node |
2434 (speedbar-change-expand-button-char ?+) | 2452 (speedbar-change-expand-button-char ?+) |
2435 (speedbar-delete-subblock indent)) | 2453 (speedbar-delete-subblock indent)) |