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
23 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
35 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 ...
3
votes
3answers
104 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
27 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 ...
0
votes
0answers
14 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
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 ...
1
vote
1answer
103 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
53 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
76 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
25 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
132 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
45 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
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. ...
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
42 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,...
1
vote
3answers
192 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
50 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
144 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
63 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
57 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
243 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
142 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
120 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
104 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
115 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
180 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
153 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
162 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
51 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
134 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
114 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
303 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
148 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
184 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
2 3 4 5