Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/8dcc/hl-printf.el
Minor mode for highlighting 'printf' format specifiers in Emacs
https://github.com/8dcc/hl-printf.el
emacs emacs-lisp emacs-package minor-mode printf syntax-highlighting
Last synced: 1 day ago
JSON representation
Minor mode for highlighting 'printf' format specifiers in Emacs
- Host: GitHub
- URL: https://github.com/8dcc/hl-printf.el
- Owner: 8dcc
- License: gpl-3.0
- Created: 2024-12-16T09:31:49.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2025-01-30T09:50:45.000Z (12 days ago)
- Last Synced: 2025-02-05T17:12:42.181Z (5 days ago)
- Topics: emacs, emacs-lisp, emacs-package, minor-mode, printf, syntax-highlighting
- Language: Emacs Lisp
- Homepage:
- Size: 43 KB
- Stars: 7
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.org
- License: LICENSE
Awesome Lists containing this project
README
#+TITLE: hl-printf.el
#+AUTHOR: 8dcc
#+OPTIONS: toc:2
#+STARTUP: nofold*Minor mode for highlighting 'printf' format specifiers in Emacs.*
This package provides a minor mode for highlighting =printf= format specifiers,
such as =%s=, =%lld= or =%-5.3f=. This package is meant for C-like modes, but it can
be used on any major mode (that can detect strings with the =syntax-ppss= Emacs
function).* Installing
This package is available in [[https://melpa.org/][Melpa]]. You can install it with
=M-x package-install RET hl-printf RET=, and then =require= it:#+begin_src emacs-lisp
(require 'hl-printf)
#+end_srcOr with =use-package=:
#+begin_src emacs-lisp
(use-package hl-printf)
#+end_srcAlternatively, you can install it with =package-vc-install=:
#+begin_src emacs-lisp
(package-vc-install "https://github.com/8dcc/hl-printf.el")
#+end_srcLastly, if you are using [[https://github.com/radian-software/straight.el][straight.el]], you can specify the recipe with
=straight-use-package=:#+begin_src emacs-lisp
(straight-use-package
'(hl-printf :type git :host github :repo "8dcc/hl-printf.el"))
#+end_src* Customizing
The following variables can be customized.
- Variable: hl-printf-regexp ::
Regular expression used to highlight format specifiers inside strings.
For example, to highlight escape sequences in strings, you can add the
following to your init file:#+begin_src emacs-lisp
(setq hl-printf-regexp
(rx (or (regexp hl-printf-regexp)
(seq "\\"
(or "a" "b" "e" "f" "n" "r" "t" "v" "\\" "'" "\"" "?"
(repeat 1 3 digit)
(seq "x" (one-or-more hex-digit))
(seq "u" (repeat 4 hex-digit))
(seq "U" (repeat 8 hex-digit)))))))
#+end_src- User Option: hl-printf-face ::
Face used when highlighting format specifiers.
* Screenshots
Here are some screenshots of the package, using my fork of Protesilaos'
[[https://github.com/protesilaos/modus-themes][modus-themes]].[[file:assets/ss-dark.png]]
[[file:assets/ss-light.png]]