From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: "Basil L. Contovounesios" Newsgroups: gmane.emacs.bugs Subject: bug#34858: indent-relative called with prefix calls tab-to-tab-stop Date: Tue, 02 Apr 2019 01:11:57 +0100 Message-ID: <87v9zx6zaq.fsf@tcd.ie> References: <871s39mpu6.fsf@gmail.com> <83wol11m5b.fsf@gnu.org> <87wol1l9bn.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="155037"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: 34858@debbugs.gnu.org To: Alex Branham Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Apr 02 02:23:51 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hB7DT-000e5Z-8h for geb-bug-gnu-emacs@m.gmane.org; Tue, 02 Apr 2019 02:23:51 +0200 Original-Received: from localhost ([127.0.0.1]:37637 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hB7DM-0004mF-OU for geb-bug-gnu-emacs@m.gmane.org; Mon, 01 Apr 2019 20:23:44 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:43935) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hB7D9-0004dR-Na for bug-gnu-emacs@gnu.org; Mon, 01 Apr 2019 20:23:33 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hB739-00075p-3k for bug-gnu-emacs@gnu.org; Mon, 01 Apr 2019 20:13:12 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:54786) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hB730-0006zr-8a for bug-gnu-emacs@gnu.org; Mon, 01 Apr 2019 20:13:05 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hB730-0004R1-2L for bug-gnu-emacs@gnu.org; Mon, 01 Apr 2019 20:13:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "Basil L. Contovounesios" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 02 Apr 2019 00:13:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34858 X-GNU-PR-Package: emacs Original-Received: via spool by 34858-submit@debbugs.gnu.org id=B34858.155416393216984 (code B ref 34858); Tue, 02 Apr 2019 00:13:01 +0000 Original-Received: (at 34858) by debbugs.gnu.org; 2 Apr 2019 00:12:12 +0000 Original-Received: from localhost ([127.0.0.1]:40097 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hB72C-0004Ps-5t for submit@debbugs.gnu.org; Mon, 01 Apr 2019 20:12:12 -0400 Original-Received: from mail-ed1-f51.google.com ([209.85.208.51]:46611) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hB729-0004Pc-Q4 for 34858@debbugs.gnu.org; Mon, 01 Apr 2019 20:12:10 -0400 Original-Received: by mail-ed1-f51.google.com with SMTP id d1so9965073edd.13 for <34858@debbugs.gnu.org>; Mon, 01 Apr 2019 17:12:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd-ie.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=uZCeJedEpLJNVPXHPvNfggXSPlpuAaavJo8aj32653c=; b=uvDfIX2XcVN4elvjpQbDMpZ+IMiGR7Z+k4BYjx3O6PswKN/YoAMiv2KFWQz4lFji1Y WTZCCGGebzLwtIHxn6oJMy6octnumoVSEQkRNXLy4uGGZRgqtUe/DdY+NQnV6oQvMQUl zoPaiE+SsnttZVjhSW+cJeFfT15WEKLMZq3mTd7ePQZ7NPpZjsTAd5VmVedXoqsuRG7S GjEA057slFOqTCeO29kjKzcwLljr1B8EAshwxl+hzBMscgx61XTmkcMxYaktjsDjoDI2 z9H3gRiqKDk7W66DxuZUTo2bWGLrGwaSRXVQFNQdf8USrlnCFJ7oElcsWoVwaZTWiqpa +atQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=uZCeJedEpLJNVPXHPvNfggXSPlpuAaavJo8aj32653c=; b=XxljDoRVkLT1CFykj2AXynqH3wXQhnOshDQsls+rcP3drFhax+YKQVtj9Mq5KbcOFP LGvwo7vdFBPjRdCiw9+xeP8hpvV9tZIANczVBifRDa8FsiisVHadXwosZZ3qq4y8XTlg jEA5vyNpLBcoLZlMNzkbCmc+vTIvqdUEBnGhPSlgCg7pEO+BHuC0xr0cAIC0aRnGdKAF ddXOlqOEB2GzXQHNI1cfDMYS3YD+88TUqX4liw30M1SPNo/XsCYK8xiSFrr+a3I20Dqi 5yRE61B0g/LMfqeLqDKZDY/Dma3SonrmRVsLXAg1qgWkb/8gTJ6IR9nF0nD5Ofjt7hY1 5i1w== X-Gm-Message-State: APjAAAV04PKXXU2WUYVat2/rw0AJtfn+II0t/Wq5fhkmUQA2oTpr3iDY q5+f15N3ur4lcVc+XgSZHo0tag== X-Google-Smtp-Source: APXvYqzi8Azh9kFQpuY5BypJMqhDH/degrnjfGLPDydlsKgpW0C2RqanEv3S8FjLB3Dl+tYUnvkoWA== X-Received: by 2002:aa7:c383:: with SMTP id k3mr7267357edq.137.1554163924172; Mon, 01 Apr 2019 17:12:04 -0700 (PDT) Original-Received: from localhost ([2a02:8084:20e2:c380:20c2:134e:4f3a:683a]) by smtp.gmail.com with ESMTPSA id i49sm1937433ede.95.2019.04.01.17.12.02 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 01 Apr 2019 17:12:03 -0700 (PDT) In-Reply-To: <87wol1l9bn.fsf@gmail.com> (Alex Branham's message of "Thu, 14 Mar 2019 11:17:16 -0500") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.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" Xref: news.gmane.org gmane.emacs.bugs:157061 Archived-At: --=-=-= Content-Type: text/plain Alex Branham writes: > On Thu 14 Mar 2019 at 11:00, Eli Zaretskii wrote: > >> I think this is a documentation bug, as it doesn't describe the >> special case of "no previous nonblank line". > > OK, patch attached. While looking over this I noticed the lisp reference > manual also needed to be updated a bit so I did that as well. I think some code needs updating in addition to the Elisp manual: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Avoid-using-obsolete-indent-relative-maybe.patch >From d8c74ae527c52cffcb23d9704a899dd304188276 Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" Date: Tue, 2 Apr 2019 00:56:04 +0100 Subject: [PATCH] Avoid using obsolete indent-relative-maybe * lisp/electric.el (electric-indent-functions-without-reindent): * lisp/indent.el (indent-according-to-mode): Check for indent-relative-first-indent-point in addition to its obsolete alias indent-relative-maybe. * lisp/obsolete/vi.el (vi-com-map): Use indent-relative-first-indent-point in place of its obsolete alias indent-relative-maybe. --- lisp/electric.el | 6 +++--- lisp/indent.el | 10 ++++++---- lisp/obsolete/vi.el | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/lisp/electric.el b/lisp/electric.el index 657913a396..07da2f1d9e 100644 --- a/lisp/electric.el +++ b/lisp/electric.el @@ -223,9 +223,9 @@ electric-indent-inhibit (defvar electric-indent-functions-without-reindent '(indent-relative indent-to-left-margin indent-relative-maybe - py-indent-line coffee-indent-line org-indent-line yaml-indent-line - haskell-indentation-indent-line haskell-indent-cycle haskell-simple-indent - yaml-indent-line) + indent-relative-first-indent-point py-indent-line coffee-indent-line + org-indent-line yaml-indent-line haskell-indentation-indent-line + haskell-indent-cycle haskell-simple-indent yaml-indent-line) "List of indent functions that can't reindent. If `indent-line-function' is one of those, then `electric-indent-mode' will not try to reindent lines. It is normally better to make the major diff --git a/lisp/indent.el b/lisp/indent.el index 34757a43d7..f3d3158faa 100644 --- a/lisp/indent.el +++ b/lisp/indent.el @@ -65,15 +65,17 @@ indent-according-to-mode "Indent line in proper way for current major mode. Normally, this is done by calling the function specified by the variable `indent-line-function'. However, if the value of that -variable is `indent-relative' or `indent-relative-maybe', handle -it specially (since those functions are used for tabbing); in -that case, indent by aligning to the previous non-blank line." +variable is `indent-relative' or `indent-relative-first-indent-point', +handle it specially (since those functions are used for tabbing); +in that case, indent by aligning to the previous non-blank line." (interactive) (save-restriction (widen) (syntax-propertize (line-end-position)) (if (memq indent-line-function - '(indent-relative indent-relative-maybe)) + '(indent-relative + indent-relative-maybe + indent-relative-first-indent-point)) ;; These functions are used for tabbing, but can't be used for ;; indenting. Replace with something ad-hoc. (let ((column (save-excursion diff --git a/lisp/obsolete/vi.el b/lisp/obsolete/vi.el index 7d44f561d4..df5ddfdbcf 100644 --- a/lisp/obsolete/vi.el +++ b/lisp/obsolete/vi.el @@ -132,7 +132,7 @@ vi-com-map (define-key vi-com-map "\C-e" 'vi-expose-line-below) (define-key vi-com-map "\C-f" 'vi-forward-windowful) (define-key vi-com-map "\C-g" 'keyboard-quit) - (define-key vi-com-map "\C-i" 'indent-relative-maybe) ; TAB + (define-key vi-com-map "\C-i" 'indent-relative-first-indent-point) ; TAB (define-key vi-com-map "\C-j" 'vi-next-line) ; LFD (define-key vi-com-map "\C-k" 'vi-kill-line) ; extension (define-key vi-com-map "\C-l" 'recenter) -- 2.20.1 --=-=-= Content-Type: text/plain I think the changes pertaining to the move from indent-relative-maybe to indent-relative-first-indent-point should be pushed independently of any changes to the behaviour of indent-relative at BOB or its documentation. Can they be pushed to master, and only backported to emacs-26 as needed/applicable? > From cefe6581558e45558907996ea39ac44e512f7944 Mon Sep 17 00:00:00 2001 > From: Alex Branham > Date: Thu, 14 Mar 2019 11:14:18 -0500 > Subject: [PATCH] Update documentation for indent-relative functions > > * lisp/indent.el (indent-relative): Document what happens when there > is no previous nonblank line. > * doc/lispref/text.texi (Relative Indent): Document > indent-relative-first-indent-point instead of obsolete > indent-relative-maybe. Fix documentation of which argument from ^^^ Missing double space. > diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi > index 21c5a73f88..abcea17010 100644 > --- a/doc/lispref/text.texi > +++ b/doc/lispref/text.texi > @@ -2571,11 +2571,11 @@ The quick brown fox jum @point{}ped. > @end example > @end deffn > > -@deffn Command indent-relative-maybe > +@deffn Command indent-relative-first-indent-point > @comment !!SourceFile indent.el > This command indents the current line like the previous nonblank line, > by calling @code{indent-relative} with @code{t} as the > -@var{unindented-ok} argument. The return value is unpredictable. > +@var{first-only} argument. The return value is unpredictable. Just curious: is there any preference between "unpredictable" and "undefined" for documenting return values? If so, why? > If the previous nonblank line has no indent points beyond the current > column, this command does nothing. > diff --git a/lisp/indent.el b/lisp/indent.el > index 34757a43d7..25615f4113 100644 > --- a/lisp/indent.el > +++ b/lisp/indent.el > @@ -598,8 +598,8 @@ considered. > > If the previous nonblank line has no indent points beyond the > column point starts at, then `tab-to-tab-stop' is done, if both > -FIRST-ONLY and UNINDENTED-OK are nil, otherwise nothing is done > -in this case. > +FIRST-ONLY and UNINDENTED-OK are nil, otherwise nothing is done. > +If there isn't a previous nonblank line, call `tab-to-tab-stop'. I'm not against spelling this final sentence out, but in my reading it's already covered by the first sentence, as a non-existent line vacuously "has no indent points beyond the column point starts at". ;) Thanks, -- Basil --=-=-=--