Questions tagged [derived-mode]

17 questions
5
votes
2 answers

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 original value), moving the cursor redraws at…
ideasman42
  • 8,375
  • 1
  • 28
  • 105
5
votes
1 answer

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. Is the current situation simply a case of…
Tianxiang Xiong
  • 3,848
  • 16
  • 27
3
votes
1 answer

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 that looks like, with plain f90-mode…
Endulum
  • 133
  • 3
3
votes
2 answers

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 way around, is there a command that would take…
thdox
  • 237
  • 1
  • 7
3
votes
1 answer

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 inconvenient because XML file under source control and…
gavenkoa
  • 3,352
  • 19
  • 36
3
votes
1 answer

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 have a completely new keymap. E.g. (defvar…
Tianxiang Xiong
  • 3,848
  • 16
  • 27
3
votes
0 answers

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 derived-mode-parent and peek at them to see if they…
Jackson
  • 1,218
  • 9
  • 19
2
votes
0 answers

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 inconsistent. The example mode reference in the…
Adrian
  • 21
  • 2
2
votes
1 answer

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 element is)). I would like to hide/remove that menu…
IvanR
  • 123
  • 2
1
vote
1 answer

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. This buffer is generated by a command and the mode…
theldoria
  • 1,825
  • 1
  • 13
  • 25
1
vote
1 answer

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-mode "foo mode" "Major mode for…
mark
  • 113
  • 2
1
vote
1 answer

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 '("func" "proc" "height")) (defvar mwe-args-list…
1
vote
0 answers

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 (defvar pandoc-template-mode-syntax-table (let…
wilx
  • 173
  • 7
1
vote
2 answers

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 'config-general-mode) But this doesn't work, I…
Tom
  • 45
  • 4
0
votes
0 answers

Implementing dependence chain for derived modes

Have several implementations for determining the dependence chain for a derived mode once the mode has been loaded. What would be the most convenient to use and what improvements can I do? Have difficulty understanding the workings of…
Dilna
  • 1,173
  • 3
  • 10
1
2