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
2 answers
77 views

How enable tree-sitter modes (*-ts-mode) that aren't built-in?

My Emacs (29.1) comes with the some tree-sitter modes: c-ts-mode go-ts-mode js-ts-mode ... I downloaded the compiled .dll and they work out of box. However, there are some languages that tree-sitter ...
Lai Yu-Hsuan's user avatar
0 votes
1 answer
22 views

set the correct major mode for script files based on interpreter

I want to make a function that will set the correct major mode based on the interpreter used for a script. I don't want to include extensions in my scripts (because that can be annoying if making cli ...
Hackerman's user avatar
1 vote
1 answer
116 views

language specific tree-sitter major mode wont show up

I'm using GNU Emacs 29.1 and have installed the tree-sitter haskell grammar: libtree-sitter-haskell.so via treesit-install-language-grammar but somehow haskell-ts-mode wont show up as a major mode ...
hubbledeepfield's user avatar
1 vote
0 answers
10 views

What is the correct way to make js2-next-error available when using js2-mode as major mode?

I'm using js2-mode. It provides js2-next-error, but apparently only when using js2-minor-mode and not when using js2-mode as a major mode. This is clear from the code in js2-mode.el (in version ...
mhucka's user avatar
  • 163
0 votes
1 answer
13 views

how to use different faces for regular expressions in the same line in font-lock-defaults

I'm trying to create a major-mode for HTTP requests in emacs, I'm stuck at the syntax coloring for regexs at the same line. let this be the HTTP request I'm trying to highlight: GET /...
ntriisii's user avatar
1 vote
2 answers
126 views

Remap mode to the new tree sitter mode not working

I"m trying to use the following code to remap js-mode to js-ts-mode. (add-to-list 'major-mode-remap-alist '(js-mode . js-ts-mode)) (Edit) I am using default emacs with a custom init file (only a ...
Seth Workman's user avatar
0 votes
0 answers
15 views

Whitespace in syntax table for comment delimiters in conflict with indentation and font lock

The special file format of my software uses angle brackets as a delimiter and # / # as comment markers (note the whitespace after the first # and before the last #). I try to make a major mode to ...
Lalylulelo's user avatar
-2 votes
1 answer
63 views

Changing the major mode of a named buffer

How can I construct a function that changes the major mode of a named buffer ? (defun change-buffer-mode (mode buffer) )
Dilna's user avatar
  • 1,183
0 votes
1 answer
40 views

Using major mode dependent functions

