Skip to main content

Questions tagged [insert]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
34 views

How to insert a named subskeleton from another skeleton?

I have a main skeleton and a subskeleton, both defined with define-skeleton. I would like to insert the subskeleton from the main one, using its name. (define-skeleton my-subskeleton "My ...
Tristan Riehs's user avatar
0 votes
0 answers
95 views

How to make all key combinations insert themselves into vterm?

I'd like to create a keymap vterm-insert-map for vterm that self-inserts all or at least all currently bound key combinations, except for one, which acts as an escape key. I can use set-transient-map ...
Alexander Praehauser's user avatar
1 vote
0 answers
36 views

delete and start insert

Coming from vim, I use evil, and I am used typing s to replace (substitute) text and continue in insert mode. In normal mode, s is a synonym for cl. In visual mode, s is a synonym for c. Both (cl and ...
Alois Pichler's user avatar
0 votes
1 answer
76 views

How to insert a space char when inputting a node name to `org-roam-node-find`?

When I use command org-roam-node-find and I want to create a node named Programming Languages, I can't enter the space character. Emacs seems to require the node title to be a single string without ...
Lindsay's user avatar
  • 37
-1 votes
1 answer
114 views

Insert a multiline string [closed]

Would it be considered normal (common and good style) to use insert with a multiline string ? (insert "This is the first line \n that gets continued on the second line \n and on the third line&...
Dilna's user avatar
  • 1
6 votes
2 answers
411 views

Insert multiple minus ('-') characters using the universal argument (C-u)

I was manually creating a table in my source code's multiline comments and inserting horizontal separators using - and =. E.g. C-u C-u C-u = as expected and inserts 64 =s at the point. But - is used ...
loonatick's user avatar
  • 217
0 votes
1 answer
45 views

Bug or feature? Insert does not insert at the current point position in the buffer

Below two screenshots: The first one before executing eval-buffer on the scratch buffer: The second one after executing 'eval-buffer`: As you can see above the commands have inserted the text ...
oOosys's user avatar
  • 475
1 vote
1 answer
32 views

insert-char completion says no matches, but inserts character anyway?

I'm using C-x 8 RET to insert a Unicode character. I enter the hex value -- for example, 201c -- and the minibuffer says "no matches". But if I just hit enter, the expected left double quote ...
Dan Drake's user avatar
  • 685
0 votes
0 answers
70 views

Slowly updating text appears to be in overwrite rather than insert mode--but isn't

I'm running emacsclient -nw and I notice sometimes the buffer appears to be in overwrite mode---I'll go to the beginning of a line and start typing, and when I do the existing text does not get pushed ...
Mittenchops's user avatar
0 votes
1 answer
148 views

How to replace the region text with the text of a string, without deleting and reinserting parts that are the same

In a few functions I've written logic that does the following: (defun replace-in-region (str beg end) "Replace the region between BEG & END with STR." (save-excursion (goto-char ...
ideasman42's user avatar
  • 9,027
1 vote
2 answers
303 views

Way to keybind «» in Emacs

I would like to be able to keybind « and » to easy key bindings. At the moment in Emacs the only way to write these latin quotation marks is this: C-x 8 < and C-x 8 > I tried the following, but ...
Adelita's user avatar
  • 255
0 votes
1 answer
62 views

Calling c-electric-brace programmatically

I'm currently extending the tempo.el template insertion system to be sensitive to C styles. Specifically, I want to insert braces using c-electric-brace. How programmatically insertion of braces as ...
Nordlöw's user avatar
  • 527
0 votes
1 answer
260 views

How to turn from command to insert mode at the end of my elisp interactive script?

I am using Evil (Vi keybindings) in Spacemacs. Let's say I have something like that: (defun myfunc-org-insert-custom-stuff () (interactive) (insert "This is custom stuff ")) but I would ...
fegax's user avatar
  • 45
3 votes
1 answer
713 views

How can I insert the backslash character ( \ ) before quotation marks (" ") in Emacs?

I am running Emacs and writing on the scratch-buffer. This is my config file. After executing describe-mode, this is the list of minor modes running: Enabled minor modes: Auto-Composition Auto-...
Pedro Delfino's user avatar
0 votes
1 answer
81 views

How can I insert a character by its hex code in the minibuffer?

I've seen it's possible to insert characters with their hex codes by using ctrl+x 8 RET but on regular buffers. I'd like to insert in the minibuffer itself.
David Borges's user avatar
1 vote
1 answer
57 views

Elisp: function to paste heading lines in an Org-mode buffer

I would like to have a function that pastes a certain heading: "#+TITLE:\n#+STARTUP: overview" I tried using insert-buffer-substring: (insert-buffer-substring "#+TITLE:\n#+STARTUP: ...
Emmanuel Goldstein's user avatar
1 vote
1 answer
186 views

Insert space before link with org-insert-link

In Doom Emacs and org-mode, I want to use org-insert-link pressing the minimum amount of keys. So I want to combine two-four commands in one. The default behaviour doesn't leave space before or after. ...
Konstantinos's user avatar
1 vote
1 answer
525 views

Insert path into buffer with vertico.el

I have recently switched from ivy to vertico for the file completion menu system (the new default in doom). Sometimes I want to insert the full path to a file into the current buffer (for example ...
Romeo Valentin's user avatar
2 votes
1 answer
236 views

Modify the first element of the kill-ring

I have stored in my clipboard a path to an image, which I want to paste inside emacs. I would like to modify the path to change/postpone/prepone some stuff before yanking. Following my previous ...
user1683620's user avatar
1 vote
1 answer
169 views

Insert text and step

I want to copy text from one buffer to another. With point in the source buffer, I want to insert text in the target buffer. In the target, the text should insert at point, a new line be opened, and ...
Lorem Ipsum's user avatar
  • 4,547
2 votes
1 answer
144 views

Evaluate a variable when inserting text into a buffer

When I open a fresh file for coding, I like to insert a header like this: ##################################################################### # Purpose: # Author: me ([email protected]) # Date: ###...
Dan's user avatar
  • 191
0 votes
1 answer
270 views

Use LaTeX accents with tex insert method

With this answer I learned how to insert math symbols with latex syntax directly into my buffer. What I can't figure out is how to make accents insert properly. I want \hat{\beta} to insert beta hat ( ...
mcp's user avatar
  • 576
0 votes
1 answer
55 views

How to end text-insert undo segment after cursor jump (caused by mouse)?

Coming from vim into (evil-mode) spacemacs, I sometimes get frustrated that undo segment is not ended when a mouse-caused cursor movement occurs. An example : While I am inserting text, touchpad gets ...
user6609's user avatar
0 votes
2 answers
321 views

AUCTeX LaTeX-math-mode outside a mathematical environment

Using AUCTeX with LaTeX-math-mode enabled, if I type (say) ` a inside a mathematical environment, it inserts \alpha, as I want. But if I do it outside a mathematical environment, it inserts \alpha{}. ...
Jeremy Rickard's user avatar
0 votes
1 answer
86 views

How to insert text and activate the mark in the same function [duplicate]

I am trying to write a function where I insert some text, and then activate the mark at the end of the function. I have several use-cases where I would like to use this. I cannot figure out how do ...
LUD's user avatar
  • 1
1 vote
1 answer
164 views

How can I insert some multiline text that respects the indentation at which it is inserted?

I have a function that reads a link from the clipboard and generates a metadata-ful markdown link from it, and inserts it: (defun night/unt () (interactive) (let* ((link (current-kill 0)) ...
HappyFace's user avatar
  • 900
0 votes
1 answer
404 views

Does Emacs have a standard function to insert or overwrite text depending of the state of overwrite-mode?

Context: using Emacs 26.2 I would like to write Emacs Lisp code that inserts or over-types text depending of the state of the overwrite-mode. I would call this function to insert text instead of the ...
PRouleau's user avatar
  • 831
5 votes
2 answers
3k views

How to insert character or word N times in a buffer or file?

Just curious to know how to do this, since i already know in other languages (bash, etc). I know how to insert a character in elisp, just not sure on how to do it when it's done nth time (in ...
Nordine Lotfi's user avatar
0 votes
1 answer
64 views

Insert aligned multi-line text in current buffer regardless of position?

I'm creating a function to easily insert ditaa boxes while drafting reports in org-mode. I have the meat of the function accomplished, but not sure how to implement it so that boxes can be inserted ...
dylanjm's user avatar
  • 333
3 votes
2 answers
84 views

How do I add text to every new buffer that I create?

Suppose I want to put my name and the date at the top of every new buffer that I create. How would I do that? Furthermore, suppose I want to use the name of the new buffer in the text that I want to ...
Prikshet Sharma's user avatar
1 vote
3 answers
294 views

How to create loops for inserting text?

Imagine I want to create a list with 10 items, i. e. 1. 2. 3. ... 10. In Vim I can use the command :for i in range(1,10) | put =i.'. ' | endfor for this. How can I do the same thing in Emacs? ...
Glory to Russia's user avatar
2 votes
1 answer
859 views

Insert space but don't move point

Search didn't yield any success. Perhaps I'm using the wrong search terms... I'd like to insert a single space (just like when you hit SPC) but without changing point. I come up with an example (let |...
rudolfo.christ's user avatar
1 vote
1 answer
322 views

(goto-char (region-end)) doesn't set the point to the end of the region

I have written a small elisp script which should put oneline or multiline comments based on the current buffer's major mode. The source file is here: https://github.com/amirteymuri/Com/blob/master/...
user avatar
2 votes
1 answer
616 views

How insert random number?

Suppose I has text: test hello The cursor is after word test. I need to insert random number? Also I need to set range of random (e.g. from 0 to 1000) The result maybe like this: test100 hello
a_subscriber's user avatar
  • 4,204
2 votes
1 answer
263 views

The insert function seems to be inheriting the read-only property

I'trying to insert a row of characters into a buffer, where the first four characters should be read-only. Here's the relevant part of the code : (insert (propertize "cn) " 'read-only t)) (insert (...
joao's user avatar
  • 123
0 votes
0 answers
93 views

Have Emacs remember text properties of buffer [duplicate]

I am using the following code to insert colored text into an Emacs buffer. (insert (propertize "green" 'font-lock-face '(:strike-through t :foreground "green" :background "blue"))) ...
Smashgen's user avatar
  • 131
4 votes
2 answers
971 views

Inserting the plus minus unicode symbol ± as a keyboard macro

I insert the plus minus symbol ± frequently enough that I want to bind it to a key. From emacs -Q, I've tried this: (global-set-key (kbd "C-c m") "±") However, when I enter C-c m, the minibuffer ...
Tyler's user avatar
  • 22.5k
0 votes
1 answer
60 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, ...
Quora Feans's user avatar
3 votes
1 answer
432 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?
Eleno's user avatar
  • 1,478
0 votes
1 answer
859 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 ...
Name's user avatar
  • 7,967
1 vote
1 answer
206 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 ...
Dodgie's user avatar
  • 482
1 vote
0 answers
103 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 ...
AhLeung's user avatar
  • 1,103
4 votes
2 answers
876 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' ...
ShreevatsaR's user avatar
0 votes
0 answers
561 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 ...
izkon's user avatar
  • 1,908
21 votes
5 answers
4k 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 ...
user8542613's user avatar
6 votes
1 answer
2k 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 (...
myTerminal's user avatar
0 votes
1 answer
518 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 '...
yPhil's user avatar
  • 993
1 vote
0 answers
55 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 ...
AlwaysLearning's user avatar
7 votes
1 answer
5k 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-...
Simon's user avatar
  • 431
6 votes
1 answer
756 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 ...
BenzoX's user avatar
  • 83