From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: =?UTF-8?Q?Hinrik_=C3=96rn_Sigur=C3=B0sson?= Newsgroups: gmane.emacs.devel Subject: Re: change soft to hard lines and back Date: Thu, 14 Dec 2017 15:18:55 +0100 Message-ID: References: <87mv2ljuer.fsf@mat.ucm.es> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="001a1149541c77d40f05604d9019" X-Trace: blaine.gmane.org 1513261148 23632 195.159.176.226 (14 Dec 2017 14:19:08 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 14 Dec 2017 14:19:08 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Dec 14 15:19:02 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ePULm-0005iv-K7 for ged-emacs-devel@m.gmane.org; Thu, 14 Dec 2017 15:19:02 +0100 Original-Received: from localhost ([::1]:41206 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ePULs-00048e-8M for ged-emacs-devel@m.gmane.org; Thu, 14 Dec 2017 09:19:08 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34599) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ePULi-00048V-Dg for emacs-devel@gnu.org; Thu, 14 Dec 2017 09:18:59 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ePULh-0006Xw-8t for emacs-devel@gnu.org; Thu, 14 Dec 2017 09:18:58 -0500 Original-Received: from mail-qk0-x22a.google.com ([2607:f8b0:400d:c09::22a]:40000) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ePULh-0006WY-3R for emacs-devel@gnu.org; Thu, 14 Dec 2017 09:18:57 -0500 Original-Received: by mail-qk0-x22a.google.com with SMTP id b123so6386515qkg.7 for ; Thu, 14 Dec 2017 06:18:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=BpGmTqIAaDLFQLxwjP8NU1FR3zeDDI+CRpBa9uw4pv4=; b=KGzqjZ4Rd8UnvJmqBJWurBjmTCS2MlXhBDxY7042C0zH3iqMYn5tD7ORsPmsWrqQP4 EW4wRLRONsAGF72uG7smZ2qyWGWV1S56Xomfwo2JgMgTB3dA8oHj0YO7lZ8eSxRLI5vn 5qU5JIENcV773KRh7+davzByjN/sYoi+svkU5CjkmhWU23Gu3zfwlUaOgVwU5IVGFQoA RW1eUxfZNmDrU+qs9HjbqiaVTBWVmMZz+hygE45DX3Eyj8e7+AVnJ6ePJcbJX3wJ2EjF qz4Wj2TnAqgH460I76yLwE7Kj/5XncDANt9yqpQMB1kDH25KVaHxRB8I7ZkBnFcpBudv yRUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=BpGmTqIAaDLFQLxwjP8NU1FR3zeDDI+CRpBa9uw4pv4=; b=DH40G9vgiIDiGd3o4brc6Pgl3erR7AtuQp2U6IM+1uT5zDQIGJ11tjoGJGFGNTJ0FD oB86RlWv1w8xldvhabnXcaYN/amdzGh5EJfu72PZLtb/wHezYI+fMSlx77LpQrpNTuuM uK8gPgvnA4JIO0wVeEHDUYgcyQk7ItSrQQjfrUMp6NvZOKOR0knraveSmu52geB+bsDN yVDVXssEhPe1dLSNtTXTs1cV9b3zkOFntlgL461YPqXyg8coMuky6iNXHjSTBSQJ3EQC pcJ2cDYYUxiJNgVl1LNSfSkrzk+LO66m9+98kI9kdZBAjt8+ObjJ8OCrLoodn35u0Exu P3/A== X-Gm-Message-State: AKGB3mIMaom3j4StwOgDmgWU5H8EpZ+A1dfBPaL06HZSpOvE6mX4Sn4f iTK0BnLeAB4mOI/eDQ/TLQ9EMV4AnEe8vdJVujsvPg== X-Google-Smtp-Source: ACJfBouhKPyeCS3Nm26IqswxhSwdI5dl/UFgttIhKidO74fZFGRgvDP62sieroq0IqB2+4vIF+LWfy8nBQw+8GhFHDI= X-Received: by 10.55.22.201 with SMTP id 70mr7341571qkw.14.1513261136072; Thu, 14 Dec 2017 06:18:56 -0800 (PST) Original-Received: by 10.140.20.83 with HTTP; Thu, 14 Dec 2017 06:18:55 -0800 (PST) In-Reply-To: <87mv2ljuer.fsf@mat.ucm.es> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c09::22a X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:221052 Archived-At: --001a1149541c77d40f05604d9019 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable You can use the function set-hard-newline-properties to mark all newlines in some range as hard. For the inverse you can remove the 'hard property with (remove-text-property START END '(hard nil)). On Thu, Dec 14, 2017 at 2:44 PM, Uwe Brauer wrote: > Hi > > For email I start to use messages-are-flowing.el (for example in this > message) which insert and display hardlines. (This is useful when sending > message to devices with small screens since then the line ending is bette= r > displayed). > > However sometimes it is a bit too much. So I still have a function which > replaces softline by hardlines, namely > > (defun harden-newlines () (interactive) (save-excursion ; (goto-char > (point-min)) (mail-text) (while (search-forward "\n" nil t) > (put-text-property (1- (point)) (point) 'hard t)))) > So I thought the inverse operation could be > (defun soften-newlines () (interactive) (save-excursion ; (goto-char > (point-min)) (mail-text) (while (search-forward "\n" nil t) > (put-text-property (1- (point)) (point) 'soft t)))) > But unfortunately this did not work out. I tried to google for the > put-text-property function but did not find anything useful. > > Somebody has an idea how to do that, replace hardlines again by softlines= ? > > Thanks > > Uwe Brauer > > =E2=80=8B --001a1149541c77d40f05604d9019 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

You can use the function set-hard-newline-properties to mark all newlines in some= range as hard. For the inverse you can remove the 'ha= rd property with (remove-text-property START END &#= 39;(hard nil)).

On Thu, Dec 14, 2017 at 2:44 PM= , Uwe Brauer <oub@ma= t.ucm.es> wrote:


Hi

For email I start to use messages-are-flowing.el (for example in this messa= ge) which insert and display hardlines. (This is useful when sending messag= e to devices with small screens since then the line ending is better displa= yed).

However sometimes it is a bit too much. So I still have a function which re= places softline by hardlines, namely

(defun harden-newlines () (interactive)=C2=A0 (save-excursion ;=C2=A0 =C2= =A0 (goto-char (point-min))=C2=A0 =C2=A0 (mail-text) (while (search-forward= "\n" nil t)=C2=A0 =C2=A0 =C2=A0 (put-text-property (1- (point)) = (point) 'hard t))))
So I thought the inverse operation could be
(defun soften-newlines () (interactive)=C2=A0 (save-excursion ;=C2=A0 =C2= =A0 (goto-char (point-min))=C2=A0 =C2=A0 (mail-text) (while (search-forward= "\n" nil t)=C2=A0 =C2=A0 =C2=A0 (put-text-property (1- (point)) = (point) 'soft t))))
But unfortunately this did not work out. I tried to google for the put-text= -property function but did not find anything useful.

Somebody has an idea how to do that, replace hardlines again by softlines?<= br>
Thanks=

Uwe Brauer

=E2=80=8B
--001a1149541c77d40f05604d9019--