GNU bug report logs - #23794
Emacs 25.0.94: Patch to make sort-lines respect visible lines (fairly urgent)

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: rswgnu@HIDDEN; dated Sat, 18 Jun 2016 15:48:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 23794 <at> debbugs.gnu.org:


Received: (at 23794) by debbugs.gnu.org; 19 Jun 2016 16:55:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jun 19 12:55:44 2016
Received: from localhost ([127.0.0.1]:46607 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1bEg0e-0004f2-JP
	for submit <at> debbugs.gnu.org; Sun, 19 Jun 2016 12:55:44 -0400
Received: from eggs.gnu.org ([208.118.235.92]:37509)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1bEg0d-0004em-5s
 for 23794 <at> debbugs.gnu.org; Sun, 19 Jun 2016 12:55:43 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <eliz@HIDDEN>) id 1bEg0U-0007Vr-QM
 for 23794 <at> debbugs.gnu.org; Sun, 19 Jun 2016 12:55:38 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_50,RP_MATCHES_RCVD
 autolearn=disabled version=3.3.2
Received: from fencepost.gnu.org ([2001:4830:134:3::e]:55436)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1bEg0U-0007Vk-Js; Sun, 19 Jun 2016 12:55:34 -0400
Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:2744
 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1bEg0K-0001zO-E5; Sun, 19 Jun 2016 12:55:25 -0400
Date: Sun, 19 Jun 2016 19:55:14 +0300
Message-Id: <83lh2186fh.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: rswgnu@HIDDEN
In-reply-to: <CA+OMD9jOBhas2Bt-7rc92UdLuPxWhJj2mEAc2KLgWAVdGFaOvw@HIDDEN>
 (message from Robert Weiner on Sun, 19 Jun 2016 12:51:08 -0400)
Subject: Re: Emacs bug #23794;
 sort-line behavior regressed from prior Emacs versions
References: <CA+OMD9g7rO1E=1k7BN6T3B6PUqEOF_PxzG4AAiiB_zMcN98oQQ@HIDDEN>
 <83shwa9zmr.fsf@HIDDEN> <83lh229ywc.fsf@HIDDEN>
 <CA+OMD9h3oQLj6-p2vWEsvg0QA3_QFWMMQAVXPNrHmqxmLtZUkQ@HIDDEN>
 <83inx69xcx.fsf@HIDDEN>
 <CA+OMD9jEwHrM6gsyjzHi5hf2nUGWDPgvFm8Fewh8wmxwTL-RKA@HIDDEN>
 <0984ce22-cbcf-42a6-906e-a03b65f3c71c@default> <8360t5aolu.fsf@HIDDEN>
 <CA+OMD9gYwmYFpa3s_20N4-uLTvKMCkqBdQBOBDUQVbhpngbiaA@HIDDEN>
 <83vb158awq.fsf@HIDDEN>
 <CA+OMD9gB=y6Uo3Sh3HCJNEhJ2jx-8Y8pE35KCPR=7FbEX-SGCA@HIDDEN>
 <83oa6x87ky.fsf@HIDDEN>
 <CA+OMD9jOBhas2Bt-7rc92UdLuPxWhJj2mEAc2KLgWAVdGFaOvw@HIDDEN>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2001:4830:134:3::e
X-Spam-Score: -6.4 (------)
X-Debbugs-Envelope-To: 23794
Cc: 23794 <at> debbugs.gnu.org, rms@HIDDEN, drew.adams@HIDDEN,
 emacs-devel@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Reply-To: Eli Zaretskii <eliz@HIDDEN>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -6.4 (------)

> From: Robert Weiner <rsw@HIDDEN>
> Date: Sun, 19 Jun 2016 12:51:08 -0400
> Cc: Drew Adams <drew.adams@HIDDEN>, Richard Stallman <rms@HIDDEN>, 
> 	emacs-devel <emacs-devel@HIDDEN>, 23794 <at> debbugs.gnu.org
> 
> On Sun, Jun 19, 2016 at 12:30 PM, Eli Zaretskii <eliz@HIDDEN> wrote:
> 
>  Didn't think that far, but is it really clean for sort-lines to have
>  special code for some major mode? I thought a better way is to
>  override the default behavior by having sort-lines call functions
>  through funcall or somesuch, and then outline modes could set the
>  appropriate variable to the function of their liking?
> 
> The problem with that approach is that each mode has to be aware of this and add a setting, really not much
> different than each mode having its own sort function or way of calling a sort function. It is much more useful
> to centralize the behavior within the sorting library, even if it adds some conditional complexity to the code.

Not necessarily: if you set that up in outline-mode, all of its
descendants will inherit the setting for free.

> Here is the suggested patch to do it this way. -- Bob

Thanks, I hope others will comment on this.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#23794; Package emacs. Full text available.

Message received at 23794 <at> debbugs.gnu.org:


Received: (at 23794) by debbugs.gnu.org; 19 Jun 2016 16:51:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jun 19 12:51:51 2016
Received: from localhost ([127.0.0.1]:46603 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1bEfws-0004Ym-T0
	for submit <at> debbugs.gnu.org; Sun, 19 Jun 2016 12:51:51 -0400
Received: from eggs.gnu.org ([208.118.235.92]:36790)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rsw@HIDDEN>) id 1bEfwr-0004YY-V0
 for 23794 <at> debbugs.gnu.org; Sun, 19 Jun 2016 12:51:50 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <rsw@HIDDEN>) id 1bEfwi-0006gf-T3
 for 23794 <at> debbugs.gnu.org; Sun, 19 Jun 2016 12:51:44 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_50,HTML_MESSAGE,
 RP_MATCHES_RCVD autolearn=disabled version=3.3.2
Received: from fencepost.gnu.org ([2001:4830:134:3::e]:55402)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <rsw@HIDDEN>)
 id 1bEfwi-0006gR-Ow
 for 23794 <at> debbugs.gnu.org; Sun, 19 Jun 2016 12:51:40 -0400
Received: from mail-oi0-f54.google.com ([209.85.218.54]:32777)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128)
 (Exim 4.82) (envelope-from <rsw@HIDDEN>) id 1bEfwh-0001Y6-1l
 for 23794 <at> debbugs.gnu.org; Sun, 19 Jun 2016 12:51:39 -0400
Received: by mail-oi0-f54.google.com with SMTP id u201so180854169oie.0
 for <23794 <at> debbugs.gnu.org>; Sun, 19 Jun 2016 09:51:38 -0700 (PDT)
