Gnus development mailing list
 help / color / mirror / Atom feed
From: Reiner Steib <4.uce.03.r.s@nurfuerspam.de>
Subject: Re: gnus-url-mailto broken on foo+bar@somewhere.invalid
Date: Wed, 27 Aug 2003 15:22:28 +0200	[thread overview]
Message-ID: <v9brub5j6z.fsf@marauder.physik.uni-ulm.de> (raw)
In-Reply-To: <m3wud0uwkk.fsf@hamster.pflaesterer.de>

On Tue, Aug 26 2003, Karl Pflästerer wrote:

>     ;; Fixme: Do it like QP.
>     (defun gnus-url-unhex-string (str &optional allow-newlines)
>       "Remove %XX, embedded spaces, etc in a url.
>     If optional second argument ALLOW-NEWLINES is non-nil, then allow the
>     decoding of carriage returns and line feeds in the string, which is normally
>     forbidden in URL encoding."

JFTR: Beside in `gnus-url-mailto' and in `gnus-url-parse-query-string'
(that is only used in `gnus-url-mailto'), `gnus-url-unhex-string' is
only used for info and customize URLs.  It's never used for http URLs.
Ah, there's one occurance in `nnwfm.el'[2], which is not mentioned in
the manual.

>       (setq str (or (mm-subst-char-in-string ?+ ?  str) "")) ; why `or'?
>
> Two questions?
> (a) What's meant with the comment?

ShengHuo[1] changed the line like this:

-  (setq str (or str ""))
+  (setq str (or (mm-subst-char-in-string ?+ ?  str) ""))

Wild guess: No error if `str' is nil?  The comment was added later; I
couldn't find a ChangeLog entry for it.

> (b) What is the substitution good for?

The reason AFAICS are info URLs like <info://gnus/Starting+Up>.  It
has been introduced along with this ChangeLog entry (see patch
below[1]):

,----[ 1 ]
| 2001-08-17 22:00:00  ShengHuo ZHU  <zsh@cs.rochester.edu>
| 
| 	* gnus.el (gnus-info-find-node): Take an argument.
| 
| 	* gnus-art.el (gnus-button-handle-info): New function.
| 	(gnus-url-unhex-string): Replace "+" with " ".
`----

Bye, Reiner.

[1]
--8<---------------cut here---------------start------------->8---
--- gnus-art.el.~6.103~	Tue Aug 26 21:12:16 2003
+++ gnus-art.el.~6.104~	Tue Aug 26 21:07:59 2003
@@ -4697,7 +4697,7 @@
 
 ;;; Internal Variables:
 
-(defcustom gnus-button-url-regexp "[...]mailto\\):[...]"
+(defcustom gnus-button-url-regexp "[...]mailto\\|info\\):[...]"
   "Regular expression that matches URLs."
   :group 'gnus-article-buttons
   :type 'regexp)
@@ -4716,6 +4716,9 @@
     ("\\(<URL: *\\)mailto: *\\([^> \n\t]+\\)>" 0 t gnus-url-mailto 2)
     ("mailto:\\([-a-zA-Z.@_+0-9%=?]+\\)" 0 t gnus-url-mailto 1)
     ("\\bmailto:\\([^ \n\t]+\\)" 0 t gnus-url-mailto 1)
+    ;; This is info
+    ("\\binfo:\\(//\\)?\\([^'\">\n\t ]+\\)" 0 t
+     gnus-button-handle-info 2)
     ;; This is how URLs _should_ be embedded in text...
     ("<URL: *\\([^<>]*\\)>" 0 t gnus-button-embedded-url 1)
     ;; Raw URLs.
@@ -5086,6 +5089,18 @@
      (group
       (gnus-button-fetch-group url)))))
 
+(defun gnus-button-handle-info (url)
+  "Fetch an info URL."
+  (if (string-match 
+       "^\\([^:/]+\\)?/\\(.*\\)"
+       url)
+      (gnus-info-find-node
+       (concat "(" (or (gnus-url-unhex-string (match-string 1 url))
+		       "Gnus") 
+	       ")" 
+	       (gnus-url-unhex-string (match-string 2 url))))
+    (error "Can't parse %s" url)))
+
 (defun gnus-button-message-id (message-id)
   "Fetch MESSAGE-ID."
   (save-excursion
@@ -5142,7 +5157,7 @@
 If optional second argument ALLOW-NEWLINES is non-nil, then allow the
 decoding of carriage returns and line feeds in the string, which is normally
 forbidden in URL encoding."
-  (setq str (or str ""))
+  (setq str (or (mm-subst-char-in-string ?+ ?  str) ""))
   (let ((tmp "")
 	(case-fold-search t))
     (while (string-match "%[0-9a-f][0-9a-f]" str)
--8<---------------cut here---------------end--------------->8---

[2] ;;; nnwfm.el --- interfacing with a web forum
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo--- PGP key available via WWW   http://rsteib.home.pages.de/




  reply	other threads:[~2003-08-27 13:22 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-26 16:52 Reiner Steib
2003-08-26 18:05 ` Karl Pflästerer
2003-08-27 13:22   ` Reiner Steib [this message]
2003-08-27 14:43     ` Karl Pflästerer
2003-08-26 21:37 ` Jesper Harder
2003-08-27 11:42   ` Benjamin Riefenstahl
2003-08-27 13:57     ` Reiner Steib
2003-08-27 14:53       ` Jesper Harder
2003-08-27 17:37         ` Kai Großjohann
2003-08-27 18:33           ` Jesper Harder
2003-09-04  1:59       ` Jesper Harder
2003-09-04 13:15         ` Reiner Steib
2003-09-04 15:32           ` Jesper Harder
2003-09-04 16:10             ` Simon Josefsson
2003-09-04 16:53               ` Reloading info files (was: gnus-url-mailto broken on foo+bar@somewhere.invalid) Reiner Steib
2003-09-05 21:58                 ` Reloading info files Kevin Ryde
2003-09-04 17:43               ` gnus-url-mailto broken on foo+bar@somewhere.invalid Jesper Harder
2003-09-04 22:42                 ` Simon Josefsson
2003-09-04 21:46 ` Frank Schmitt
2003-09-05  1:34   ` Jesper Harder
2003-09-05  7:33     ` Frank Schmitt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=v9brub5j6z.fsf@marauder.physik.uni-ulm.de \
    --to=4.uce.03.r.s@nurfuerspam.de \
    --cc=reiner.steib@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).