From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stephen Berman Newsgroups: gmane.emacs.bugs Subject: bug#19102: 24.4; outline-move-subtree-up/down error at last and second-last subtree Date: Sat, 22 Nov 2014 23:20:03 +0100 Message-ID: <87oaryop2k.fsf@rosalinde.fritz.box> References: <87lhn7s522.fsf@rosalinde.fritz.box> <83lhn789tq.fsf@gnu.org> <87h9xvruan.fsf@rosalinde.fritz.box> <83tx1v6mur.fsf@gnu.org> <87a93nrlql.fsf@rosalinde.fritz.box> <83lhn76iex.fsf@gnu.org> <8761easv3s.fsf@rosalinde.fritz.box> <87r3wytcaa.fsf@rosalinde.fritz.box> <83vbm96dxs.fsf@gnu.org> <87oas0n8sr.fsf@rosalinde.fritz.box> <8361e84yxb.fsf@gnu.org> <87fvdcmpeg.fsf@rosalinde.fritz.box> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1416694889 15312 80.91.229.3 (22 Nov 2014 22:21:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 22 Nov 2014 22:21:29 +0000 (UTC) Cc: paul@tilk.co, 19102@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Nov 22 23:21:21 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XsJ3O-0007eL-Qr for geb-bug-gnu-emacs@m.gmane.org; Sat, 22 Nov 2014 23:21:18 +0100 Original-Received: from localhost ([::1]:46958 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XsJ3O-0003oj-DP for geb-bug-gnu-emacs@m.gmane.org; Sat, 22 Nov 2014 17:21:18 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44135) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XsJ3E-0003oM-5y for bug-gnu-emacs@gnu.org; Sat, 22 Nov 2014 17:21:14 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XsJ38-0008QR-6C for bug-gnu-emacs@gnu.org; Sat, 22 Nov 2014 17:21:08 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:44823) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XsJ38-0008QN-35 for bug-gnu-emacs@gnu.org; Sat, 22 Nov 2014 17:21:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XsJ37-0007LG-K2 for bug-gnu-emacs@gnu.org; Sat, 22 Nov 2014 17:21:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stephen Berman Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 22 Nov 2014 22:21:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19102 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 19102-submit@debbugs.gnu.org id=B19102.141669481928165 (code B ref 19102); Sat, 22 Nov 2014 22:21:01 +0000 Original-Received: (at 19102) by debbugs.gnu.org; 22 Nov 2014 22:20:19 +0000 Original-Received: from localhost ([127.0.0.1]:42036 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XsJ2Q-0007KD-Ed for submit@debbugs.gnu.org; Sat, 22 Nov 2014 17:20:18 -0500 Original-Received: from mout.gmx.net ([212.227.15.18]:49543) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XsJ2M-0007K0-PQ for 19102@debbugs.gnu.org; Sat, 22 Nov 2014 17:20:16 -0500 Original-Received: from rosalinde.fritz.box ([89.245.78.19]) by mail.gmx.com (mrgmx003) with ESMTPSA (Nemesis) id 0M2cYX-1YAvwn3Kpp-00sR99; Sat, 22 Nov 2014 23:20:05 +0100 In-Reply-To: (Stefan Monnier's message of "Sat, 22 Nov 2014 11:32:21 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-Provags-ID: V03:K0:GK17LvhA596zeu845DMEBdmWo7SQgCd4X0wApoIzlDPWPx8FcGy zM7tnzEoFJA6SSgRZ346fbbOuynvH8G2WUUdCQpHBtpYsNnB/ft4j8SvTj3vAPr638/01sM Hxi30nI3sWceZxa8qqhbgBSuvQq+oAnxv7zL7VZ0tzEKouAUY6bsypbHm34MxIrL4g6r76v 99oN6/5N+1ol56qzK6/hw== X-UI-Out-Filterresults: notjunk:1; X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:96437 Archived-At: On Sat, 22 Nov 2014 11:32:21 -0500 Stefan Monnier wrote: >> Yes. As long as there is a final newline, the only change the current >> code needs is to replace `=' with `eq'. So given that >> require-final-newline is true for files in outline-mode, the only case >> that requires adding a final newline is a non-file outline-mode buffer >> that lacks a final newline. > > I don't understand why there'd be a difference between file and > non-file buffers. Outline-mode doesn't care about files at all. > > The buffer can end without a newline both in the file and in the > non-file case, regardless of the require-final-newline setting. But by default, when a file in outline-mode is saved, if it doesn't end in a new line one is added, so on revisiting the file the user would have to delete the final newline for there to be none. Otherwise, the only problematic case is a buffer in outline-mode that hasn't been written to a file yet, since here the user has to add a final newline to avoid errors. Here's a minimal recipe to show the problem: 0. emacs -Q 1. C-x b test RET 2. evaluate this sexp: (progn (switch-to-buffer (generate-new-buffer "test")) (insert "* one\n* two\n") (outline-mode)) 3. Typing `C-c C-v' (outline-move-subtree-down) with point on either line, or typing `C-c C-^' (outline-move-subtree-up) with point on the second line, raises the error "Wrong type argument: number-or-marker-p, nil". (This is the error of the OP of this bug.) 4. You can avoid this error by replacing both occurrences of `=' with `eq' in outline-move-subtree-down, and now `C-c C-v' and `C-c C-^' work as expected. 5. Now delete the final newline, so that eob is after the "o" in line 2. => Now typing either `C-c C-v' with point on line one or `C-c C-^' with point line two result in the buffer containing the single line "* two* one". So once the error in step 3 is fixed, you still have to make sure there's a final newline. > OTOH, we can add a final newline pretty much any time we feel like it > (better not do it gratuitously, but in the present case I can't think > of any reason why we'd go out of our way just to avoid adding a final > newline). Does "we" refer to the outline.el code? If so, the proposed patch does just the opposite: it makes sure there's a final newline. Does this make things clearer? Steve Berman