Questions tagged [prog-mode]

Major mode for editing programming language source code. Typically, it is not used directly, instead many programming-related major modes are derived from this mode.

15 questions
10
votes
4 answers

How do I inherit from prog-mode, whilst still supporting older emacsen?

I'm writing a major mode for a programming language, but I want to support older Emacs versions. prog-mode is relatively new. I want to inherit from prog-mode if it's defined, but still do something sensible otherwise. What's the best approach?…
Wilfred Hughes
  • 6,890
  • 2
  • 29
  • 59
7
votes
1 answer

Is a Lisp program in both prog-mode and lisp-mode?

Upon reading (emacs) Program Modes: Entering a programming language mode runs the custom Lisp functions specified in the hook variable prog-mode-hook, followed by those specified in the mode's own mode hook (see Major Modes). For instance, …
AbstProcDo
  • 1,231
  • 5
  • 15
6
votes
3 answers

Turn a non prog-mode derived major-mode into a prog-mode derived major-mode

erlang-mode is not a derived prog-mode. Is there any way to make it part of the prog-mode-hook ?
syl20bnr
  • 2,095
  • 11
  • 21
3
votes
1 answer

Variable assignment for programming modes not working

I want to set the variable truncate-lines to t in order to have truncated lines, but only in programming modes. So, following this thread, I put the following code in my configuration file: (defun my-prog-mode-hook () (setq truncate-lines…
Giuseppe
  • 455
  • 2
  • 14
3
votes
2 answers

How to create a block from lines

In various programming modes, assuming I have a few lines of code like this : foo() bar() And I want to turn it into a block (say, and if of some sort) if (something) { foo() bar() } Is there, in general, a more clever way than : selecting…
phtrivier
  • 135
  • 5
1
vote
0 answers

Highlight variables/functions in commens of all prog-modes

In lisp-mode, strings inside comments that are encapsulated by `' are highlighted with font-lock-constant-face. How can I make all prog-mode-derived modes do that by default?
Atemu
  • 290
  • 1
  • 11
1
vote
1 answer

Run an external program with customized environment/options in current buffer

How can I organize Emacs to run a specific external program with some specific environment/options for the mode or the buffer currently open. My current solution is to use setenv before running the external program, however it seems to change the…
Émilien
  • 70
  • 7
1
vote
0 answers

Emacs really laggy on prog-mode

I noticed Emacs was really laggy on any mode derived from prog-mode two days ago. Before that, everything was fine. I can navigate on a 1000+ lines org-mode file without problem, but I can't even type without lag on a 100- line of a C file, or a 50…
1
vote
0 answers

prog-mode-hook not run for C++ mode

I am trying to turn on linum-mode and fci-mode for C++ editing. Here is my configuration: ;; If non nil line numbers are turned on in all `prog-mode' and `text-mode' ;; derivatives. If set to `relative', also turns on relative line numbers. ;;…
Yang
  • 165
  • 5
1
vote
0 answers

find-file opens file but buries its buffer when ECB is activated

I have a hook in my .emacs file that activates ECB when prog-mode entered: (add-hook 'prog-mode-hook 'ecb-activate) When I open the first file that starts a prog-mode, it seems to cause find-file* to open the file, but then 'bury' it below all the…
nik
  • 111
  • 2
0
votes
1 answer

company-mode no popup graphics at completion-at-point

I tried to install company and lsp on running on Emacs v28.2 on 5.4.240-1-MANJARO for a handful of languages. Most of the stuff works fine, flycheck, linters,lsp-connection, the popup completion with added documentation. Then i reproduce the config…
xdobx
  • 1
  • 3
0
votes
0 answers

indent-region inconsistent with existing code that's indented more than python-indent-offset

Say I have an existing, simple block of code that uses an indent width of 4, as such def incDictValue(d, k): if not k in d: d[k] = 1 else: d[k] += 1 return and setup python-mode in my init.el file to use a 2 space…
0
votes
0 answers

Enable prog-mode when minor mode is activated

I created a minor mode for some specific file extension to fontify the syntax and provide correct indentation. 1)The indentation doesn't work for some reason. 2) How to enable prog-mode when the minor mode is enabled? (define-minor-mode…
SFbay007
  • 554
  • 4
  • 13
0
votes
1 answer

prog-mode-hook not recognizing .ex files in user-config

I'm trying to display prettify-symbols-mode to display for certain characters. I would like for this minor mode to be enabled across all programming languages - thus prog-mode. When I navigate to a .ex file it is not giving me the expected outcome…
0
votes
0 answers

Create a minor mode only for prog-mode major modes

I am working on a minor-mode and I'd like it to be active only for major modes derived from prog-mode. So far I know that the macro define-minor-mode takes a argument :global to decide whether or not the mode should be global. But this is too…
wizmer
  • 877
  • 1
  • 7
  • 9