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
0answers
12 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 ...
1
vote
1answer
24 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. --...
1
vote
0answers
14 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 ...
1
vote
1answer
97 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 ...
1
vote
1answer
49 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 ...
0
votes
2answers
69 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 ...
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
38 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
23 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
118 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
43 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
32 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
25 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
17 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?
0
votes
1answer
27 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-...
0
votes
0answers
21 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. ...
0
votes
0answers
16 views

Overriding preprocessor font-lock behavior in major mode derived from c-mode

I have a custom language that mostly follows C syntax, but uses (only) # for comments instead. I want to build a major mode with font locking for it. I've got it mostly working, by deriving from c-...
1
vote
1answer
40 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?
0
votes
0answers
13 views

Set mode for new Tex files in a directory

How to change the default mode for new Tex files in a directory? I tried putting this into a .dir-local.el: ((nil (tex-default-mode . context-mode) (TeX-default-mode . context-mode))) but newly ...
1
vote
2answers
46 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,...
0
votes
0answers
22 views

is it possible to configure my major mode to ensure the presence of whitespace at the start of each line?

I have a Javascript file which uses the styled-components library to define CSS inside string literals: var MyComponent = styled.div` height: 32px; background-color: tomato; `; I'd like to use ...
1
vote
3answers
191 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
48 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
141 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
61 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
50 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
237 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
138 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
114 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 ...
1
vote
2answers
93 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
112 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?
3
votes
1answer
163 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 ...
1
vote
1answer
55 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
149 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,...
3
votes
1answer
147 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
79 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
49 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
49 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
123 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
111 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
32 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
77 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
302 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
147 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
177 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
323 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
301 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
70 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/...
1
vote
1answer
306 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
2 3 4 5