From f12c63b8a531cb62901b0fc8d326e9b615a0b655 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Thu, 20 Oct 2022 17:59:55 +1100 Subject: render a dump buffer --- luwak.el | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/luwak.el b/luwak.el index 88946f4..b2cb42d 100644 --- a/luwak.el +++ b/luwak.el @@ -207,9 +207,10 @@ When non-nill, swap the tor-switch in prefix-arg effect." (defun luwak-reload () (interactive) - (luwak-open-url - (plist-get luwak-data :url) - (plist-get luwak-data :no-tor))) + (let ((url (plist-get luwak-data :url))) + (unless url + (error "The current buffer is not associated with any url.")) + (luwak-open-url url (plist-get luwak-data :no-tor)))) (defun luwak-follow-link (marker) (let ((url (get-text-property marker 'url))) @@ -225,6 +226,19 @@ When non-nill, swap the tor-switch in prefix-arg effect." (funcall luwak-render-link-function i url) (setq i (1+ i))))))) +(defun luwak-render-buffer () + "Render the current buffer in luwak mode." + (interactive) + (let ((dump (buffer-string))) + (with-current-buffer (get-buffer-create luwak-buffer) + (luwak-open-internal + nil + dump + (or (plist-get luwak-data :history-pos) 0) + (or (plist-get luwak-data :no-tor) + (xor luwak-tor-switch current-prefix-arg))) + (luwak-add-to-history)))) + (defun luwak-render-link-forward-sexp (idx url) "Render a link using forward-sexp." (when (re-search-forward (format "\\[%d\\]" idx) nil t) -- cgit v1.2.3