Questions tagged [major-mode]
60 questions
60
votes
7 answers
emacs lisp, how to get buffer major mode?
I have tried to search Google and look in the manual, but still cannot find how to get major mode of a buffer object. Can you help me with an example or a reference. Thanks
only solution I could find was to query major-mode after changing the…

Anycorn
- 50,217
- 42
- 167
- 261
22
votes
3 answers
How to reload an emacs major mode?
I have a buffer in some major-mode, and in another buffer the mode file itself (*.el). After I edit the *.el file I want to see the changes reflected in the first buffer, without restarting emacs. I tried to run the -mode function but it didn't…

yuk
- 221
- 2
- 3
16
votes
3 answers
How to turn off electric-indent-mode for specific Major mode?
I have few Major modes (like: Yaml and NXML) that I don't want electric-indent-mode (I want it for C like languages) but I'm unable to turn if off. To enable I have:
(electric-indent-mode 1)
from documentation (for variable…

jcubic
- 61,973
- 54
- 229
- 402
13
votes
4 answers
A 'hello world' example for a major mode in Emacs?
Can anyone provide me with a hello world example for a major mode in emacs?
I guess it's a beginner question, still I really like to write a major mode, both to learn emacs and elisp, as to be able to use customization to the fullest.
What I have…

Peter
- 47,963
- 46
- 132
- 181
11
votes
3 answers
Emacs name of current local keymap?
I am writing an elisp function that permanently binds a given key to a given command in the current major mode's keymap. For example,
(define-key python-mode-map [C-f1] 'python-describe-symbol)
The command and the key sequence are gathered…

ealfonso
- 6,622
- 5
- 39
- 67
8
votes
1 answer
Highlighting correctly in an emacs major mode
I am developing an emacs major mode for a language (aka mydsl). However, using the techniques on xahlee's site doesn't seem to be working for some reason (possibly older emacs dialect..)
The key issues I am fighting with are (1) highlighting…

Paul Nathan
- 39,638
- 28
- 112
- 212
8
votes
1 answer
Can't turn on plantuml-mode in Emacs
I am on Emacs 24.3.1. I installed the MELPA version of plantuml-mode via
M-x package-install RET plantuml-mode RET.
When I try to turn on plantuml-mode for a buffer, I get the following error:
Wrong type argument: stringp, nil
Trying to find…

itsjeyd
- 5,070
- 2
- 30
- 49
6
votes
2 answers
How can I install nginx-mode into emacs?
I want to install nginx-mode into emacs so that I can have highlighting and formatting of my nginx configuration files. What is the easiest way to do this?

Simon Woodside
- 7,175
- 5
- 50
- 66
6
votes
3 answers
Emacs keybinding not working in custom major mode
I'm in the early stages of creating a major mode for Emacs for browsing and interacting with the Stack Exchange Network.
Involved in it are several major modes, all with one-key keybindings similar to dired. I looked at the source for dired, and…

Sean Allred
- 3,558
- 3
- 32
- 71
6
votes
2 answers
How to write an emacs major-mode like dired
I've found a bunch of information (like this) on writing a major-mode for a language, but... I'd like to write a mode along the lines of dired or tetris - modes that use the buffer as a GUI.
In the "Major Modes" section of the manual, the "Basic…

dbr
- 165,801
- 69
- 278
- 343
5
votes
1 answer
Emacs: Set fill-column in Change Log Mode
Very specific question that I hope is not too dumb.
(setq-default fill-column 120) sets the width of the buffer fill to 120 columns. Default for me otherwise is 74.
This command, when put in my .emacs file, works for all major modes I use (C++,…

Alan Turing
- 12,223
- 16
- 74
- 116
5
votes
2 answers
Redefine major mode prefix key in Emacs
I've been trying teach myself emacs, and because I am using dvorak, I foolishly rebound C-c to a movement key and got used to it. Now i'm actually starting to do some programming with it, and I loaded up a python file and noticed that C-c is the…

colinmarc
- 2,421
- 1
- 22
- 34
5
votes
1 answer
Emacs: How to use a major mode for non-standard file extension
I'd like to use R major mode for another file extension in emacs (for an unsupported language with syntax similar to R).
How do I force emacs to change the major mode for a buffer I'm editing? How do I change my .emacs to permanently associate a…

daj
- 6,962
- 9
- 45
- 79
5
votes
1 answer
major-mode hook configuration affects other buffers
Let me start by saying I'm very new to emacs.
I'm attempting to create customizations for major-modes. While my settings are functioning correctly, I'm observing that when I open a new buffer, that buffers major-mode customization is being applied…

user1902144
- 53
- 2
4
votes
1 answer
Avoid font-locking interfering inside of comments
In my font-lock-defaults I have:
("\\(^\\| \\|\t\\)\\(![^\n]+\\)\n" 2 'factor-font-lock-comment)
The comment character is ! and this makes it so comments get the right face. This works mostly, except when there is a competing font-locked entity…

Björn Lindqvist
- 19,221
- 20
- 87
- 122