From: Christopher Brannon Date: Fri, 19 Feb 2021 03:15:13 +0000 (-0800) Subject: Fix "wrong type argument" messages when fetching from Gemini. X-Git-Tag: v3.0.0~22^2~41^2 X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?a=commitdiff_plain;h=fbb52a780ac26d328d930ddfd20ec67ce282cb6f;p=elpher.git Fix "wrong type argument" messages when fetching from Gemini. This is a problem that has affected people using elpher under emacs in a tty. I tracked down the cause. The header filling calculations fail because the tty font doesn't have a :size property. There's another proposed fix in patch_header_text_termina, but I couldn't get that one to work. --- diff --git a/elpher.el b/elpher.el index 4c34f52..92215fa 100644 --- a/elpher.el +++ b/elpher.el @@ -1366,15 +1366,16 @@ The gemini map file line describing the header is given by HEADER-LINE." (when (string-match "^\\(#+\\)[ \t]*" header-line) (let* ((level (length (match-string 1 header-line))) - (header (substring header-line (match-end 0))) - (face (pcase level - (1 'elpher-gemini-heading1) - (2 'elpher-gemini-heading2) - (3 'elpher-gemini-heading3) - (_ 'default))) - (fill-column (/ (* fill-column - (font-get (font-spec :name (face-font 'default)) :size)) - (font-get (font-spec :name (face-font face)) :size)))) + (header (substring header-line (match-end 0))) + (face (pcase level + (1 'elpher-gemini-heading1) + (2 'elpher-gemini-heading2) + (3 'elpher-gemini-heading3) + (_ 'default))) + (fill-column (if (display-graphic-p) + (/ (* fill-column + (font-get (font-spec :name (face-font 'default)) :size)) + (font-get (font-spec :name (face-font face)) :size)) fill-column))) (unless (display-graphic-p) (insert (make-string level ?#) " ")) (insert (propertize header 'face face))