Skip to main content

Questions tagged [abbrev]

is for the abbreviation feature of Emacs where a string of characters are expanded to a longer string. Mainly used to reduce typing, `abbrev` are recorded in a table that is shared locally, among buffers of the same major mode, or even globally. Some Emacs features, such as mail, implement their own `abbrev` functionality. Use additional tags when appropriate.

Filter by
Sorted by
Tagged with
0 votes
0 answers
15 views

Convert file paths in compilation buffer

The paths of files in my compilation buffer don't match the actual files on disk, because building my project happens in another context. I want to convert the file paths in my compilation buffer, so ...
Gauthier's user avatar
  • 509
0 votes
1 answer
30 views

How do I correctly save abbrevs?

I defined a global abbrev, then thought that I better make it a local one, so I wanted to save the abbrevs, then edit abbrev_defs accordingly. So I used abbrev-edit-save-buffer, then opened ...
Alexander Praehauser's user avatar
1 vote
2 answers
133 views

Single letter abbrev and expansion case

If I define an abbrev like wo -> without, and then type Wo, it's expanded to Without, starting with a capital letter. This is the behavior that I want. However, I'd like to define the abbrev t ->...
NTC's user avatar
  • 57
0 votes
0 answers
77 views

Abbrevs with Skeletons no longer expanding

I've mashed together my own form of "snippets" in Emacs with Skeletons and Abbrevs. I updated the exact macro for generating both the abbrev and skeleton function, but now abbrevs never ...
alecStewart1's user avatar
1 vote
0 answers
58 views

How can I get the :regexp property for abbrev to work?

I have a local abbrev table set up in a file. I have an abbrev that has the "+" character. By default, abbrev will not expand this abbrev because it sees "+" as a word boundary. ...
Beetle B.'s user avatar
  • 640
1 vote
3 answers
106 views

Seamlessly replace a keyboard input key sequence

