vermiculus / sx.el

Stack Exchange for Emacs
http://stackapps.com/q/3950
709 stars 40 forks source link

inbox url links #345

Open Boruch-Baum opened 6 years ago

Boruch-Baum commented 6 years ago

Now that I have the notification inbox functioning, I see that it is displaying url links as raw html source. This is a visually annoiying bug, but how do you want to present it?

1) Do you already have a convention / method that you use elsewhere in the project?

2) Should the html info just be stripped and replaced with a propertized text string?

3) Should it be a "clickable link", and if so, how?

Boruch-Baum commented 6 years ago

I noticed now the error message "Viewing notifications is not yet implemented", generated by function sx-display. The following is a simple solution, adding a few lines to that function sx-display, but it's done without knowledge of any features of the API that might offer native features.

     (.notification_type
      (sx-message "Viewing notifications is not yet implemented")
      (let ((start 0))
       (while (string-match "\\(http[^\"]+\\)\"" .body start)
         (setq .link (match-string 1 .body))
         (setq start (match-end 0))))
      (browse-url .link))
vermiculus commented 6 years ago

It looks like the notification is indeed only available as straight-up HTML, so it looks like we'll have to deal with it on those terms.

I'll make code comments on #348.