From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alex Newsgroups: gmane.emacs.bugs Subject: bug#24766: 26.0.50: [PATCH] Confusing behaviour for indent-relative-maybe Date: Sun, 23 Oct 2016 14:43:57 -0600 Message-ID: <87twc2iynm.fsf@gmail.com> References: <8760ok8ays.fsf@gmail.com> <83lgxgp4ts.fsf@gnu.org> <871sz8894m.fsf@gmail.com> <83h984p3lb.fsf@gnu.org> <87shro6ol6.fsf@gmail.com> <83a8dvpor2.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1477255542 20746 195.159.176.226 (23 Oct 2016 20:45:42 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 23 Oct 2016 20:45:42 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) Cc: 24766@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Oct 23 22:45:38 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1byPdp-0001y5-EI for geb-bug-gnu-emacs@m.gmane.org; Sun, 23 Oct 2016 22:45:13 +0200 Original-Received: from localhost ([::1]:42390 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1byPdr-0006g7-JM for geb-bug-gnu-emacs@m.gmane.org; Sun, 23 Oct 2016 16:45:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53884) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1byPdj-0006eF-Gz for bug-gnu-emacs@gnu.org; Sun, 23 Oct 2016 16:45:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1byPde-0007Y1-KE for bug-gnu-emacs@gnu.org; Sun, 23 Oct 2016 16:45:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:34881) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1byPde-0007XR-Gz for bug-gnu-emacs@gnu.org; Sun, 23 Oct 2016 16:45:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1byPde-0001gq-8f for bug-gnu-emacs@gnu.org; Sun, 23 Oct 2016 16:45:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alex Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 23 Oct 2016 20:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24766 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 24766-submit@debbugs.gnu.org id=B24766.14772554506416 (code B ref 24766); Sun, 23 Oct 2016 20:45:02 +0000 Original-Received: (at 24766) by debbugs.gnu.org; 23 Oct 2016 20:44:10 +0000 Original-Received: from localhost ([127.0.0.1]:50280 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1byPco-0001fQ-9G for submit@debbugs.gnu.org; Sun, 23 Oct 2016 16:44:10 -0400 Original-Received: from mail-yw0-f180.google.com ([209.85.161.180]:36297) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1byPcm-0001fD-JC for 24766@debbugs.gnu.org; Sun, 23 Oct 2016 16:44:08 -0400 Original-Received: by mail-yw0-f180.google.com with SMTP id u124so147116441ywg.3 for <24766@debbugs.gnu.org>; Sun, 23 Oct 2016 13:44:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version; bh=VYcvv+Aw1KhrKbK/fplubuKUl3/I882kAFJK1C9CeeE=; b=odV6aHCXvfwxaYCwhyiR891fzMQxmzF10DDtNNK+ycgWn/AQJmdF9r09eUwGJhu+9a 8f6zTLXup3jSwCr0BHNAVinTQItRXrnrmVghCyfPGwMioj1Jh+rcl0LfIbxwaU0BTaYW 1GUez84nBhFLEaVfx6TA/CREZno4YIMcjTUnAQgA2gT1aFaUhjhiny9vf1vOgTURFHDP x4tDcAUyZJB+lJ3RNuD3HWuZKVaQAPsZxXPM+pcPv7uzWN7x66KKnczuA0aW5w/h0dq8 l7HXGnVpJmefdonmib/WSGcaDKjx7gSsXY8H98MTf4Mwyxfa+f+5U9yXZV2vAmodqx22 IyEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references :user-agent:date:message-id:mime-version; bh=VYcvv+Aw1KhrKbK/fplubuKUl3/I882kAFJK1C9CeeE=; b=awtFv289ROfk9LwtWq6zQD+WuuGC9Cmqu814UImqroECSY6l4Ic/DIHg1Z/gkHp5qs RozwDAhZGAnUv3GsVZwze28Awq1ziVsSjgd3PltRhgzF2bv7i8Kx4t9C2RxnOdIRIiU4 vSDQmcql4GUnVzjyUeDkrJID/8M6BBu+ojCNprxhaCleHBf6BMHV0lLBA3vaeRNiqp/H KihVnGu9NZl0fkdg+8r/36X4hlKi6LfgHUfAKwEvO4Gci0dV50fYizfwRTSh1LX86yk3 dqhK+qelitvtRuen5R/rPtdhXMm2KPS7qm6FFx28Q+sVPNF6woIhJoa/DUXofFBV9Ws9 +jfQ== X-Gm-Message-State: ABUngvfpik2SRjNhtmv07XOIEVspGlzaG8ZavONNEAEn0yL7bO1nk+zHlzxBmDu3guIGNg== X-Received: by 10.107.43.75 with SMTP id r72mr10402964ior.26.1477255442993; Sun, 23 Oct 2016 13:44:02 -0700 (PDT) Original-Received: from lylat (S01061859339e9903.ss.shawcable.net. [174.2.107.88]) by smtp.gmail.com with ESMTPSA id b6sm6216883iob.4.2016.10.23.13.44.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 23 Oct 2016 13:44:02 -0700 (PDT) In-Reply-To: <83a8dvpor2.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 23 Oct 2016 09:23:45 +0300") 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: 208.118.235.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:124936 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii writes: > Like I said, I don't think the behavior should be changed, only the > documentation, which is somewhat misleading. If we want some > different behavior, we could have a new function, or a new value of > the argument to indent-relative. > > Thanks. What about changing `indent-relative-maybe' and adding an extra argument to `indent-relative'? Since `indent-relative-maybe' has had that docstring for a good 15 years, and the name fits the new behaviour more. Then in Emacs core we can replace the single instance of it with (indent-relative t). The corresponding diff: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=indent2.patch Content-Description: second time diff --git a/lisp/indent.el b/lisp/indent.el index 0f6c68d..675b6b8 100644 --- a/lisp/indent.el +++ b/lisp/indent.el @@ -566,9 +566,9 @@ indent-relative-maybe See also `indent-relative'." (interactive) - (indent-relative t)) + (indent-relative nil t)) -(defun indent-relative (&optional unindented-ok) +(defun indent-relative (&optional first-only unindented-ok) "Space out to under next indent point in previous nonblank line. An indent point is a non-whitespace character following whitespace. The following line shows the indentation points in this line. @@ -594,17 +594,18 @@ indent-relative (if (> (current-column) start-column) (backward-char 1)) (or (looking-at "[ \t]") - unindented-ok + first-only (skip-chars-forward "^ \t" end)) (skip-chars-forward " \t" end) (or (= (point) end) (setq indent (current-column)))))) - (if indent - (let ((opoint (point-marker))) - (indent-to indent 0) - (if (> opoint (point)) - (goto-char opoint)) - (move-marker opoint nil)) - (tab-to-tab-stop)))) + (cond (indent + (let ((opoint (point-marker))) + (indent-to indent 0) + (if (> opoint (point)) + (goto-char opoint)) + (move-marker opoint nil))) + (unindented-ok nil) + (t (tab-to-tab-stop))))) (defcustom tab-stop-list nil "List of tab stop positions used by `tab-to-tab-stop'. --=-=-=--