summaryrefslogtreecommitdiff
path: root/devdocs/elisp/commands-for-insertion.html
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
committerCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
commit754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch)
treef1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/elisp/commands-for-insertion.html
new repository
Diffstat (limited to 'devdocs/elisp/commands-for-insertion.html')
-rw-r--r--devdocs/elisp/commands-for-insertion.html18
1 files changed, 18 insertions, 0 deletions
diff --git a/devdocs/elisp/commands-for-insertion.html b/devdocs/elisp/commands-for-insertion.html
new file mode 100644
index 00000000..508b7580
--- /dev/null
+++ b/devdocs/elisp/commands-for-insertion.html
@@ -0,0 +1,18 @@
+ <h3 class="section">User-Level Insertion Commands</h3> <p>This section describes higher-level commands for inserting text, commands intended primarily for the user but useful also in Lisp programs. </p> <dl> <dt id="insert-buffer">Command: <strong>insert-buffer</strong> <em>from-buffer-or-name</em>
+</dt> <dd><p>This command inserts the entire accessible contents of <var>from-buffer-or-name</var> (which must exist) into the current buffer after point. It leaves the mark after the inserted text. The value is <code>nil</code>. </p></dd>
+</dl> <dl> <dt id="self-insert-command">Command: <strong>self-insert-command</strong> <em>count &amp;optional char</em>
+</dt> <dd>
+ <p>This command inserts the character <var>char</var> (the last character typed); it does so <var>count</var> times, before point, and returns <code>nil</code>. Most printing characters are bound to this command. In routine use, <code>self-insert-command</code> is the most frequently called function in Emacs, but programs rarely use it except to install it on a keymap. </p> <p>In an interactive call, <var>count</var> is the numeric prefix argument. </p> <p>Self-insertion translates the input character through <code>translation-table-for-input</code>. See <a href="translation-of-characters">Translation of Characters</a>. </p> <p>This command calls <code>auto-fill-function</code> whenever that is non-<code>nil</code> and the character inserted is in the table <code>auto-fill-chars</code> (see <a href="auto-filling">Auto Filling</a>). </p> <p>This command performs abbrev expansion if Abbrev mode is enabled and the inserted character does not have word-constituent syntax. (See <a href="abbrevs">Abbrevs</a>, and <a href="syntax-class-table">Syntax Class Table</a>.) It is also responsible for calling <code>blink-paren-function</code> when the inserted character has close parenthesis syntax (see <a href="blinking">Blinking</a>). </p> <p>The final thing this command does is to run the hook <code>post-self-insert-hook</code>. You could use this to automatically reindent text as it is typed, for example. If any function on this hook needs to act on the region (see <a href="the-region">The Region</a>), it should make sure Delete Selection mode (see <a href="https://www.gnu.org/software/emacs/manual/html_node/emacs/Using-Region.html#Using-Region">Delete Selection</a> in <cite>The GNU Emacs Manual</cite>) doesn’t delete the region before <code>post-self-insert-hook</code> functions are invoked. The way to do so is to add a function that returns <code>nil</code> to <code>self-insert-uses-region-functions</code>, a special hook that tells Delete Selection mode it should not delete the region. </p> <p>Do not try substituting your own definition of <code>self-insert-command</code> for the standard one. The editor command loop handles this function specially. </p>
+</dd>
+</dl> <dl> <dt id="newline">Command: <strong>newline</strong> <em>&amp;optional number-of-newlines interactive</em>
+</dt> <dd>
+<p>This command inserts newlines into the current buffer before point. If <var>number-of-newlines</var> is supplied, that many newline characters are inserted. In an interactive call, <var>number-of-newlines</var> is the numeric prefix argument. </p> <p>This command calls <code>self-insert-command</code> to insert newlines, which may subsequently break the preceding line by calling <code>auto-fill-function</code> (see <a href="auto-filling">Auto Filling</a>). Typically what <code>auto-fill-function</code> does is insert a newline; thus, the overall result in this case is to insert two newlines at different places: one at point, and another earlier in the line. <code>newline</code> does not auto-fill if <var>number-of-newlines</var> is non-<code>nil</code>. </p> <p>This command does not run the hook <code>post-self-insert-hook</code> unless called interactively or <var>interactive</var> is non-<code>nil</code>. </p> <p>This command indents to the left margin if that is not zero. See <a href="margins">Margins</a>. </p> <p>The value returned is <code>nil</code>. </p>
+</dd>
+</dl> <dl> <dt id="overwrite-mode">Variable: <strong>overwrite-mode</strong>
+</dt> <dd><p>This variable controls whether overwrite mode is in effect. The value should be <code>overwrite-mode-textual</code>, <code>overwrite-mode-binary</code>, or <code>nil</code>. <code>overwrite-mode-textual</code> specifies textual overwrite mode (treats newlines and tabs specially), and <code>overwrite-mode-binary</code> specifies binary overwrite mode (treats newlines and tabs like any other characters). </p></dd>
+</dl><div class="_attribution">
+ <p class="_attribution-p">
+ Copyright &copy; 1990-1996, 1998-2022 Free Software Foundation, Inc. <br>Licensed under the GNU GPL license.<br>
+ <a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Commands-for-Insertion.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Commands-for-Insertion.html</a>
+ </p>
+</div>