Gnus development mailing list
 help / color / mirror / Atom feed
From: Matthieu Moy <Matthieu.Moy@imag.fr>
Subject: Re: [PATCH] message-elide-region.
Date: Tue, 23 Apr 2002 15:58:30 +0200	[thread overview]
Message-ID: <vpqk7qyseih.fsf@montrose.imag.fr> (raw)
In-Reply-To: <vafznzufs0m.fsf@INBOX.auto.gnus.tok.lucy.cs.uni-dortmund.de> (Kai.Grossjohann@CS.Uni-Dortmund.DE's message of "Tue, 23 Apr 2002 15:45:13 +0200")

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



  reply	other threads:[~2002-04-23 13:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-23 11:28 Matthieu Moy
2002-04-23 13:45 ` Kai Großjohann
2002-04-23 13:58   ` Matthieu Moy [this message]
2002-04-23 18:53   ` Karl Pflästerer
2002-04-24 11:17     ` Kai Großjohann

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=vpqk7qyseih.fsf@montrose.imag.fr \
    --to=matthieu.moy@imag.fr \
    /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).