X-Gm-Message-State: ALyK8tLQT8jAcJrRYRujv6zpeG+kAZaF63stNP2wIL1og5kMLtdrCkukhPTHgUGlZ2KW7XOLABVob68qp5ia3w==
X-Received: by 10.202.178.84 with SMTP id b81mr5562803oif.155.1466355098169;
 Sun, 19 Jun 2016 09:51:38 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.202.236.73 with HTTP; Sun, 19 Jun 2016 09:51:08 -0700 (PDT)
In-Reply-To: <83oa6x87ky.fsf@HIDDEN>
References: <CA+OMD9g7rO1E=1k7BN6T3B6PUqEOF_PxzG4AAiiB_zMcN98oQQ@HIDDEN>
 <83shwa9zmr.fsf@HIDDEN> <83lh229ywc.fsf@HIDDEN>
 <CA+OMD9h3oQLj6-p2vWEsvg0QA3_QFWMMQAVXPNrHmqxmLtZUkQ@HIDDEN>
 <83inx69xcx.fsf@HIDDEN>
 <CA+OMD9jEwHrM6gsyjzHi5hf2nUGWDPgvFm8Fewh8wmxwTL-RKA@HIDDEN>
 <0984ce22-cbcf-42a6-906e-a03b65f3c71c@default> <8360t5aolu.fsf@HIDDEN>
 <CA+OMD9gYwmYFpa3s_20N4-uLTvKMCkqBdQBOBDUQVbhpngbiaA@HIDDEN>
 <83vb158awq.fsf@HIDDEN>
 <CA+OMD9gB=y6Uo3Sh3HCJNEhJ2jx-8Y8pE35KCPR=7FbEX-SGCA@HIDDEN>
 <83oa6x87ky.fsf@HIDDEN>
From: Robert Weiner <rsw@HIDDEN>
Date: Sun, 19 Jun 2016 12:51:08 -0400
X-Gmail-Original-Message-ID: <CA+OMD9jOBhas2Bt-7rc92UdLuPxWhJj2mEAc2KLgWAVdGFaOvw@HIDDEN>
Message-ID: <CA+OMD9jOBhas2Bt-7rc92UdLuPxWhJj2mEAc2KLgWAVdGFaOvw@HIDDEN>
Subject: Re: Emacs bug #23794;
 sort-line behavior regressed from prior Emacs versions
To: Eli Zaretskii <eliz@HIDDEN>
Content-Type: multipart/alternative; boundary=001a113ce25abdb8590535a46662
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2001:4830:134:3::e
X-Spam-Score: -3.9 (---)
X-Debbugs-Envelope-To: 23794
Cc: 23794 <at> debbugs.gnu.org, Richard Stallman <rms@HIDDEN>,
 Drew Adams <drew.adams@HIDDEN>, emacs-devel <emacs-devel@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Reply-To: rswgnu@HIDDEN
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -6.4 (------)

--001a113ce25abdb8590535a46662
Content-Type: text/plain; charset=UTF-8

On Sun, Jun 19, 2016 at 12:30 PM, Eli Zaretskii <eliz@HIDDEN> wrote:

> Didn't think that far, but is it really clean for sort-lines to have
> special code for some major mode?  I thought a better way is to
> override the default behavior by having sort-lines call functions
> through funcall or somesuch, and then outline modes could set the
> appropriate variable to the function of their liking?
>

The problem with that approach is that each mode has to be aware of this
and add a setting, really not much different than each mode having its own
sort function or way of calling a sort function.  It is much more useful to
centralize the behavior within the sorting library, even if it adds some
conditional complexity to the code.  Here is the suggested patch to do it
this way.  -- Bob

*** sort-orig.el.gz 2016-06-19 12:42:12.000000000 -0400
--- sort.el.gz 2016-06-19 12:42:12.000000000 -0400
***************
*** 39,44 ****
--- 39,50 ----
    :type 'boolean)
  ;;;###autoload(put 'sort-fold-case 'safe-local-variable 'booleanp)

