Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect if the current major mode is derived from prog-mode

Tags:

emacs

mode

I want to write a function that invokes one of 2 functions, depending on whether the current major mode is a prog-mode. How do I detect if the current major mode is a prog-mode?

like image 764
windrg00 Avatar asked Jun 28 '17 03:06

windrg00


People also ask

How do you find the major mode?

To easily find the mode, put the numbers in order from least to greatest and count how many times each number occurs. The number that occurs the most is the mode!

How to switch major mode Emacs?

Usually, the major mode is automatically set by Emacs, when you first visit a file or create a buffer (see Choosing Modes). You can explicitly select a new major mode by using an M-x command.

What is the default mode of Emacs?

The standard default value is fundamental-mode . If the default value is nil , then whenever Emacs creates a new buffer via a command such as C-x b ( switch-to-buffer ), the new buffer is put in the major mode of the previously current buffer.


1 Answers

(if (derived-mode-p 'prog-mode) ...)
like image 55
phils Avatar answered Sep 22 '22 01:09

phils