Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
* How to shorten urls displayed in text version of mail in Gnus
@ 2020-05-22 20:59 Narendra Joshi
  2020-05-22 22:40 ` Emanuel Berg via info-gnus-english
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Narendra Joshi @ 2020-05-22 20:59 UTC (permalink / raw)
  To: info-gnus-english

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How to shorten urls displayed in text version of mail in Gnus
  2020-05-22 20:59 How to shorten urls displayed in text version of mail in Gnus Narendra Joshi
@ 2020-05-22 22:40 ` Emanuel Berg via info-gnus-english
  2020-05-23 11:13 ` Colin Baxter
       [not found] ` <mailman.67.1590181841.2541.info-gnus-english@gnu.org>
  2 siblings, 0 replies; 7+ messages in thread
From: Emanuel Berg via info-gnus-english @ 2020-05-22 22:40 UTC (permalink / raw)
  To: 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How to shorten urls displayed in text version of mail in Gnus
  2020-05-22 20:59 How to shorten urls displayed in text version of mail in Gnus Narendra Joshi
  2020-05-22 22:40 ` Emanuel Berg via info-gnus-english
@ 2020-05-23 11:13 ` Colin Baxter
  2020-05-23 11:31   ` Emanuel Berg via info-gnus-english
       [not found] ` <mailman.67.1590181841.2541.info-gnus-english@gnu.org>
  2 siblings, 1 reply; 7+ messages in thread
From: Colin Baxter @ 2020-05-23 11:13 UTC (permalink / raw)
  To: Narendra Joshi; +Cc: 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How to shorten urls displayed in text version of mail in Gnus
  2020-05-23 11:13 ` Colin Baxter
@ 2020-05-23 11:31   ` Emanuel Berg via info-gnus-english
  2020-05-23 11:35     ` Narendra Joshi
  0 siblings, 1 reply; 7+ messages in thread
From: Emanuel Berg via info-gnus-english @ 2020-05-23 11:31 UTC (permalink / raw)
  To: 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How to shorten urls displayed in text version of mail in Gnus
  2020-05-23 11:31   ` Emanuel Berg via info-gnus-english
@ 2020-05-23 11:35     ` Narendra Joshi
  2020-05-23 11:50       ` Emanuel Berg via info-gnus-english
  0 siblings, 1 reply; 7+ messages in thread
From: Narendra Joshi @ 2020-05-23 11:35 UTC (permalink / raw)
  To: Emanuel Berg, 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How to shorten urls displayed in text version of mail in Gnus
  2020-05-23 11:35     ` Narendra Joshi
@ 2020-05-23 11:50       ` Emanuel Berg via info-gnus-english
  0 siblings, 0 replies; 7+ messages in thread
From: Emanuel Berg via info-gnus-english @ 2020-05-23 11:50 UTC (permalink / raw)
  To: Narendra Joshi; +Cc: 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How to shorten urls displayed in text version of mail in Gnus
       [not found] ` <mailman.67.1590181841.2541.info-gnus-english@gnu.org>
@ 2020-05-23 17:39   ` Christian Barthel
  0 siblings, 0 replies; 7+ messages in thread
From: Christian Barthel @ 2020-05-23 17:39 UTC (permalink / raw)
  To: info-gnus-english; +Cc: Narendra Joshi

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-05-23 17:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-22 20:59 How to shorten urls displayed in text version of mail in Gnus Narendra Joshi
2020-05-22 22:40 ` Emanuel Berg via info-gnus-english
2020-05-23 11:13 ` Colin Baxter
2020-05-23 11:31   ` Emanuel Berg via info-gnus-english
2020-05-23 11:35     ` Narendra Joshi
2020-05-23 11:50       ` Emanuel Berg via info-gnus-english
     [not found] ` <mailman.67.1590181841.2541.info-gnus-english@gnu.org>
2020-05-23 17:39   ` Christian Barthel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).