Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [insert]

The tag has no usage guidance.

0
votes
1answer
36 views

All Greek letters are capitals, no small Greek letters

So far, I need some Greek letter every now and then. I enter them through: C-x8RET GREEK SMALL LETTER LAMBDA RET → λ or simply by C-x8RET 03bb RET → λ However, I tried this after a long hiatus, ...
1
vote
1answer
58 views

Insert text or overwrite region

In an Emacs Lisp function, I would like to insert some text at point or - if the region is active - overwrite it with such text. How to do it?
0
votes
1answer
84 views

How to programmatically insert a string at the end of some file?

How to silently (in background) create a new line at the end of a specific file, say /path/to/file.txt (which is not necessarily a visiting file and is not necessarily already open in emacs) and ...
0
votes
1answer
48 views

Cover the active region with a character

Called with an active region, it will replace all spaces in that region with the character corresponding to the subsequent key press. E.g., if cover-active-region is bound to C-c /, then C-c / h will ...
1
vote
0answers
56 views

Make `insert` follow `(delete-selection-mode t)`

When I call helm-copy-to-buffer (which calls insert) with active region in my current buffer, the marked helm candidate is added after the active region. But I expect the active region to be replaced ...
3
votes
1answer
187 views

Move to goal-column inserting spaces if necessary

I have a bunch of lines of text and I'm trying to insert text starting at a certain column on each line. For example: 'Some text' This is ok 'Another longer text' ask Ram 'weird stuff' ...
0
votes
0answers
236 views

Wanted: vim-like paste behavior from browse-kill-ring

When using the browse-kill-ring package to insert some text from the kill ring, the text always gets inserted before point. This is not intuitive to vim users who are used to pasted text being ...
6
votes
4answers
797 views

Result of arithmetic evaluation in buffer, not echo area

Windows 10, Emacs 25.1 I want to do some arithmetic operation I do this: The result is in the echo area, but I want the result to be in cursor place in the buffer. Something like this: How do I do ...
4
votes
1answer
321 views

How to insert a formatted string into a specific buffer?