I have a function (tika-outlhg-regexp) that sets custom outline headings based on major mode. I activate this with major-mode hooks. Is there some other way? (defun tika-addhook-hgptn () (add-hook '...
Dilna's user avatar
  • 1,183
0 votes
1 answer
109 views

Using hooks in minor modes

I have introduced the following hook function inside a minor mode. The intention is to activate the minor mode for a number of major modes. I would also need to activate outline-minor-mode once tika-...
Dilna's user avatar
  • 1,183
1 vote
1 answer
83 views

How do I turn off electric-indent mode within 'Fundamental' mode?

Currently, in my .emacs.d/init.el, I have: (setq-default indent-tabs-mode nil) (setq-default tab-width 4) (setq indent-line-function 'insert-tab) (push (cons "\\*shell\\*" display-buffer--...
user129393192's user avatar
0 votes
0 answers
40 views

SMIE: defining a build.ninja grammar

I'm trying to write a mode in SMIE, to figure out how it works and to create some documentation. build.ninja (a build system used by Meson and others) is a perfect candidate due to its very simple ...
Hi-Angel's user avatar
  • 544
0 votes
1 answer
102 views

Using the push function to append a list to the default-frame-alist variable

I've noticed some people use this to disable the menu bar in the GUI: (push '(menu-bar-lines . 0) default-frame-alist) and some people use this: (menu-bar-mode -1) Both achieve the same. The first ...
Zoli's user avatar
  • 391
0 votes
0 answers
18 views

default extension-specific split windows?

I currently have emacs to open up with split vertical windows. This is helpful for .R files but useless for .txt (or other files I edit in emacs). Can I set extension-specific window arrangement in ...
Jacob's user avatar
  • 21
0 votes
0 answers
146 views

How do I use a local tree-sitter grammar in my emacs major mode?

I want to create a new major mode for a language with tree-sitter. I am working on the tree-sitter parser locally and It's working (tested in neovim and helix) Now I want to tell emacs to use the ...
Abdellah Stands with Palestine's user avatar
0 votes
0 answers
145 views

Is there a major mode for dbt

I'm trying to use dbt in emacs, and I'm hoping that there is a mode for this that will combine the jinja and sql parts in an intelligent way... I quick google search didn't find anything, so the ...
Brian Postow's user avatar
0 votes
1 answer
38 views

Call different functions based on buffer mode

I annotate my reading with org-remark and pdf-annot. They work with EPUBs and PDFs respectively, and are not interchangeable, with inconvenient consequences. What I would like to do is to bind a ...
Sati's user avatar
  • 775
0 votes
1 answer
28 views

Highlight code between specified tags

how can I write extension for existing major mode, e.g. dart-mode to highlight block of codes. For example: // $done> import 'dart:async'; import 'dart:convert'; import 'dart:io'; import 'dart:ui'; ...
Andrey's user avatar
  • 13
0 votes
1 answer
53 views

Rebind key to a different character in a specific mode?

I already tried some different ways of doing this, but never got it quite right, so I put it here. When working in buffers using some specific modes (lisp-mode, emacs-lisp-mode) I want to make it so a ...
Jborg's user avatar
  • 189
1 vote
1 answer
231 views

How can I turn off Company mode in only some major modes? [duplicate]

I use company when coding. I currently have it set to global. I would like to turn it off for a few major modes. However, instead of turning it off globally, I only want to deactivate company for 2 or ...
Vinn's user avatar
  • 283
1 vote
0 answers
44 views

How to apply changes from a major mode that I'm currently creating?

I'm writing a syntax highlighting mode for emacs, and wondering if there is a way to improve my workflow. Currently I do this: make edits to mymode.el restart emacs open mymode.el eval buffer open a ...
Alex Shroyer's user avatar
0 votes
1 answer
27 views

Making function callable only whilst in `c-mode`

How can I make this function callable only whilst in c-mode? (defun nuket-c (actm) "Code templates for the C language" (interactive (list (let ( (cseq '("struct" "...
Dilna's user avatar
  • 1,183
1 vote
2 answers
121 views

How do I permanently configure a major mode?

I've been searching most of the day for an answer to this basic question, but I can't find an answer for the noise. If you search for, say, "configuring indentation in emacs," there's lots ...
JonahHuron's user avatar
0 votes
2 answers
89 views

Are C-[0-9] and M-[0-9] completely interchangeable?

In all my exploration, it seems that M-[0-9] and C-[0-9] apply numeric prefixes in the same way everywhere. Does this change for any common modes? I'm considering overwriting one of the sets of ...
ComfyPotato3's user avatar
1 vote
1 answer
44 views

How to disable `q` key (quit) for *Geiser Debug* window?

The *Geiser Debug* window disappears after pressing q. This is normally good for dismissing the error messages in the window (for scheme). However, I'd like to keep this window open so that I can see ...
tinlyx's user avatar
  • 1,280
1 vote
1 answer
174 views

How to make a popup buffer like *Help* accept and return some input upon pressing RET?

What I need to capture some text which is then inserted at point without using the minibuffer (see "why" for why this is not entirely stupid). My idea was to just pop up a temporary window ...
Betta George's user avatar
0 votes
1 answer
18 views

When is the major-mode assigned to an input file determined by its file extension?

How does Emacs determine the major-mode assigned to a file based on file extension, e.g. .txt or .odt? If the filename has no extension, and I don't do anything to tell Emacs how to treat it, what ...
daveboss's user avatar
1 vote
0 answers
24 views

Major mode to colour fragments such as tables

I would like to define a major mode for some class of documents, a few faces, and fontification rules that find fragments users would want colored and apply those faces. The user will be able to ...
Dilna's user avatar
  • 1,183
0 votes
1 answer
26 views

comments are not highlighted with numbers in derived mode of prog-mode

It seems if the major mode is derived from prog-mode, a comment line will not be highlighted as a comment if it contains any numbers surrounded by blank spaces. The content of tt-mode.el (setq tt--...
Zheng Qu's user avatar
  • 123
0 votes
1 answer
44 views

Keybinding according to mode

I have done the following keybindings. Although they work, eval-last-sexp is only relevant it lisp-interaction-mode, emacs-lisp-mode, and lisp-mode, whereas eval-expression is more relevant in non-...
Dilna's user avatar
  • 1,183
0 votes
0 answers
27 views

Mode to automatically open generated files

I'm looking for a mode or hook that automatically opens a generated in read-only and auto-revert-mode mode alongside an associated with a source file. For instance when calling dmd -vgc-ast on a .d-...
Nordlöw's user avatar
  • 487
0 votes
1 answer
42 views

How to switch to cc-mode programatically (from elisp code)

In my lisp code, I need to switch to cc-mode, do something and back to original mode (text mode). How to do that ?
emacs-user-2021's user avatar
0 votes
1 answer
51 views

Why does the %m construct does not work for emacs-lisp-mode?

I have the following modeline configuration : (setq-default mode-line-format '((:eval (me/simple-mode-line-render ;; Left. (quote (" " mode-line-mule-...
Emperor_Udan's user avatar
0 votes
1 answer
64 views

How can I turn off apheleia-mode for Latex-mode?

I am using apheleia for buffer formatting. I want to disable apheleia-mode for the Latex-mode. I have tried following solution but it did not help. (defun jpk/org-mode-hook () (company-mode -1)) (...
alper's user avatar
  • 1,238
0 votes
1 answer
33 views

C-c C-c on #+PROPERTY: keyword line changes the mode from Org to TeX

Context Linux Mageia 8 GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.24, cairo version 1.16.0) of 2021-04-01 Issue With: this (rather long) org-mode file, open with emacs -Q, C-c ...
Denis Bitouzé's user avatar
1 vote
1 answer
463 views

Good mode to edit CSV files including adding and removing columns?

Looking for a mode to edit CSV files. I tried csv-mode which is great for viewing CSVs via the minor mode csv-align-mode. However I cannot find an easy way to add or delete columns in this mode. Is ...
halloleo's user avatar
  • 1,291
0 votes
1 answer
81 views

Different behavior between M-! and a terminal?

I'm writing a major mode to interface with a popular but clunky Monte Carlo program. I've also written a script that makes the interface a little more tolerable, and have written the following simple ...
Duncan W's user avatar
  • 113
4 votes
2 answers
284 views

How can I enable electric indentation for all modes except some?

I am trying to enable electric-indent-mode for all modes except fundamental-mode, where it is just annoying. In my init file, I have the following: (electric-indent-mode +1) (add-hook 'after-change-...
tinskip's user avatar
  • 41
1 vote
2 answers
89 views

How can a function check which major mode is enabled?

The accepted answer to this question says: When the function is invoked, it can test the current mode and do something appropriate. For example, for some modes, or all modes except some modes, it can ...
M0M0's user avatar
  • 143
0 votes
2 answers
84 views

Is this syntax parse possible with Emacs' regex expressions?

I'm trying to write a small new mode for some input files to a specific computational physics program. I'm doing it the define-derived-mode way, and was specifying the syntax highlighting by setting ...
Duncan W's user avatar
  • 113
0 votes
1 answer
27 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 ...
Peyrol's user avatar
  • 1
0 votes
0 answers
131 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 ...
PRouleau's user avatar
  • 754
4 votes
3 answers
259 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 ...
Guillaume's user avatar
  • 189
1 vote
1 answer
78 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 ...
PRouleau's user avatar
  • 754
1 vote
0 answers
202 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 ...
Nicholas Hubbard's user avatar
1 vote
1 answer
47 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. --...
Lennart Van der Goten's user avatar
1 vote
0 answers
23 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 ...
Egydio Pacheco's user avatar
1 vote
2 answers
402 views

Disabling visual-line-mode only in org-agenda-mode

My emacs configuration has global visual line mode enabled via (global-visual-line-mode 1). I want to disable this mode, but only when in org-agenda-mode. When I do this manually, via M-x org-agenda, ...
Timo's user avatar
  • 13
1 vote
1 answer
421 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 ...
alper's user avatar
  • 1,238
0 votes
1 answer
62 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 ...
vonbrand's user avatar
  • 101

1
2 3 4 5 6