Questions tagged [major-mode]

The mode that determines the editing behavior of Emacs while that buffer is current. The mode line normally shows the name of the current major mode, in parentheses.

Filter by
Sorted by
Tagged with
4
votes
2answers
40 views

How can I enable electric indentation for all modes except some?

I am trying to enable electric-indent-mode for all modes except fundamental-mode, where it is just annoying. In my init file, I have the following: (electric-indent-mode +1) (add-hook 'after-change-...
0
votes
1answer
170 views

Highlight syntax of function names and their arguments in custom mode

I'm trying to create a major mode that handles the following syntax: function someName(value1, value2) # some contents end function I'm using the following to highlight the keywords function,...
0
votes
1answer
21 views

How can a function check which major mode is enabled?

The accepted answer to this question says: When the function is invoked, it can test the current mode and do something appropriate. For example, for some modes, or all modes except some modes, it can ...
0
votes
2answers
29 views

Is this syntax parse possible with Emacs' regex expressions?

I'm trying to write a small new mode for some input files to a specific computational physics program. I'm doing it the define-derived-mode way, and was specifying the syntax highlighting by setting ...
5
votes
2answers
2k views

Change the default mode used when opening a new buffer

For example, we can open a new buffer with C-x b <new-buffer-name>, and by default, this new buffer opens in fundamental-mode, which is not very useful to me. I would like to change this to open ...
0
votes
1answer
24 views

POVray mode minor change sought

POVray is a scripting language used to define 3-dimensional graphics. POVray mode for emacs provides text coloring, automatic indenting, etc. when developing a script on emacs. For the most part, this ...
0
votes
0answers
43 views

How to add `imenu` support to a major mode that does not support it and issue and error?

When working with YANG files using the yang-mode I get a imenu-unavailable "The mode ‘YANG//l’ does not support Imenu error. The yang-mode derives from prog-mode which I believe requires imenu ...
8
votes
4answers
1k views

How to associate more than one file extension with a given mode in `use-package`

When using use-package, is there a way to associate more than one file extension with a particular mode in one place instead of multiple locations? Case in point is that I would like to associate ...
3
votes
3answers
112 views

load user-written minor mode in a specific major mode

I'm trying to use a very simple minor mode I've written to personnalize the appearance of the buffer when I'm running R in ESS. Basically, I've set the linespacing in my init file to increase it and ...
1
vote
1answer
43 views

How to support `<` and `>` as balanced parens without impacting ability to use them as comparison operators?

Languages like Erlang and Elixir use << >> for binaries and bit-string syntax, but they also use the classical < and > for comparison operators as well as -> and <- in list ...
1
vote
0answers
37 views

Catch popup buffers by major-mode with display-buffer-alist?

I would like to catch popup buffers with display-buffer-alist by their major-mode instead of matching the buffer name with a regexp. For example I have dired-mode buffers that popup and I can't come ...
3
votes
3answers
447 views

Create new major mode from cc-mode that allows comments with two dashes

It is possible and relatively easy to create a new major mode, deriving from c-mode, and just add two dashes '--' to work as comments too? I have checked many resources, but couldn't find anything ...
13
votes
3answers
2k views

How to set major mode for a file in .dir-locals.el?

I would like to set the major mode for a file as you would using file-local variables Local Variables: mode: text End: but in .dir-locals.el in order not to “pollute” the file in question. Is this ...
1
vote
1answer
57 views

symbol's value as variable is void: command, when using ibuffer-sidebar

I installed ibuffer-sidebar (https://github.com/jojojames/ibuffer-sidebar) and added the following to my ~/.emacs.d/init.el: (use-package "ibuffer-sidebar.el") (require 'ibuffer-sidebar) (setq ...
1
vote
1answer
25 views

How are program arguments handled when a program/script is launched from Emacs?

I often find myself wondering how people handle program arguments when they are developing with Emacs. Let's say we have a Python script test.py and launching it requires supplying arguments, e.g. --...
0
votes
0answers
17 views

Edit wikitext using Doom Emacs

I might have to edit some wikitext files. I am using tiddlywiki but the syntax is similar to mediawiki. I looked up but could not find any specific mode to edit wikitext documents. HTML goes closest ...
0
votes
1answer
29 views

How do I stop Prolog mode from jumping to the Prolog REPL when consulting the buffer?

Suppose I am using Prolog mode with the Prolog REPL started as an inferior process using CtrlcEnter. Whenever I "consult" (i.e. evaluate) the Prolog mode buffer using CtrlcCtrlb ((prolog-...
1
vote
2answers
112 views

Cperl-mode syntax highlighting breaks when inserting a newline into a here doc

in cperl-mode, here docs are colored with a font-lock-string-face. However if you used any function that inserts a newline on a blank line (e.g. M-: (insert "\n")) it will cause all code after the ...
1
vote
0answers
18 views

Customized c-mode indentation style in Emacs 27.2

I would like to produce c code in the following format: char *ft_strdup(const char *s1) { char *h; size_t len; ... } Where I can tab after the type of the function signature and ...
0
votes
1answer
216 views

Whitespace mode settings on per major mode basis

When I open the Linux Kernel code, my default indentation conflicts with the desired formatting of the Kernel. I use Emacs Prelude, so I added the settings from this link to my c-mode-common-hook. I ...
1
vote
1answer
111 views

How to define different font-lock-variable-name-face respect to different modes

By default font-lock-variable-name-face is defined as follows: '(font-lock-variable-name-face ((t (:foreground "black" :weight bold)))) Would it be possible to change its color for ...
0
votes
1answer
20 views

Any mode for Modula 2?

I'm (after a hiatus of some 30 years) dabbling again in Modula 2 (yes, too much time cooped up). But neither ELPA nor MELPA knows anything about a mode for GNU Emacs. This site seems not to mention ...
0
votes
2answers
100 views

Stop major modes from overwriting my keybinding [duplicate]

By default C-x n is a prefix keymap used for narrowing. I want to bind C-x n to windmove-down. (global-set-key (kbd "C-x n") 'windmove-down) This works fine for Text mode. But many major ...
1
vote
1answer
62 views

How to quickly cycles through buffers of the same major mode as current one?

I'd like to find a way to cycle through all buffers that use the same major mode as the current buffer. For all major modes, including the special buffers. Use case example: when refactoring code I ...
6
votes
4answers
1k views

Make names of major modes shorter in the mode-line

I want to make names of major modes shorter. No longer than three characters. Is there any packages that do something like that? It's better to shorten mode names in automatic fashion, so one doesn't ...
0
votes
0answers
31 views

How the inner working of Mode management is actually like?

I'm aware of some way to set up my own custom mode in Emacs, but I'm wondering: How does it actually manage Mode (eg: Setting things up, then resetting them once exiting Mode, etc)? I'm guessing it ...
1
vote
1answer
40 views

Switch to most recent buffer in a given mode

I am trying to create a function that switches to the most recent buffer in major mode major-mode. An answer to a related question supplies a function that should require the smallest of tweaks to ...
0
votes
1answer
27 views

Where does my key bind so I can unbind it in major mode

I changed my key bindings with this lines in my .init.d: (global-set-key "\C-i" 'previous-line) It works normally, but when I change to markdown-mode, key rebinds to something else, how can ...
1
vote
0answers
156 views

How to set major mode localleader keybinding to both `SPC m` and `comma` in Doom

I want to be able to use both SPC m and , as major mode localleader keybinding in Doom. With my current Doom setup, I can only use , as localleader key. SPC m is undefined currently.
1
vote
1answer
48 views

PSGML conflicts with built-in `sgml-mode`

I’ve installed psgml 1.4.0-9 and psgml-html-mode for DTD-aware editing of HTML.* But the built-in sgml-mode/html-mode seems to be causing some problems: some tags are highlighted in font-lock-function-...
0
votes
0answers
37 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 :...
0
votes
1answer
28 views

Bindings just for text buffers created by magit?

I'm trying to create a different keybinding to abort a commit in magit. Right now, when you're editing a commit message C-c C-k is bound to with-editor-cancel, which does the trick. But I'm an evil ...
1
vote
0answers
85 views

Running logo program (ucblogo) in Emacs

I am trying to run logo programs (ucblogo version 5.5) on my emacs in Debian Linux (26.1). There is a currently a mode for it ( https://www.emacswiki.org/emacs/LogoMode ). I followed the instructions ...
1
vote
0answers
21 views

Emacs Mode to edit template toolkit files

Is there a mode to edit template toolkit files ? Web-Mode works decently, but maybe some modes can be combined to proved some specific Perl-editing-Funcitonality?
58
votes
7answers
27k views

How do I list all key-bindings available in a given buffer?

I am trying out a new major mode, how can I take advantage of Emacs' documentation system to get a listing of key bindings available in that specific buffer?
1
vote
2answers
113 views

How to find inheritance of modes?

As an example, let's use latex-mode, that inherits from tex-mode, that inherits from text-mode. Is there a command, that would take as input latex-mode and give me parent and grand-parent? Or, other ...
0
votes
0answers
23 views

How to prevent js2-mode from shortening keywords

I'm a longtime vimmer switched to Emacs with Doom this year when I got a job writing Clojure. Writing JS this week I came across a maddening configuration that I can't figure out how to turn off. ...
1
vote
1answer
44 views

How to get the mode-specific help information or help files

No matter in which mode I am currently in, is there a general way / key combination to open the help file related to the currently active mode?
1
vote
2answers
49 views

Implement modal interface in a major mode

I am creating a major mode, and would like to have modal interface (such as vi) on it. I want to have a special key that toggles the behaviour on arrow keys. So, for example, if the special key is hit,...
1
vote
3answers
197 views

Is there command to cause emacs to rescan the buffer to determine mode?

Apologies if this has been asked before (I couldn't find an answer to this.) Frequently, when I open an existing file or create a new file with emacs, the mode is determined correctly based on the ...
1
vote
1answer
59 views

How to enable org mode and evil mode for untitled buffer when creating a new frame

The code below creates a new frame with an untitled buffer, how to make this buffer default with org-mode and evil-mode? (global-set-key (kbd "s-n") 'new-empty-frame) (defun new-empty-frame ...
2
votes
1answer
157 views

How can I see what Major and Minor modes I'm currently in?

Is there an easy way to see what modes are currently operating in a buffer? And have a list of their names?
0
votes
1answer
67 views

How to temporarily switch to another major mode in elisp (with-current-mode ?)

Is there reliable way to temporarily switch the current buffer to another major mode, perform some function, then switch back to the original mode? Basically, I was looking for something similar to ...
0
votes
1answer
63 views

Apply settings in .dir-locals.el to both c and c++ major modes

Is there a way to specify the same settings for c-mode and c++-mode without repeating the alist? I have: ((c-mode . ((comment-start . "/* ") (comment-end . " */") (comment-...
5
votes
0answers
268 views

Emacs Mode For Editing Guitar/Bass Tablature?

I have been looking for a while, and have not been able to find an Emacs major mode for editing Guitar/Bass tablature.
1
vote
1answer
125 views

sage-shell-mode repeat the input in the output

I wanted to use sagemath straight in emacs instead of having a terminal open. I tried to use a shell (or eshell for that matters) in emacs and launch sage there, but every time I input a command, the ...
0
votes
0answers
172 views

Setting custom font size for org-mode?

What's a recommended way to set the font size for org-mode (or any other major mode) to a certain value that is different from the global font size? By looking at documentation C-h k C-x C-+, this is ...
20
votes
4answers
9k views

How to edit jsx (react) files in emacs?

I've use js2-mode but it don't indent html in javascript properly. I've found this repo https://github.com/jsx/jsx-mode.el but it's not for react, it's for some other jsx. What do you use for editing ...
1
vote
1answer
74 views

File mode name with -mode suffix or not?

I am not sure when I should name file x-mode.el and when x.el. Note that because of established practice mode writer should put (provide 'x) or (provide x-mode) to the end of file and end-users load ...
1
vote
2answers
121 views

How to describe-mode (but not the current major mode)?

I know that describe-mode will describe the current major mode. Is it possible to describe a mode, and I will input the mode name?

1
2 3 4 5