12

Are there any better alternatives? Emacs 27 will support a fill column indicator natively by way of the buffer-local minor mode display-fill-column-indicator-mode and its global counterpart global-display-fill-column-indicator-mode. Here it is in action: Quoth (emacs) Displaying Boundaries: 14.15 Displaying Boundaries =========================== Emacs ...


4

It refers to the regexp group that should be highlighted. 0 means the entire regexp. 1 means the first group etc. A group is specified using \( and \). For example: "\\(Humpty\\)\\(Dumpty\\)" (1 'hi-red-b prepend) (2 'hi-green prepend)) In this example, Humpty is subgroup 1 and Dumpty 2. They will be colored red and green, respectively. Note that regexp:...


3

You can simulate the \ze construct using repeated matching. See also (info "(elisp) Search-based Fontification"). (defun my-matcher (limit) (when (re-search-forward "\\([0-9]\\{1,3\\}\\)\\(?:[0-9]\\{6\\}\\)*\\(?:[0-9]\\{3\\}\\)\\_>" limit t) (goto-char (match-beginning 1)) (re-search-forward "[0-9]+" (match-end 1)))) (font-lock-add-...


3

You can use the package font-lock-profiler. For each font-lock rule, it measures execution time and the number of times the rule matched. The package supports measuring time for highlighting a buffer or a region. It also allows measuring time during an editing session. Simply run font-lock-profiler-start, edit your text, and run font-lock-profiles-stop-and-...


2

Here's a code snippet that will make all occurrences of " / " appear as " ÷ " in the current buffer: (add-to-list 'font-lock-extra-managed-props 'display) (font-lock-add-keywords nil '((" \\(/\\) " 1 '(face nil display "÷")))) The first line makes font-lock manage the display property of text, so that it removes the property when a piece of text no longer ...


2

They are displayed in the diredp-omit-file-name face defined in the very same file: (defface diredp-omit-file-name (if (assq :inherit custom-face-attributes) ; Emacs 22+ '((((background dark)) (:inherit diredp-ignored-file-name :strike-through "#555555555555")) ; ~ dark gray (t (:inherit diredp-ignored-file-name :strike-...


2

Try (defconst trigger-zone-highlights '(("trigger-zone" (0 '(face trigger-zone-face keymap trigger-zone-map)))))


2

First, define a major mode that treats single quotes like string delimiters, and backslash as escape character. Secondly, define font-lock rules for REPLACE INTO and VALUES. You can use a so-called "anchored" rule (a two-layer rule) where the outer rule match the keyword and the inner each string. The inner rule decide which color to use for the strings, ...


2

You'll want to use the function buffer-substring-no-properties. In the documentation for M-x describe-function buffer-substring it says this: This function copies the text properties of that part of the buffer into the result string; if you don’t want the text properties, use buffer-substring-no-properties instead.


1

Emacs provides a general-purpose highlight mechanism which might work here. See Interactive Highlighting in the Emacs manual. The relevant commands are highlight-phrase or highlight-regexp to define what you want to highlight (and in what color). You can ask Hi Lock mode to save the highlight instructions in the file itself using hi-lock-write-interactive-...


1

Just remove the strike-throughs in lines 3839-3842 of dired+.el, to give (defface diredp-omit-file-name ;; (if (assq :inherit custom-face-attributes) ; Emacs 22+ '((((background dark)) (:inherit diredp-ignored-file-name)) (t (:inherit diredp-ignored-file-name))) Either rename the file or make a note of the change so you're not ...


1

Indeed, the last font-lock rule still matches, and of its 3 highlighting instructions, the first (that which highlights the opening $) won't be applied because this chars has already been highlighted by the first rule, but the other 2 highlighting instructions are still applied because that part of the text hasn't been highlighted yet. There are also "...


1

AUCTeX fontifies all control words: For known ones (added in font-latex.el or via AUCTeX style files), it uses different classes (e.g., warning, function, textual etc.) and for unknown ones, it simply uses the font-latex-sedate-face which defaults to Foreground: DimGray. You can customize this face if you want a different appearance. There is no ...


1

Just add this, after the defface, to define a variable of the same name, whose value is the face symbol: (defvar my-r-face 'my-r-face "Variable for face `my-r-face'.) font-lock-defaults in the case of just (pgn-highlights) defines font-lock-keywords as the list that is the value of variable pgn-highlights. The doc for font-lock-keywords tells you about ...


1

There's no convention, AFAIK. But define "matching quotation". That could mean several different things. The devil is in the definition/specification. Typically you want to match a quote char, followed by zero or more chars that are each either (1) a non-quote char or (2) an escaped quote char, followed by an unescaped quote char. If start and close quote ...


1

The function c-literal-limits, defined in progmodes/cc-engine.el determines how strings and comments are identified in all c-mode variants. It uses these two definitions to do so: ;; String syntax chars, suitable for skip-syntax-(forward|backward). (defconst c-string-syntax (if (memq 'gen-string-delim c-emacs-features) "\"|" ...


1

I believe what you need to do is check the inheritance of the various faces. This can be done with describe-face. The available options are given in the manual under Face Attributes, but I believe the one you want is unspecified. Here is what I use in my init.el for highlighting and how I solved the problem of the highlight clobbering other faces: (...


1

I've found a solution using the emacs package mmm-mode. Most of the information I got was from this article. What this package does, is allow multiple major modes in the same buffer. You basically set the opening and closing clauses for whatever nested syntax you have, and that block will be highlighted in a submode. M-x package-install RET graphql-mode M-...


1

Since fill-column-indicator is quite heavy, this solution shows a character to the right of the current line. So when you're typing you can see the line limit before you exceed it. This defines the minor-mode hl-line-margin-mode: ;; Global, ensures one active margin for the active buffer. (defvar hl-line-margin--overlay nil) (defun hl-line-margin--...


Only top voted, non community-wiki answers of a minimum length are eligible