Gnus development mailing list
 help / color / mirror / Atom feed
* gnus-cited-lines-visible
@ 1999-01-28 19:22 Michael Cook
  1999-01-28 20:52 ` gnus-cited-lines-visible Michael Welsh Duggan
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Cook @ 1999-01-28 19:22 UTC (permalink / raw)


Here's a patch that lets you set `gnus-cited-lines-visible' to a
pair of numbers--how many lines at the top and bottom of the cited
text to remain visible.  (Previously, gnus-cited-lines-visible would
be only a single integer--how many lines at the top only.)

I suspect the defcustom declaration is wrong, now, because it says
`integer' only.  Anybody know offhand what it /should/ say?

--- lisp/gnus-cite.el.~1~	Sat Jan 23 09:30:39 1999
+++ lisp/gnus-cite.el	Thu Jan 28 14:17:44 1999
@@ -58,7 +58,9 @@
   :type 'string)
 
 (defcustom gnus-cited-lines-visible nil
-  "The number of lines of hidden cited text to remain visible."
+  "The number of lines of hidden cited text to remain visible.
+Or a pair of numbers which are the number of lines at the top
+and bottom of the text, respectively, to remain visible."
   :group 'gnus-cite
   :type '(choice (const :tag "none" nil)
 		 integer))
@@ -486,10 +488,18 @@
 	  ;; Skip past lines we want to leave visible.
 	  (when (and beg end gnus-cited-lines-visible)
 	    (goto-char beg)
-	    (forward-line gnus-cited-lines-visible)
+	    (forward-line (if (listp gnus-cited-lines-visible)
+			      (car gnus-cited-lines-visible)
+			    gnus-cited-lines-visible))
 	    (if (>= (point) end)
 		(setq beg nil)
-	      (setq beg (point-marker))))
+	      (setq beg (point-marker))
+	      (when (listp gnus-cited-lines-visible)
+		(goto-char end)
+		(forward-line (- (cadr gnus-cited-lines-visible)))
+		(if (<= (point) beg)
+		    (setq beg nil)
+		  (setq end (point-marker))))))
 	  (when (and beg end)
 	    ;; We use markers for the end-points to facilitate later
 	    ;; wrapping and mangling of text.

M.


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

* Re: gnus-cited-lines-visible
  1999-01-28 19:22 gnus-cited-lines-visible Michael Cook
@ 1999-01-28 20:52 ` Michael Welsh Duggan
  1999-01-28 21:20   ` gnus-cited-lines-visible Michael Cook
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Welsh Duggan @ 1999-01-28 20:52 UTC (permalink / raw)



Michael Cook <cook@sightpath.com> writes:

> Here's a patch that lets you set `gnus-cited-lines-visible' to a
> pair of numbers--how many lines at the top and bottom of the cited
> text to remain visible.  (Previously, gnus-cited-lines-visible would
> be only a single integer--how many lines at the top only.)
> 
> I suspect the defcustom declaration is wrong, now, because it says
> `integer' only.  Anybody know offhand what it /should/ say?

Since you used a list rather than a cons:

    :type '(choice (const :tag "none" nil)
                   integer
                   (list integer integer))

If you had used a cons:
    
    :type '(choice (const :tag "none" nil)
                   integer
                   (cons integer integer))

-- 
Michael Duggan
(md5i@cs.cmu.edu)
.



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

* Re: gnus-cited-lines-visible
  1999-01-28 20:52 ` gnus-cited-lines-visible Michael Welsh Duggan
@ 1999-01-28 21:20   ` Michael Cook
  1999-01-29  9:31     ` gnus-cited-lines-visible Per Abrahamsen
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Cook @ 1999-01-28 21:20 UTC (permalink / raw)
  Cc: ding

Michael Welsh Duggan <md5i@cs.cmu.edu> writes:

> If you had used a cons:
> 
>     :type '(choice (const :tag "none" nil)
>                    integer
>                    (cons integer integer))

Thanks.  Here's an updated patch, including a switch to cons.

