gph-mode 1.1, now with tab highlighting. - geomyidae - A small C-based gopherd. HTML git clone git://bitreich.org/geomyidae/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/geomyidae/ DIR Log DIR Files DIR Refs DIR Tags DIR README DIR LICENSE --- DIR commit 0bf8a3b9d7371bf83b44a64b882a224607d9d41c DIR parent 9f6992fbf205ebf60a0674c9ec29a86c73cb4fa9 HTML Author: Troels Henriksen <athas@sigkill.dk> Date: Thu, 4 Aug 2022 19:26:38 +0200 gph-mode 1.1, now with tab highlighting. Signed-off-by: Christoph Lohmann <20h@r-36.net> Diffstat: M gph/emacs/gph-mode.el | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) --- DIR diff --git a/gph/emacs/gph-mode.el b/gph/emacs/gph-mode.el @@ -2,9 +2,9 @@ ;; Copyright (C) Troels Henriksen (athas@sigkill.dk) 2022 ;; -;; URL: https://github.com/diku-dk/futhark-mode +;; URL: gopher://sigkill.dk/1/programming ;; Keywords: gopher -;; Version: 1.0 +;; Version: 1.1 ;; Package-Requires: ((emacs "25.1")) ;; This file is not part of GNU Emacs. @@ -15,7 +15,9 @@ ;;; Commentary: ;; .gph is the map file format used by the geomyidae Gopher daemon. ;; This Emacs mode provides basic understanding of the link syntax, -;; such that highlighting and folding works properly. +;; such that highlighting and folding works properly. It also +;; highlights tab characters in pink because these are not allowed in +;; .gph files. ;; ;; Files with the ".gph" extension are automatically handled by this mode. ;; @@ -27,6 +29,14 @@ (eval-when-compile (require 'rx)) +(defface gph-tabs-face + '((((class color)) (:background "hotpink")) + (t (:reverse-video t))) + "Face to use for highlighting tabs in Font-Lock mode.") + +(defvar gph-tabs 'gph-tabs-face + "Face to use for highlighting tabs in Font-Lock mode.") + (defvar gph--font-lock-defaults (let* ((type-rx '(or "0" "1" "3" "7" "8" "9" "g" "I" "h" "i")) (desc-rx '(* (not "|"))) @@ -36,7 +46,8 @@ (link-rx `(: line-start "[" ,type-rx "|" ,desc-rx "|" ,path-rx "|" ,host-rx "|" ,port-rx "]")) (badlink-rx `(: line-start "[" (* anything)))) `((,(rx-to-string link-rx) 0 font-lock-doc-markup-face) - (,(rx-to-string badlink-rx) 0 font-lock-warning-face)))) + (,(rx-to-string badlink-rx) 0 font-lock-warning-face) + ("\t" 0 gph-tabs)))) (defvar gph-mode-hook nil "Hook for `gph-mode'. Is run whenever the mode is entered.")