* gnus-summary-toggle-header fails for body-less, boundary-less articles
@ 2002-02-19 19:28 Paul Jarc
2002-02-19 20:25 ` ShengHuo ZHU
2002-02-19 20:25 ` ShengHuo ZHU
0 siblings, 2 replies; 6+ messages in thread
From: Paul Jarc @ 2002-02-19 19:28 UTC (permalink / raw)
For an article which has no body and no empty line marking the end of
the header, gnus-summary-toggle-header fails in two ways. This line
finds the character position before the end of the buffer, instead of
the one at the end:
(setq e (1- (or (search-forward "\n\n" nil t) (point-max))))
This is easy enough to fix:
(setq e (search-forward "\n\n" nil t)
e (if e (1- e) (point-max)))
But it also fails to delete the header, so the added header:
(when (search-forward "\n\n" nil t)
(delete-region (point-min) (1- (point))))
This doesn't try to do anything for the no-boundary case, so I'm
wondering if that's intentional. Anyone know? Or should it just
delete all the way to (point-max) in this case?
paul
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: gnus-summary-toggle-header fails for body-less, boundary-less articles
2002-02-19 19:28 gnus-summary-toggle-header fails for body-less, boundary-less articles Paul Jarc
2002-02-19 20:25 ` ShengHuo ZHU
@ 2002-02-19 20:25 ` ShengHuo ZHU
1 sibling, 0 replies; 6+ messages in thread
From: ShengHuo ZHU @ 2002-02-19 20:25 UTC (permalink / raw)
[-- Attachment #1: Type: text/plain, Size: 854 bytes --]
prj@po.cwru.edu (Paul Jarc) writes:
> For an article which has no body and no empty line marking the end of
> the header, gnus-summary-toggle-header fails in two ways. This line
> finds the character position before the end of the buffer, instead of
> the one at the end:
> (setq e (1- (or (search-forward "\n\n" nil t) (point-max))))
> This is easy enough to fix:
> (setq e (search-forward "\n\n" nil t)
> e (if e (1- e) (point-max)))
> But it also fails to delete the header, so the added header:
> (when (search-forward "\n\n" nil t)
> (delete-region (point-min) (1- (point))))
> This doesn't try to do anything for the no-boundary case, so I'm
> wondering if that's intentional. Anyone know? Or should it just
> delete all the way to (point-max) in this case?
Does the attached patch fix the problem?
ShengHuo
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: gnus-sum.el.diff --]
[-- Type: text/x-patch, Size: 743 bytes --]
--- gnus-sum.el.~6.185.~ Mon Feb 18 08:46:11 2002
+++ gnus-sum.el Tue Feb 19 15:21:54 2002
@@ -8180,13 +8180,13 @@
(article-narrow-to-head)
(gnus-article-hidden-text-p 'headers))))
(goto-char (point-min))
- (when (search-forward "\n\n" nil t)
- (delete-region (point-min) (1- (point))))
- (goto-char (point-min))
+ (search-forward "\n\n" nil 'move)
+ (delete-region (point-min) (point))
(save-excursion
(set-buffer gnus-original-article-buffer)
(goto-char (point-min))
- (setq e (1- (or (search-forward "\n\n" nil t) (point-max)))))
+ (search-forward "\n\n" nil 'move)
+ (setq e (point)))
(insert-buffer-substring gnus-original-article-buffer 1 e)
(save-restriction
(narrow-to-region (point-min) (point))
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: gnus-summary-toggle-header fails for body-less, boundary-less articles
2002-02-19 19:28 gnus-summary-toggle-header fails for body-less, boundary-less articles Paul Jarc
@ 2002-02-19 20:25 ` ShengHuo ZHU
2002-02-19 20:33 ` Paul Jarc
2002-02-19 20:33 ` Paul Jarc
2002-02-19 20:25 ` ShengHuo ZHU
1 sibling, 2 replies; 6+ messages in thread
From: ShengHuo ZHU @ 2002-02-19 20:25 UTC (permalink / raw)
[-- Attachment #1: Type: text/plain, Size: 854 bytes --]
prj@po.cwru.edu (Paul Jarc) writes:
> For an article which has no body and no empty line marking the end of
> the header, gnus-summary-toggle-header fails in two ways. This line
> finds the character position before the end of the buffer, instead of
> the one at the end:
> (setq e (1- (or (search-forward "\n\n" nil t) (point-max))))
> This is easy enough to fix:
> (setq e (search-forward "\n\n" nil t)
> e (if e (1- e) (point-max)))
> But it also fails to delete the header, so the added header:
> (when (search-forward "\n\n" nil t)
> (delete-region (point-min) (1- (point))))
> This doesn't try to do anything for the no-boundary case, so I'm
> wondering if that's intentional. Anyone know? Or should it just
> delete all the way to (point-max) in this case?
Does the attached patch fix the problem?
ShengHuo
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: gnus-sum.el.diff --]
[-- Type: text/x-patch, Size: 743 bytes --]
--- gnus-sum.el.~6.185.~ Mon Feb 18 08:46:11 2002
+++ gnus-sum.el Tue Feb 19 15:21:54 2002
@@ -8180,13 +8180,13 @@
(article-narrow-to-head)
(gnus-article-hidden-text-p 'headers))))
(goto-char (point-min))
- (when (search-forward "\n\n" nil t)
- (delete-region (point-min) (1- (point))))
- (goto-char (point-min))
+ (search-forward "\n\n" nil 'move)
+ (delete-region (point-min) (point))
(save-excursion
(set-buffer gnus-original-article-buffer)
(goto-char (point-min))
- (setq e (1- (or (search-forward "\n\n" nil t) (point-max)))))
+ (search-forward "\n\n" nil 'move)
+ (setq e (point)))
(insert-buffer-substring gnus-original-article-buffer 1 e)
(save-restriction
(narrow-to-region (point-min) (point))
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: gnus-summary-toggle-header fails for body-less, boundary-less articles
2002-02-19 20:25 ` ShengHuo ZHU
@ 2002-02-19 20:33 ` Paul Jarc
2002-02-19 20:33 ` Paul Jarc
1 sibling, 0 replies; 6+ messages in thread
From: Paul Jarc @ 2002-02-19 20:33 UTC (permalink / raw)
ShengHuo ZHU <zsh@cs.rochester.edu> wrote:
> prj@po.cwru.edu (Paul Jarc) writes:
>> For an article which has no body and no empty line marking the end of
>> the header, gnus-summary-toggle-header fails in two ways.
...
> Does the attached patch fix the problem?
I committed a different version with the same behavior which I'd
already written. I just wasn't sure if this behavior was correct, but
I guess we'll hear about it if it isn't.
paul
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: gnus-summary-toggle-header fails for body-less, boundary-less articles
2002-02-19 20:25 ` ShengHuo ZHU
2002-02-19 20:33 ` Paul Jarc
@ 2002-02-19 20:33 ` Paul Jarc
1 sibling, 0 replies; 6+ messages in thread
From: Paul Jarc @ 2002-02-19 20:33 UTC (permalink / raw)
ShengHuo ZHU <zsh@cs.rochester.edu> wrote:
> prj@po.cwru.edu (Paul Jarc) writes:
>> For an article which has no body and no empty line marking the end of
>> the header, gnus-summary-toggle-header fails in two ways.
...
> Does the attached patch fix the problem?
I committed a different version with the same behavior which I'd
already written. I just wasn't sure if this behavior was correct, but
I guess we'll hear about it if it isn't.
paul
^ permalink raw reply [flat|nested] 6+ messages in thread
* gnus-summary-toggle-header fails for body-less, boundary-less articles
@ 2002-02-19 19:28 Paul Jarc
0 siblings, 0 replies; 6+ messages in thread
From: Paul Jarc @ 2002-02-19 19:28 UTC (permalink / raw)
For an article which has no body and no empty line marking the end of
the header, gnus-summary-toggle-header fails in two ways. This line
finds the character position before the end of the buffer, instead of
the one at the end:
(setq e (1- (or (search-forward "\n\n" nil t) (point-max))))
This is easy enough to fix:
(setq e (search-forward "\n\n" nil t)
e (if e (1- e) (point-max)))
But it also fails to delete the header, so the added header:
(when (search-forward "\n\n" nil t)
(delete-region (point-min) (1- (point))))
This doesn't try to do anything for the no-boundary case, so I'm
wondering if that's intentional. Anyone know? Or should it just
delete all the way to (point-max) in this case?
paul
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2002-02-19 20:33 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-19 19:28 gnus-summary-toggle-header fails for body-less, boundary-less articles Paul Jarc
2002-02-19 20:25 ` ShengHuo ZHU
2002-02-19 20:33 ` Paul Jarc
2002-02-19 20:33 ` Paul Jarc
2002-02-19 20:25 ` ShengHuo ZHU
2002-02-19 19:28 Paul Jarc
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).