aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorRichard M. Stallman1998-08-08 21:27:22 +0000
committerRichard M. Stallman1998-08-08 21:27:22 +0000
commit1bcedb3b6bf72ff4268da1dcd001948d051c3891 (patch)
treeed6dd3de5bd2d12ff0a7b519dca150677dd42f84 /lisp
parentfd7bd989f8ea8e28fe5f1d5ec6ff2d72d6496a80 (diff)
downloademacs-1bcedb3b6bf72ff4268da1dcd001948d051c3891.tar.gz
emacs-1bcedb3b6bf72ff4268da1dcd001948d051c3891.zip
Bind case-fold-search to t in many functions.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/info.el233
1 files changed, 128 insertions, 105 deletions
diff --git a/lisp/info.el b/lisp/info.el
index f1278a988b0..002bc29ff0a 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -380,7 +380,8 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself."
380 (widen) 380 (widen)
381 (setq Info-current-node nil) 381 (setq Info-current-node nil)
382 (unwind-protect 382 (unwind-protect
383 (progn 383 ;; Bind case-fold-search in case the user sets it to nil.
384 (let ((case-fold-search t))
384 ;; Switch files if necessary 385 ;; Switch files if necessary
385 (or (null filename) 386 (or (null filename)
386 (equal Info-current-file filename) 387 (equal Info-current-file filename)
@@ -546,6 +547,8 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself."
546 Info-dir-file-attributes)))) 547 Info-dir-file-attributes))))
547 (insert Info-dir-contents) 548 (insert Info-dir-contents)
548 (let ((dirs Info-directory-list) 549 (let ((dirs Info-directory-list)
550 ;; Bind this in case the user sets it to nil.
551 (case-fold-search t)
549 buffers buffer others nodes dirs-done) 552 buffers buffer others nodes dirs-done)
550 553
551 (setq Info-dir-file-attributes nil) 554 (setq Info-dir-file-attributes nil)
@@ -718,34 +721,36 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself."
718 721
719;; Select the info node that point is in. 722;; Select the info node that point is in.
720(defun Info-select-node () 723(defun Info-select-node ()
721 (save-excursion 724 ;; Bind this in case the user sets it to nil.
722 ;; Find beginning of node. 725 (let ((case-fold-search t))
723 (search-backward "\n\^_") 726 (save-excursion
724 (forward-line 2) 727 ;; Find beginning of node.
725 ;; Get nodename spelled as it is in the node. 728 (search-backward "\n\^_")
726 (re-search-forward "Node:[ \t]*") 729 (forward-line 2)
727 (setq Info-current-node 730 ;; Get nodename spelled as it is in the node.
728 (buffer-substring-no-properties (point) 731 (re-search-forward "Node:[ \t]*")
729 (progn 732 (setq Info-current-node
730 (skip-chars-forward "^,\t\n") 733 (buffer-substring-no-properties (point)
731 (point)))) 734 (progn
732 (Info-set-mode-line) 735 (skip-chars-forward "^,\t\n")
733 ;; Find the end of it, and narrow. 736 (point))))
734 (beginning-of-line) 737 (Info-set-mode-line)
735 (let (active-expression) 738 ;; Find the end of it, and narrow.
736 (narrow-to-region (point) 739 (beginning-of-line)
737 (if (re-search-forward "\n[\^_\f]" nil t) 740 (let (active-expression)
738 (prog1 741 (narrow-to-region (point)
739 (1- (point)) 742 (if (re-search-forward "\n[\^_\f]" nil t)
740 (if (looking-at "[\n\^_\f]*execute: ") 743 (prog1
741 (progn 744 (1- (point))
742 (goto-char (match-end 0)) 745 (if (looking-at "[\n\^_\f]*execute: ")
743 (setq active-expression 746 (progn
744 (read (current-buffer)))))) 747 (goto-char (match-end 0))
745 (point-max))) 748 (setq active-expression
746 (if Info-enable-active-nodes (eval active-expression)) 749 (read (current-buffer))))))
747 (if Info-fontify (Info-fontify-node)) 750 (point-max)))
748 (run-hooks 'Info-selection-hook)))) 751 (if Info-enable-active-nodes (eval active-expression))
752 (if Info-fontify (Info-fontify-node))
753 (run-hooks 'Info-selection-hook)))))
749 754
750(defun Info-set-mode-line () 755(defun Info-set-mode-line ()
751 (setq mode-line-buffer-identification 756 (setq mode-line-buffer-identification
@@ -809,7 +814,9 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself."
809 814
810(defun Info-build-node-completions () 815(defun Info-build-node-completions ()
811 (or Info-current-file-completions 816 (or Info-current-file-completions
812 (let ((compl nil)) 817 (let ((compl nil)
818 ;; Bind this in case the user sets it to nil.
819 (case-fold-search t))
813 (save-excursion 820 (save-excursion
814 (save-restriction 821 (save-restriction
815 (if (marker-buffer Info-tag-table-marker) 822 (if (marker-buffer Info-tag-table-marker)
@@ -924,16 +931,18 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself."
924;; If there is none, use ERRORNAME in the error message; 931;; If there is none, use ERRORNAME in the error message;
925;; if ERRORNAME is nil, just return nil. 932;; if ERRORNAME is nil, just return nil.
926(defun Info-extract-pointer (name &optional errorname) 933(defun Info-extract-pointer (name &optional errorname)
927 (save-excursion 934 ;; Bind this in case the user sets it to nil.
928 (goto-char (point-min)) 935 (let ((case-fold-search t))
929 (forward-line 1) 936 (save-excursion
930 (if (re-search-backward (concat name ":") nil t) 937 (goto-char (point-min))
931 (progn 938 (forward-line 1)
932 (goto-char (match-end 0)) 939 (if (re-search-backward (concat name ":") nil t)
933 (Info-following-node-name)) 940 (progn
934 (if (eq errorname t) 941 (goto-char (match-end 0))
935 nil 942 (Info-following-node-name))
936 (error "Node has no %s" (capitalize (or errorname name))))))) 943 (if (eq errorname t)
944 nil
945 (error "Node has no %s" (capitalize (or errorname name))))))))
937 946
938;; Return the node name in the buffer following point. 947;; Return the node name in the buffer following point.
939;; ALLOWEDCHARS, if non-nil, goes within [...] to make a regexp 948;; ALLOWEDCHARS, if non-nil, goes within [...] to make a regexp
@@ -995,6 +1004,7 @@ If SAME-FILE is non-nil, do not move to a different Info file."
995NAME may be an abbreviation of the reference name." 1004NAME may be an abbreviation of the reference name."
996 (interactive 1005 (interactive
997 (let ((completion-ignore-case t) 1006 (let ((completion-ignore-case t)
1007 (case-fold-search t)
998 completions default alt-default (start-point (point)) str i bol eol) 1008 completions default alt-default (start-point (point)) str i bol eol)
999 (save-excursion 1009 (save-excursion
1000 ;; Store end and beginning of line. 1010 ;; Store end and beginning of line.
@@ -1053,7 +1063,8 @@ NAME may be an abbreviation of the reference name."
1053 (list (if (equal input "") 1063 (list (if (equal input "")
1054 default input))) 1064 default input)))
1055 (error "No cross-references in this node")))) 1065 (error "No cross-references in this node"))))
1056 (let (target beg i (str (concat "\\*note " (regexp-quote footnotename)))) 1066 (let (target beg i (str (concat "\\*note " (regexp-quote footnotename)))
1067 (case-fold-search t))
1057 (while (setq i (string-match " " str i)) 1068 (while (setq i (string-match " " str i))
1058 (setq str (concat (substring str 0 i) "[ \t\n]+" (substring str (1+ i)))) 1069 (setq str (concat (substring str 0 i) "[ \t\n]+" (substring str (1+ i))))
1059 (setq i (+ i 6))) 1070 (setq i (+ i 6)))
@@ -1190,29 +1201,31 @@ Completion is allowed, and the menu item point is on is the default."
1190 1201
1191(defun Info-extract-menu-item (menu-item) 1202(defun Info-extract-menu-item (menu-item)
1192 (setq menu-item (regexp-quote menu-item)) 1203 (setq menu-item (regexp-quote menu-item))
1193 (save-excursion 1204 (let ((case-fold-search t))
1194 (goto-char (point-min)) 1205 (save-excursion
1195 (or (search-forward "\n* menu:" nil t) 1206 (goto-char (point-min))
1196 (error "No menu in this node")) 1207 (or (search-forward "\n* menu:" nil t)
1197 (or (re-search-forward (concat "\n\\* +" menu-item ":") nil t) 1208 (error "No menu in this node"))
1198 (re-search-forward (concat "\n\\* +" menu-item) nil t) 1209 (or (re-search-forward (concat "\n\\* +" menu-item ":") nil t)
1199 (error "No such item in menu")) 1210 (re-search-forward (concat "\n\\* +" menu-item) nil t)
1200 (beginning-of-line) 1211 (error "No such item in menu"))
1201 (forward-char 2) 1212 (beginning-of-line)
1202 (Info-extract-menu-node-name))) 1213 (forward-char 2)
1214 (Info-extract-menu-node-name))))
1203 1215
1204;; If COUNT is nil, use the last item in the menu. 1216;; If COUNT is nil, use the last item in the menu.
1205(defun Info-extract-menu-counting (count) 1217(defun Info-extract-menu-counting (count)
1206 (save-excursion 1218 (let ((case-fold-search t))
1207 (goto-char (point-min)) 1219 (save-excursion
1208 (or (search-forward "\n* menu:" nil t) 1220 (goto-char (point-min))
1209 (error "No menu in this node")) 1221 (or (search-forward "\n* menu:" nil t)
1210 (if count 1222 (error "No menu in this node"))
1211 (or (search-forward "\n* " nil t count) 1223 (if count
1212 (error "Too few items in menu")) 1224 (or (search-forward "\n* " nil t count)
1213 (while (search-forward "\n* " nil t) 1225 (error "Too few items in menu"))
1214 nil)) 1226 (while (search-forward "\n* " nil t)
1215 (Info-extract-menu-node-name))) 1227 nil))
1228 (Info-extract-menu-node-name))))
1216 1229
1217(defun Info-nth-menu-item () 1230(defun Info-nth-menu-item ()
1218 "Go to the node of the Nth menu item. 1231 "Go to the node of the Nth menu item.
@@ -1424,7 +1437,8 @@ previous node or back up to the parent node."
1424 "Move cursor to the next cross-reference or menu item in the node." 1437 "Move cursor to the next cross-reference or menu item in the node."
1425 (interactive) 1438 (interactive)
1426 (let ((pat "\\*note[ \n\t]*\\([^:]*\\):\\|^\\* .*:") 1439 (let ((pat "\\*note[ \n\t]*\\([^:]*\\):\\|^\\* .*:")
1427 (old-pt (point))) 1440 (old-pt (point))
1441 (case-fold-search t))
1428 (or (eobp) (forward-char 1)) 1442 (or (eobp) (forward-char 1))
1429 (or (re-search-forward pat nil t) 1443 (or (re-search-forward pat nil t)
1430 (progn 1444 (progn
@@ -1443,7 +1457,8 @@ previous node or back up to the parent node."
1443 "Move cursor to the previous cross-reference or menu item in the node." 1457 "Move cursor to the previous cross-reference or menu item in the node."
1444 (interactive) 1458 (interactive)
1445 (let ((pat "\\*note[ \n\t]*\\([^:]*\\):\\|^\\* .*:") 1459 (let ((pat "\\*note[ \n\t]*\\([^:]*\\):\\|^\\* .*:")
1446 (old-pt (point))) 1460 (old-pt (point))
1461 (case-fold-search t))
1447 (or (re-search-backward pat nil t) 1462 (or (re-search-backward pat nil t)
1448 (progn 1463 (progn
1449 (goto-char (point-max)) 1464 (goto-char (point-max))
@@ -1471,7 +1486,8 @@ Give a blank topic name to go to the Index node itself."
1471 (rnode nil) 1486 (rnode nil)
1472 (pattern (format "\n\\* +\\([^\n:]*%s[^\n:]*\\):[ \t]*\\([^.\n]*\\)\\.[ \t]*\\([0-9]*\\)" 1487 (pattern (format "\n\\* +\\([^\n:]*%s[^\n:]*\\):[ \t]*\\([^.\n]*\\)\\.[ \t]*\\([0-9]*\\)"
1473 (regexp-quote topic))) 1488 (regexp-quote topic)))
1474 node) 1489 node
1490 (case-fold-search t))
1475 (Info-goto-node "Top") 1491 (Info-goto-node "Top")
1476 (or (search-forward "\n* menu:" nil t) 1492 (or (search-forward "\n* menu:" nil t)
1477 (error "No index")) 1493 (error "No index"))
@@ -1546,17 +1562,18 @@ Give a blank topic name to go to the Index node itself."
1546 1562
1547(defun Info-find-index-name (name) 1563(defun Info-find-index-name (name)
1548 "Move point to the place within the current node where NAME is defined." 1564 "Move point to the place within the current node where NAME is defined."
1549 (if (or (re-search-forward (format 1565 (let ((case-fold-search t))
1550 "[a-zA-Z]+: %s\\( \\|$\\)" 1566 (if (or (re-search-forward (format
1551 (regexp-quote name)) nil t) 1567 "[a-zA-Z]+: %s\\( \\|$\\)"
1552 (search-forward (format "`%s'" name) nil t) 1568 (regexp-quote name)) nil t)
1553 (and (string-match "\\`.*\\( (.*)\\)\\'" name) 1569 (search-forward (format "`%s'" name) nil t)
1554 (search-forward 1570 (and (string-match "\\`.*\\( (.*)\\)\\'" name)
1555 (format "`%s'" (substring name 0 (match-beginning 1))) 1571 (search-forward
1556 nil t)) 1572 (format "`%s'" (substring name 0 (match-beginning 1)))
1557 (search-forward name nil t)) 1573 nil t))
1558 (beginning-of-line) 1574 (search-forward name nil t))
1559 (goto-char (point-min)))) 1575 (beginning-of-line)
1576 (goto-char (point-min)))))
1560 1577
1561(defun Info-undefined () 1578(defun Info-undefined ()
1562 "Make command be undefined in Info." 1579 "Make command be undefined in Info."
@@ -1605,32 +1622,33 @@ SIG optional fourth argument, controls action on no match
1605 nil: return nil 1622 nil: return nil
1606 t: beep 1623 t: beep
1607 a string: signal an error, using that string." 1624 a string: signal an error, using that string."
1608 (save-excursion 1625 (let ((case-fold-search t))
1609 (goto-char pos) 1626 (save-excursion
1610 ;; First look for a match for START that goes across POS. 1627 (goto-char pos)
1611 (while (and (not (bobp)) (> (point) (- pos (length start))) 1628 ;; First look for a match for START that goes across POS.
1612 (not (looking-at start))) 1629 (while (and (not (bobp)) (> (point) (- pos (length start)))
1613 (forward-char -1)) 1630 (not (looking-at start)))
1614 ;; If we did not find one, search back for START 1631 (forward-char -1))
1615 ;; (this finds only matches that end at or before POS). 1632 ;; If we did not find one, search back for START
1616 (or (looking-at start) 1633 ;; (this finds only matches that end at or before POS).
1617 (progn 1634 (or (looking-at start)
1618 (goto-char pos) 1635 (progn
1619 (re-search-backward start (max (point-min) (- pos 200)) 'yes))) 1636 (goto-char pos)
1620 (let (found) 1637 (re-search-backward start (max (point-min) (- pos 200)) 'yes)))
1621 (while (and (re-search-forward all (min (point-max) (+ pos 200)) 'yes) 1638 (let (found)
1622 (not (setq found (and (<= (match-beginning 0) pos) 1639 (while (and (re-search-forward all (min (point-max) (+ pos 200)) 'yes)
1623 (> (match-end 0) pos)))))) 1640 (not (setq found (and (<= (match-beginning 0) pos)
1624 (if (and found (<= (match-beginning 0) pos) 1641 (> (match-end 0) pos))))))
1625 (> (match-end 0) pos)) 1642 (if (and found (<= (match-beginning 0) pos)
1626 (buffer-substring (match-beginning 1) (match-end 1)) 1643 (> (match-end 0) pos))
1627 (cond ((null errorstring) 1644 (buffer-substring (match-beginning 1) (match-end 1))
1628 nil) 1645 (cond ((null errorstring)
1629 ((eq errorstring t) 1646 nil)
1630 (beep) 1647 ((eq errorstring t)
1631 nil) 1648 (beep)
1632 (t 1649 nil)
1633 (error "No %s around position %d" errorstring pos))))))) 1650 (t
1651 (error "No %s around position %d" errorstring pos))))))))
1634 1652
1635(defun Info-mouse-follow-nearest-node (click) 1653(defun Info-mouse-follow-nearest-node (click)
1636 "\\<Info-mode-map>Follow a node reference near point. 1654 "\\<Info-mode-map>Follow a node reference near point.
@@ -1778,7 +1796,8 @@ If no reference to follow, moves to the next node, or up if none."
1778 ;; Update reference menu. Code stolen from `Info-follow-reference'. 1796 ;; Update reference menu. Code stolen from `Info-follow-reference'.
1779 (let ((items nil) 1797 (let ((items nil)
1780 str i entries current 1798 str i entries current
1781 (number 0)) 1799 (number 0)
1800 (case-fold-search t))
1782 (save-excursion 1801 (save-excursion
1783 (goto-char (point-min)) 1802 (goto-char (point-min))
1784 (while (re-search-forward "\\*note[ \n\t]*\\([^:]*\\):" nil t) 1803 (while (re-search-forward "\\*note[ \n\t]*\\([^:]*\\):" nil t)
@@ -2061,7 +2080,8 @@ The alist key is the character the title is underlined with (?*, ?= or ?-)."
2061 2080
2062(defun Info-fontify-node () 2081(defun Info-fontify-node ()
2063 (save-excursion 2082 (save-excursion
2064 (let ((buffer-read-only nil)) 2083 (let ((buffer-read-only nil)
2084 (case-fold-search t))
2065 (goto-char (point-min)) 2085 (goto-char (point-min))
2066 (when (looking-at "^File: [^,: \t]+,?[ \t]+") 2086 (when (looking-at "^File: [^,: \t]+,?[ \t]+")
2067 (goto-char (match-end 0)) 2087 (goto-char (match-end 0))
@@ -2187,7 +2207,8 @@ NODE is an optional argument that is used to represent the
2187specific node to expand." 2207specific node to expand."
2188 (if (and (not node) 2208 (if (and (not node)
2189 (save-excursion (goto-char (point-min)) 2209 (save-excursion (goto-char (point-min))
2190 (looking-at "Info Nodes:"))) 2210 (let ((case-fold-search t))
2211 (looking-at "Info Nodes:"))))
2191 ;; Update our "current node" maybe? 2212 ;; Update our "current node" maybe?
2192 nil 2213 nil
2193 ;; We cannot use the generic list code, that depends on all leaves 2214 ;; We cannot use the generic list code, that depends on all leaves
@@ -2276,6 +2297,7 @@ Optional THISFILE represends the filename of"
2276 ;; Scan the created buffer 2297 ;; Scan the created buffer
2277 (goto-char (point-min)) 2298 (goto-char (point-min))
2278 (let ((completions nil) 2299 (let ((completions nil)
2300 (case-fold-search t)
2279 (thisfile (progn (string-match "^(\\([^)]+\\))" nodespec) 2301 (thisfile (progn (string-match "^(\\([^)]+\\))" nodespec)
2280 (match-string 1 nodespec)))) 2302 (match-string 1 nodespec))))
2281 ;; Always skip the first one... 2303 ;; Always skip the first one...
@@ -2298,7 +2320,8 @@ Optional THISFILE represends the filename of"
2298 "Create a speedbar display to help navigation in an Info file. 2320 "Create a speedbar display to help navigation in an Info file.
2299BUFFER is the buffer speedbar is requesting buttons for." 2321BUFFER is the buffer speedbar is requesting buttons for."
2300 (if (save-excursion (goto-char (point-min)) 2322 (if (save-excursion (goto-char (point-min))
2301 (not (looking-at "Info Nodes:"))) 2323 (let ((case-fold-search t))
2324 (not (looking-at "Info Nodes:"))))
2302 (erase-buffer)) 2325 (erase-buffer))
2303 (Info-speedbar-hierarchy-buttons nil 0) 2326 (Info-speedbar-hierarchy-buttons nil 0)
2304 ) 2327 )