I am looking for a way to insert a formatted text into a specific buffer (not the active buffer). As it seems to me, the only way to do so is to use a snippet as shown below: (insert (propertize (...
0
votes
1answer
241 views

Run command after each type/insert in particular buffer

I'm implementing a (optional, de-activable) real-time syntax checker. Each time the user types/deletes anything, I want to run my spell-checking funtion : I tried (add-hook 'post-self-insert-hook '...
1
vote
0answers
33 views

Insert from ELisp code using quail

After evaluating the expressions in this code, I evaluated (activate-input-method "TeX"). When I type in the buffer \`a, the translation happens as expected and I get à. However, I cannot achieve the ...
6
votes
1answer
1k views

Insert line above/below

I have a couple of functions for inserting blank lines above and below the current line: (defun insert-line-below () (interactive) (move-end-of-line nil) (open-line 1)) (defun insert-line-...
6
votes
1answer
316 views

Spacemacs : insert single character in normal mode

I am using Spacemacs in Vim mode, and I would like to be able to insert a single character while remaining in normal mode, as described here for Vim. For example, typing SPC i k in normal mode would ...
0
votes
1answer
219 views

Using quail input-method to insert a string

The standard way to define an abbreviation using quail is as follows: (quail-define-rules ("a" ?s )) Inserting "a" gives "s". I am wondering if one can insert an arbitrary string using quail, I ...
4
votes
2answers
385 views

Insert a string from eval-expression without the quotes

I want to use C-u M-:, then (format-time-string "%m/%d/%Y") to insert a customized date string. But it is inserted into the current buffer with double quotes. Any trick to remove these quotes?
4
votes
1answer
195 views

How can I type simple underline “_” in Auctex

I am using Auctex in Aquamacs. Everytime I type underline "_", it will show as $_{}$ automatically which is very annoying. I am wondering how could I turn off this function. Thanks.
3
votes
2answers
187 views

Quickly inserting a single Greek letter

How can I make it so that H-g followed by a gives an alpha etc.?
7
votes
2answers
180 views

Key bound to string does not handle some chars in string correctly

(I ask this question after reading this one.) The form (global-set-key (kbd "M-e") "e") is, as far as I can tell, equivalent to (global-set-key (kbd "M-e") (lambda () (interactive) (insert "e"))) ...
1
vote
0answers
73 views

emacs multiple-cursors insert letters (numbers) issue

I've created an ascii video at https://asciinema.org/a/63b67gx2hm5pasdvjkhiyq4ud to demo my emacs issue with multiple-cursors. I created 4 lines of text and created 4 cursors (see 00:36). Then I use C-...
3
votes
1answer
302 views

Insert into specific buffer (not the active buffer)?

Is there any way to insert text into a buffer that isn't the active buffer with Elisp? Perhaps there is an equivalent to with-temp-buffer that takes a specific, existing buffer as an argument?
1
vote
1answer
69 views

How to create a file from a template if it does not exist or open existing copy?

Trying to make a function that I can call to create a file from a template or open an existing file. Current attempt is as follows: (defun journal-entry () (interactive) (let ((daily-name (format-...
1
vote
0answers
42 views

extra e character is inserted before every character

I have a problem every so often where I accidentally hit a key combination (don't know what it is) and I get into a state where the letter e (sometimes it is another letter IIRC) is inserted before ...
4
votes
2answers
293 views

Is there a way to get a Unicode character by name?

Is there a way to get a character by name (e.g. GREEK SMALL LETTER LAMBDA) instead of by code point (\uX3BB)?
4
votes
1answer
1k views

How to insert a new same-level headline after current one?

Suppose I have an org-mode buffer that contains the outline shown below, and that point is at the position indicated by the ▮ character. * foo ** bar *** baz - eenie - yabba - dabba▮ ...
1
vote
1answer
39 views

must clear insert buffer-string?

This code (defun insert-dateutc.* () (interactive) (insert (with-temp-buffer (call-process "date" nil t nil "+%Y-%m-%dT%H:%M:%S") (buffer-substring-no-properties 1 (line-...
2
votes
0answers
438 views

`insert-file-contents` without the comments

The below command insert the contents of the file myfile.txt. (insert-file-contents "~/myfile.txt") Is there a way to tell emacs to not insert the comments (assuming the comment syntax is known to ...
2
votes
1answer
91 views

Insert Text Leftwards in Overwrite Mode

How can I insert text so that the cursor stays in the same position while text I type is shifted to the left, overwriting existing text? For example: row_title: some words old_title: letters ...
2
votes
2answers
265 views

How to include a text verbatim in Emacs Lisp?

How to programmatically insert a text verbatim? The following function inserts ocumentclass and not \documentclass. (defun foo () (interactive) (insert "\documentclass")) Of course one can use (...
12
votes
1answer
711 views

How do I insert text with a specific face?

I have a face, created this way: (defface test-face '((t . (:height 2.0))) "A face for testing.") I'd like to insert some text with that face. But these ways insert the text without the face: (...
2
votes
0answers
95 views

Insert to the right of cursor

Q: What is the simplest way to insert text without moving the cursor? Is there a command, say insert-right-of-point, that does just that already? I did not find one and gave up after several C-h a. ...
1
vote
1answer
140 views

How do I insert the buffer's name at the beginning of the buffer?

I am trying to write a function that prints the name of the current buffer to the file in the current buffer in its first line. For example, if the file is called "test.el", when invoking such ...
2
votes
1answer
93 views

How to use the inserting commands/functions in the mini-buffer?

Assume that I have defined a function like below with some keybinding (e.g.M-p). (defun foo () (interactive) (insert "something very long") ) (global-set-key [(meta p)] 'foo) If I hit M-p while the ...
3
votes
3answers
823 views

Insert left and right double quotation marks instead of ordinary quotation mark

For a given document (buffer), I would like use left double quotation mark “ (U+201C) and right double quotation mark ” (U+201D) instead of the ordinary double quote " (U+0022). I want to surround ...
6
votes
2answers
1k views

How to insert invalid UTF-8 sequence

In order to test that some code handles an invalid UTF-8 sequence properly, I need to insert an invalid UTF-8 sequence into an existing text file. However, my attempts to do so result in a valid UTF-...
1
vote
2answers
122 views

Undo custom command without moving the point

I would like to have a command that inserts some text at a distance, while keeping the point in place during its own execution and while being undone. To illustrate the point, consider following ...
6
votes
1answer
533 views

Mimic self-insert-command with insert/insert-char?

Due to various/extensive remappings I insert symbols with Control+key, for example Ctrl+9 inserts a left parenthesis (. This works fine with the remappings and the insert/insert-commands, however, ...
0
votes
2answers
64 views

How to define a variable which gives the last inserted character of the current buffer?

Is there a built-in variable which gives the last inserted character of a buffer (inserted by self-insert-command)? Note that the cursor is not necessarily at the place of the last insertion. If ...
5
votes
2answers
247 views

Define an emacs function to take arguments in the same way as something like M-x goto-line

I want to write an emacs function for debug purposes in c++ code. Basically I'm fed up typing the following: std::cout << "variable is: " << variable << std::endl; Instead I want ...
6
votes
3answers
601 views

How to insert a specific number of newlines in org-mode

Inside org-mode, RETURN is bound to (org-return &optional INDENT). This command apparently ignores C-u numeric prefixes and so if you want to enter 10 newlines, you can't just type C-u 1 0 RET and ...