X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?a=blobdiff_plain;f=elpher.el;h=cf641ab8f712514ecad611174ac721f2fc613f6b;hb=18d0288be12c989845bc6b70b0ff7f8244105cd8;hp=9edd178ee4f79fa5223fa2c43f7759d2abe51289;hpb=1edbaec565d413a9c7d4c55e9356c38b2037e0f5;p=elpher.git diff --git a/elpher.el b/elpher.el index 9edd178..cf641ab 100644 --- a/elpher.el +++ b/elpher.el @@ -71,7 +71,7 @@ ;;; Global constants ;; -(defconst elpher-version "2.10.0" +(defconst elpher-version "2.10.2" "Current version of elpher.") (defconst elpher-margin-width 6 @@ -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 ;; @@ -478,7 +482,7 @@ unless NO-HISTORY is non-nil." (if previous-page (elpher-visit-page previous-page nil t) (error "No previous page")))) - + (defun elpher-reload-current-page () "Reload the current page, discarding any existing cached content." (elpher-cache-content (elpher-page-address elpher-current-page) nil) @@ -1053,7 +1057,7 @@ The response is rendered using the rendering function RENDERER." (elpher-get-gopher-response search-address renderer)) (if aborted (elpher-visit-previous-page)))))) - + ;; Raw server response rendering (defun elpher-render-raw (data &optional mime-type-string) @@ -1359,7 +1363,7 @@ treatment that a separate function is warranted." 'help-echo #'elpher--page-button-help)) (insert (propertize display-string 'face 'elpher-unknown))) (insert "\n")))) - + (defun elpher-gemini-insert-header (header-line) "Insert header described by HEADER-LINE into a text/gemini document. The gemini map file line describing the header is given @@ -1385,17 +1389,20 @@ 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)) - (adaptive-fill-mode nil) - (fill-prefix (if (match-string 2 text-line) - (replace-regexp-in-string "[>\*]" " " (match-string 0 text-line)) - nil))) + (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))) @@ -1592,7 +1599,7 @@ The result is rendered using RENDERER." 'help-echo help-string)) (insert "\n") (elpher-restore-pos))) - + ;;; Bookmarks ;; @@ -1602,7 +1609,7 @@ The result is rendered using RENDERER." DISPLAY-STRING determines how the bookmark will appear in the bookmark list, while URL is the url of the entry." (list display-string url)) - + (defun elpher-bookmark-display-string (bookmark) "Get the display string of BOOKMARK." (elt bookmark 0)) @@ -1888,7 +1895,7 @@ When run interactively HOST-OR-URL is read from the minibuffer." (if button (elpher-info-page (button-get button 'elpher-page)) (error "No item selected")))) - + (defun elpher-info-current () "Display information on current page." (interactive)