diff --git a/oni/home/services/emacs/oni-dashboard.el b/oni/home/services/emacs/oni-dashboard.el index b08be37..85a5608 100644 --- a/oni/home/services/emacs/oni-dashboard.el +++ b/oni/home/services/emacs/oni-dashboard.el @@ -43,21 +43,30 @@ (dashboard-insert-heading "Today's Wiki page:" "w") (insert "\n ") (dashboard-insert-shortcut 'random-wiki-page "w" "Today's Wiki page:") - (let ((info (with-current-buffer (url-retrieve-synchronously "https://www.emacswiki.org/emacs?action=random") - (prog1 (cons (url-recreate-url url-current-object) - (progn - (search-forward "") - (let ((beginning (point))) - (search-forward "") - (forward-char -8) - (buffer-substring-no-properties beginning (point))))) - (kill-buffer))))) - (message "Got: %s" info) - (widget-create 'url-link - :format (format "%%[%s%%]" (cdr info)) - :button-suffix "" - :button-prefix "" - (car info)))) + (let ((text-beginning-marker (point-marker))) + (insert "Loading...") + (url-retrieve "https://www.emacswiki.org/emacs?action=random" + (lambda (&rest _args) + (let ((info (prog1 (cons (url-recreate-url url-current-object) + (progn + (search-forward "") + (let ((beginning (point))) + (search-forward "") + (forward-char -8) + (buffer-substring-no-properties beginning (point))))) + (kill-buffer)))) + (with-current-buffer (marker-buffer text-beginning-marker) + (let ((inhibit-read-only t)) + (save-excursion + (goto-char (marker-position text-beginning-marker)) + (delete-char 10) + (widget-create 'url-link + :format (format "%%[%s%%]" (cdr info)) + :button-suffix "" + :button-prefix "" + (car info))))))) + nil + t))) (add-to-list 'dashboard-item-generators '(random-wiki-page . oni-dashboard-insert-random-wiki-page)) (add-to-list 'dashboard-items '(random-wiki-page))