+ (defcustom sort-invisible-lines nil
+   "Non-nil if the buffer `sort-line' function should treat invisible
lines like visible ones."
+   :group 'sort
+   :type 'boolean)
+ ;;;###autoload(put 'sort-invisible-lines 'safe-local-variable 'booleanp)
+
  ;;;###autoload
  (defun sort-subr (reverse nextrecfun endrecfun
   &optional startkeyfun endkeyfun predicate)
***************
*** 210,216 ****
        (goto-char (point-min))
        (let ;; To make `end-of-line' and etc. to ignore fields.
   ((inhibit-field-text-motion t))
! (sort-subr reverse 'forward-line 'end-of-line)))))

  ;;;###autoload
  (defun sort-paragraphs (reverse beg end)
--- 216,228 ----
        (goto-char (point-min))
        (let ;; To make `end-of-line' and etc. to ignore fields.
   ((inhibit-field-text-motion t))
! (if (and (not sort-invisible-lines)
! (or (derived-mode-p 'outline-mode)
!     (and (boundp 'outline-minor-mode) outline-minor-mode)))
!    ;; In in an outline mode with sort-invisible-lines nil, sort
!    ;; only visible lines.
!    (sort-subr reverse 'forward-visible-line 'end-of-visible-line)
!  (sort-subr reverse 'forward-line 'end-of-line))))))

  ;;;###autoload
  (defun sort-paragraphs (reverse beg end)

*** simple-orig.el.gz 2016-06-18 11:29:58.000000000 -0400
--- simple.el.gz 2016-06-18 11:29:58.000000000 -0400
***************
*** 4909,4918 ****
  (kill-region (point)
       (progn (forward-visible-line arg) (point))))))

! (defun forward-visible-line (arg)
!   "Move forward by ARG lines, ignoring currently invisible newlines only.
  If ARG is negative, move backward -ARG lines.
  If ARG is zero, move to the beginning of the current line."
    (condition-case nil
        (if (> arg 0)
   (progn
--- 4909,4919 ----
  (kill-region (point)
       (progn (forward-visible-line arg) (point))))))

! (defun forward-visible-line (&optional arg)
!   "Move forward by optional ARG lines (default = 1), ignoring currently
invisible newlines only.
  If ARG is negative, move backward -ARG lines.
  If ARG is zero, move to the beginning of the current line."
+   (if (null arg) (setq arg 1))
    (condition-case nil
        (if (> arg 0)
   (progn

--001a113ce25abdb8590535a46662
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote">On S=
un, Jun 19, 2016 at 12:30 PM, Eli Zaretskii <span dir=3D"ltr">&lt;<a href=
=3D"mailto:eliz@HIDDEN" target=3D"_blank">eliz@HIDDEN</a>&gt;</span> wrot=
e:<br><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;b=
order-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,=
204);padding-left:1ex"><div>Didn&#39;t think that far, but is it really cle=
an for sort-lines to have<br>
special code for some major mode?=C2=A0 I thought a better way is to<br>
override the default behavior by having sort-lines call functions<br>
through funcall or somesuch, and then outline modes could set the<br>
appropriate variable to the function of their liking?</div></blockquote><di=
v><br></div><div>The problem with that approach is that each mode has to be=
 aware of this and add a setting, really not much different than each mode =
having its own sort function or way of calling a sort function.=C2=A0 It is=
 much more useful to centralize the behavior within the sorting library, ev=
en if it adds some conditional complexity to the code.=C2=A0 Here is the su=
ggested patch to do it this way. =C2=A0-- Bob</div><div><br></div><div><div=
>*** sort-orig.el.gz<span style=3D"white-space:pre-wrap">	</span>2016-06-19=
 12:42:12.000000000 -0400</div><div>--- sort.el.gz<span style=3D"white-spac=
e:pre-wrap">		</span>2016-06-19 12:42:12.000000000 -0400</div><div>********=
*******</div><div>*** 39,44 ****</div><div>--- 39,50 ----</div><div>=C2=A0 =
=C2=A0 :type &#39;boolean)</div><div>=C2=A0 ;;;###autoload(put &#39;sort-fo=
ld-case &#39;safe-local-variable &#39;booleanp)</div><div>=C2=A0=C2=A0</div=
><div>+ (defcustom sort-invisible-lines nil</div><div>+ =C2=A0 &quot;Non-ni=
l if the buffer `sort-line&#39; function should treat invisible lines like =
visible ones.&quot;</div><div>+ =C2=A0 :group &#39;sort</div><div>+ =C2=A0 =
:type &#39;boolean)</div><div>+ ;;;###autoload(put &#39;sort-invisible-line=
s &#39;safe-local-variable &#39;booleanp)</div><div>+=C2=A0</div><div>=C2=
=A0 ;;;###autoload</div><div>=C2=A0 (defun sort-subr (reverse nextrecfun en=
drecfun</div><div>=C2=A0 <span style=3D"white-space:pre-wrap">			</span> =
=C2=A0&amp;optional startkeyfun endkeyfun predicate)</div><div>************=
***</div><div>*** 210,216 ****</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 (goto-=
char (point-min))</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 (let ;; To make `en=
d-of-line&#39; and etc. to ignore fields.</div><div>=C2=A0 <span style=3D"w=
hite-space:pre-wrap">	</span> =C2=A0((inhibit-field-text-motion t))</div><d=
iv>! <span style=3D"white-space:pre-wrap">	</span>(sort-subr reverse &#39;f=
orward-line &#39;end-of-line)))))</div><div>=C2=A0=C2=A0</div><div>=C2=A0 ;=
;;###autoload</div><div>=C2=A0 (defun sort-paragraphs (reverse beg end)</di=
v><div>--- 216,228 ----</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 (goto-char (p=
oint-min))</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 (let ;; To make `end-of-li=
ne&#39; and etc. to ignore fields.</div><div>=C2=A0 <span style=3D"white-sp=
ace:pre-wrap">	</span> =C2=A0((inhibit-field-text-motion t))</div><div>! <s=
pan style=3D"white-space:pre-wrap">	</span>(if (and (not sort-invisible-lin=
es)</div><div>! <span style=3D"white-space:pre-wrap">		</span> (or (derived=
-mode-p &#39;outline-mode)</div><div>! <span style=3D"white-space:pre-wrap"=
>		</span> =C2=A0 =C2=A0 (and (boundp &#39;outline-minor-mode) outline-mino=
r-mode)))</div><div>! <span style=3D"white-space:pre-wrap">	</span> =C2=A0 =
=C2=A0;; In in an outline mode with sort-invisible-lines nil, sort</div><di=
v>! <span style=3D"white-space:pre-wrap">	</span> =C2=A0 =C2=A0;; only visi=
ble lines.</div><div>! <span style=3D"white-space:pre-wrap">	</span> =C2=A0=
 =C2=A0(sort-subr reverse &#39;forward-visible-line &#39;end-of-visible-lin=
e)</div><div>! <span style=3D"white-space:pre-wrap">	</span> =C2=A0(sort-su=
br reverse &#39;forward-line &#39;end-of-line))))))</div><div>=C2=A0=C2=A0<=
/div><div>=C2=A0 ;;;###autoload</div><div>=C2=A0 (defun sort-paragraphs (re=
verse beg end)</div></div><div><br></div></div><span style=3D"font-size:12.=
8px">*** simple-orig.el.gz 2016-06-18 11:29:58.000000000 -0400</span><br st=
yle=3D"font-size:12.8px"><span style=3D"font-size:12.8px">--- simple.el.gz =
2016-06-18 11:29:58.000000000 -0400</span><br style=3D"font-size:12.8px"><s=
pan style=3D"font-size:12.8px">***************</span><br style=3D"font-size=
:12.8px"><span style=3D"font-size:12.8px">*** 4909,4918 ****</span><br styl=
e=3D"font-size:12.8px"><span style=3D"font-size:12.8px">=C2=A0 (kill-region=
 (point)</span><br style=3D"font-size:12.8px"><span style=3D"font-size:12.8=
px">=C2=A0 =C2=A0 =C2=A0 =C2=A0(progn (forward-visible-line arg) (point))))=
))</span><br style=3D"font-size:12.8px"><span style=3D"font-size:12.8px">=
=C2=A0=C2=A0</span><br style=3D"font-size:12.8px"><span style=3D"font-size:=
12.8px">! (defun forward-visible-line (arg)</span><br style=3D"font-size:12=
.8px"><span style=3D"font-size:12.8px">! =C2=A0 &quot;Move forward by ARG=
=C2=A0</span><span class=3D"" style=3D"font-size:12.8px;background-color:rg=
b(255,255,255)">lines</span><span style=3D"font-size:12.8px">, ignoring cur=
rently invisible newlines only.</span><br style=3D"font-size:12.8px"><span =
style=3D"font-size:12.8px">=C2=A0 If ARG is negative, move backward -ARG=C2=
=A0</span><span class=3D"" style=3D"font-size:12.8px;background-color:rgb(2=
55,255,255)">lines</span><span style=3D"font-size:12.8px">.</span><br style=
=3D"font-size:12.8px"><span style=3D"font-size:12.8px">=C2=A0 If ARG is zer=
o, move to the beginning of the current line.&quot;</span><br style=3D"font=
-size:12.8px"><span style=3D"font-size:12.8px">=C2=A0 =C2=A0 (condition-cas=
e nil</span><br style=3D"font-size:12.8px"><span style=3D"font-size:12.8px"=
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 (if (&gt; arg 0)</span><br style=3D"font-size:=
12.8px"><span style=3D"font-size:12.8px">=C2=A0 =C2=A0(progn</span><br styl=
e=3D"font-size:12.8px"><span style=3D"font-size:12.8px">--- 4909,4919 ----<=
/span><br style=3D"font-size:12.8px"><span style=3D"font-size:12.8px">=C2=
=A0 (kill-region (point)</span><br style=3D"font-size:12.8px"><span style=
=3D"font-size:12.8px">=C2=A0 =C2=A0 =C2=A0 =C2=A0(progn (forward-visible-li=
ne arg) (point))))))</span><br style=3D"font-size:12.8px"><span style=3D"fo=
nt-size:12.8px">=C2=A0=C2=A0</span><br style=3D"font-size:12.8px"><span sty=
le=3D"font-size:12.8px">! (defun forward-visible-line (&amp;optional arg)</=
span><br style=3D"font-size:12.8px"><span style=3D"font-size:12.8px">! =C2=
=A0 &quot;Move forward by optional ARG=C2=A0</span><span class=3D"" style=
=3D"font-size:12.8px;background-color:rgb(255,255,255)">lines</span><span s=
tyle=3D"font-size:12.8px">=C2=A0(default =3D 1), ignoring currently invisib=
le newlines only.</span><br style=3D"font-size:12.8px"><span style=3D"font-=
size:12.8px">=C2=A0 If ARG is negative, move backward -ARG=C2=A0</span><spa=
n class=3D"" style=3D"font-size:12.8px;background-color:rgb(255,255,255)">l=
ines</span><span style=3D"font-size:12.8px">.</span><br style=3D"font-size:=
12.8px"><span style=3D"font-size:12.8px">=C2=A0 If ARG is zero, move to the=
 beginning of the current line.&quot;</span><br style=3D"font-size:12.8px">=
<span style=3D"font-size:12.8px">+ =C2=A0 (if (null arg) (setq arg 1))</spa=
n><br style=3D"font-size:12.8px"><span style=3D"font-size:12.8px">=C2=A0 =
=C2=A0 (condition-case nil</span><br style=3D"font-size:12.8px"><span style=
=3D"font-size:12.8px">=C2=A0 =C2=A0 =C2=A0 =C2=A0 (if (&gt; arg 0)</span><b=
r style=3D"font-size:12.8px"><span style=3D"font-size:12.8px">=C2=A0 =C2=A0=
(progn</span></div><div class=3D"gmail_extra"><span style=3D"font-size:12.8=
px"><br></span><br></div></div>

--001a113ce25abdb8590535a46662--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#23794; Package emacs. Full text available.

Message received at 23794 <at> debbugs.gnu.org:


Received: (at 23794) by debbugs.gnu.org; 18 Jun 2016 18:18:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jun 18 14:18:51 2016
Received: from localhost ([127.0.0.1]:45381 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1bEKpW-0002qm-Sp
	for submit <at> debbugs.gnu.org; Sat, 18 Jun 2016 14:18:51 -0400
Received: from eggs.gnu.org ([208.118.235.92]:39241)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1bEKpV-0002qX-8J
 for 23794 <at> debbugs.gnu.org; Sat, 18 Jun 2016 14:18:49 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <eliz@HIDDEN>) id 1bEKpM-00085o-PD
 for 23794 <at> debbugs.gnu.org; Sat, 18 Jun 2016 14:18:43 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_50,RP_MATCHES_RCVD
 autolearn=disabled version=3.3.2
Received: from fencepost.gnu.org ([2001:4830:134:3::e]:37529)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1bEKpM-00085f-M1; Sat, 18 Jun 2016 14:18:40 -0400
Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:1931
 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1bEKpK-0001kN-9w; Sat, 18 Jun 2016 14:18:39 -0400
Date: Sat, 18 Jun 2016 21:19:36 +0300
Message-Id: <83h9cq9x6v.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: rswgnu@HIDDEN
In-reply-to: <83k2hm9ylj.fsf@HIDDEN> (message from Eli Zaretskii on Sat, 18
 Jun 2016 20:49:12 +0300)
Subject: Re: bug#23794: Emacs 25.0.94: Patch to make sort-lines respect visible
 lines (fairly urgent)
References: <CA+OMD9gF+7j37bCm-GtNXwzimWzYa1yVu2UbBhd2uTwBzvp13g@HIDDEN>
 <83twgq9znu.fsf@HIDDEN>
 <CA+OMD9hALyTj+7zoAyUHJc6FUJE4g8QMd4xJmMiZi_fpry_g1w@HIDDEN>
 <83k2hm9ylj.fsf@HIDDEN>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2001:4830:134:3::e
X-Spam-Score: -6.4 (------)
X-Debbugs-Envelope-To: 23794
Cc: 23794 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Reply-To: Eli Zaretskii <eliz@HIDDEN>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -6.4 (------)

> Date: Sat, 18 Jun 2016 20:49:12 +0300
> From: Eli Zaretskii <eliz@HIDDEN>
> Cc: 23794 <at> debbugs.gnu.org
> 
> > For clarity, the original behavior of sort-lines is what the patch restores. The backward-incompatibility to which
> > you refer is then just an implementation error that occurred when switching over to the overlay implementation
> > of outlines as there was never any documentation that I can see that suggested any behavior change. There
> > certainly could be better documentation as to whether a 'line' refers to a visible line, an invisible line or both
> > but many functions do not delineate this. A major reason for making lines invisible is so that they are not
> > treated as regular lines when functions are applied to buffer text. Thus, sort-lines should by default operate on
> > visible lines. It could be extended or another function could be written to operate on invisible lines as well, e.g.
> > sort-invisible-lines and an alias could be made to sort-lines to be called sort-visible-lines. All of this in the
> > future. The only thing I am suggesting for right now is to restore the original behavior. Note that if all lines are
> > visible, the patch codes works as well. The issue is that when lines are invisible the current code in Emacs
> > does not work in a very useful way.
> 
> I think I already responded to this argument in my previous message.

In case it wasn't clear, I would welcome a change that is specific to
outline modes, whereby sorting would produce the same effect as it did
in Emacs 21 in these modes.  But even in outline modes, I think there
should be a way of getting the old behavior back.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#23794; Package emacs. Full text available.

Message received at 23794 <at> debbugs.gnu.org:


Received: (at 23794) by debbugs.gnu.org; 18 Jun 2016 17:48:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jun 18 13:48:33 2016
Received: from localhost ([127.0.0.1]:45376 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1bEKMD-00025T-DG
	for submit <at> debbugs.gnu.org; Sat, 18 Jun 2016 13:48:33 -0400
Received: from eggs.gnu.org ([208.118.235.92]:59219)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1bEKMA-00025F-1Q
 for 23794 <at> debbugs.gnu.org; Sat, 18 Jun 2016 13:48:31 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <eliz@HIDDEN>) id 1bEKLz-0000qo-Tw
 for 23794 <at> debbugs.gnu.org; Sat, 18 Jun 2016 13:48:24 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_50,RP_MATCHES_RCVD
 autolearn=disabled version=3.3.2
Received: from fencepost.gnu.org ([2001:4830:134:3::e]:36848)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1bEKLz-0000po-Qr; Sat, 18 Jun 2016 13:48:19 -0400
Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:1910
 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1bEKLx-0000Bp-Mr; Sat, 18 Jun 2016 13:48:18 -0400
Date: Sat, 18 Jun 2016 20:49:12 +0300
Message-Id: <83k2hm9ylj.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: rswgnu@HIDDEN
In-reply-to: <CA+OMD9hALyTj+7zoAyUHJc6FUJE4g8QMd4xJmMiZi_fpry_g1w@HIDDEN>
 (message from Robert Weiner on Sat, 18 Jun 2016 13:42:01 -0400)
Subject: Re: bug#23794: Emacs 25.0.94: Patch to make sort-lines respect
 visible lines (fairly urgent)
References: <CA+OMD9gF+7j37bCm-GtNXwzimWzYa1yVu2UbBhd2uTwBzvp13g@HIDDEN>
 <83twgq9znu.fsf@HIDDEN>
 <CA+OMD9hALyTj+7zoAyUHJc6FUJE4g8QMd4xJmMiZi_fpry_g1w@HIDDEN>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2001:4830:134:3::e
X-Spam-Score: -6.4 (------)
X-Debbugs-Envelope-To: 23794
Cc: 23794 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Reply-To: Eli Zaretskii <eliz@HIDDEN>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -6.4 (------)

> From: Robert Weiner <rsw@HIDDEN>
> Date: Sat, 18 Jun 2016 13:42:01 -0400
> Cc: 23794 <at> debbugs.gnu.org
> 
>  I don't think we can make such a backward-incompatible change without
>  (a) an entry in NEWS,
> 
> I am willing to write this.

Thanks.

>  (b) suitable changes in the manual(s), and
> 
> I looked at both the Emacs and the Elisp manuals and the only change necessary would be in the elisp
> manual where the full code for sort-lines is shown, so that would be a simple replace.

I think the fact that sorting ignores invisible text should be
prominently mentioned in both the user manual and the ELisp manual,
where the sort functions and commands are described.

>  (c) some way of getting back the old behavior (which could be by way
>  of having this new behavior as an optional one).
> 
> See below. 
> 
> For clarity, the original behavior of sort-lines is what the patch restores. The backward-incompatibility to which
> you refer is then just an implementation error that occurred when switching over to the overlay implementation
> of outlines as there was never any documentation that I can see that suggested any behavior change. There
> certainly could be better documentation as to whether a 'line' refers to a visible line, an invisible line or both
> but many functions do not delineate this. A major reason for making lines invisible is so that they are not
> treated as regular lines when functions are applied to buffer text. Thus, sort-lines should by default operate on
> visible lines. It could be extended or another function could be written to operate on invisible lines as well, e.g.
> sort-invisible-lines and an alias could be made to sort-lines to be called sort-visible-lines. All of this in the
> future. The only thing I am suggesting for right now is to restore the original behavior. Note that if all lines are
> visible, the patch codes works as well. The issue is that when lines are invisible the current code in Emacs
> does not work in a very useful way.

I think I already responded to this argument in my previous message.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#23794; Package emacs. Full text available.

Message received at 23794 <at> debbugs.gnu.org:


Received: (at 23794) by debbugs.gnu.org; 18 Jun 2016 17:42:43 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jun 18 13:42:42 2016
Received: from localhost ([127.0.0.1]:45372 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1bEKGY-0001v6-LM
	for submit <at> debbugs.gnu.org; Sat, 18 Jun 2016 13:42:42 -0400
Received: from eggs.gnu.org ([208.118.235.92]:58330)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rsw@HIDDEN>) id 1bEKGX-0001ui-BE
 for 23794 <at> debbugs.gnu.org; Sat, 18 Jun 2016 13:42:41 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <rsw@HIDDEN>) id 1bEKGO-00088p-W6
 for 23794 <at> debbugs.gnu.org; Sat, 18 Jun 2016 13:42:36 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_50,HTML_MESSAGE,
 RP_MATCHES_RCVD autolearn=disabled version=3.3.2
Received: from fencepost.gnu.org ([2001:4830:134:3::e]:36803)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <rsw@HIDDEN>)
 id 1bEKGO-00088g-ST
 for 23794 <at> debbugs.gnu.org; Sat, 18 Jun 2016 13:42:32 -0400
Received: from mail-oi0-f46.google.com ([209.85.218.46]:35947)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128)
 (Exim 4.82) (envelope-from <rsw@HIDDEN>) id 1bEKGN-00084d-9q
 for 23794 <at> debbugs.gnu.org; Sat, 18 Jun 2016 13:42:31 -0400
Received: by mail-oi0-f46.google.com with SMTP id p204so159312514oih.3
 for <23794 <at> debbugs.gnu.org>; Sat, 18 Jun 2016 10:42:31 -0700 (PDT)
X-Gm-Message-State: ALyK8tJGPT5K6vtw2uROtID5EgKLfs2/4aknEhvWRDmy/67z4vETgfR2rmbzU8fbvrgHJBhazWYkyKQdomMHuA==
X-Received: by 10.157.14.174 with SMTP id 43mr4493447otj.83.1466271750549;
 Sat, 18 Jun 2016 10:42:30 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.202.236.73 with HTTP; Sat, 18 Jun 2016 10:42:01 -0700 (PDT)
In-Reply-To: <83twgq9znu.fsf@HIDDEN>
References: <CA+OMD9gF+7j37bCm-GtNXwzimWzYa1yVu2UbBhd2uTwBzvp13g@HIDDEN>
 <83twgq9znu.fsf@HIDDEN>
From: Robert Weiner <rsw@HIDDEN>
Date: Sat, 18 Jun 2016 13:42:01 -0400
X-Gmail-Original-Message-ID: <CA+OMD9hALyTj+7zoAyUHJc6FUJE4g8QMd4xJmMiZi_fpry_g1w@HIDDEN>
Message-ID: <CA+OMD9hALyTj+7zoAyUHJc6FUJE4g8QMd4xJmMiZi_fpry_g1w@HIDDEN>
Subject: Re: bug#23794: Emacs 25.0.94: Patch to make sort-lines respect
 visible lines (fairly urgent)
To: Eli Zaretskii <eliz@HIDDEN>
Content-Type: multipart/alternative; boundary=001a113db4bad5f7c1053590fed6
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2001:4830:134:3::e
X-Spam-Score: -3.9 (---)
X-Debbugs-Envelope-To: 23794
Cc: 23794 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Reply-To: rswgnu@HIDDEN
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -6.4 (------)

--001a113db4bad5f7c1053590fed6
Content-Type: text/plain; charset=UTF-8

On Sat, Jun 18, 2016 at 1:26 PM, Eli Zaretskii <eliz@HIDDEN> wrote:

> > From: Robert Weiner <rsw@HIDDEN>
> > Date: Sat, 18 Jun 2016 11:47:08 -0400
> >
> > sort-lines calls forward-line rather than forward-visible line, so if
> > you have emacs outline entries that are collapsed/hidden to single lines
> > each and you try to sort them, their bodies and subtrees are sorted
> > separately because forward-visible-line is not used.
>
> I don't think we can make such a backward-incompatible change without
> (a) an entry in NEWS,


I am willing to write this.


> (b) suitable changes in the manual(s), and
>

I looked at both the Emacs and the Elisp manuals and the only change
necessary would be in the elisp manual where the full code for sort-lines
is shown, so that would be a simple replace.

(c) some way of getting back the old behavior (which could be by way
> of having this new behavior as an optional one).
>

See below.

For clarity, the original behavior of sort-lines is what the patch
restores.  The backward-incompatibility to which you refer is then just an
implementation error that occurred when switching over to the overlay
implementation of outlines as there was never any documentation that I can
see that suggested any behavior change.  There certainly could be better
documentation as to whether a 'line' refers to a visible line, an invisible
line or both but many functions do not delineate this.  A major reason for
making lines invisible is so that they are not treated as regular lines
when functions are applied to buffer text.  Thus, sort-lines should by
default operate on visible lines.  It could be extended or another function
could be written to operate on invisible lines as well, e.g.
sort-invisible-lines and an alias could be made to sort-lines to be called
sort-visible-lines.  All of this in the future.  The only thing I am
suggesting for right now is to restore the original behavior.  Note that if
all lines are visible, the patch codes works as well.  The issue is that
when lines are invisible the current code in Emacs does not work in a very
useful way.

Bob

--001a113db4bad5f7c1053590fed6
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote">On S=
at, Jun 18, 2016 at 1:26 PM, Eli Zaretskii <span dir=3D"ltr">&lt;<a href=3D=
"mailto:eliz@HIDDEN" target=3D"_blank">eliz@HIDDEN</a>&gt;</span> wrote:<=
br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left=
:1px #ccc solid;padding-left:1ex">&gt; From: Robert Weiner &lt;<a href=3D"m=
ailto:rsw@HIDDEN">rsw@HIDDEN</a>&gt;<br>
&gt; Date: Sat, 18 Jun 2016 11:47:08 -0400<br>
&gt;<br>
&gt; sort-lines calls forward-line rather than forward-visible line, so if<=
br>
&gt; you have emacs outline entries that are collapsed/hidden to single lin=
es<br>
&gt; each and you try to sort them, their bodies and subtrees are sorted<br=
>
&gt; separately because forward-visible-line is not used.<br>
<br>
I don&#39;t think we can make such a backward-incompatible change without<b=
r>
(a) an entry in NEWS,</blockquote><div><br></div><div>I am willing to write=
 this.</div><div>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"mar=
gin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> (b) suitable c=
hanges in the manual(s), and<br></blockquote><div><br></div><div>I looked a=
t both the Emacs and the Elisp manuals and the only change necessary would =
be in the elisp manual where the full code for sort-lines is shown, so that=
 would be a simple replace.</div><div><br></div><blockquote class=3D"gmail_=
quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1=
ex">
(c) some way of getting back the old behavior (which could be by way<br>
of having this new behavior as an optional one).<br></blockquote><div><br><=
/div><div>See below.=C2=A0</div><div><br></div><div>For clarity, the origin=
al behavior of sort-lines is what the patch restores.=C2=A0 The backward-in=
compatibility to which you refer is then just an implementation error that =
occurred when switching over to the overlay implementation of outlines as t=
here was never any documentation that I can see that suggested any behavior=
 change.=C2=A0 There certainly could be better documentation as to whether =
a &#39;line&#39; refers to a visible line, an invisible line or both but ma=
ny functions do not delineate this.=C2=A0 A major reason for making lines i=
nvisible is so that they are not treated as regular lines when functions ar=
e applied to buffer text.=C2=A0 Thus, sort-lines should by default operate =
on visible lines.=C2=A0 It could be extended or another function could be w=
ritten to operate on invisible lines as well, e.g. sort-invisible-lines and=
 an alias could be made to sort-lines to be called sort-visible-lines.=C2=
=A0 All of this in the future.=C2=A0 The only thing I am suggesting for rig=
ht now is to restore the original behavior.=C2=A0 Note that if all lines ar=
e visible, the patch codes works as well.=C2=A0 The issue is that when line=
s are invisible the current code in Emacs does not work in a very useful wa=
y.</div><div><br></div><div>Bob</div><div><br></div></div></div></div>

--001a113db4bad5f7c1053590fed6--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#23794; Package emacs. Full text available.

Message received at 23794 <at> debbugs.gnu.org:


Received: (at 23794) by debbugs.gnu.org; 18 Jun 2016 17:25:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jun 18 13:25:21 2016
Received: from localhost ([127.0.0.1]:45350 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1bEJzl-0001RI-5M
	for submit <at> debbugs.gnu.org; Sat, 18 Jun 2016 13:25:21 -0400
Received: from eggs.gnu.org ([208.118.235.92]:54378)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1bEJzj-0001R5-Jn
 for 23794 <at> debbugs.gnu.org; Sat, 18 Jun 2016 13:25:19 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <eliz@HIDDEN>) id 1bEJza-0004W1-JT
 for 23794 <at> debbugs.gnu.org; Sat, 18 Jun 2016 13:25:14 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_50,RP_MATCHES_RCVD
 autolearn=disabled version=3.3.2
Received: from fencepost.gnu.org ([2001:4830:134:3::e]:34570)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1bEJza-0004VQ-Gy; Sat, 18 Jun 2016 13:25:10 -0400
Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:1885
 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1bEJzY-0000Oz-Is; Sat, 18 Jun 2016 13:25:09 -0400
Date: Sat, 18 Jun 2016 20:26:13 +0300
Message-Id: <83twgq9znu.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: rswgnu@HIDDEN
In-reply-to: <CA+OMD9gF+7j37bCm-GtNXwzimWzYa1yVu2UbBhd2uTwBzvp13g@HIDDEN>
 (message from Robert Weiner on Sat, 18 Jun 2016 11:47:08 -0400)
Subject: Re: bug#23794: Emacs 25.0.94: Patch to make sort-lines respect visible
 lines (fairly urgent)
References: <CA+OMD9gF+7j37bCm-GtNXwzimWzYa1yVu2UbBhd2uTwBzvp13g@HIDDEN>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2001:4830:134:3::e
X-Spam-Score: -6.4 (------)
X-Debbugs-Envelope-To: 23794
Cc: 23794 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Reply-To: Eli Zaretskii <eliz@HIDDEN>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -6.4 (------)

> From: Robert Weiner <rsw@HIDDEN>
> Date: Sat, 18 Jun 2016 11:47:08 -0400
> 
> sort-lines calls forward-line rather than forward-visible line, so if
> you have emacs outline entries that are collapsed/hidden to single lines
> each and you try to sort them, their bodies and subtrees are sorted
> separately because forward-visible-line is not used.
> 
> This patch fixes this problem and also unifies the calling convention of
> forward-visible-line with that of forward-line (allowing it to take an
> optional argument) leading to a cleaner calling convention.
> 
> Please apply it as soon as you can as Hyperbole uses sort-lines to sort
> its contact manager records and right now this doesn't work.  Although,
> sort-subr could be called directly for this application, sort-lines
> should work properly with both visible and invisible text and the patch
> is quite simple.

I don't think we can make such a backward-incompatible change without
(a) an entry in NEWS, (b) suitable changes in the manual(s), and
(c) some way of getting back the old behavior (which could be by way
of having this new behavior as an optional one).

Thanks.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#23794; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 18 Jun 2016 15:47:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jun 18 11:47:56 2016
Received: from localhost ([127.0.0.1]:45289 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1bEITU-0005eQ-35
	for submit <at> debbugs.gnu.org; Sat, 18 Jun 2016 11:47:56 -0400
Received: from eggs.gnu.org ([208.118.235.92]:37537)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rsw@HIDDEN>) id 1bEITS-0005e0-02
 for submit <at> debbugs.gnu.org; Sat, 18 Jun 2016 11:47:54 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <rsw@HIDDEN>) id 1bEITL-0001nt-K4
 for submit <at> debbugs.gnu.org; Sat, 18 Jun 2016 11:47:48 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_50,HTML_MESSAGE,
 RP_MATCHES_RCVD autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:37987)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <rsw@HIDDEN>)
 id 1bEITL-0001n5-Gx
 for submit <at> debbugs.gnu.org; Sat, 18 Jun 2016 11:47:47 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:56738)
 by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <rsw@HIDDEN>)
 id 1bEITI-0007S1-VX
 for bug-gnu-emacs@HIDDEN; Sat, 18 Jun 2016 11:47:46 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <rsw@HIDDEN>) id 1bEITE-0001mo-N1
 for bug-gnu-emacs@HIDDEN; Sat, 18 Jun 2016 11:47:43 -0400
Received: from fencepost.gnu.org ([2001:4830:134:3::e]:59627)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <rsw@HIDDEN>)
 id 1bEITE-0001mR-K2
 for bug-gnu-emacs@HIDDEN; Sat, 18 Jun 2016 11:47:40 -0400
Received: from mail-oi0-f50.google.com ([209.85.218.50]:35654)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128)
 (Exim 4.82) (envelope-from <rsw@HIDDEN>) id 1bEITD-00069v-3F
 for bug-gnu-emacs@HIDDEN; Sat, 18 Jun 2016 11:47:39 -0400
Received: by mail-oi0-f50.google.com with SMTP id a64so3588419oii.2
 for <bug-gnu-emacs@HIDDEN>; Sat, 18 Jun 2016 08:47:38 -0700 (PDT)
X-Gm-Message-State: ALyK8tLmayH2yRCPeh7jh9dvaq7t6VXIuYwemPwo3/vxO8XFwLUycdd3HPwyc69oxVGWpWE+m5lreNSQXIGIaA==
X-Received: by 10.202.218.65 with SMTP id r62mr3836293oig.32.1466264858124;
 Sat, 18 Jun 2016 08:47:38 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.202.236.73 with HTTP; Sat, 18 Jun 2016 08:47:08 -0700 (PDT)
From: Robert Weiner <rsw@HIDDEN>
Date: Sat, 18 Jun 2016 11:47:08 -0400
X-Gmail-Original-Message-ID: <CA+OMD9gF+7j37bCm-GtNXwzimWzYa1yVu2UbBhd2uTwBzvp13g@HIDDEN>
Message-ID: <CA+OMD9gF+7j37bCm-GtNXwzimWzYa1yVu2UbBhd2uTwBzvp13g@HIDDEN>
Subject: Emacs 25.0.94: Patch to make sort-lines respect visible lines (fairly
 urgent)
To: bug-gnu-emacs@HIDDEN
Content-Type: multipart/alternative; boundary=001a113d48b203ea7605358f6459
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -3.9 (---)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Reply-To: rswgnu@HIDDEN
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -6.4 (------)

--001a113d48b203ea7605358f6459
Content-Type: text/plain; charset=UTF-8

sort-lines calls forward-line rather than forward-visible line, so if
you have emacs outline entries that are collapsed/hidden to single lines
each and you try to sort them, their bodies and subtrees are sorted
separately because forward-visible-line is not used.

This patch fixes this problem and also unifies the calling convention of
forward-visible-line with that of forward-line (allowing it to take an
optional argument) leading to a cleaner calling convention.

Please apply it as soon as you can as Hyperbole uses sort-lines to sort
its contact manager records and right now this doesn't work.  Although,
sort-subr could be called directly for this application, sort-lines
should work properly with both visible and invisible text and the patch
is quite simple.

Thanks,

Bob
--------

In GNU Emacs 25.0.94.1 (x86_64-apple-darwin13.4.0, NS appkit-1265.21
Version 10.9.5 (Build 13F1603))
 of 2016-05-17 built on builder10-9.local
Windowing system distributor 'Apple', version 10.3.1404
Configured using:
 'configure --with-ns '--enable-locallisppath=/Library/Application
 Support/Emacs/${version}/site-lisp:/Library/Application
 Support/Emacs/site-lisp''

Configured features:
NOTIFY ACL LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

----------------

*** sort-orig.el.gz 2016-06-18 11:31:13.000000000 -0400
--- sort.el.gz 2016-06-18 11:31:13.000000000 -0400
***************
*** 210,216 ****
        (goto-char (point-min))
        (let ;; To make `end-of-line' and etc. to ignore fields.
   ((inhibit-field-text-motion t))
! (sort-subr reverse 'forward-line 'end-of-line)))))

  ;;;###autoload
  (defun sort-paragraphs (reverse beg end)
--- 210,216 ----
        (goto-char (point-min))
        (let ;; To make `end-of-line' and etc. to ignore fields.
   ((inhibit-field-text-motion t))
! (sort-subr reverse 'forward-visible-line 'end-of-visible-line)))))

  ;;;###autoload
  (defun sort-paragraphs (reverse beg end)


*** simple-orig.el.gz 2016-06-18 11:29:58.000000000 -0400
--- simple.el.gz 2016-06-18 11:29:58.000000000 -0400
***************
*** 4909,4918 ****
  (kill-region (point)
       (progn (forward-visible-line arg) (point))))))

! (defun forward-visible-line (arg)
!   "Move forward by ARG lines, ignoring currently invisible newlines only.
  If ARG is negative, move backward -ARG lines.
  If ARG is zero, move to the beginning of the current line."
    (condition-case nil
        (if (> arg 0)
   (progn
--- 4909,4919 ----
  (kill-region (point)
       (progn (forward-visible-line arg) (point))))))

! (defun forward-visible-line (&optional arg)
!   "Move forward by optional ARG lines (default = 1), ignoring currently
invisible newlines only.
  If ARG is negative, move backward -ARG lines.
  If ARG is zero, move to the beginning of the current line."
+   (if (null arg) (setq arg 1))
    (condition-case nil
        (if (> arg 0)
   (progn

--001a113d48b203ea7605358f6459
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">sort-lines calls forward-line rather than forward-visible =
line, so if<br>you have emacs outline entries that are collapsed/hidden to =
single lines<br>each and you try to sort them, their bodies and subtrees ar=
e sorted<br>separately because forward-visible-line is not used.<br><br>Thi=
s patch fixes this problem and also unifies the calling convention of<br>fo=
rward-visible-line with that of forward-line (allowing it to take an<br>opt=
ional argument) leading to a cleaner calling convention.<br><br>Please appl=
y it as soon as you can as Hyperbole uses sort-lines to sort<br>its contact=
 manager records and right now this doesn&#39;t work.=C2=A0 Although,<br>so=
rt-subr could be called directly for this application, sort-lines<br>should=
 work properly with both visible and invisible text and the patch<br>is qui=
te simple.<br><br>Thanks,<br><br>Bob<br>--------<br><br>In GNU Emacs 25.0.9=
4.1 (x86_64-apple-darwin13.4.0, NS appkit-1265.21 Version 10.9.5 (Build 13F=
1603))<br>=C2=A0of 2016-05-17 built on builder10-9.local<br>Windowing syste=
m distributor &#39;Apple&#39;, version 10.3.1404<br>Configured using:<br>=
=C2=A0&#39;configure --with-ns &#39;--enable-locallisppath=3D/Library/Appli=
cation<br>=C2=A0Support/Emacs/${version}/site-lisp:/Library/Application<br>=
=C2=A0Support/Emacs/site-lisp&#39;&#39;<br><br>Configured features:<br>NOTI=
FY ACL LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS<br><br>Important settings:<br>=
=C2=A0 value of $LANG: en_US.UTF-8<br>=C2=A0 locale-coding-system: utf-8-un=
ix<br><br>----------------<br><br>*** sort-orig.el.gz 2016-06-18 11:31:13.0=
00000000 -0400<br>--- sort.el.gz 2016-06-18 11:31:13.000000000 -0400<br>***=
************<br>*** 210,216 ****<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 (goto-char =
(point-min))<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 (let ;; To make `end-of-line&#3=
9; and etc. to ignore fields.<br>=C2=A0 =C2=A0((inhibit-field-text-motion t=
))<br>! (sort-subr reverse &#39;forward-line &#39;end-of-line)))))<br>=C2=
=A0 <br>=C2=A0 ;;;###autoload<br>=C2=A0 (defun sort-paragraphs (reverse beg=
 end)<br>--- 210,216 ----<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 (goto-char (point-=
min))<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 (let ;; To make `end-of-line&#39; and =
etc. to ignore fields.<br>=C2=A0 =C2=A0((inhibit-field-text-motion t))<br>!=
 (sort-subr reverse &#39;forward-visible-line &#39;end-of-visible-line)))))=
<br>=C2=A0 <br>=C2=A0 ;;;###autoload<br>=C2=A0 (defun sort-paragraphs (reve=
rse beg end)<br><br><br>*** simple-orig.el.gz 2016-06-18 11:29:58.000000000=
 -0400<br>--- simple.el.gz 2016-06-18 11:29:58.000000000 -0400<br>*********=
******<br>*** 4909,4918 ****<br>=C2=A0 (kill-region (point)<br>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0(progn (forward-visible-line arg) (point))))))<br>=C2=A0 <=
br>! (defun forward-visible-line (arg)<br>! =C2=A0 &quot;Move forward by AR=
G lines, ignoring currently invisible newlines only.<br>=C2=A0 If ARG is ne=
gative, move backward -ARG lines.<br>=C2=A0 If ARG is zero, move to the beg=
inning of the current line.&quot;<br>=C2=A0 =C2=A0 (condition-case nil<br>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (if (&gt; arg 0)<br>=C2=A0 =C2=A0(progn<br>--- =
4909,4919 ----<br>=C2=A0 (kill-region (point)<br>=C2=A0 =C2=A0 =C2=A0 =C2=
=A0(progn (forward-visible-line arg) (point))))))<br>=C2=A0 <br>! (defun fo=
rward-visible-line (&amp;optional arg)<br>! =C2=A0 &quot;Move forward by op=
tional ARG lines (default =3D 1), ignoring currently invisible newlines onl=
y.<br>=C2=A0 If ARG is negative, move backward -ARG lines.<br>=C2=A0 If ARG=
 is zero, move to the beginning of the current line.&quot;<br>+ =C2=A0 (if =
(null arg) (setq arg 1))<br>=C2=A0 =C2=A0 (condition-case nil<br>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 (if (&gt; arg 0)<br>=C2=A0 =C2=A0(progn</div>

--001a113d48b203ea7605358f6459--




Acknowledgement sent to rswgnu@HIDDEN:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#23794; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 19 Jun 2016 17:00:01 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.