dotemacs

My Emacs configuration
git clone git://git.entf.net/dotemacs
Log | Files | Refs | LICENSE

compat-font-lock.el (1689B)


      1 ;;; compat-font-lock.el ---                          -*- lexical-binding: t; -*-
      2 
      3 ;; Copyright (C) 2022 Free Software Foundation, Inc.
      4 
      5 ;; Author: Philip Kaludercic <philipk@posteo.net>
      6 ;; Keywords:
      7 
      8 ;; This program is free software; you can redistribute it and/or modify
      9 ;; it under the terms of the GNU General Public License as published by
     10 ;; the Free Software Foundation, either version 3 of the License, or
     11 ;; (at your option) any later version.
     12 
     13 ;; This program is distributed in the hope that it will be useful,
     14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
     15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     16 ;; GNU General Public License for more details.
     17 
     18 ;; You should have received a copy of the GNU General Public License
     19 ;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
     20 
     21 ;;; Commentary:
     22 
     23 ;; Optional font-locking for `compat' definitions.  Every symbol with
     24 ;; an active compatibility definition will be highlighted.
     25 ;;
     26 ;; Load this file to enable the functionality.
     27 
     28 ;;; Code:
     29 
     30 (eval-and-compile
     31   (require 'cl-lib)
     32   (require 'compat-macs))
     33 
     34 (defvar compat-generate-common-fn)
     35 (let ((compat-generate-common-fn
     36        (lambda (name _def-fn _install-fn check-fn attr _type)
     37          (unless (and (plist-get attr :no-highlight)
     38                       (funcall check-fn))
     39            `(font-lock-add-keywords
     40              'emacs-lisp-mode
     41              ',`((,(concat "\\_<\\("
     42                            (regexp-quote (symbol-name name))
     43                            "\\)\\_>")
     44                   1 font-lock-preprocessor-face prepend)))))))
     45   (load "compat"))
     46 
     47 (provide 'compat-font-lock)
     48 ;;; compat-font-lock.el ends here