Hi, I have configured Gnus to try to display mail with the `text/plain` version if available. A lot of mail happens to have very long URLs that I would like to shorten while displaying them in the Article buffer. It would be great if there is something in Gnus that does this already. Is there any function to wash the article buffer and shorten the text displayed for URL present in it? Best, -- Narendra Joshi _______________________________________________ info-gnus-english mailing list info-gnus-english@gnu.org https://lists.gnu.org/mailman/listinfo/info-gnus-english
Narendra Joshi wrote: > I have configured Gnus to try to display mail with > the `text/plain` version if available. > > A lot of mail happens to have very long URLs that > I would like to shorten while displaying them in > the Article buffer. It would be great if there is > something in Gnus that does this already. Is there > any function to wash the article buffer and shorten > the text displayed for URL present in it? Don't know but search here: https://www.gnu.org/software/emacs/manual/html_node/gnus/Article-Washing.html https://www.gnu.org/software/emacs/manual/html_node/gnus/Customizing-Articles.html https://www.gnu.org/software/emacs/manual/html_node/gnus/Article-Buttons.html -- underground experts united http://user.it.uu.se/~embe8573 https://dataswamp.org/~incal _______________________________________________ info-gnus-english mailing list info-gnus-english@gnu.org https://lists.gnu.org/mailman/listinfo/info-gnus-english
>>>>> Narendra Joshi <narendraj9@gmail.com> writes: > Hi, I have configured Gnus to try to display mail with the > `text/plain` version if available. > A lot of mail happens to have very long URLs that I would like to > shorten while displaying them in the Article buffer. It would be > great if there is something in Gnus that does this already. Is > there any function to wash the article buffer and shorten the text > displayed for URL present in it? There's https://www.emacswiki.org/emacs/TinyUrl. -- Colin Baxter URL: http://www.Colin-Baxter.com _______________________________________________ info-gnus-english mailing list info-gnus-english@gnu.org https://lists.gnu.org/mailman/listinfo/info-gnus-english
Colin Baxter wrote: >> Hi, I have configured Gnus to try to display mail >> with the `text/plain` version if available. >> >> A lot of mail happens to have very long URLs that >> I would like to shorten while displaying them in >> the Article buffer. It would be great if there is >> something in Gnus that does this already. Is there >> any function to wash the article buffer and >> shorten the text displayed for URL present in it? > > There's https://www.emacswiki.org/emacs/TinyUrl. And in MELPA: isgd 20150414.936 available melpa Shorten URLs using the isgd.com shortener service -- underground experts united http://user.it.uu.se/~embe8573 https://dataswamp.org/~incal _______________________________________________ info-gnus-english mailing list info-gnus-english@gnu.org https://lists.gnu.org/mailman/listinfo/info-gnus-english
[-- Attachment #1.1: Type: text/plain, Size: 1228 bytes --] I am looking for shortening the url using an external service. I would like the text displayed for the url to not take a lot of space. I have gone through the washing documentation but nothing seems to cover my use case. On Sat, 23 May 2020, 13:31 Emanuel Berg via info-gnus-english, < info-gnus-english@gnu.org> wrote: > Colin Baxter wrote: > > >> Hi, I have configured Gnus to try to display mail > >> with the `text/plain` version if available. > >> > >> A lot of mail happens to have very long URLs that > >> I would like to shorten while displaying them in > >> the Article buffer. It would be great if there is > >> something in Gnus that does this already. Is there > >> any function to wash the article buffer and > >> shorten the text displayed for URL present in it? > > > > There's https://www.emacswiki.org/emacs/TinyUrl. > > And in MELPA: > > isgd 20150414.936 available melpa > Shorten URLs using the isgd.com shortener service > > -- > underground experts united > http://user.it.uu.se/~embe8573 > https://dataswamp.org/~incal > > > _______________________________________________ > info-gnus-english mailing list > info-gnus-english@gnu.org > https://lists.gnu.org/mailman/listinfo/info-gnus-english > [-- Attachment #1.2: Type: text/html, Size: 2199 bytes --] [-- Attachment #2: Type: text/plain, Size: 162 bytes --] _______________________________________________ info-gnus-english mailing list info-gnus-english@gnu.org https://lists.gnu.org/mailman/listinfo/info-gnus-english
Narendra Joshi wrote: > I am looking for shortening the url using an > external service. I would like the text displayed > for the url to not take a lot of space. I have gone > through the washing documentation but nothing seems > to cover my use case. Check out the Emacs-wiki suggestion and the MELPA pack :) -- underground experts united http://user.it.uu.se/~embe8573 https://dataswamp.org/~incal _______________________________________________ info-gnus-english mailing list info-gnus-english@gnu.org https://lists.gnu.org/mailman/listinfo/info-gnus-english
Narendra Joshi <narendraj9@gmail.com> writes: > A lot of mail happens to have very long URLs that I would like to > shorten while displaying them in the Article buffer. It would be great > if there is something in Gnus that does this already. Is there any > function to wash the article buffer and shorten the text displayed for > URL present in it? Here are two functions that replace long URLs with the string "URL" and make them clickable (<ENTER>): (defun gnus-buttonize-and-shorten () (interactive) (progn (goto-char (point-min)) (while (re-search-forward "\\(https*://[-~_a-zA-Z0-9][-~_\\.a-zA-Z0-9/]*\\)" (point-max) t) (let* ((start (match-beginning 0)) (end (match-end 0))) (message "%d %d" start end) (goto-char start) (let ((thisurl (thing-at-point 'url))) (kill-region start end) (insert-text-button "URL" 'url thisurl 'action (lambda (btn) (browse-url (button-get btn 'url))) )) (goto-char (+ start 1)))))) (defun gnus-wash-long-urls () (interactive "") (gnus-summary-select-article) (gnus-eval-in-buffer-window gnus-article-buffer (let ((inhibit-read-only t)) (save-excursion (save-restriction (gnus-buttonize-and-shorten)))) (gnus-treat-article nil))) A better approach would be to use the button mechanism of Gnus and set the text to something different. But I did not find [1] any option to set the button text. [1] https://www.gnu.org/software/emacs/manual/html_node/gnus/Article-Buttons.html -- Christian Barthel <bch@online.de> _______________________________________________ info-gnus-english mailing list info-gnus-english@gnu.org https://lists.gnu.org/mailman/listinfo/info-gnus-english