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
0answers
84 views

Is there a way for a display-buffer-base-action function to know the forthcoming major-mode?

I am writing a mode that implements a persistent horizontal window (very similar to the "persistence compile window" in ECB). While I did study the ECB code it is quite old and endeavored to work ...
8
votes
2answers
801 views

How to activate semantic-mode for specific major modes only?

I've seen this question a lot. But none of the replies fixed my issue: the minor mode stays on in others modes. So far, I have tried: (use-package stickyfunc-enhance :config ;; (add-to-list '...
11
votes
1answer
5k views

Javascript mode compatible with es6

Does anyone know of a javascript editing mode that supports the es6 syntax additions (arrow functions, extends, imports, generators, etc.)? I've done some quick searching but it looks like so far ...
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 ...
5
votes
1answer
784 views

Inferior Lisp Mode vs Superior Lisp Mode

Can someone explain all the differences in the various lisp modes (inferior, superior, slime, cider)? Which came first? Which are extra packages? What should one use?
1
vote
0answers
64 views

Is there an existing function to add docstrings, relevant to the current major mode?

In emacs is there a function that I can invoke to add a docstring template based on the current major mode? eg: If I'm working on javascript, insert a javascript docstring template "here", like: /*...
7
votes
4answers
865 views

How to obtain a list of all functions exclusively provided by a certain major mode

This question in inspired by https://stackoverflow.com/q/605785/. By M-x describe-function <TAB> I can get a list of all interactive or nonintractive functions available in the current state of ...
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) ...
2
votes
1answer
102 views

How can I tell if a buffer is a comint buffer, eshell buffer or neither?

I have Emacs Lisp program that I want to work inside either a comint process buffer or an eshell buffer. The code I currently am using is: https://github.com/rocky/emacs-dbgr/blob/master/realgud/...
5
votes
2answers
683 views

How to set major mode according to buffer name for non-file buffers

Some buffers are created by emacs and is set in fundamental mode, like the Org-Babel results. I think it is more convenient to set them in special mode, which can be closed with key q. How do set the ...
3
votes
1answer
96 views

Using a different major mode in comments

A programming language that I use lets me format comments and docstrings using markdown, and then export my code and documentation to PDF. When I edit the file, though, Emacs doesn't see comments as ...
5
votes
1answer
215 views

How can I make emacs ignore part of the file name when deciding major mode?

If you have a GPG-encrypted file, say notes.org.gpg, emacs figures out that the major mode has to be set to org-mode. This applies in general to any major mode out there; you do not need to modify the ...
3
votes
1answer
163 views

Why doesn't electric-indent-mode indent in comments?

I've defined my own major mode using define-generic-mode, and in the setup function I have (set (make-local-variable 'indent-line-function) 'my-indent-function). This works fine in general code, ...
1
vote
2answers
194 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 "<?...
7
votes
3answers
573 views

What's the difference between words and symbols?

When defining a syntax table for a major mode, I can define both word constituents and symbol constituents. When should I use each? For example, given a programming language that writes variables in ...
13
votes
4answers
417 views

Differences between setting major mode keys with a hook versus adding them to the mode map

Assume that I have downloaded a major mode called magical-mode, and it has its own magical keymap called magical-mode-map. This mode also provides a hook magical-mode-hook which is run each time ...
14
votes
2answers
7k views

Run command when opening a file of a specific filetype

I'm trying to get a lisp script to run some commands for me when I open a file of a specific filetype. I know that I'm working in the correct init file because if I remove the theme from it, emacs has ...
4
votes
1answer
160 views

How to specify the buffer mode on the command line?

I want to open a file in makefile-gmake mode. Is there a way to do this from the command line? I'm looking for something like: $ emacs -m makefile-gmake filename I do not want to change any config ...
7
votes
1answer
143 views

How do I find the code for the current major mode?

How do I find the elisp code for the major mode in use in the current buffer?
10
votes
2answers
640 views

Remember modes for files without extensions

I've started editing a lot of files that have no extensions, but are still in a major mode format. I'm the only Emacs user on the team, and I don't want to make it a painfully obvious that my editor ...
1
vote
1answer
117 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
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 & ...
7
votes
3answers
385 views

