diff options
| author | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
| commit | 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch) | |
| tree | f1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/elisp/interactive-examples.html | |
new repository
Diffstat (limited to 'devdocs/elisp/interactive-examples.html')
| -rw-r--r-- | devdocs/elisp/interactive-examples.html | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/devdocs/elisp/interactive-examples.html b/devdocs/elisp/interactive-examples.html new file mode 100644 index 00000000..5aaa03cc --- /dev/null +++ b/devdocs/elisp/interactive-examples.html @@ -0,0 +1,44 @@ + <h4 class="subsection">Examples of Using interactive</h4> <p>Here are some examples of <code>interactive</code>: </p> <div class="example"> <pre class="example">(defun foo1 () ; <span class="roman"><code>foo1</code> takes no arguments,</span> + (interactive) ; <span class="roman">just moves forward two words.</span> + (forward-word 2)) + ⇒ foo1 +</pre> + +<pre class="example">(defun foo2 (n) ; <span class="roman"><code>foo2</code> takes one argument,</span> + (interactive "^p") ; <span class="roman">which is the numeric prefix.</span> + ; <span class="roman">under <code>shift-select-mode</code>,</span> + ; <span class="roman">will activate or extend region.</span> + (forward-word (* 2 n))) + ⇒ foo2 +</pre> + +<pre class="example">(defun foo3 (n) ; <span class="roman"><code>foo3</code> takes one argument,</span> + (interactive "nCount:") ; <span class="roman">which is read with the Minibuffer.</span> + (forward-word (* 2 n))) + ⇒ foo3 +</pre> + +<pre class="example">(defun three-b (b1 b2 b3) + "Select three existing buffers. +Put them into three windows, selecting the last one." +</pre> +<pre class="example"> (interactive "bBuffer1:\nbBuffer2:\nbBuffer3:") + (delete-other-windows) + (split-window (selected-window) 8) + (switch-to-buffer b1) + (other-window 1) + (split-window (selected-window) 8) + (switch-to-buffer b2) + (other-window 1) + (switch-to-buffer b3)) + ⇒ three-b +</pre> +<pre class="example">(three-b "*scratch*" "declarations.texi" "*mail*") + ⇒ nil +</pre> +</div><div class="_attribution"> + <p class="_attribution-p"> + Copyright © 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/Interactive-Examples.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Interactive-Examples.html</a> + </p> +</div> |
