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?
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!
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.
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.
(if (derived-mode-p 'prog-mode) ...)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With