diff options
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/char-fold.el (renamed from lisp/character-fold.el) | 52 | ||||
-rw-r--r-- | lisp/isearch.el | 10 | ||||
-rw-r--r-- | lisp/menu-bar.el | 2 | ||||
-rw-r--r-- | lisp/replace.el | 16 |
4 files changed, 40 insertions, 40 deletions
diff --git a/lisp/character-fold.el b/lisp/char-fold.el index 2d3a8c67fa5..68bea29ea45 100644 --- a/lisp/character-fold.el +++ b/lisp/char-fold.el @@ -1,4 +1,4 @@ -;;; character-fold.el --- match unicode to similar ASCII -*- lexical-binding: t; -*- +;;; char-fold.el --- match unicode to similar ASCII -*- lexical-binding: t; -*- ;; Copyright (C) 2015-2016 Free Software Foundation, Inc. @@ -22,12 +22,12 @@ ;;; Code: -(eval-and-compile (put 'character-fold-table 'char-table-extra-slots 1)) +(eval-and-compile (put 'char-fold-table 'char-table-extra-slots 1)) -(defconst character-fold-table +(defconst char-fold-table (eval-when-compile - (let ((equiv (make-char-table 'character-fold-table)) - (equiv-multi (make-char-table 'character-fold-table)) + (let ((equiv (make-char-table 'char-fold-table)) + (equiv-multi (make-char-table 'char-fold-table)) (table (unicode-property-table-internal 'decomposition))) (set-char-table-extra-slot equiv 0 equiv-multi) @@ -115,7 +115,7 @@ equiv) equiv)) "Used for folding characters of the same group during search. -This is a char-table with the `character-fold-table' subtype. +This is a char-table with the `char-fold-table' subtype. Let us refer to the character in question by char-x. Each entry is either nil (meaning char-x only matches literally) @@ -136,18 +136,18 @@ For instance, the default alist for ?f includes: Exceptionally for the space character (32), ALIST is ignored.") -(defun character-fold--make-space-string (n) +(defun char-fold--make-space-string (n) "Return a string that matches N spaces." (format "\\(?:%s\\|%s\\)" (make-string n ?\s) (apply #'concat - (make-list n (or (aref character-fold-table ?\s) " "))))) + (make-list n (or (aref char-fold-table ?\s) " "))))) ;;;###autoload -(defun character-fold-to-regexp (string &optional _lax from) - "Return a regexp matching anything that character-folds into STRING. +(defun char-fold-to-regexp (string &optional _lax from) + "Return a regexp matching anything that char-folds into STRING. Any character in STRING that has an entry in -`character-fold-table' is replaced with that entry (which is a +`char-fold-table' is replaced with that entry (which is a regexp) and other characters are `regexp-quote'd. If the resulting regexp would be too long for Emacs to handle, @@ -156,7 +156,7 @@ just return the result of calling `regexp-quote' on STRING. FROM is for internal use. It specifies an index in the STRING from which to start." (let* ((spaces 0) - (multi-char-table (char-table-extra-slot character-fold-table 0)) + (multi-char-table (char-table-extra-slot char-fold-table 0)) (i (or from 0)) (end (length string)) (out nil)) @@ -172,9 +172,9 @@ from which to start." (pcase (aref string i) (`?\s (setq spaces (1+ spaces))) (c (when (> spaces 0) - (push (character-fold--make-space-string spaces) out) + (push (char-fold--make-space-string spaces) out) (setq spaces 0)) - (let ((regexp (or (aref character-fold-table c) + (let ((regexp (or (aref char-fold-table c) (regexp-quote (string c)))) ;; Long string. The regexp would probably be too long. (alist (unless (> end 50) @@ -206,13 +206,13 @@ from which to start." (let ((length (car entry)) (suffix-regexp (cdr entry))) (concat suffix-regexp - (character-fold-to-regexp subs nil length)))) + (char-fold-to-regexp subs nil length)))) `((0 . ,regexp) . ,matched-entries) "\\|") "\\)")))) out)))) (setq i (1+ i))) (when (> spaces 0) - (push (character-fold--make-space-string spaces) out)) + (push (char-fold--make-space-string spaces) out)) (let ((regexp (apply #'concat (nreverse out)))) ;; Limited by `MAX_BUF_SIZE' in `regex.c'. (if (> (length regexp) 5000) @@ -221,22 +221,22 @@ from which to start." ;;; Commands provided for completeness. -(defun character-fold-search-forward (string &optional bound noerror count) - "Search forward for a character-folded version of STRING. -STRING is converted to a regexp with `character-fold-to-regexp', +(defun char-fold-search-forward (string &optional bound noerror count) + "Search forward for a char-folded version of STRING. +STRING is converted to a regexp with `char-fold-to-regexp', which is searched for with `re-search-forward'. BOUND NOERROR COUNT are passed to `re-search-forward'." (interactive "sSearch: ") - (re-search-forward (character-fold-to-regexp string) bound noerror count)) + (re-search-forward (char-fold-to-regexp string) bound noerror count)) -(defun character-fold-search-backward (string &optional bound noerror count) - "Search backward for a character-folded version of STRING. -STRING is converted to a regexp with `character-fold-to-regexp', +(defun char-fold-search-backward (string &optional bound noerror count) + "Search backward for a char-folded version of STRING. +STRING is converted to a regexp with `char-fold-to-regexp', which is searched for with `re-search-backward'. BOUND NOERROR COUNT are passed to `re-search-backward'." (interactive "sSearch: ") - (re-search-backward (character-fold-to-regexp string) bound noerror count)) + (re-search-backward (char-fold-to-regexp string) bound noerror count)) -(provide 'character-fold) +(provide 'char-fold) -;;; character-fold.el ends here +;;; char-fold.el ends here diff --git a/lisp/isearch.el b/lisp/isearch.el index 418d9ea273a..e4de0b627e3 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -222,7 +222,7 @@ It is nil if none yet.") Default value, nil, means edit the string instead." :type 'boolean) -(autoload 'character-fold-to-regexp "character-fold") +(autoload 'char-fold-to-regexp "char-fold") (defcustom search-default-mode nil "Default mode to use when starting isearch. @@ -236,7 +236,7 @@ isearch). If a function, use that function as an `isearch-regexp-function'. Example functions (and the keys to toggle them during isearch) are `word-search-regexp' \(`\\[isearch-toggle-word]'), `isearch-symbol-regexp' -\(`\\[isearch-toggle-symbol]'), and `character-fold-to-regexp' \(`\\[isearch-toggle-character-fold]')." +\(`\\[isearch-toggle-symbol]'), and `char-fold-to-regexp' \(`\\[isearch-toggle-char-fold]')." ;; :type is set below by `isearch-define-mode-toggle'. :type '(choice (const :tag "Literal search" nil) (const :tag "Regexp search" t) @@ -718,7 +718,7 @@ Type \\[isearch-toggle-invisible] to toggle search in invisible text. Type \\[isearch-toggle-regexp] to toggle regular-expression mode. Type \\[isearch-toggle-word] to toggle word mode. Type \\[isearch-toggle-symbol] to toggle symbol mode. -Type \\[isearch-toggle-character-fold] to toggle character folding. +Type \\[isearch-toggle-char-fold] to toggle character folding. Type \\[isearch-toggle-lax-whitespace] to toggle whitespace matching. In incremental searches, a space or spaces normally matches any whitespace @@ -1546,9 +1546,9 @@ The command then executes BODY and updates the isearch prompt." Turning on word search turns off regexp mode.") (isearch-define-mode-toggle symbol "_" isearch-symbol-regexp "\ Turning on symbol search turns off regexp mode.") -(isearch-define-mode-toggle character-fold "'" character-fold-to-regexp "\ +(isearch-define-mode-toggle char-fold "'" char-fold-to-regexp "\ Turning on character-folding turns off regexp mode.") -(put 'character-fold-to-regexp 'isearch-message-prefix "char-fold ") +(put 'char-fold-to-regexp 'isearch-message-prefix "char-fold ") (isearch-define-mode-toggle regexp "r" nil nil (setq isearch-regexp (not isearch-regexp)) diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index 6571a4b9d4f..640395e8d7d 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -1257,7 +1257,7 @@ mail status in mode line")) (defvar menu-bar-search-options-menu (let ((menu (make-sparse-keymap "Search Options"))) - (dolist (x '((character-fold-to-regexp "Fold Characters" "Character folding") + (dolist (x '((char-fold-to-regexp "Fold Characters" "Character folding") (isearch-symbol-regexp "Whole Symbols" "Whole symbol") (word-search-regexp "Whole Words" "Whole word"))) (bindings--define-key menu (vector (nth 0 x)) diff --git a/lisp/replace.el b/lisp/replace.el index 26e5875dc08..fe90062cc8a 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -33,7 +33,7 @@ :type 'boolean :group 'matching) -(defcustom replace-character-fold nil +(defcustom replace-char-fold nil "Non-nil means replacement commands should do character folding in matches. This means, for instance, that \\=' will match a large variety of unicode quotes. @@ -324,7 +324,7 @@ If `replace-lax-whitespace' is non-nil, a space or spaces in the string to be replaced will match a sequence of whitespace chars defined by the regexp in `search-whitespace-regexp'. -If `replace-character-fold' is non-nil, matching uses character folding, +If `replace-char-fold' is non-nil, matching uses character folding, i.e. it ignores diacritics and other differences between equivalent character strings. @@ -383,7 +383,7 @@ If `replace-regexp-lax-whitespace' is non-nil, a space or spaces in the regexp to be replaced will match a sequence of whitespace chars defined by the regexp in `search-whitespace-regexp'. -This function is not affected by `replace-character-fold'. +This function is not affected by `replace-char-fold'. Third arg DELIMITED (prefix arg if interactive), if non-nil, means replace only matches surrounded by word boundaries. A negative prefix arg means @@ -474,7 +474,7 @@ If `replace-regexp-lax-whitespace' is non-nil, a space or spaces in the regexp to be replaced will match a sequence of whitespace chars defined by the regexp in `search-whitespace-regexp'. -This function is not affected by `replace-character-fold'. +This function is not affected by `replace-char-fold'. Third arg DELIMITED (prefix arg if interactive), if non-nil, means replace only matches that are surrounded by word boundaries. @@ -568,7 +568,7 @@ If `replace-lax-whitespace' is non-nil, a space or spaces in the string to be replaced will match a sequence of whitespace chars defined by the regexp in `search-whitespace-regexp'. -If `replace-character-fold' is non-nil, matching uses character folding, +If `replace-char-fold' is non-nil, matching uses character folding, i.e. it ignores diacritics and other differences between equivalent character strings. @@ -623,7 +623,7 @@ If `replace-regexp-lax-whitespace' is non-nil, a space or spaces in the regexp to be replaced will match a sequence of whitespace chars defined by the regexp in `search-whitespace-regexp'. -This function is not affected by `replace-character-fold' +This function is not affected by `replace-char-fold' In Transient Mark mode, if the mark is active, operate on the contents of the region. Otherwise, operate from point to the end of the buffer's @@ -2051,9 +2051,9 @@ It is called with three arguments, as if it were ;; used after `recursive-edit' might override them. (let* ((isearch-regexp regexp-flag) (isearch-regexp-function (or delimited-flag - (and replace-character-fold + (and replace-char-fold (not regexp-flag) - #'character-fold-to-regexp))) + #'char-fold-to-regexp))) (isearch-lax-whitespace replace-lax-whitespace) (isearch-regexp-lax-whitespace |