--- gnus-cite.el.~1~	Sat Jan 23 09:30:39 1999
+++ gnus-cite.el	Thu Jan 28 16:16:16 1999
@@ -58,10 +58,13 @@
   :type 'string)
 
 (defcustom gnus-cited-lines-visible nil
-  "The number of lines of hidden cited text to remain visible."
+  "The number of lines of hidden cited text to remain visible.
+Or a pair (cons) of numbers which are the number of lines at the top
+and bottom of the text, respectively, to remain visible."
   :group 'gnus-cite
   :type '(choice (const :tag "none" nil)
-		 integer))
+		 integer
+		 (cons integer integer)))
 
 (defcustom gnus-cite-parse-max-size 25000
   "Maximum article size (in bytes) where parsing citations is allowed.
@@ -486,10 +489,18 @@
 	  ;; Skip past lines we want to leave visible.
 	  (when (and beg end gnus-cited-lines-visible)
 	    (goto-char beg)
-	    (forward-line gnus-cited-lines-visible)
+	    (forward-line (if (consp gnus-cited-lines-visible)
+			      (car gnus-cited-lines-visible)
+			    gnus-cited-lines-visible))
 	    (if (>= (point) end)
 		(setq beg nil)
-	      (setq beg (point-marker))))
+	      (setq beg (point-marker))
+	      (when (consp gnus-cited-lines-visible)
+		(goto-char end)
+		(forward-line (- (cdr gnus-cited-lines-visible)))
+		(if (<= (point) beg)
+		    (setq beg nil)
+		  (setq end (point-marker))))))
 	  (when (and beg end)
 	    ;; We use markers for the end-points to facilitate later
 	    ;; wrapping and mangling of text.

M.


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

* Re: gnus-cited-lines-visible
  1999-01-28 21:20   ` gnus-cited-lines-visible Michael Cook
@ 1999-01-29  9:31     ` Per Abrahamsen
  1999-01-29 16:05       ` gnus-cited-lines-visible Michael Cook
  0 siblings, 1 reply; 5+ messages in thread
From: Per Abrahamsen @ 1999-01-29  9:31 UTC (permalink / raw)


Michael Cook <cook@sightpath.com> writes:

>    :type '(choice (const :tag "none" nil)
> -		 integer))
> +		 integer
> +		 (cons integer integer)))

You should probably provide some :tag or :menu-tag for the later two
choices, the default tags `integer' and `cons' doesn't really tell you
much.


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

* Re: gnus-cited-lines-visible
  1999-01-29  9:31     ` gnus-cited-lines-visible Per Abrahamsen
@ 1999-01-29 16:05       ` Michael Cook
  0 siblings, 0 replies; 5+ messages in thread
From: Michael Cook @ 1999-01-29 16:05 UTC (permalink / raw)
  Cc: ding

Per Abrahamsen <abraham@dina.kvl.dk> writes:

> Michael Cook <cook@sightpath.com> writes:
> 
> >    :type '(choice (const :tag "none" nil)
> > -		 integer))
> > +		 integer
> > +		 (cons integer integer)))
> 
> You should probably provide some :tag or :menu-tag for the later two
> choices, the default tags `integer' and `cons' doesn't really tell you
> much.

Okay.  These tags seem to be pretty terse.  How about:

   (cons :tag "Top and Bottom" integer integer)))

Here's an updated patch:

--- gnus-cite.el.~1~	Sat Jan 23 09:30:39 1999
+++ gnus-cite.el	Fri Jan 29 11:03:56 1999
@@ -58,10 +58,13 @@
   :type 'string)
 
 (defcustom gnus-cited-lines-visible nil
-  "The number of lines of hidden cited text to remain visible."
+  "The number of lines of hidden cited text to remain visible.
+Or a pair (cons) of numbers which are the number of lines at the top
+and bottom of the text, respectively, to remain visible."
   :group 'gnus-cite
   :type '(choice (const :tag "none" nil)
-		 integer))
+		 integer
+		 (cons :tag "Top and Bottom" integer integer)))
 
 (defcustom gnus-cite-parse-max-size 25000
   "Maximum article size (in bytes) where parsing citations is allowed.
@@ -486,10 +489,18 @@
 	  ;; Skip past lines we want to leave visible.
 	  (when (and beg end gnus-cited-lines-visible)
 	    (goto-char beg)
-	    (forward-line gnus-cited-lines-visible)
+	    (forward-line (if (consp gnus-cited-lines-visible)
+			      (car gnus-cited-lines-visible)
+			    gnus-cited-lines-visible))
 	    (if (>= (point) end)
 		(setq beg nil)
-	      (setq beg (point-marker))))
+	      (setq beg (point-marker))
+	      (when (consp gnus-cited-lines-visible)
+		(goto-char end)
+		(forward-line (- (cdr gnus-cited-lines-visible)))
+		(if (<= (point) beg)
+		    (setq beg nil)
+		  (setq end (point-marker))))))
 	  (when (and beg end)
 	    ;; We use markers for the end-points to facilitate later
 	    ;; wrapping and mangling of text.

M.


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

end of thread, other threads:[~1999-01-29 16:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-01-28 19:22 gnus-cited-lines-visible Michael Cook
1999-01-28 20:52 ` gnus-cited-lines-visible Michael Welsh Duggan
1999-01-28 21:20   ` gnus-cited-lines-visible Michael Cook
1999-01-29  9:31     ` gnus-cited-lines-visible Per Abrahamsen
1999-01-29 16:05       ` gnus-cited-lines-visible Michael Cook

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