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
2
votes
1answer
69 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
30 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
20 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-...
2
votes
0answers
46 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.
0
votes
0answers
57 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 ...
1
vote
1answer
38 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
17 views

Editing mode for OpenBSD .conf files

Can GNU Emacs edit OpenBSD configuration files (/etc/*.conf, curly-brace syntax) with auto-indentation and syntax highlighting? conf-mode does not seem to handle that syntax in Emacs 26. c-mode ...
1
vote
1answer
20 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 ...
1
vote
2answers
54 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?
2
votes
1answer
56 views

Is there a standard mode for .ini files?

After looking for a mode for .ini files, I found ini-mode via MELPA, but upon installing it in Emacs 26, there was a message about it being an obsolete mode. What are the alternatives? In my limited ...
0
votes
1answer
30 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 ...
0
votes
1answer
48 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,...
1
vote
1answer
57 views

How to activate diff-mode from command line?

Git's editor config is set to launch emacs in no-window mode and to execute lisp function diff-mode: git config --global core.editor "emacs -nw -f diff-mode" However, when I execute git commit -v to ...
1
vote
2answers
71 views

Change major mode for buffer without a corresponding file

I want to change the major mode from fundamental-mode to compilation-mode for a buffer which contains some generated output named for eg. *results*. I've tried to add an entry to auto-mode-alist but ...
0
votes
2answers
39 views

How to overwrite a package major mode?

I'm a newcomer to Emacs from Vim, I use rsjx-mode for react files. Its major mode calls itself RJSX, but I would like to call it React, so how can I overwrite the rjsx package major mode name?
0
votes
2answers
29 views

Call mode-specific backspace from “smart-backspace” function

I'm writing an IntelliJ-style "smart backspace" function which does the following: If the whole of the line up to the point is whitespace Join the line to the previous line, killing that whitespace ...
1
vote
1answer
53 views

Create custom “mode-hook” for other programming languages

For C/C++, I have the following to be run when I do M-x compile on a .c/.cpp file (add-hook 'c++-mode-hook (lambda () (set (make-local-variable 'compile-command) ...
0
votes
1answer
44 views

How to set the default of `truncate-lines` for dired buffers to `truncate`?

How can I set the default of truncate-lines for dired buffers to truncate? I.e. when I open a new dired buffer it should show the directory truncated and not wrapped into the next line.
1
vote
2answers
25 views

Can a mode setup function fail?

If I define a new mode using define-derived-mode or define-minor-mode, can the mode setup somehow signal failure so that the mode is not activated? All of the following modes are activated despite ...
0
votes
1answer
50 views

How to disable a minor/major mode so that mwheel-scroll don’t take effect?

I am trying to have a simple solution to center the cursor at all times. I found that centered-cursor-mode was too slow and found this simpler solution. The only problem is mouse scrolling no longer ...
1
vote
1answer
262 views

Find out, which mode is in use

Suppose I want to code something like this case mode in lisp-mode) do-something ;; shell-mode) do-other ;; latex-mode) do-different ;; esac What ...
0
votes
0answers
62 views

use-package deferred loading for extensions not in :mode

When moving to use-package, I'd to replace (require 'markdown-mode) (add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode)) with (use-package markdown-mode :mode "\\.md\\'" :config ... ) ...
0
votes
1answer
57 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 ...
3
votes
1answer
115 views

How are major modes and local keymaps associated?

The Emacs manual says: Major modes customize Emacs by providing their own key bindings in local keymaps.... Minor modes can also have local keymaps... Roughly, it seems to say: Major modes ...
0
votes
1answer
83 views

how to bind custom commands to keys in existing mode map?

I wrote some extra commands for Python mode: python-insert-quote and python-insert-double-quote. I want to have these commands be available in the minibuffer when python-mode is active. How can I add ...
2
votes
1answer
49 views

What's the idiomatic way of overriding a key binding for a given major-mode (but no other)?

I'd like to bind C-x C-e to python-shell-send-region when I am in python major-mode. In my config file, I have an add-hook for python mode, but I'd like this keybinding override to be removed/...
0
votes
1answer
123 views

Check whether buffer is in org-mode

I want to programmatically check whether the current buffer is in org mode. I know that major modes should usually define the variable <modename>-mode, i.e., org-mode should be a defined ...
1
vote
1answer
119 views

How to make font-lock use my face?

I'm interested in making a major mode to display PGN files nicely. I'm trying to create my own faces since the defaults don't seem super-appropriate. My mode definition looks like this: (defface ...
0
votes
0answers
21 views

Disable Flycheck for different file extensions with the same mode

I use verilog-mode for both Verilog (extension .v) and System Verilog (extension .sv). I want to disable flycheck for .v files only. (Because they are typically multi-gigabyte netlists that take lots ...
1
vote
1answer
135 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
99 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
38 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> (...
1
vote
0answers
24 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 ...
1
vote
3answers
104 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
121 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
430 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 ...
2
votes
1answer
94 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, ...
3
votes
1answer
71 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
71 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 ...
2
votes
1answer
114 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
2answers
161 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
40 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 ...
9
votes
3answers
2k 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, ...
0
votes
1answer
373 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 ...
4
votes
1answer
242 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-...
3
votes
2answers
387 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
215 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
336 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:...
0
votes
0answers
33 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?
2
votes
0answers
70 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 ...

1
2 3 4 5