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
0
votes
1answer
3 views

How do you automatically enable writeoom-mode when org-mode starts?

I want to enable writeroom-mode whenever I startup org-mode because I don't really ever want writeroom-mode to be disabled if I'm using org-mode.
0
votes
0answers
30 views

Howto define TAB and S-TAB in keymap of custom mode

I'm trying to bind the TAB and shift TAB keys to a custom readonly buffer mode. The skeleton of the mode looks like this: ;; 8< --- exmode.el ------- (defun exmode-i () (interactive) (message ...
1
vote
1answer
26 views

How to bind a key in a `generic` mode?

Is there a way to bind a key in a mode defined using define-generic-mode such as xmodmap-generic-mode? Generic does not appear to create keymaps. ELISP> (require 'generic-x) generic-x ELISP> (...
0
votes
0answers
13 views

Keybindigs conflict between minor modes

The configuration that I have for python mode implies loading both elpy.el and python.el. The things is that I found the python.el keybindings more natural than the elpy.el ones. And most of the ...
3
votes
2answers
173 views

File-local variable to force specific shell for shell-script major mode

I'm having the same problem as asked in this question: emacs is dropping into shell-script mode, but for the wrong shell variant. Using a shebang as suggested in that question's answer is ...
19
votes
4answers
5k 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
3answers
44 views

SMIE Indenting Arguments and Blocks

This is closely related to a previous question I asked here: SMIE Basic Identation and Block Example However, it is sufficiently different (and already big enough) that I might as well ask it as a ...
3
votes
2answers
45 views

SMIE Basic Identation and Block Example

I've tried for a while to create a simple major mode that uses SMIE to perform navigation and indentation, but it seems like even the simple examples that I've found seems to break quite easily. The ...
7
votes
1answer
329 views

Is a Lisp program in both prog-mode and lisp-mode?

Upon reading (emacs) Program Modes: Entering a programming language mode runs the custom Lisp functions specified in the hook variable prog-mode-hook, followed by those specified in the mode's ...
3
votes
1answer
49 views

Why won't `emacs -nw -f org-mode foo` open `foo` in `org-mode`?

I want to open a file foo in org-mode on the terminal. However, Issuing emacs -nw -f org-mode foo opens foo in Fundamental mode. What's wrong with my command?
1
vote
1answer
55 views

Retrieve all the major modes equipped with emacs

I learned that GNU Emacs Manual Most major modes fall into three major groups. The first group contains modes for normal text, either plain or with mark-up. It includes Text mode, HTML mode, ...
2
votes
1answer
40 views

Set the major mode of a new buffer interactively

When creating a new buffer via: C-x b NonExistentBufferName RET RET I would like Emacs to ask me what major mode this buffer is going to use upon opening. Moreover, I want Emacs to infer the major ...
3
votes
1answer
96 views

How to check if a major mode derives from another?

Is it possible to check if a mode is derived from another mode? eg: (member major-mode '(c-mode c++-mode glsl-mode)) Could be replace with something like this: (does-mode-derive-from major-mode cc-...
1
vote
1answer
63 views

Setting the major mode of a new buffer interactively

When creating a new buffer via: C-x b NonExistentBufferName RET RET I would like Emacs to prompt me for the major mode this buffer is going to use upon opening. Moreover, I want Emacs to infer the ...
3
votes
2answers
131 views

How do I disassociate a filetype and mode?

I think the Change Log mode in emacs (spacemacs) acts crazily and I want to turn it off when editing my CHANGELOG. How do I do that for good?
1
vote
0answers
23 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 ...
0
votes
0answers
75 views

Spacemacs - python mode

I have some problems with my spacemacs configuration. For instance, it's supposed to be globally set up with emacs editing mode and the line numbers as well dotspacemacs-editing-style 'emacs ...
9
votes
3answers
1k views

How to start emacs in “nothing” mode (`fundamental-mode`)

If I type emacs test.sh Emacs insists on putting me in Shell-script mode. Another time I want to edit the file help.txt and then Emacs puts me in Text mode. But sometimes I don't want any of this, ...
10
votes
4answers
338 views

How do I inherit from prog-mode, whilst still supporting older emacsen?

I'm writing a major mode for a programming language, but I want to support older Emacs versions. prog-mode is relatively new. I want to inherit from prog-mode if it's defined, but still do something ...
7
votes
2answers
154 views

what are the options to write a language grammar for a new major mode?

I am writing a major mode for a programming language that has a well-defined grammar: it has a BNF, formalised in some happy files. I don't particularly want to re-implement the BNF as a series of ...
0
votes
1answer
78 views

does one has to explicity enable python-mode etc. to work with python files?

Sometimes I see people talking about enabling python-mode and so on. Is that only necessary for older emacs versions? I thought, the respective mode is enabled automatically when opening a ...
32
votes
6answers
13k 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?
2
votes
2answers
148 views

Are there hooks for leaving modes?

There seems to be a bug in clojure-mode (mentioned here) because it does things in a mode hook (for paredit-mode) but doesn't undo them when the mode is turned off. I understand that add-hook can ...
1
vote
1answer
70 views

Emacs custom major mode with multiple comment types

I'm trying to write my first (very simple) major mode for Emacs. My goal is to have multiple comment types, but I can't find a way to implement this. Basically, I want my major mode to make ...
0
votes
0answers
228 views

Spacemacs user-config error

I'm using Spacemacs to develop a laravel + Vue application and I followed the steps in this configuration example to highlight syntax in Vue, but now every time Spacemacs starts it gives me this error:...
2
votes
2answers
160 views

How to load an Idris file that depends on a package?

Working in Spacemacs (on Linux Mint, if that is relevant), using the Idris layer, one of my major mode commands is SPC m-r (Vim-style keybindings): idris-load-file. This causes Spacemacs to load up an ...
4
votes
2answers
372 views

sh-script alignment issues

I'm sure emacs used to do it my way, but things appear to have changed (probably years ago, I've just been living with the pain). I want this (to conform to corp. standards): MULTIFORM=$( curl -...
0
votes
0answers
29 views

Get the syntax coloring of another mode for newly defined mode

I am defining a new mode in emacs, but I want to have the same syntax highlighting as Org mode. How can I do this?
10
votes
1answer
5k views

How do I associate a file extension with a specific mode? [duplicate]

I would like emacs to switch to gnuplot-mode when I open a file ending in .g or .gnuplot. I tried ;; gnuplot mode-name (add-to-list 'gnuplot-mode '("\\.g\\'" . gnuplot-mode)) or ;; gnuplot mode-...
2
votes
0answers
69 views

Strange comment indentation results

I am working with a simple major mode. The format has one single line comment delimiter, i.e., %. However, I get strange results when running fill-paragraph on a comment. Specifically, the result I ...
2
votes
1answer
74 views

Create a command or key binding for closing code blocks

In AUXtex there is the key binding macro C-c ] which closes the lowest current TeX environment. For example \begin{equation} ... would be closed (by putting an \end{equation} on a new line after ...
6
votes
2answers
2k views

How to change comment character from # (hash) to % (percent sign) for Octave major mode

By default, comment-region inserts # for comments in Octave major mode: # foo I want to modify the behavior so that it inserts the percent sign % foo I used the following (setq octave-mode-hook ...
1
vote
0answers
38 views

Change major-mode keymap char-table

I'm trying to write my own major mode, which I want to use under MS Windows. Unfortunately, Windows doesn't have my favourite keyboard layout, so I'm planning to implement this keyboard layout in my ...
2
votes
2answers
107 views

How to make all variables and functions of a mode visible without activating the mode

Let's say I want to customize a keybind for a mode that hasn't been loaded yet like so: (define-key eshell-mode-map (kbd "C-M-i") 'eshell-previous-input) But the problem is if I haven't yet loaded ...
31
votes
3answers
12k views

How do I get the current major mode?

If I am editing a .tex file in emacs, by default (for me) the bottom right corner of the frame will say "LaTeX/P". However, I won't get to that mode by typing "M-x LaTeX/P-mode"; I can only get to it ...
1
vote
1answer
198 views

What does the `/l` mean in the mode `C++/l` mean?

Just a simple question with more than likely a simple answer: What does the /l mean in the mode C++/l mean?
6
votes
1answer
272 views

# -*- mode: … -*- string fallback

So I know that I can put at the first or second line of a file a line such as: # -*- mode: conf -*- to tell Emacs what major mode I want the file to be opened with. But if that mode isn't installed ...
15
votes
4answers
4k views

Automatically formatting SQL code

There are some general well-known coding standards and styles for SQL (e.g. capitalizing reserved words, placing main keywords in different lines, etc.). Does Emacs come with any modes for this, or ...
2
votes
2answers
109 views

Syntax table to match arbitrary forms with regexp

I'm trying to write a small major-mode for editing pico-8 files in emacs and I had a quick question regarding best practices and matching a somewhat arbitrary form in the pico-8 cartridge files for ...
3
votes
2answers
60 views

When writing a new major mode, should it add itself to auto-mode-alist?

I am defining a new major mode, foo-mode, which is closely and only associated with .foo files. Should foo-mode.el fiddle with auto-mode-alist to add this association, or is that the user's ...
0
votes
1answer
84 views

pressing return in paragraph-indent-text-mode deletes whitespace indenting beginning of paragraph

I'm currently using emacs 25.3 on Mac OSX installed using Homebrew, and without any modifications in my .emacs file or anywhere else. I think I may be fundamentally misunderstanding what paragraph-...
1
vote
1answer
83 views

Determining major mode for proper comment character insertion

I currently have a function like so in my .emacs file: (defun insert-todo () (interactive) (insert "// TODO(map) : ") ) It is bound to my key combination of "C-t". This will work for me if I'...
3
votes
2answers
86 views

ANSI / xterm font-locking

I have a buffer with terminal escape codes in it and I want them to be colored: I was able to do this with (ansi-color-apply-on-region (point-min) (point-max)): However, my file is really big and ...
4
votes
1answer
78 views

How should I test my new mode?

I am trying to create a new mode for Emacs lisp, let's call it xyz-mode.el. In testing the mode, I want to re-run xyz-mode.el on a potential target file, let's say abc.xyz. In other words, as I edit ...
-1
votes
1answer
53 views

use a major mode from the internet

After installing emacs on windows 10 and gone through the tutorial and downloaded a major mode mt4.el , Now where to save it and how to use it in emacs? googling did not help me.
2
votes
1answer
381 views

Where is mhtml mode defined? And why am I getting it by default when I open HTML files?

Under some very special conditions (namely, performing one particular edit in one particular HTML file), my Emacs session will freeze completely, and starts consuming ~100% of the CPU. The only ...
1
vote
2answers
73 views

add-hook unable to reassign a mode-specific keybinding

I'm attempting to override a mode-specific keybinding, but my attempt so far hasn't been able to reassign it. I use the M-j,k,i,l to navigate instead of the regular C-n, C-p etc. I find it to be a ...
2
votes
2answers
196 views

Enable mode if file content contains a matching string

I would like to enable rjsx-mode whenever a file I open contains a specific string, or a regex like import.*react for example. Is there a way to do something like this in emacs?
1
vote
1answer
52 views

Enable diff-mode for files with diff-ish content

How do I make Emacs automatically turn on diff-mode for any file with diff-looking content, eg. --- a.txt +++ b.txt @@ -1234,56 +1234,56 @@
1
vote
0answers
170 views

How to add additional comment syntax to a mode?

In general, given a major mode with a defined comment syntax, what do I have to define or change to add a new comment syntax? By "adding", I mean setting some new characters so that they work with ...