As of May 31, 2023, we have updated our Code of Conduct.

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
1 vote
0 answers
32 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
  • 600
1 vote
3 answers
84 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
24 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 (&...
Ephram's user avatar
  • 455
0 votes
1 answer
26 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?
Ephram's user avatar
  • 455
0 votes
1 answer
18 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&...
Ephram's user avatar
  • 455
0 votes
1 answer
24 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&...
Ephram's user avatar
  • 455
0 votes
0 answers
74 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 ...
Ephram's user avatar
  • 455
0 votes
1 answer
15 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"...
Ephram's user avatar
  • 455
0 votes
0 answers
36 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.
Ephram's user avatar
  • 455
0 votes
0 answers
27 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" ...
Ephram's user avatar
  • 455
0 votes
1 answer
38 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 ...
Ephram's user avatar
  • 455
0 votes
2 answers
45 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,644
0 votes
1 answer
46 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
37 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,143
0 votes
1 answer
46 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
48 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,250
0 votes
0 answers
23 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
  • 535
4 votes
1 answer
58 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
383 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
  • 427
0 votes
1 answer
18 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
  • 427
1 vote
1 answer
197 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
  • 427
1 vote
1 answer
51 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
58 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,644
0 votes
0 answers
72 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
81 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
109 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,267
1 vote
1 answer
198 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
133 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
152 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
194 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 ...
Nick's user avatar
  • 125
0 votes
1 answer
52 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
213 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
118 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
17 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,752
1 vote
1 answer
132 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
57 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
124 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
  • 149
1 vote
1 answer
198 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
43 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
279 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
308 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
184 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,267
0 votes
1 answer
194 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
43 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
  • 912
0 votes
1 answer
62 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,114
1 vote
1 answer
834 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
0 votes
2 answers
96 views

Automatically `expand-abbrev` with `org-meta-return` and `org-insert-heading-respect-content`

I take notes with org-mode and abbrev-mode. Normally pressing SPC or RET leads to any abbreviations at point expanding before the edit is made. This doesn't happen when I use C-RET (org-insert-...
Michael Hoffman's user avatar
0 votes
1 answer
2k views

Best pratice advices for abbrev vs. completion vs. snippets

I am not sure if this is really a proper question but I am interested in having some opinions about the most efficient usage of Emacs' abbreviations features (abbrev/dabbrev) in combination with auto-...
Martin Buchmann's user avatar
4 votes
2 answers
129 views

Use abbrev to expand "-->"

I want to type "--> " and have it automatically converted into "→ ". Is there a way to do this using Abbrev?
scaramouche's user avatar
  • 1,760
0 votes
1 answer
223 views

How to define abbrev boundaries and where to put them?

I'm new to Emacs and Common Lisp. I'm wanting to use abbrev-mode to replace standard Common Lisp function names with aliases that I have created. So for example, I would like to replace the following ...
Noble_Bright_Life's user avatar