I need something like abbrev, just without any extra spaces, including spaces which trigger the replacement. I experimented with keyboard shortcuts, like this: ;;(general-auto-unbind-keys) (global-set-...
Alexey Orlov's user avatar
0 votes
1 answer
26 views

abbrev-mode not being enabled with value 1

With the following function doing (protabbrev) does not enable abbrev-mode even though protabbrev-state is 1. What could be the reason? (defvar-local protabbrev-state nil) (defun protabbrev (&...
Dilna's user avatar
  • 1
0 votes
1 answer
33 views

Setting abbrev-mode variables before enabling abbrev-mode

Have done some tests with abbrev-mode variables. I can set global-abbrev-table even when abbrev-mode has not been enabled yet with a hook or with (abbrev-mode 1). How does this happen?
Dilna's user avatar
  • 1
0 votes
1 answer
19 views

Looping defconst to fill global-abbrev-table

I have about 30 defconsts for abbrevs and want to loop them to fill global-abbrev-table. (defconst tablet1 '( ("all" "l") ("as" "as") ("can&...
Dilna's user avatar
  • 1
0 votes
1 answer
39 views

Add multiple lists to global-abbrev-table

How can I add multiple lists to global-abbrev-table? (defconst tablet1 '( ("all" "l") ("as" "as") ("can" "k") ("some&...
Dilna's user avatar
  • 1
0 votes
1 answer
167 views

Enabling and disabling abbrev globally and by major-mode

Have noticed that abbrev-mode only works for the current buffer. Thus using the following configuration does not enable abbrev-mode when I load an org-mode file. (require 'toro) (toro-abbrev) Here ...
Dilna's user avatar
  • 1
0 votes
1 answer
22 views

(abbrev-mode 1) not enabling automatic abbreviation

I have an elisp file named toro.el that I want to call in my init file (defconst tablet2 '( ("is" "s") ("it" "t") ("know" "no"...
Dilna's user avatar
  • 1
0 votes
0 answers
37 views

Automatic abbrev expansion as you type?

Is C-x ' the only way that abbrev expansion is invoked, or is there a way to expand abbrevs automatically, as you type, a bit like company-mode does.
Dilna's user avatar
  • 1
0 votes
0 answers
33 views

Abbrev with different tables

I am trying to use abbrev-mode but having great difficulty how to make it work for me. I want to have different replacement tables that I can use for abbrev. (setq word-table-2 '( ("all" ...
Dilna's user avatar
  • 1
0 votes
1 answer
48 views

Word sequences to abbreviated forms

Is there a way to change words or a sequence of words into abbreviated forms. about to ab; after to af; between to bt? And doing the reverse as well, with an abbreviated word showing a list showing ...
Dilna's user avatar
  • 1
0 votes
2 answers
52 views

Tools for conversion of a machine-readable list of misspellings autocorrection to an Emacs abbrev table

There is already a sample autocorrection abbrev_defs file on Emacs wiki: https://www.emacswiki.org/emacs/autocorrection_abbrev_defs There are other more comprehensive common misspellings ...
Name's user avatar
  • 7,893
0 votes
1 answer
50 views

Can I somehow code dynamic "macros" that calls elisp code when I type certain things in a text-mode (or org-mode) buffer?

Short version When I, in the middle of a text-mode or org-mode buffer, type a line that looks like this: >1d6 ... I want Emacs to generate a random number between 1 and 6, and insert it on the ...
Enfors's user avatar
  • 105
0 votes
0 answers
40 views

Expanding phrases not merely words in abbrev-mode

Emacs abbrev-mode is very helpful for expanding words into other words or phrases. For example, I can ask Emacs to expand "edv" into "Emacs Developmental Version". However, it ...
Edman's user avatar
  • 1,229
0 votes
1 answer
68 views

How to automatically disable abbrev-mode when entering math environment?

I use abbrev-mode mostly for usual text in LaTeX. How can I automatically disable it when entering math environment?
Cong Wen's user avatar
1 vote
1 answer
60 views

How to configure Emacs to list the most recently used (MRU) completion options first?

I find autocomplete features in Emacs very helpful. Every time I type a partial word, it infers what the word I have in mind based on some history it has seen so far. I am not exactly sure how. I've ...
tinlyx's user avatar
  • 1,364
0 votes
0 answers
24 views

Can I use an abbrev that starts with a backslash? [duplicate]

I want to type certain unicode characters using backslashes, but it seems that abbrev-mode ignores such strings. For example, I'd like \approx to expand to ≈. If I have this: (define-abbrev-table '...
Rob N's user avatar
  • 649
4 votes
1 answer
76 views

How to share `abbrev_defs` across multiple systems

I keep my abbrev_defs file in a git repository so I can share my abbreviations across systems. Unfortunately, the count feature of abbrev-mode leads to little changes in the :count property of defined ...
Michael Hoffman's user avatar
0 votes
1 answer
547 views

Practical emacs abbrev-mode

Following up on Different abbrevs for each major mode, which covers the first step that I found from here. And now, trying to cover to the next step. In summary, the first step, i.e., Different ...
xpt's user avatar
  • 477
0 votes
1 answer
19 views

Expanding Abbrev Mode Alphabet

Is it possible to write some elisp code so that we can use numbers for Abbrev Mode abbreviations? E.g., m2 -> me too h4 -> hope for gr8 -> greate
xpt's user avatar
  • 477
1 vote
1 answer
269 views

Different abbrevs for each major mode

The https://www.emacswiki.org/emacs/AbbrevMode says You can have different abbrevs for each mode (cperl, c++, Message); but it doesn't show exactly how, yet that's exactly what I am looking for. So, ...
xpt's user avatar
  • 477
1 vote
1 answer
59 views

How to prevent <RET> from triggering abbrev expansion?

I am trying to stop emacs from expanding abbrevs after I press the return key. If I press return, I simply want to create a new line without expanding any abbrev at point. I am relatively new at elisp....
Faulkner77's user avatar
0 votes
1 answer
75 views

Multiple files for reading abbreviations?

Is it possible to have multiple files to tell emacs reads abbrevs? In other words I would like that emacs reads abbrevs from files A and B, but write abbrevs only in A. Is it possible? (setq abbrev-...
Name's user avatar
  • 7,893
0 votes
0 answers
103 views

How to disable Emacs asking if user wants to save abbrevs defined with :system property in a major mode

My Emacs version is 27.1 I am developing a major mode and I want to include some abbrevs to ship with it. I noticed that Emacs asks if user wants to save the abbrevs even if abbrevs have property :...
jevar's user avatar
  • 1
2 votes
1 answer
97 views

Org-mode: disable abbrev-mode in source blocks

I use org-mode to write an executable paper, combining text and code. I make use of abbrev-mode to insert text more efficiently (e.g. type 'bc' to insert 'because') and to correct spelling errors. Is ...
wjbg's user avatar
  • 23
0 votes
1 answer
148 views

Abbrev capitalizes first character

The Qt framework has lots of camel case and pascal case keywords (e.g. textEdited or QWidget). To avoid pressing Shift constantly, I call add-global-abbrev to add a lowercase abbrev and use abbrev-...
Lorem Ipsum's user avatar
  • 4,517
1 vote
1 answer
230 views

Replace a character with a string as it is typed

I would like to do the following: activate some mode so that whenener I type the $ character in my buffer, it immediately gets replaced by <m>. Even better: when I type $ it puts <m></m&...
NWMT's user avatar
  • 115
0 votes
1 answer
150 views

Completion of sentences stored in a file

I know this question is similar to completion of a sentence rather than word but I ask anyway since I suggest another way of storing what is supposed to be auto-completed. Suppose I stored some ...
Denis Bitouzé's user avatar
0 votes
1 answer
193 views

How can I make abbreviations expand instantly?

Is there a way to make emacs expand abbreviations as soon as I finish typing them, rather than having to use a key combination, tab, or space? For example, I want "`a" to expand to "\alpha". It would ...
zurajanai's user avatar
1 vote
1 answer
257 views

How to insert the current date into a file using abbrev or similar?

I'd like to replicate something in emacs that I do in AutoHotkey all the time: type td have that string be replaced with the current date I'm trying to do this with Emacs abbrevs but I'm running ...
may's user avatar
  • 125
0 votes
1 answer
60 views

Abbrevs and UTF-8

For writing texts on spectroscopy I would like to use abbrevs for common notations for spectral lines. However, the method outlined in the documentation for defining abbrevs with C-x a l or C-x a g ...
Christian Herenz's user avatar
1 vote
1 answer
281 views

abbreviations do not expand

My abbreviations are not expanding when I type the abbreviations I have the following in my ~/.emacs for initiating the abbrev mode (setq-default abbrev-mode t) (setq save-abbrevs t) (setq abbrev-...
Baburaj Puthenveettil's user avatar
0 votes
1 answer
127 views

Is it possible to have expand abbreviations when calling a skeleton-read?

I have a large set of abbreviations I defined inside an abbrev-table. Take one of them: (define-abbrev-table 'latex-mode-abbrev-table '(("ff" "my abbreviation!" 0 nil))) If I run a predefined ...
JeffDror's user avatar
1 vote
0 answers
24 views

How can I always expand abbrevs with prefixes?

How can I remove the need to use M-' for abbrevs with a prefix? From the manual: You may wish to expand an abbrev and attach a prefix to the expansion; for example, if cnst expands into ...
antonio's user avatar
  • 1,822
1 vote
1 answer
160 views

Don't consider space and tab as abbrev-expand commands, but keep the C-x whatever shortcuts intact

I read the docs (at bottom) but can't figure this out. I just started using "abbrev.el", and find that pressing space, tab, C-x ', C-x a ', C-x a e can cause the expansion to happen. what if I find ...
american-ninja-warrior's user avatar
0 votes
1 answer
65 views

Why does emacs add a tab to the current line when I use "expand abbreviation" feature?

Apologies if my question is silly, it's my first day using abbrev expand. I have an abbrev set up like this "bm" 3 "bookmarks-acd1fe" When I press bm tab, I end up with bookmarks-...
american-ninja-warrior's user avatar
0 votes
1 answer
148 views

Expand abbrev on two spaces

I want to expand abbrev when I type two spaces instead of one. Is there any way to do it? Simply adding a space to the abbrev pattern doesn't work -- the abbrev is still expanded on the first space.
Yuan Fu's user avatar
  • 259
1 vote
1 answer
219 views

abbrevs not expanding

I have wrote the following abbrev definition file, and saved it as my_abbrev.el: (define-abbrev-table 'global-abbrev-table '( ("else__" "else begin end") )) ;; turn on abbrev mode globally (...
Omer Zimerman's user avatar
1 vote
1 answer
51 views

Abbrevs with interstitial capital letters

Whenever I type YouTrack, abbrev erroneously corrects it to Youtrack. I noticed that in my abbrevs file it has ("youtrack" "youtrack" nil :count 7). Why is that there, and how can I get abbrev to ...
Matthew Piziak's user avatar
5 votes
2 answers
287 views

How to expand abbrevs without hitting another extra key?

How can I expand oe to ö immediately after hitting the e without hitting any extra key like space for expansion? Why? For better ergonomics I've remapped some keys like ö, ü and thus must write them ...
user3166159's user avatar
5 votes
1 answer
349 views

Using a common set of abbreviation for multiple major modes

I use multiple programming languages, and there are a considerable number of abbreviations that I use across all of their corresponding major mode (they are usually name of certain variables, but not ...
neuroprinciplist's user avatar
7 votes
2 answers
236 views

How to use abbrevs

I find using abbrevs in Emacs confusing. Despite reading the manual and the EmacsWiki, I continue to have problems using them. Goal: Define a quick, throw-away abbrev for a single Emacs session. ...
Lorem Ipsum's user avatar
  • 4,517
0 votes
1 answer
223 views

evil-mode unwanted abbrev expand (setq evil-want-abbrev-expand-on-insert-exit nil)

Upon escaping evil-insert-state, if the cursor is next to a letter/phrase in my abbrev list, it expands despite having (setq evil-want-abbrev-expand-on-insert-exit nil) called before evil-mode. ...
nb3pt470's user avatar
1 vote
1 answer
44 views

Define abbrev for `helm-mini`

I am trying to define an abbreviation for helm-mini, I would like d to expand to *dired. When I try my usual way of *dired C-x a i l, I get an error saying Command attempted to use minibuffer while in ...
Arktik's user avatar
  • 972
1 vote
1 answer
79 views

Hooking on to abbreviation expansion

I don't know exactly how abbrev-mode works, but I suppose certain keys --spaces and stops-- cause an examination of the word before point, and a replacement of it in some cases. My question is how ...
Toothrot's user avatar
  • 3,274
1 vote
1 answer
906 views

use a single abbrev-table for multiple modes?

I would like for all my text-based modes (org, markdown, message, mu4e-compose, etc) to use a single abbrev-table, and especially, to add new abbrevs to that shared table whenever I'm in one of those ...
Matt's user avatar
  • 43