Gnus development mailing list
 help / color / mirror / Atom feed
* Better definition for `gnus-article-refer-article'
@ 2003-02-19 21:41 Karl Pflästerer
  2003-02-20 10:06 ` Kai Großjohann
  0 siblings, 1 reply; 10+ messages in thread
From: Karl Pflästerer @ 2003-02-19 21:41 UTC (permalink / raw)


Hi,
I noticed that the buttons react at the moment smarter if you press them
at a message-id in the article buffer than `gnus-article-refer-article'.
I looked at the definition for that function and wrote it a bit
different. What do you mean? IMO I must have forgotten something because
it seems to easy. I don't think it's necessary to check if we have a
message-id around point because a user would only use that function for
a message-id.

(defun gnus-article-refer-article ()
  "Read article specified by message-id around point."
  (interactive)
  (let ((point (point)) message-id)
    (re-search-backward "<?news:\\|<" nil t)
    (cond ((re-search-forward gnus-button-mid-or-mail-regexp nil t)
	    (setq message-id (concat "<" (match-string 0) ">"))
	    (goto-char point)
	    (set-buffer gnus-summary-buffer)
	    (gnus-summary-refer-article message-id))
	  (t
	    (goto-char point)
	    (error "No references around point")))))

bye
   KP

-- 
    'Twas brillig, and the slithy toves
        Did gyre and gimble in the wabe;
    All mimsy were the borogoves,
         And the mome raths outgrabe.   "Lewis Carroll" "Jabberwocky"



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

* Re: Better definition for `gnus-article-refer-article'
  2003-02-19 21:41 Better definition for `gnus-article-refer-article' Karl Pflästerer
@ 2003-02-20 10:06 ` Kai Großjohann
  2003-02-20 13:08   ` Karl Pflästerer
  0 siblings, 1 reply; 10+ messages in thread
From: Kai Großjohann @ 2003-02-20 10:06 UTC (permalink / raw)


sigurd@12move.de (Karl Pflästerer) writes:

> I noticed that the buttons react at the moment smarter if you press them
> at a message-id in the article buffer than `gnus-article-refer-article'.
> I looked at the definition for that function and wrote it a bit
> different. What do you mean? IMO I must have forgotten something because
> it seems to easy. I don't think it's necessary to check if we have a
> message-id around point because a user would only use that function for
> a message-id.
>
> (defun gnus-article-refer-article ()
>   "Read article specified by message-id around point."
>   (interactive)
>   (let ((point (point)) message-id)
>     (re-search-backward "<?news:\\|<" nil t)
>     (cond ((re-search-forward gnus-button-mid-or-mail-regexp nil t)
> 	    (setq message-id (concat "<" (match-string 0) ">"))
> 	    (goto-char point)
> 	    (set-buffer gnus-summary-buffer)
> 	    (gnus-summary-refer-article message-id))
> 	  (t
> 	    (goto-char point)
> 	    (error "No references around point")))))

In principle, it's a good idea.  There could be a problem, though.
Have you tried it on buttons looking like <foo@bar.baz>?  I think it
might set message-id to something like <<foo@bar.baz>> -- one set of
angle brackets too many.
-- 
A preposition is not a good thing to end a sentence with.



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

* Re: Better definition for `gnus-article-refer-article'
  2003-02-20 10:06 ` Kai Großjohann
