Gnus development mailing list
 help / color / mirror / Atom feed
* [PATCH] message-elide-region.
@ 2002-04-23 11:28 Matthieu Moy
  2002-04-23 13:45 ` Kai Großjohann
  0 siblings, 1 reply; 5+ messages in thread
From: Matthieu Moy @ 2002-04-23 11:28 UTC (permalink / raw)


Hi ! 

You  all should  know the  C-c  C-e shortcut  to elide  a region  when
replying. 

it works when the region is a set of full lines, but if I call it with
regions beginning in the middle of a line, everything goes wrong:

Example :

> it works when  the region is a set  of full lines, but if  I call it
> with  regions beginning  in the  middle of  a line,  everything goes
> wrong:

Now, I want to elide `beginning'. I get this.


> it works when  the region is a set  of full lines, but if  I call it
> with  regions 
[...]

 in the  middle of  a line,  everything goes
> wrong:


What I want is this :


> it works when  the region is a set  of full lines, but if  I call it
> with  regions 

[...]

> in the middle of a line, everything goes wrong:


The function to accomplish this is this one:

;;;###autoload
(defun message-elide-region (b e)
  "Elide the text in the region.
An ellipsis (from `message-elide-ellipsis') will be inserted where the
text was killed."
  (interactive "r")
  (kill-region b e)
  (message-newline-and-reformat)
  (delete-region
   (progn (previous-line 1) (point))
   (progn (next-line 3) (point)))
  (insert message-elide-ellipsis))

Anyone to commit this ?

-- 
Matthieu

By  the  way,  I've  just  discovered   M-RET  to  cut  a  line  in  a
citation. It's very usefull.



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

* Re: [PATCH] message-elide-region.
  2002-04-23 11:28 [PATCH] message-elide-region Matthieu Moy
@ 2002-04-23 13:45 ` Kai Großjohann
  2002-04-23 13:58   ` Matthieu Moy
  2002-04-23 18:53   ` Karl Pflästerer
  0 siblings, 2 replies; 5+ messages in thread
From: Kai Großjohann @ 2002-04-23 13:45 UTC (permalink / raw)


Matthieu Moy <Matthieu.Moy@imag.fr> writes:

> it works when the region is a set of full lines, but if I call it with
> regions [...] in the middle of a line, everything goes wrong:

As you can see, it works for me.  (I also elided "beginning".)  But I
have (setq message-elide-ellipsis "[...]").  Does that make a
difference?

kai
-- 
Silence is foo!



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

* Re: [PATCH] message-elide-region.
  2002-04-23 13:45 ` Kai Großjohann
@ 2002-04-23 13:58   ` Matthieu Moy
  2002-04-23 18:53   ` Karl Pflästerer
  1 sibling, 0 replies; 5+ messages in thread
From: Matthieu Moy @ 2002-04-23 13:58 UTC (permalink / raw)


Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai Großjohann) writes:

> Matthieu Moy <Matthieu.Moy@imag.fr> writes:
>
>> it works when the region is a set of full lines, but if I call it with
>> regions [...] in the middle of a line, everything goes wrong:
>
> As you can see, it works for me.  (I also elided "beginning".)  But I
> have (setq message-elide-ellipsis "[...]").  Does that make a
> difference? 

Yes, and unfortunately, your example break my code :-(

The   old   message-elide-region    kills   the   region,   and   puts
message-elide-ellipsis instead. It doesn't  take any care of citation,
which   is   very   enoying   when   message-elide-ellipsis   contains
"\n"'s. (which is the default)

My  modification  was  to  add  (message-newline-and-reformat),  which
breaks a cited line properly. 

OK, lets try an improved version :

(defun message-elide-region (b e)
  "Elide the text in the region.
An ellipsis (from `message-elide-ellipsis') will be inserted where the
text was killed."
  (interactive "r")
  (kill-region b e)
  (if (string-match "\n.*\n" message-elide-ellipsis)
      (progn
	(message-newline-and-reformat)
	(delete-region
	 (progn (previous-line 1) (point))
	 (progn (next-line 3) (point))))
    )
  (insert message-elide-ellipsis))

This tests wether message-elide-ellipsis  begins and ends by "\n", and
do what it has to do then.

-- 
Matthieu



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

* Re: [PATCH] message-elide-region.
  2002-04-23 13:45 ` Kai Großjohann
  2002-04-23 13:58   ` Matthieu Moy
@ 2002-04-23 18:53   ` Karl Pflästerer
  2002-04-24 11:17     ` Kai Großjohann
  1 sibling, 1 reply; 5+ messages in thread
From: Karl Pflästerer @ 2002-04-23 18:53 UTC (permalink / raw)


Kai Großjohann <- Kai.Grossjohann@CS.Uni-Dortmund.DE wrote:
> As you can see, it works for me.  (I also elided "beginning".)  But I
> have (setq message-elide-ellipsis "[...]").  Does that make a
> difference?

If `message-elide-region' should be changed should we also mention the
possible changes we discussed in dcsg? (It was the possibility to change
the ellipsis to some text when C-C C-e had been pressed) eg. change
[...] to [SHORT_DESCRIPTION]

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] 5+ messages in thread

* Re: [PATCH] message-elide-region.
  2002-04-23 18:53   ` Karl Pflästerer
@ 2002-04-24 11:17     ` Kai Großjohann
  0 siblings, 0 replies; 5+ messages in thread
From: Kai Großjohann @ 2002-04-24 11:17 UTC (permalink / raw)
  Cc: ding

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

> If `message-elide-region' should be changed should we also mention the
> possible changes we discussed in dcsg? (It was the possibility to change
> the ellipsis to some text when C-C C-e had been pressed) eg. change
> [...] to [SHORT_DESCRIPTION]

Changing message-elide-region was proposed before, but Lars said that
it doesn't make sense: C-w [ x x x ] is not any longer than C-u C-c
C-e xxx RET.  Why make a keybindig that essentially inserts text into
the buffer?  It only makes sense if something more happens.

I didn't like it, but I had to agree with Lars...

kai
-- 
Silence is foo!



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

end of thread, other threads:[~2002-04-24 11:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-23 11:28 [PATCH] message-elide-region Matthieu Moy
2002-04-23 13:45 ` Kai Großjohann
2002-04-23 13:58   ` Matthieu Moy
2002-04-23 18:53   ` Karl Pflästerer
2002-04-24 11:17     ` 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).