Skip to main content

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
1 vote
0 answers
44 views

"dual-mode" helper which opens _both_ .tar.gz _and_ .zip archives confusedly saved under the same file extension (say, `.yuppie`)?

So someone at my company years ago decided it was a good idea to create a company internal package format, say "yuppie" for yunified package. And that can randomly be tgz or zip archives. ...
Susanne Oberhauser's user avatar
0 votes
2 answers
60 views

How to get "human readable" name for the current major mode?

I'm using emacs package that does LLM prompt construction and appends current major mode name(You are %s programmer. Rewrite the following code kind of string) Related code looks like this: ;; "...
Nikita Fedyashev's user avatar
0 votes
0 answers
77 views

Trying to get treesitter indents to work with multiple languages for a major mode

I am working on a major mode using treesitter as my parser. It's been pretty intuitive but I ran into an issue. When trying to use multiple languages, you have to specify ranges using nodes in the AST ...
Marc Johnson's user avatar
0 votes
2 answers
87 views

before-save-hook not working with use-package and custom mode

I wrote a little derived mode for the kage shader language, it's derived from go-mode (syntax is the same). I also like to use gofmt, but it's just not loading the hook. Here's the mode: (define-...
Tom's user avatar
  • 45
0 votes
2 answers
147 views

What to do when a major mode overides keybindings set in doom emacs?

[Edit: I should specify that there are many keybindings in the major mode that overide the desired keybinding. They all start with a whereas I would like a to do something else. I already thought ...
userrandrand's user avatar
0 votes
0 answers
19 views

How to put 'viper-change-state-to-emacs function on some hook

I am using viper-mode, which is vi emulator and can be switched to the original emacs mode with viper-change-state-to-emacs, when I edit program files. But, sometimes I want to create some special ...
20 Abbeyroad's user avatar
0 votes
1 answer
22 views

`tab-stop-list` being ignored

Tying to write a new mode, I am stuck at: (define-derived-mode NEWS-mode text-mode "NEWS" "Major mode for NEWS file." (setq tab-stop-list '(2 6 59 65)) (setq indent-tabs-...
emacs drives me nuts's user avatar
0 votes
1 answer
21 views

Update content of a buffer in side window when a custom mode is on [duplicate]

I have following code which is supposed to clear existing content in a buffer and write new one. (defun display-file-dir (path) (text-mode) (if buffer-read-only (read-only-mode)) (erase-...
Suren Shrestha's user avatar
1 vote
0 answers
93 views

What is the advantage of major-mode-remap-alist?

I've had this in my init file about forever: (defalias 'perl-mode 'cperl-mode) ;cperl is much nicer Now I learned about major-mode-remap-alist in Emacs 29.1 which I had installed shortly after ...
q.undertow's user avatar
0 votes
0 answers
29 views

Viewing a single mail file in a maildir

Is there any major mode that allows one to properly view a single mail file in a maildir? By "properly" here I mean similar to "big" email clients, like mu4e or gnus, so allowing (...
Alex's user avatar
  • 155
1 vote
0 answers
86 views

Mermaid major mode not showing up after installation

I've installed mermaid-mode by using package-install and MPLA but for some reason, it's not showing up when I type it after M-x. (I get Match required). I'm running Doom Emacs. Any clue why this ...
shintuku's user avatar
  • 121
0 votes
0 answers
20 views

Haskell Interactive mode - incorrect parsing of crammed code

When using list comprehension without white spaces, all text after vertical bar turns grey. [x| is treated like header of here-document - grey color spans for the rest of the buffer, unless sequence |...
Przemek's user avatar
  • 101
0 votes
0 answers
27 views

Is there a major mode for editing xkb files?

I have a custom keyboard layout I'm often editing. This is a file stored in /usr/share/X11/xkb/symbols/, similar to the other language files there. Since none of these files have an extension Emacs ...
Alexander Praehauser's user avatar
0 votes
1 answer
38 views

change major mode without hiding text or revealing hidden text (for live-coding)

Question I am live-coding. I would like to be able to change the major mode to and from org-mode without un-hiding any of the text that org-mode has hidden. I would switch to a code mode whenever I ...
Jeffrey Benjamin Brown's user avatar
0 votes
1 answer
42 views

Different outputs from minor-mode depending on major-mode

My minor-mode is inserting text in the current buffer. I want the default format of the text to be different depending on what major-mode the buffer is in, and to allow the user to override this ...
pelle's user avatar
  • 1
0 votes
2 answers
2k 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
33 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
1k 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 ...
bird-dancer's user avatar
1 vote
0 answers
15 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
  • 193
0 votes
1 answer
26 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
3 votes
2 answers
603 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
1 answer
28 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
78 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
0 votes
1 answer
51 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
0 votes
1 answer
187 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
1 vote
1 answer
273 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
63 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
  • 858
0 votes
1 answer
237 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
  • 471
1 vote
0 answers
182 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 Gaza's user avatar
1 vote
1 answer
367 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
56 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
  • 825
0 votes
1 answer
29 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
157 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
645 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
  • 303
1 vote
0 answers
54 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
29 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
2 votes
2 answers
336 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
122 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
61 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,374
1 vote
1 answer
293 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
22 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
0 votes
1 answer
29 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
87 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
0 votes
0 answers
30 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
  • 527
0 votes
1 answer
52 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
64 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
166 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,420
0 votes
1 answer
38 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
1k 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,365

1
2 3 4 5 6