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
238 views

How to set whitespace-line-colum per mode?

I'm trying to have whitespace-line-column set to 80 in prog-mode and 100 in web-mode, etc. However when using hooks seems to get ignored, as is always set to 80. (require 'whitespace) (setq ...
2
votes
1answer
186 views

How to match more than one instance of a single subexpression?

I'm trying to use a regular expression of the form "foo\\(?:\\(bar\\)\\(baz\\)\\)*\\(quux\\)", but I want the inner two subexpressions to retain all of their matches, not just the first one. I ...
2
votes
1answer
29 views

Adding XUL file syntax highlighting support?

I am new on Emacs and I am working on modifying firefox interface. XUL is implemented as an XML dialect. I just need basic syntax highlighting for XUL. I found that VIM and gedit are working out of ...
2
votes
1answer
364 views

Executing programs the efficient way with Spacemacs

I'm a Vim user trying to learn Spacemacs. In Vim, I execute a Scheme program by typing :mit-scheme < xxx.scm. After the program exits, I can continue editing simply by press Enter. However, doing ...
2
votes
3answers
398 views

How do I change the cursor face per buffer?

I have a custom emacs major-mode which I specified the background and foreground colors for. However, the default cursor color clashes with the background and you can't see it. 'set-cursor-color' ...
2
votes
0answers
69 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 ...
2
votes
1answer
74 views

Create a command or key binding for closing code blocks

In AUXtex there is the key binding macro C-c ] which closes the lowest current TeX environment. For example \begin{equation} ... would be closed (by putting an \end{equation} on a new line after ...
2
votes
2answers
109 views

Syntax table to match arbitrary forms with regexp

I'm trying to write a small major-mode for editing pico-8 files in emacs and I had a quick question regarding best practices and matching a somewhat arbitrary form in the pico-8 cartridge files for ...
2
votes
0answers
66 views

Recommended use of non-file-visiting revert-buffer-function

Summary I am working on a major mode derived from special-mode, which populates its buffers with formatted lists of items retrieved from a web API. Reverting such a buffer involves refetching and ...
2
votes
0answers
129 views

SMIE default syntax : First level of indentation

When you only do that in your major mode : (require 'smie) (smie-setup nil #'ignore) That means SMIE but no grammar, and no rules. And it's great. It makes the point stay on col0 when you TAB and ...
2
votes
0answers
97 views

Find all modes derived from a mode

Is there any way to easily find all the modes that derive from a mode? The closest I can get is to use M-x apropros and search for -mode$ and manually comb through all defuns with the property ...
2
votes
1answer
263 views

Updating taskpaper major mode to add date to @done tasks

I am trying to update the fairly old taskpaper major mode for Emacs found here to simply include the current date, whenever I mark a task as done. The line should then read: - Task @done(2015-07-13) ...
1
vote
1answer
94 views

How to modify existing major-mode?

I've made a minor change to the existing code in bibtex.el; to be more precise, I've modified the function bibtex-generate-url-list so that it can generate URLs for several more fields (in addition to ...
1
vote
2answers
118 views

Recognize template filename extension?

I use a template engine for a lot of files in my project. The specific one is irrelevant -- let's say all my template files end with .template. Now, I've got many different kinds of templated files, ...
1
vote
1answer
53 views

File mode name with -mode suffix or not?

I am not sure when I should name file x-mode.el and when x.el. Note that because of established practice mode writer should put (provide 'x) or (provide x-mode) to the end of file and end-users load ...
1
vote
1answer
47 views

emacs major mode for INF files

Is there a major mode for .inf files (https://en.wikipedia.org/wiki/INF_file)? If there is one, it's proving to be most unGoogleable.
1
vote
1answer
55 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, ...
1
vote
1answer
117 views

Why is cperl-mode-hook running twice?

I am using cperl-mode to edit Perl scripts. According to the Emacs wiki ( link ) one could use defalias to use cperl-mode instead of perl-mode. Here is an example: $ emacs -Q -l init.el test.pl & ...
1
vote
1answer
160 views

Major mode map in emacs

How to print, all file extensions & the mapped major modes (and possibly minor modes...) in emacs? like this, *.js js-mode *.json js-mode *.c c-mode Which global map variable contains ...
1
vote
3answers
44 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 ...
1
vote
1answer
63 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 ...
1
vote
1answer
198 views

What does the `/l` mean in the mode `C++/l` mean?

Just a simple question with more than likely a simple answer: What does the /l mean in the mode C++/l mean?
1
vote
1answer
53 views

derive major mode but do not derive mode hooks

I am trying to reuse lots of things that are built in c-mode for technically another c-like language, including syntactical highlighting and stuff like that. However, c-mode in my settings are ...
1
vote
2answers
139 views

Is it possible to lazy-load language mode packages?

Most of the packages I currently use are major modes for various languages that are only included in the off-chance I load a file of that type. Is there a way to postpone loading them at startup in ...
1
vote
2answers
117 views

How to make $ not part of a symbol in tcl-mode?

Recently I found out about isearch-forward-symbol-at-point but in tcl it's rather useless, because when dereferencing a variable the $ is part of the symbol and so the symbol-at-point $var does not ...
1
vote
1answer
634 views

Set a default scratch buffer

My emacs daemon for ocaml (I use more than one emacs daemon) starts in a tuareg scratch buffer. I am aware of initial-major-mode but this hasn't worked: the scratch is started before (setqinitial-...
1
vote
2answers
198 views

How to detect mode, then execute?

I'm currently using autoheader. I have this configuration, which causes the <?php tag to be inserted in other modes: (defsubst my/header-title () "Insert buffer's first row." (insert "<?...
1
vote
1answer
119 views

Tie a minor-mode to a particular major mode

I'm writing an extension to a major mode (coq-mode) that adds extra features, plus a few keybindings. To makes it easy to disable or redefine these keybindings, I packaged them in a keymap. That ...
1
vote
2answers
66 views

Enable mode association with backup files as well

I want to enable mode association with backup files as well. E.g., if I backup my my-markdown.md file as my-markdown.md.orig or my-markdown.md.lastweek etc, I want them still be associated with the ...
1
vote
1answer
70 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 ...
1
vote
1answer
52 views

Enable diff-mode for files with diff-ish content

How do I make Emacs automatically turn on diff-mode for any file with diff-looking content, eg. --- a.txt +++ b.txt @@ -1234,56 +1234,56 @@
1
vote
1answer
75 views

Elisp: Inserting Comments

I'm trying to write an elisp program that will insert a section header and footer as a comment. For example, if I need a section called "intro" for my LaTeX document, the following would be inserted: ...
1
vote
1answer
488 views

Setting the Default Major Mode?

I have a lot of files on my system without extensions (i.e., files like todo, list_of_stuff, etc). I would like these types of files to default to markdown-mode for their major mode. How to do this? ...
1
vote
1answer
71 views

Cperl-mode syntax highlighting breaks when inserting a newline into a here doc

in cperl-mode, here docs are colored with a font-lock-string-face. However if you used any function that inserts a newline on a blank line (e.g. M-: (insert "\n")) it will cause all code after the ...
1
vote
1answer
79 views

init.el config overwritten in certain modes? [duplicate]

I find when I am using emacs in certain modes that configurations made in my init.el files do not apply anymore. E.g. I have my keybinds set up so that tab is used for indentation, § for snippet ...
1
vote
1answer
436 views

Syntax highlighting: highlight text followed by a pattern, but not the pattern itself

I'm writing a major mode to handle syntax highlighting for a language that allows namespaces just like in C++ e.g. somewhere::out_there. I'd like to highlight the text somewhere, but leave the ...
1
vote
2answers
70 views

Files for which to activate generic mode

I've created a generic mode for emacs, but I have trouble matching the file names I want the generic mode to be on, right now I'm using proguard-* but I would like to match only file names with ...
1
vote
1answer
166 views

syntax-highlighting strings incorrectly for strings in opascal-mode

I write my projects in FreePascal and use opascal-mode to write it. I'm having a problem that this mode thinks that '\' is not a complete string, and hence all code after it is highlighted as a string....
1
vote
2answers
73 views

add-hook unable to reassign a mode-specific keybinding

I'm attempting to override a mode-specific keybinding, but my attempt so far hasn't been able to reassign it. I use the M-j,k,i,l to navigate instead of the regular C-n, C-p etc. I find it to be a ...
1
vote
2answers
204 views

How to define key bindings for major mode extensions?

I am writing some extension features for various major modes. The features are (as usual in Emacs) some functions that should be bound to some keys to simplify the workflow of the user. I started ...
1
vote
1answer
26 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
1answer
83 views

Determining major mode for proper comment character insertion

I currently have a function like so in my .emacs file: (defun insert-todo () (interactive) (insert "// TODO(map) : ") ) It is bound to my key combination of "C-t". This will work for me if I'...
1
vote
1answer
39 views

Is it possible to “protect” strings from formatting?

I'm working on a latex document \documentclass{exam} \printanswers % to use the tag % \usepackage{catchfilebetweentags} % \ExecuteMetaData[file.tex]{tag} %<*afterclass> \begin{document} \...
1
vote
1answer
646 views

Highlighting YAML comments correctly

See https://lists.gnu.org/archive/html/emacs-devel/2015-12/msg01046.html for more background. YAML defines a comment as a # either preceded by the beginning of the line or whitespace (more ...
1
vote
1answer
65 views

How do I use epa-sign-file and not disrupt functionality of the file with the ASCII-armored signature

I want to be able to gpg sign specific files, specifically org-mode file. However, doing M-x epa-sign-file RET filename.org will create the file filename.org.asc and introduce new text in that file ...
1
vote
1answer
44 views

New buffers of the same name don't inherit default major mode?

I'm using the following to create a new buffer "untitled" with the keyboard map C-n. This works fine for a new buffer but additional buffers of the same name where <num> gets applied seem to ...
1
vote
2answers
181 views

js-comint mode (node) returning too many undefined responses?

I am using js2-mode and comint-mode to run the Node REPL in emacs. For some reason the prompt is returning a lot of undefined and ...undefined responses, which it wouldn't do normally. for instance, ...
1
vote
0answers
23 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 ...
1
vote
0answers
38 views

Change major-mode keymap char-table

I'm trying to write my own major mode, which I want to use under MS Windows. Unfortunately, Windows doesn't have my favourite keyboard layout, so I'm planning to implement this keyboard layout in my ...
1
vote
0answers
170 views

How to add additional comment syntax to a mode?

In general, given a major mode with a defined comment syntax, what do I have to define or change to add a new comment syntax? By "adding", I mean setting some new characters so that they work with ...