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

How to disable skeleton-pair-insert-maybe?

I recently got a new Chromebook and installed Ubuntu via crouton. I then installed Emacs 23 and transferred my .emacs file to the new machine. However, a few of my key rebindings have been ...
0
votes
1answer
59 views

different mode setting

I often use .c file and .txt file on the split emacs frame. I wrote a code such as the following to init.el. ;; change text-mode indent (add-hook 'text-mode-hook (lambda () (setq ...
3
votes
2answers
910 views

How to customize major mode initialization with local variables?

Seems like most major modes clear all local variables before initializing. It also seems like many major modes read variables while initializing to customize their behavior. If I want to set a file ...
9
votes
2answers
2k views

How do I write a simple `completion-at-point-functions` function?

I'm considering writing a major mode for editing Magic: the Gathering decks. Most of it seems pretty straightforward but I have one question. There are about 15 000 unique Magic cards available (...
1
vote
0answers
26 views

Specify fallback possibilities for file-local variables?

It is clear from the manual how to set file variables: -*- mode: modename; var: value; … -*- For example, at the top of my ~/.gitconfig file, I have # -*- mode: conf; -*- I recently discovered ...
4
votes
3answers
419 views

How can I create mode-local variables?

I'm looking to create a command which stores a kind of "history" for the current major-mode. I need the variable to be independent for each major mode, but consistent across all buffers in any ...
1
vote
1answer
431 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 ...
0
votes
1answer
191 views

How do I enable a mode, when another mode runs?

All I want to do is enable tern-mode, when I enter js-mode. I know that a hook called js-mode is run when I open a javascript file but for some reason tern-mode is not enabled. In my init.el file I ...
0
votes
1answer
104 views

Stop automatic indentation and cursor movement while typing in major mode

I've put together a simple major mode for syntax highlighting and indentation of AQL. This is my first, and I'm open to any suggestions there, but my question is more specific: When I type two ...
24
votes
1answer
770 views

How can I quickly toggle between a file and a *scratch* buffer having the same major mode?

At times while working on a code, it's useful to quickly open a *scratch* buffer to paste a snippet from that code file. If I am working on a Perl script, I would like to quickly open a *scratch* ...
2
votes
1answer
425 views

How do I force a mode on a specific file through special comments

I have a file called zshrc (not .zshrc). Emacs does not recognize that it must use sh-modeautomatically. I want to put some sort of hint for emacs to pick up and syntax highlight my file accordingly. ...
1
vote
2answers
179 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, ...
0
votes
0answers
165 views

font-lock problem of c++ mode

I recently notice that there's some strange behaviours of the font-lock of the c++-mode. Let's start emacs by emacs -Q in the terminal, edit a new file test.cpp and save the following contents Then ...
2
votes
1answer
393 views

How to prevent line wrapping in code, but allow it in help/info buffers?

I'm quite new to emacs (coming from vim), and I'm struggling to figure out how to configure sane line-wrapping/truncation behavior. For the most part, I'd like to prevent wrapping, so I put this in ...
2
votes
1answer
233 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 ...
11
votes
2answers
257 views

Use two major-mode-maps in the same buffer

I've run into a few situations where it would be highly convenient to have to have the keymap of one major-mode act as a fallback keymap for another major-mode. For instance: I write a lot of LaTeX ...
4
votes
1answer
224 views

Why isn't emacs-lisp-mode derived from lisp-mode?

Just out of curiosity, why isn't emacs-lisp-mode derived from lisp-mode? Instead, both are derived from prog-mode. It seems to me that there is a natural hierarchical relationship that should exist. ...
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 ...
2
votes
2answers
278 views

Create new major mode from cc-mode that allows comments with two dashes

It is possible and relatively easy to create a new major mode, deriving from c-mode, and just add two dashes '--' to work as comments too? I have checked many resources, but couldn't find anything ...
6
votes
2answers
399 views

How to associate more than one file extension with a given mode in `use-package`

When using use-package, is there a way to associate more than one file extension with a particular mode in one place instead of multiple locations? Case in point is that I would like to associate ...
0
votes
1answer
324 views

Is there major mode for editting CQL?

I'm editting CQL(Cassandra Query Language) on emacs and came to wonder if there's any dedicated major mode for editting CQLs. Is there such one?
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 ...
5
votes
1answer
1k views

Writing a Major Mode

What are some resources for learning to write a major mode for a programming language such as Haskell? I know such things exist but I would like to learn how to do it, it seems like a fun 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 ...
5
votes
3answers
267 views

How to never have a major mode enabled automatically

looks like Emacs tries to be smart, switching to an annoying change-log-mode often when i am editing a changelog file. I would like to disable it, but i just find info about how to interactively ...
0
votes
1answer
965 views

How to have emacs recognize Makefile as a prefix for makefile-mode?

I figured the following would tell emacs to recognize files starting with "Makefile" and start makefile-mode: (add-to-list 'auto-mode-alist '("\\`Makefile" . makefile-mode)) The \\` indicates the ...
3
votes
1answer
498 views

How to define “mode-specific” functions?

How can I define an Elisp function such that it is available only under a specific mode? (FWIW, at the moment, the mode I want to restrict a function to is comint.)
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
1answer
637 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 ...
4
votes
2answers
432 views

Which mode is best for a special configuration file, specifically logstash

I'm using logstash and its configuration file (documented here) looks like this: input { file { path => "/some/path/to/file" option => 1 } } filter { if [var] == "string" { ...
2
votes
1answer
185 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 ...
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 ...
0
votes
1answer
118 views

Make major mode be used by default for new files in directory

I forget to enter sh-mode when I create new shell scripts in ~/.local/bin, so I want emacs to do this automatically. Because I have an advice set up to make them executable, this will have the effect ...
5
votes
1answer
1k views

How can I change which shell script mode I'm in?

Occasionally, emacs opens a file in shell-script[fish] when I want it to open in shell-script[bash]. How can I manually change the subtype of shell-script mode that I'm in?
3
votes
2answers
617 views

Git commit uses fundamental mode after magit update

I recently updated magit to 20151025.1115, which gave me a message about git-commit-mode incompatibility. I now, instead, have a package git-commit at version 20151022.933 (from the magit project) ...
1
vote
1answer
626 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-...
3
votes
2answers
2k views

Use-package for a mode

it's not clear for me how should I set use-package to load a package when a mode is activated. I have read different things about :mode, :init :config and I am now confused. Could someone explains it ...
1
vote
0answers
100 views

Auto-indent problems related to syntax in Haxe-Mode

In the Haxe programming language, you can specify the type of the return value of a function with a colon. function funcName() : ReturnType { } This becomes a problem when using emacs with haxe-mode....
1
vote
1answer
64 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 ...
0
votes
1answer
198 views

How to change the font-lock string definition?

I wrote a simple mode with the following font-lock definition, which defines just some keywords: (defvar marpa-mode-font-lock `((,(regexp-opt '(":default" "action" "lexeme" "default" "latm" "...
8
votes
1answer
1k views

Which mode to use for ECMAScript 6?

Is there a mode out there that has syntax higlighting (and possibly more, but this is the least I want) for a more recent ecmascript? I'm especially interested in one that has support for template ...
1
vote
2answers
116 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, ...
4
votes
1answer
460 views

nxhtml mode support

I've been using https://stackoverflow.com/a/17761144/788700 to get multiple major modes in rst-mode. It has been working in Emacs 24.3. However as emacs develops the same code gradually stops working. ...
-1
votes
1answer
74 views

How to specify the mode-name displayed in the buffer pop-up list?

I'm working on a couple of XML-format major modes, both of which are derived modes based on nXML, and I cannot get Emacs to display the mode names -- either in the minibuffer or in the buffer-list pop-...
0
votes
0answers
101 views

scss-mode compile not reading config.rb

Just discovered scss-mode and it's concomitant compile-on-save (very cool). However, I keep getting errors because sass it is not reading ../config.rb. I can find no variables in scss-mode nor params ...
3
votes
0answers
100 views

Can twittering-mode be used with GNU Social, and if so, how? If not, any alternatives?

I have an account on GNUSocial, and I want to be able to control it from Emacs. However, I haven't found a way to do so yet. I can control my Twitter just fine through twittering-mode, and was ...
7
votes
3answers
2k views

Auto enable minor modes in fundamental-mode

By design, the fundamental-mode is bare bones as other major modes are supposed to derive from this one. From the info page (elisp) Major Modes, we have: This is the major mode command for ...
0
votes
0answers
57 views

Determine if emacs knows the mode for a file

I'd like to add another system to set the major modes of file visiting buffers. To do so, I need to know if any of the existing major mode setting systems know how to set the mode, and do my thing ...
5
votes
3answers
977 views

Make names of major modes shorter in the mode-line

I want to make names of major modes shorter. No longer than three characters. Is there any packages that do something like that? It's better to shorten mode names in automatic fashion, so one doesn't ...
3
votes
1answer
131 views

Set “Edit with Emacs” major mode to markdown-mode

I'm using Edit with Emacs to edit Stack Overflow and Stack Exchange sites. Currently I'm doing it with this message ;-) When I click on the button under the text area of Chrome browser, I get a new ...