You are right in assuming that the location is wrong. Emacs does not know about your niranjan directory. You assume that ~/.emacs.d/elpa/ is a special location and that emacs automatically knows how to add packages installed in there.
If you look at the contents of the variable load-path, you'll see that is not the case. Every package that has been ...
I think it's a bug.
If you don't use that alist as the KEYMAP arg, but instead you create a keymap, assign it to a variable, use define-key with (kbd "C-n") etc., and use that variable as the KEYMAP arg, then it works.
Please consider using M-x report-emacs-bug, to report this.
(setq toto-map (make-sparse-keymap))
(defun foo () "..." (...
Almost every mode puts some kind of text in the mode line, which is the line of text at the bottom of every buffer. You can also type C-h m (or M-x describe-mode)to get long-form documentation about every mode that is currently active. This includes their names as well as all of their keybindings.
As xuchunyang noted in comments, your shouldn't use prose-mode to name a function that doesn't define a mode, so you could define your function like this:
"Load additional stuff with olivetti-mode."
Note that display-line-numbers-mode, accepts an optional ...
minor-mode-map-alist is a variable defined in `C source code'.
Alist of keymaps to use for minor modes.
Each element looks like (VARIABLE . KEYMAP); KEYMAP is used to read
key sequences and look up bindings if VARIABLE's value is non-nil.
If two active keymaps bind the same key, the keymap appearing earlier
in the list takes precedence.
You can use a source block with a self-defined major mode.
It is easy to define a customized major mode with helper functions like define-derived-mode.
Let us name your new major mode myorg-mode. Then the name of the function executed on C-c C-c is org-babel-execute:myorg.
It is called with two arguments. The first arg is the content of the source block as a ...
There's M-x describe-mode, which is bound to C-h m by default. It shows the current major mode, as well as all current minor modes.
If you want to jump directly to the description of your current major mode, then either evaluate (describe-function major-mode) (via M-:) or bind it to a key, for example:
(defun my/describe-current-major-mode ()
Refer to the manual:
C-hig (elisp)Properties in Mode
Or in the online manual (which is always for the most recent stable release of Emacs): https://www.gnu.org/software/emacs/manual/html_node/elisp/Properties-in-Mode.html
I think there's no point in quoting an excerpt here -- you need to read the whole page.
Attempting answering my own question:
Try 1: partially works, but as per comments below doesn't seem reliable
Create a wrapper global mode, that is selective about when it enables.
(define-global-minor-mode my-global-selectrum-mode selectrum-mode
(when (not (memq major-mode
See C-hf kill-local-variable for reverting a buffer-local variable to the global state.
If you just set the buffer-local value to the variable's current default value, then it's still a buffer-local value (i.e. it won't reflect future changes to the default).
Minor modes are toggles. Defining a minor mode also creates a variabel with the same name. This variable is toggled when enabling/disabling the minor mode.
So following code works:
(if (not margin-mode)
(setq left-margin-width 3)
(setq left-margin-width (default-value 'left-margin-width))))
Elisp is a Lisp-n type ...
All you have to do is replace the set-buffer-major-mode call which sets the buffer to a default mode (fundamental mode in this case) with a couple of calls to set the modes you want.
org-mode is a major mode, so you set it by calling the function that implements it, with no arguments, in the buffer whose mode you want to set:
(set-buffer <some buffer>)
Just following up I ended up going with a simplified version of the example code (https://github.com/emacsorphanage/god-mode#change-modeline-color) and adding cursor change:
;; Update cursor
(defun my-god-mode-update-cursor ()
(setq cursor-type (if (or god-local-mode buffer-read-only)
I tested the (mapcar #'car minor-mode-alist) solution, but its length doesn't change after I disable a minor mode (while M-x describe-mode reflects this). Moreover, it seems inaccurate as I can't find some minor-modes listed by M-x describe-mode.
I tried the package manage-minor-mode which allows users to enable/disable a minor-mode through an interface. ...
If you don't want to do diminish/delight on every package. You could try minions it will hide all minor mode and can be toggled using mouse. Or you can use awesome-tray which you can use to refine what to show in modeline.