From: Étienne Deparis Date: Sat, 21 Nov 2020 18:03:32 +0000 (+0100) Subject: Add a new face to customize quoted texts in gemini pages X-Git-Tag: v3.0.0~22^2~47^2 X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?a=commitdiff_plain;h=18d0288be12c989845bc6b70b0ff7f8244105cd8;p=elpher.git Add a new face to customize quoted texts in gemini pages --- diff --git a/elpher.el b/elpher.el index c6ee0b4..cf641ab 100644 --- a/elpher.el +++ b/elpher.el @@ -252,6 +252,10 @@ some servers which do not support IPv6 can take a long time to time-out." '((t :inherit fixed-pitch)) "Face used for pre-formatted gemini text blocks.") +(defface elpher-gemini-quoted + '((t :inherit font-lock-doc-face)) + "Face used for gemini quoted texts.") + ;;; Model ;; @@ -1385,13 +1389,19 @@ by HEADER-LINE." This function uses Emacs' auto-fill to wrap text sensibly to a maximum width defined by elpher-gemini-max-fill-width." (string-match "\\(^[ \t]*\\)\\(\*[ \t]+\\|>[ \t]*\\)?" text-line) - (let* ((processed-text-line (if (match-string 2 text-line) - (concat - (replace-regexp-in-string "\*" - elpher-gemini-bullet-string - (match-string 0 text-line)) - (substring text-line (match-end 0))) - text-line)) + (let* ((line-prefix (match-string 2 text-line)) + (processed-text-line + (if line-prefix + (cond ((string-prefix-p "*" line-prefix) + (concat + (replace-regexp-in-string "\*" + elpher-gemini-bullet-string + (match-string 0 text-line)) + (substring text-line (match-end 0)))) + ((string-prefix-p ">" line-prefix) + (propertize text-line 'face 'elpher-gemini-quoted)) + (t text-line)) + text-line)) (adaptive-fill-mode nil)) (insert (elpher-process-text-for-display processed-text-line)) (newline)))