Questions tagged [syntax-highlighting]

is the feature of displaying text, especially source code, in different colors and fonts according to the meaning of different terms.

Filter by
Sorted by
Tagged with
0
votes
1answer
84 views

Default syntax highlighting as in “emacs -Q”

I want to use the syntax highlighting that you get when running emacs -Q. If I run emacs -q, or run Emacs with no ~/.emacs file existent, or not load any custom theme, I get a dark-backgrounded color ...
3
votes
0answers
70 views

How to place asterisks in beginning and end of lines in a marked region?

I use org-mode a a lot and take notes in Org files. I like to sometimes highlight some important text. I colored bold to be red but it doesn't span multiple lines. And I couldn't get that to work ...
1
vote
1answer
192 views

Syntax highlighting inside HTML5 <script> tags

I was curious if there was a way to get highlighting/indentation for any JavaScript that's inside of HTML5 tags? I don't frequently use JavaScript but for a class I'm in we're working with it. I ...
1
vote
1answer
291 views

Is there a way to highlight the (s) expression you are in?

I currently have (paren-set-mode 'paren) in my init.el, and it does a good job of highlighting the area between parentheses. However, I was wondering if there was a way to highlight the expression I ...
1
vote
3answers
818 views

Different colors for questions and answers in org-mode

I'm writing questions and answers in org-mode for project purposes (like meeting notes). A sample looks like this: 1. [X] Equipment name for tags associated with pumps - Discuss Comment: We can ...
0
votes
1answer
236 views

Adding new syntax highlighting for some major modes does not work

My question is similar to this one and that one: I would like to add highlighting of some characters that are not highlighted in some programming modes, like python-mode and fortran-mode. So, ...
2
votes
0answers
59 views

Which mode to get syntax-highlighting for commit messages (svn/git/hg… etc)

When editing commit messages for various version control, what should I enable to get syntax highlighting? (without having to use some heavy mode for all other VCS operations like magit)
1
vote
0answers
55 views

How can I activate my syntax-table?

I'm using SampleMode and the ModeTutorial to create my own mode. I have a problem with the syntax table. As I understand, // and # start one-line comments like this: (defvar my-mode-syntax-table (...
1
vote
0answers
55 views

LaTeX highlighting: Dollar expressions across lines

I'm having some trouble with LaTeX math expressions between (single) dollar signs. Specifically, syntax highlighting breaks across lines. Things looks something like this: if there exists $\alpha&...
8
votes
1answer
721 views

Fontify broken links in org-mode

If I create a bad [[file:link]] or an internal [[Link]] that does not exist, I would like to org-mode to fontify this using org-warning face. How can I get this done? Thanks,
0
votes
1answer
185 views

How to highlight other square brackets in custom major mode?

I'm working in a custom major mode, and part of the syntax are the square brackets, like [Hello world] and so they can contain nested square brackets as in [Hello [World]], however I see this problem ...
4
votes
1answer
569 views

Set web-mode engine per directory

I'm hoping this is possible. I work in a variety of environments and languages. Right now it's mostly django and Node.js, but there have been others. What I would like to do is set the web-mode engine ...
0
votes
1answer
506 views

How to activate AUCTeX support for beamer without preamble?

Usually, AUCTeX activates beamer-specific settings (e.g. syntax highlighting) depending on \documentclass. In my LaTeX templates, however, I have separated the preamble from the rest of the document ...
0
votes
1answer
24 views

Apply a background to code with font-lock

I have a command file that uses syntax such as -TAG <ARGS> -TAG- to pass arguments to a sub program. I want to Highlight everything between the opening and closing tags with specific background ...
2
votes
1answer
182 views

How to syntax-colour py.test output?

In compilation-mode (or some similar mode), how can I make the default py.test output be colourized? I'm not talking about clickable links, but about just 'syntax' colouring the various parts of the ...
2
votes
1answer
684 views

Gray-out preprocessor conditionals

Is there a package that will gray out or hide the false portion of a c preprocessor macro? #define ENABLE 1 #if ENABLE bool hide = false; #else bool hide = true; #endif In the above example, ...
3
votes
1answer
89 views

Adding a rule to color text

I'd like to add a rule to supersede a tex mode. I'd like to colour text between two strings over multiple lines in a similar way that the character % is used as a comment character and so colours (...
1
vote
0answers
74 views

Eclim problems not being highlighted/problems not being shown in minibuffer

I know I have eclim setup correctly because everything else works, I.E I can do autocomplete, jump to definition etc. I can even see problems with eclim-problems. However, when I make a syntax error, ...
3
votes
1answer
2k views

How to change syntax highlighting for mode?

I've been able to partially modify how emacs highlights syntax of python files. For example I find highlighting the definition of variable to be disturbing and I've done this '(font-lock-constant-...
2
votes
2answers
2k views

How to get colored syntax highlighting of code blocks in asynchronous Org-mode exports to HTML?

Colored syntax highlighting of code blocks in .org files works well when executed through the main init.el file. However, when setting up Emacs and Org-mode to publish projects asynchronously, colored ...
4
votes
3answers
2k views

Syntax highlight doxygen comments in C/C++? (c-doc-comment-style)

Is it possible to syntax highlight doxygen in C/C++ code? QtCreator and Vim both support basic highlighting so \param, \note... etc are highlighted differently.
0
votes
1answer
81 views

Define a new babel src (based in python)

I would like to write pieces of code (I don't need to evaluate it---yet---) of Cadabra see the web page which is based in python. However, it uses the symbol # as part of the code. How could I define ...
1
vote
0answers
22 views

Cperl font lock regions in here docs

I am having a problem in cperl-mode described in this question. Basically inserting a newline at the start of a line in here doc in cperl-mode is breaking the syntax highlighting. One of the answers ...
1
vote
1answer
182 views

How can I syntax-highlight a function like a macro?

I've got a function that behaves more like a macro in that it does compile-time environment definitions. For various reasons (at this point, one of those reasons is 'because it is easier to grok in ...
1
vote
1answer
74 views

Cperl-mode syntax highlighting breaks when inserting a newline into a here doc

in cperl-mode, here docs are colored with a font-lock-string-face. However if you used any function that inserts a newline on a blank line (e.g. M-: (insert "\n")) it will cause all code after the ...
2
votes
1answer
406 views

Block syntax highlighting breaks in org-mode in this case, how to fix?

I have this in my init.el to enable block code syntax highlighting in org-mode: (setq org-src-fontify-natively t) I have also this for org-babel: (org-babel-do-load-languages 'org-babel-load-...
5
votes
2answers
288 views

Don't switch to math-mode when entering `$` in a `minted` environment

I am using AUCTeX to edit Latex files and use the minted package to highlight source-code within documents. Unfortunately the character $ is still recognized as a delimiter for a math-mode even though ...
2
votes
1answer
497 views

Adding new commands to the syntax highlighting of a language mode

I am working on a corporate installation. They have emacs, and it has tcl mode. The issue is that the command lassign is not highlighted, unlike, for example, set, or return. What that I would like, ...
1
vote
1answer
928 views

Better syntax highlighting in MATLAB/Octave

I'm using emacs for editing a bunch of matlab files. The only gripe that I have is that the syntax highlighting provided by octave-mode is pretty poor. This is the syntax highlighting provided by ...
0
votes
1answer
79 views

Highlight text based on condition on consecutive lines

How can we visually add separators in log files, based on conditions between consecutive lines? Sample log file: [DEBUG][2016-05-26 10:24:51,714][FileHelper] - [realContextPath] [DEBUG][2016-05-26 ...
3
votes
1answer
171 views

AUCTeX: Turn on syntax highlighting for natbib commmands under BibLaTeX

I'm using natbib commands like \citep and \citealt under BibLaTeX thanks to the option natbib=true. Yet AUCTeX won't highlight them the way it highlights, for example, \cite (or \parencite, which is ...
2
votes
1answer
273 views

add a rule to syntax-propertize-rules

I have an issue outlined here that I was able to find a partial solution for. The problem involved changing perl-modes syntax table. One of the commenters pointed me to the function syntax-propertize-...
3
votes
1answer
165 views

modify syntax table for strings in perl modes

My company uses a version of Perl where you can define by binary number using something like my $var = 'b010110110; etc. Problem is both perl-mode and cperl-mode interpret ' as the start of the string ...
1
vote
1answer
1k views

How to automatically highlight all the words same with selection just like Notepad++

For example when I select a word I want the same words to be automatically highlighted just like it in Notepad++: When I select the word "install" in Notepad++ (all other "install" are highlighted"): ...
2
votes
1answer
57 views

Modify mode's font-locking without changing source code

Suppose I want to make additions to a major mode's syntax highlighting, how would I do this without modifying the major mode's source code? Some ideas: Redefine variable in .emacs Define a minor ...
6
votes
3answers
540 views

Syntax highlighting for comments starting with specific sequence of characters

In clojure, the comment character is ;. clojure-mode syntax highlighting + color scheme greys comment text out. I want emacs to color lines that begin with ;-; with a different color. For example: ...
6
votes
1answer
4k views

Export code blocks in org-mode with minted environment

After inspecting the LaTeX generated for my org-mode file, I figured out that the code blocks are exported with the verbatim environment. Are there any way to tell org-mode to export code blocks using ...
6
votes
2answers
2k views

Highlight current line without changing colours

I use (global-hl-line-mode 1) in order to highlight the current line. This changes the text colours of the highlighted line. Is it possible to highlight while keeping the current syntax highlighting ...
2
votes
2answers
372 views

How can I get regexp-opt (or similar) not apply on the word with added underscore?

See excerpt below for code used in emacs Cadence SKILL mode: (cons (concat "\\<" (regexp-opt '("nil" "t") t) "\\>") 'font-lock-constant-face) it does a brilliant job at highlighting nil and ...
1
vote
2answers
320 views

Syntax highlighting (in Emacs) for SQL code in log files

How can we highlight SQL code in some log files, with Emacs? Sample log file: [DEBUG][2016-05-26 09:04:51,714][FileHelper] - [realContextPath=[/server.xml]] [DEBUG][2016-05-26 10:24:22,369][...
4
votes
1answer
1k views

Exporting highlighted source code to pdf in Org-Mode

I'm trying to export some python code with syntax highlighted to a pdf, from org-mode. Even though I can export to html without any issues I could not find a way to export it to pdf. n.b. I'm using ...
12
votes
2answers
2k views

Can I turn off or switch the syntax checker for js2-mode?

I have a default setup of js2-mode. This provides nice syntax highlighting and checking but I am now working on a project with a different set of styles (specifically this new project does not use ...
1
vote
1answer
537 views

Syntax highlighting using Emacs

I'm creating an elisp file based on http://ergoemacs.org/emacs/elisp_syntax_coloring.html from this site. My updated code is shown below ;;; MOD5-mode.el --- sample major mode for editing MOD5 ...
1
vote
1answer
447 views

Syntax highlighting: highlight text followed by a pattern, but not the pattern itself

I'm writing a major mode to handle syntax highlighting for a language that allows namespaces just like in C++ e.g. somewhere::out_there. I'd like to highlight the text somewhere, but leave the ...
1
vote
0answers
39 views

Modified mode highlighting

I want to modify the highlighting of my JS files, so that every line starting with LOG gets shown in a different color.1 I wrote the following (require 'font-core) (font-lock-mode 1) (defface mg-...
3
votes
1answer
248 views

Syntax highlight embedded script

I have a bash shell script that has a fairly sizable amount of perl code in it. Is there a why to get perl syntax highlighting instead of the normal here doc coloring? Thank you for any help, I'm new ...
0
votes
1answer
307 views

Is it possible to create case-insensitive keywords in a generic-mode?

I am very new to Emacs and I am discovering the functionality of "generic-mode" for the first time. I am trying to add a generic-mode to create basic syntax highlighting for an obscure programming ...
2
votes
1answer
736 views

Override c++-mode font lock

I am improving the C++ highlighting in Emacs with the minor mode: modern-cpp-font-lock. Consider this following C++14 code: int main() { int i = 1'2'3l; } From cppreference.com Optional single ...
3
votes
2answers
373 views

Division sometimes breaks syntax highlighting in ruby-mode

Interesting bug in ruby-mode. When a variable called index is followed by a slash /, syntax highlighting breaks. Here's a screenshot to show you what I mean: I'm not really sure how to file a ...
2
votes
1answer
131 views

Treat shebang as a comment

I am trying to get js-mode to highlight a "shebang" (#!/usr/bin/env node) as a comment, but my code is not working. Instead, the entire buffer is colored like a comment. I've read the documentation ...