Questions tagged [derived-mode]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
4 votes
2 answers
1k views

How to run a 'prog-mode-hook' after more specific hooks?

I'm running into an order of initialization issue with hooks. prog-mode-hook enables fci-mode rust-mode-hook sets the fci-rule-column to 99. on initial display the fill column shows at 80 (it's ...
user avatar
  • 7,069
4 votes
1 answer
335 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. ...
user avatar
3 votes
1 answer
226 views

Prevent hooks from parent mode in derived mode

I have: (add-hook 'text-mode-hook 'turn-on-auto-fill) but in lisp/nxml/nxml-mode.el: (define-derived-mode nxml-mode text-mode "nXML" All XML files is opened with auto-fill-mode. That is ...
user avatar
  • 3,122
3 votes
1 answer
451 views

Derived mode without merging keymap

It seems that when using define-derived-mode, the new mode's keymap is merged with that of the parent mode. Is there a way to avoid this? That is, to inherit font-lock, etc. from the parent mode, but ...
user avatar
3 votes
1 answer
75 views

Derived major mode: new keyword fontification not playing nice with parent mode's

I am writing a major mode derived from f90-mode in order to fontify the syntax of a commonly used Fortran preprocessor, fypp (similar to jinja2 for HTML templating). Here's a contrived example of what ...
user avatar
  • 133
3 votes
0 answers
154 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 ...
user avatar
  • 1,148
2 votes
0 answers
63 views

Derived mode from CC Mode: how do I write one?

Where is the definitive, up-to-date guide on how to write a derived mode from CC Mode. I have a mode that's malfunctioning and thought I might just rewrite it, but information I find is spotty and ...
user avatar
  • 21
2 votes
1 answer
78 views

How to delete menu item defined in a parent major from within derived mode?

I'm creating custom major mode derived from js-mode which comes with it's own menu entry "Javascript" (top-level entry, between Tools & Help (sorry, not sure what the correct name for that UI ...
user avatar
  • 123
1 vote
1 answer
33 views

Hide a command from user

Is there a way to hide a command from user? Or, in other words, is there a way to undo an interactive spec? Background: I have a derived mode, which is used in a special buffer as the buffer's mode. ...
user avatar
  • 1,775
1 vote
2 answers
114 views

defalias derived mode to parent mode

I wrote a new major mode config-general-mode, which is derived from conf-mode. I like it a lot and want to have it as the default mode for all configuration files. Thus I tried: (defalias 'conf-mode '...
user avatar
  • 45
1 vote
1 answer
80 views

disable lsp-mode for derived mode of haskell

I am writing a major mode for a new programming language that looks very similar to Haskell, and so not surprisingly I am writing a derived mode from haskell-mode (define-derived-mode foo-mode haskell-...
user avatar
  • 113
1 vote
1 answer
37 views

Syntax highlighting of keywords only if following builtin

I'm writing a syntax highlighting mode and am trying to highlight certain arguments, only if they are following a specific word. I've written a MWE to show my problem: (defvar mwe-builtin-list '("...
user avatar
  • 331
1 vote
2 answers
173 views

How to find inheritance of modes?

As an example, let's use latex-mode, that inherits from tex-mode, that inherits from text-mode. Is there a command, that would take as input latex-mode and give me parent and grand-parent? Or, other ...
user avatar
  • 217
1 vote
0 answers
58 views

derived mode for Pandoc Templates

I am trying to derive mode based on Sample Mode. Reduced contents here: ;;; pandoc-template.el --- Pandoc-Template major mode ;; Copyright (C) 2017 ;; Author: VaclavHaisman ;; Keywords: extensions (...
user avatar
  • 173
0 votes
0 answers
78 views

`scad-mode` (derived from CC Mode) hangs Emacs. How to debug/fix?

I have found that scad-mode.el, a derived mode from CC Mode, which can be found here: https://github.com/openscad/openscad/blob/master/contrib/scad-mode.el hangs emacs if I type #( into the window,...
user avatar
  • 21
0 votes
0 answers
33 views

Defining a derived mode breaks a feature that worked in the parent mode

In org-ref there is a feature whereby when the cursor is on a citation link, the information about the citation appears in the echo area. The feature is implemented using idle timers. I have defined ...
user avatar