permanently change buffer mode of a file?

Beginner question: In OSX 10.6.8, Aquamacs has many buffer modes. My .tex files open in TeX mode, but I would like to open them in LaTeX mode. I can change the Mode with "Change Buffer Mode", but ...
4
votes
1answer
2k views

js2-mode on, still emacs hunts for javascript-mode

I enabled js2-mode in emacs by adding this snippet in .emacs, (add-to-list 'auto-mode-alist '("\\.js$'" . js2-mode)) But still for .js files, emacs tries to load javascript-mode alias js-mode as ...
1
vote
1answer
159 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 ...
9
votes
1answer
2k views

Why does *compilation* buffer show control characters?

I'm using the *compilation* buffer to build a C++ application on Centos 5 and Centos 6. The buffer shows the build and includes references to files that are part of the build. However, I'm getting ...
0
votes
1answer
217 views

Visual Basic mode doesn't work after update

I'm on Windows. I updated my emacs to 24.4. Now, when trying to open a file that has its extension mapped to the Visual Basic mode at http://www.emacswiki.org/emacs/visual-basic-mode.el, I get these ...
6
votes
1answer
557 views

Is possible to execute a key binding in a function?

Say, the C-M-j is bound to c-indent-new-comment-line for c-mode (and c++-mode) and indent-new-comment-line for other modes, but I want to define a function that will execute C-M-j to c-indent-new-...
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 ...
5
votes
2answers
798 views

CSS code completion as in Firebug

One of the convenient features of in-browser inspectors like Firebug is that it is so easy to tweak CSS stylesheets. As you type in the attribute position, all possible attributes are shown in a ...
3
votes
5answers
461 views

How to get a major mode to open full screen

I'd like magit to default to a large buffer instead of one that is half the size of the available space. Even better would be a way to wrap the call to a major mode to make this happen when opening ...
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.
8
votes
2answers
567 views

Make buffer read-only on a per-file basis

I know I can set something like -*- mode: read-only-mode -*- inside a commentary and Emacs will open the corresponding file as read-only. My problem is that I still want to read files that include ...
10
votes
2answers
354 views

Why don't major modes just inspect the faces?

When writing a major mode, it's often useful to know 'is point in a string?' 'is point in a comment?'. Most major modes seem to attempt to parse the programming language. For example: python-syntax-...
17
votes
2answers
3k views

Using a different font for each major mode

Is it possible to set different fonts following the major mode? Say Inconsolata-12 in org-mode buffers and Symbola-12 in all remaining modes. Or at least, is it possible to do a (set-frame-font "...
0
votes
1answer
88 views

Is there a mode for phpBB?

I'm using the "It's all Text" addon for Firefox so I can edit textarea's in Emacs. As I spend some time on a phpBB forum, I was wondering if there is an Emacs mode for phpBB with it's syntax of using [...
5
votes
1answer
285 views

hierarchy of modes

I am aware that org-mode derives from outline-mode, in the same way as outline-mode derives from text-mode, which derives from nil. I have always wonder if there exists something similar to a ...
6
votes
1answer
542 views

Specify major-mode for files with multiple extensions

In my .emacs file, I have: (setq-default major-mode (lambda () (let ((buffer-file-name (replace-regexp-in-string "\\.tmp$" "" ...
13
votes
6answers
765 views

how to get buffers (not just files) to honor auto-mode-alist?

Q: how can I get new buffers to honor the mapping in auto-mode-alist? When finding a file, Emacs compares the file extension to the auto-mode-alist to determine which major mode to use for the file's ...
5
votes
3answers
122 views

elisp: retaining data structure after inserting string representation to buffer?

I'm currently writing a major mode (for interacting with a remote Grid Engine) which involves fetching data, parsing it into an alist, formating the alist into a string and then inserting the ...
2
votes
1answer
922 views

Filter Helm buffers by mode in ibuffer

When I try to filter buffers by mode in ibuffer, I am not able to filter by major mode helm-mode. For example, MR Name Size Mode -- ---- ---- ---- * *helm apropos*...
15
votes
1answer
1k views

How do I automatically load a mode for a specific set of file extensions?

I'd like to load the yaml-mode for any files named *.yml or *.yaml.