From 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Apr 2024 13:41:34 -0500 Subject: new repository --- devdocs/elisp/substitution.html | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 devdocs/elisp/substitution.html (limited to 'devdocs/elisp/substitution.html') diff --git a/devdocs/elisp/substitution.html b/devdocs/elisp/substitution.html new file mode 100644 index 00000000..4e0fd810 --- /dev/null +++ b/devdocs/elisp/substitution.html @@ -0,0 +1,29 @@ +

Substituting for a Character Code

The following functions replace characters within a specified region based on their character codes.

Function: subst-char-in-region start end old-char new-char &optional noundo +
+

This function replaces all occurrences of the character old-char with the character new-char in the region of the current buffer defined by start and end. Both characters must have the same length of their multibyte form.

If noundo is non-nil, then subst-char-in-region does not record the change for undo and does not mark the buffer as modified. This was useful for controlling the old selective display feature (see Selective Display).

subst-char-in-region does not move point and returns nil.

---------- Buffer: foo ----------
+This is the contents of the buffer before.
+---------- Buffer: foo ----------
+
+ +
(subst-char-in-region 1 20 ?i ?X)
+     ⇒ nil
+
+---------- Buffer: foo ----------
+ThXs Xs the contents of the buffer before.
+---------- Buffer: foo ----------
+
+
+
Function: subst-char-in-string fromchar tochar string &optional inplace +
+

This function replaces all occurrences of the character fromchar with tochar in string. By default, substitution occurs in a copy of string, but if the optional argument inplace is non-nil, the function modifies the string itself. In any case, the function returns the resulting string.

+
+
Command: translate-region start end table +
+

This function applies a translation table to the characters in the buffer between positions start and end.

The translation table table is a string or a char-table; (aref table ochar) gives the translated character corresponding to ochar. If table is a string, any characters with codes larger than the length of table are not altered by the translation.

The return value of translate-region is the number of characters that were actually changed by the translation. This does not count characters that were mapped into themselves in the translation table.

+
+
+

+ Copyright © 1990-1996, 1998-2022 Free Software Foundation, Inc.
Licensed under the GNU GPL license.
+ https://www.gnu.org/software/emacs/manual/html_node/elisp/Substitution.html +

+
-- cgit v1.2.3