@ 2003-02-20 13:08   ` Karl Pflästerer
  2003-02-21 17:59     ` Proposed patch (was: Better definition for `gnus-article-refer-article') Karl Pflästerer
  0 siblings, 1 reply; 10+ messages in thread
From: Karl Pflästerer @ 2003-02-20 13:08 UTC (permalink / raw)


Kai Großjohann <- kai.grossjohann@uni-duisburg.de wrote:

> In principle, it's a good idea.  There could be a problem, though.
> Have you tried it on buttons looking like <foo@bar.baz>?  I think it

Yes.

> might set message-id to something like <<foo@bar.baz>> -- one set of
> angle brackets too many.

No that doesn't happen. I have another IMO better definition of the
function here. I think it is enough to search on the line where point
is.

(defun gnus-article-refer-article ()
  "Read article specified by message-id around point."
  (interactive)
  (save-excursion
    (re-search-backward "<?news:\\|<" (point-at-bol) t)
    (cond ((re-search-forward
	    gnus-button-mid-or-mail-regexp (point-at-eol) t)
	    (let ((msg-id (concat "<" (match-string 0) ">")))
	      (set-buffer gnus-summary-buffer)
	      (gnus-summary-refer-article msg-id)))
	  (t
	    (error "No references around point")))))

A check for already existing angle brackets would be possible but IMO it
is not necessary. I tried some message ids and saw no expresssion where
there brackets get caught by `match-string'.

bye
   KP

-- 
'Twas brillig, and the slithy toves
    Did gyre and gimble in the wabe;
  All mimsy were the borogoves,
   And the mome raths outgrabe.   "Lewis Carroll" "Jabberwocky"



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

* Proposed patch (was: Better definition for `gnus-article-refer-article')
  2003-02-20 13:08   ` Karl Pflästerer
@ 2003-02-21 17:59     ` Karl Pflästerer
  2003-02-21 21:12       ` Proposed patch Kai Großjohann
  2003-02-22 13:31       ` Kai Großjohann
  0 siblings, 2 replies; 10+ messages in thread
From: Karl Pflästerer @ 2003-02-21 17:59 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 140 bytes --]

On Thu, 20 Feb 2003, Karl Pflästerer <- sigurd@12move.de wrote:

As noone yells I think I'll propose a patch for `gnus-art.el'. Here it
is:

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Patch for gnus-art.el --]
[-- Type: text/x-patch, Size: 1273 bytes --]

Index: gnus-art.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/gnus-art.el,v
retrieving revision 6.298
diff -u -r6.298 gnus-art.el
--- gnus-art.el	21 Feb 2003 13:35:05 -0000	6.298
+++ gnus-art.el	21 Feb 2003 18:09:13 -0000
@@ -4772,15 +4772,15 @@
 (defun gnus-article-refer-article ()
   "Read article specified by message-id around point."
   (interactive)
-  (let ((point (point)))
-    (search-forward ">" nil t)		;Move point to end of "<....>".
-    (if (re-search-backward "\\(<[^<> \t\n]+>\\)" nil t)
-	(let ((message-id (gnus-replace-in-string (match-string 1) "<news:" "<" )))
-	  (goto-char point)
-	  (set-buffer gnus-summary-buffer)
-	  (gnus-summary-refer-article message-id))
-      (goto-char (point))
-      (error "No references around point"))))
+  (save-excursion
+    (re-search-backward "<?news:\\|<" (point-at-bol) t)
+    (cond ((re-search-forward
+	    gnus-button-mid-or-mail-regexp (point-at-eol) t)
+	    (let ((msg-id (concat "<" (match-string 0) ">")))
+	      (set-buffer gnus-summary-buffer)
+	      (gnus-summary-refer-article msg-id)))
+	  (t
+	    (error "No references around point")))))
 
 (defun gnus-article-show-summary ()
   "Reconfigure windows to show summary buffer."

[-- Attachment #3: Type: text/plain, Size: 325 bytes --]


Please tell me if you also need something for the changelog.

bye
   KP

-- 
Der wahre Weltuntergang ist die Vernichtung des Geistes, der andere hängt von
dem gleichgiltigen Versuch ab, ob nach der Vernichtung des Geistes noch eine
Welt bestehen kann.
                   Karl Kraus 'Untergang der Welt durch schwarze Magie'

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

* Re: Proposed patch
  2003-02-21 17:59     ` Proposed patch (was: Better definition for `gnus-article-refer-article') Karl Pflästerer
@ 2003-02-21 21:12       ` Kai Großjohann
  2003-02-21 21:58         ` Karl Pflästerer
  2003-02-21 22:02         ` Karl Pflästerer
  2003-02-22 13:31       ` Kai Großjohann
  1 sibling, 2 replies; 10+ messages in thread
From: Kai Großjohann @ 2003-02-21 21:12 UTC (permalink / raw)


sigurd@12move.de (Karl Pflästerer) writes:

> Please tell me if you also need something for the changelog.

I think the patch is short enough so it doesn't need paperwork.  But
I don't know what to write.  In your original message, you said that
"Gnus reacts smarter", but I don't know what it means :-)

So in what way is it now smarter than before?
-- 
A preposition is not a good thing to end a sentence with.



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

* Re: Proposed patch
  2003-02-21 21:12       ` Proposed patch Kai Großjohann
@ 2003-02-21 21:58         ` Karl Pflästerer
  2003-03-01 22:48           ` Jesper Harder
  2003-02-21 22:02         ` Karl Pflästerer
  1 sibling, 1 reply; 10+ messages in thread
From: Karl Pflästerer @ 2003-02-21 21:58 UTC (permalink / raw)


Kai Großjohann <- kai.grossjohann@uni-duisburg.de wrote:

> I think the patch is short enough so it doesn't need paperwork.  But
> I don't know what to write.  In your original message, you said that
> "Gnus reacts smarter", but I don't know what it means :-)

> So in what way is it now smarter than before?

Before if you wanted to use `gnus-article-refer-article' on message-ids
*without* »<>« that didn't work (allthough the button worked). That was
a situation I didn't like as I like to do nearly everything with the
keyboard. Now message-ids like
    o news:foo.bar@baz.bat (which is a correct URI)
can also be searched with `C-c ^'. Try it at the moment it is not
possible. e.g.
    o <m3of55tt40.fsf@hamster.pflaesterer.de> against
    o <news:m3of55tt40.fsf@hamster.pflaesterer.de> against
    o news:<m3of55tt40.fsf@hamster.pflaesterer.de>
      (incorrect but can often be seen) against
    o news:84d6lls5gk.fsf@lucy.is.informatik.uni-duisburg.de


With the last URI the actual code won't find that article but always
uses the URIs with »<>« (it also happens that the actual code trys to
use the email-address from the attribution-line instead of the
Message-id because of the same reason (no »<>« surrounding the
message-id)).

bye
   KP

-- 
 `Beware the Jabberwock, my son!
     The jaws that bite, the claws that catch!
  Beware the Jubjub bird, and shun
    The frumious Bandersnatch!'   "Lewis Carroll" "Jabberwocky"



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

* Re: Proposed patch
  2003-02-21 21:12       ` Proposed patch Kai Großjohann
  2003-02-21 21:58         ` Karl Pflästerer
@ 2003-02-21 22:02         ` Karl Pflästerer
  2003-02-22 10:38           ` Kai Großjohann
  1 sibling, 1 reply; 10+ messages in thread
From: Karl Pflästerer @ 2003-02-21 22:02 UTC (permalink / raw)


Kai Großjohann <- kai.grossjohann@uni-duisburg.de wrote:

> I think the patch is short enough so it doesn't need paperwork.  But

BTW
Where is the threshhold? If it isn't a great affair I'll sign papers so
that for the future (perhaps I write another piece of code) everything
is correct.

bye
   KP

-- 
            One, two!  One, two!  And through and through
                 The vorpal blade went snicker-snack!
          He left it dead, and with its head
                He went galumphing back.   "Lewis Carroll" "Jabberwocky"



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

* Re: Proposed patch
  2003-02-21 22:02         ` Karl Pflästerer
@ 2003-02-22 10:38           ` Kai Großjohann
  0 siblings, 0 replies; 10+ messages in thread
From: Kai Großjohann @ 2003-02-22 10:38 UTC (permalink / raw)


sigurd@12move.de (Karl Pflästerer) writes:

> Kai Großjohann <- kai.grossjohann@uni-duisburg.de wrote:
>
>> I think the patch is short enough so it doesn't need paperwork.  But
>
> BTW
> Where is the threshhold?

Ten lines or so.

> If it isn't a great affair I'll sign papers so that for the future
> (perhaps I write another piece of code) everything is correct.

Very good!  I'll send you a form.
-- 
A preposition is not a good thing to end a sentence with.



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

* Re: Proposed patch
  2003-02-21 17:59     ` Proposed patch (was: Better definition for `gnus-article-refer-article') Karl Pflästerer
  2003-02-21 21:12       ` Proposed patch Kai Großjohann
@ 2003-02-22 13:31       ` Kai Großjohann
  1 sibling, 0 replies; 10+ messages in thread
From: Kai Großjohann @ 2003-02-22 13:31 UTC (permalink / raw)


I've now committed the most recent version.  Thanks!
-- 
A preposition is not a good thing to end a sentence with.



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

* Re: Proposed patch
  2003-02-21 21:58         ` Karl Pflästerer
@ 2003-03-01 22:48           ` Jesper Harder
  0 siblings, 0 replies; 10+ messages in thread
From: Jesper Harder @ 2003-03-01 22:48 UTC (permalink / raw)


sigurd@12move.de (Karl Pflästerer) writes:

> Before if you wanted to use `gnus-article-refer-article' on message-ids
> *without* »<>« that didn't work (allthough the button worked). That was
> a situation I didn't like as I like to do nearly everything with the
> keyboard. Now message-ids like
>     o news:foo.bar@baz.bat (which is a correct URI)
> can also be searched with `C-c ^'. Try it at the moment it is not
> possible. e.g.
>     o <m3of55tt40.fsf@hamster.pflaesterer.de> against
>     o <news:m3of55tt40.fsf@hamster.pflaesterer.de> against
>     o news:<m3of55tt40.fsf@hamster.pflaesterer.de>
>       (incorrect but can often be seen) against
>     o news:84d6lls5gk.fsf@lucy.is.informatik.uni-duisburg.de

I found a couple of problems with it:

  * I think `gnus-button-mid-or-mail-regexp' is too restrictive.  It's
    okay for automatic buttonizing, but when the user calls
    `gnus-article-refer-article' interactively, we shouldn't insist that
    the TLD is valid.  E.g. these don't work:

      <m3adh6bvr0.fsf@troodon.localdomain>

      <news:m3adh6bvr0.fsf@troodon.localdomain>

      m3adh6bvr0.fsf@troodon.localdomain

   
   * It sometimes fails for a plain msg-id with no brackets or "news:",
     e.g. place point after the "@" and press `C-c ^' there:

      m3of55tt40.fsf@hamster.pflaesterer.de

I've checked in another version.  It appears to work for all the
examples in this message -- but shout up if you find an example where it
fails.



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

end of thread, other threads:[~2003-03-01 22:48 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-19 21:41 Better definition for `gnus-article-refer-article' Karl Pflästerer
2003-02-20 10:06 ` Kai Großjohann
2003-02-20 13:08   ` Karl Pflästerer
2003-02-21 17:59     ` Proposed patch (was: Better definition for `gnus-article-refer-article') Karl Pflästerer
2003-02-21 21:12       ` Proposed patch Kai Großjohann
2003-02-21 21:58         ` Karl Pflästerer
2003-03-01 22:48           ` Jesper Harder
2003-02-21 22:02         ` Karl Pflästerer
2003-02-22 10:38           ` Kai Großjohann
2003-02-22 13:31       ` Kai Großjohann

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).