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: Tue, 08 Nov 2016 13:09:42 -0600 Message-ID: <87k2cdn5zd.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> <87twc2iynm.fsf@gmail.com> <837f8y5f5x.fsf@gnu.org> <87insh4keo.fsf@gmail.com> <83insh34g8.fsf@gnu.org> <878tsuivot.fsf@gmail.com> <83h97iggcy.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1478632459 9158 195.159.176.226 (8 Nov 2016 19:14:19 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 8 Nov 2016 19:14:19 +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 Tue Nov 08 20:14:15 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 1c4BqU-0001Ol-Hn for geb-bug-gnu-emacs@m.gmane.org; Tue, 08 Nov 2016 20:14:10 +0100 Original-Received: from localhost ([::1]:34957 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c4BqX-0006Ds-KC for geb-bug-gnu-emacs@m.gmane.org; Tue, 08 Nov 2016 14:14:13 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50565) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c4BnX-00045x-ME for bug-gnu-emacs@gnu.org; Tue, 08 Nov 2016 14:11:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c4BnS-0000ug-KJ for bug-gnu-emacs@gnu.org; Tue, 08 Nov 2016 14:11:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:34576) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c4BnS-0000uA-Ex for bug-gnu-emacs@gnu.org; Tue, 08 Nov 2016 14:11:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1c4BnS-00019k-9q for bug-gnu-emacs@gnu.org; Tue, 08 Nov 2016 14:11:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alex Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 08 Nov 2016 19:11: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.14786322054370 (code B ref 24766); Tue, 08 Nov 2016 19:11:02 +0000 Original-Received: (at 24766) by debbugs.gnu.org; 8 Nov 2016 19:10:05 +0000 Original-Received: from localhost ([127.0.0.1]:49974 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c4BmX-00018Q-1Q for submit@debbugs.gnu.org; Tue, 08 Nov 2016 14:10:05 -0500 Original-Received: from mail-it0-f66.google.com ([209.85.214.66]:33884) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c4BmV-00017P-JX for 24766@debbugs.gnu.org; Tue, 08 Nov 2016 14:10:03 -0500 Original-Received: by mail-it0-f66.google.com with SMTP id q124so18434155itd.1 for <24766@debbugs.gnu.org>; Tue, 08 Nov 2016 11:10:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=11RJaaai2NcH1FINT2Fxn596/rDWEpBlNFVgsoRfguM=; b=xfTHytSRpDry9PwFGPyCI0FPfdpvrd+MWrF9CAv7HI0kUcIRBcyluecimjNl/J1rDm E2Bm+KB0uy/5+HafY3yfgKg+UWkQpeFyDVvaEiohmMKQLyr2ree3uOgAXrCuSuBu+nGE rg7JxtciOnw3DhY8Jpp1G++zDR7HPL+/+kl0nz5QQFpFVAiyRAIQM61ijmReZsbo1T49 pghXQPgr1KBwnG7bSjGksxHnVr+uNt3TkLMcvUZ/blhvN6KRYdrsscEJ0CeLjaJlZ937 o/sWHqIO1I2ywLvSAyFDH79GCVQCJFThE7FKzNcWetJQ3W0ZOpnEEl/kF+ixv6KpIiEb +67Q== 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:references:date:in-reply-to :message-id:user-agent:mime-version; bh=11RJaaai2NcH1FINT2Fxn596/rDWEpBlNFVgsoRfguM=; b=GnEwqkvVZGo9tS3UF3bu4G4QYdUSFZi2VDRuVIdNF5i7IFjSbKm32E5DqMST/OhKWs sor+OFXOIiYeGBpD2MI0roj9wmvwm98b55kHvlHWB75t06csPOt5bCPX/3eozkjPRjTL 9OoDE5F5wF4d0/WItpyx0G0Ws13S1lrTkK4KLsNU0t/pub0HRB9ULQGOCQsA7SSdmVco bL6q0vK4THjcdeCOuMrNlSgRJ6lpCC4TTQyKjtWg8IH8CVEg5BYgMKhkF9KcVZiOSzyr /Ot39PgGtIJl0NFNs2oYKjaRWVNWazyUAup8IiWXiqx1sEhwoDMwEaaGneLqONuIsDng GvZA== X-Gm-Message-State: ABUngvepuEhQM0q2TBy0Q1CthIJ21CzAvIdE2G07aRzjsOJMv1s9GImreAipU8OXpEZdIQ== X-Received: by 10.107.7.168 with SMTP id g40mr14192832ioi.114.1478632198070; Tue, 08 Nov 2016 11:09:58 -0800 (PST) Original-Received: from lylat (S01061859339e9903.ss.shawcable.net. [174.2.107.88]) by smtp.gmail.com with ESMTPSA id l14sm12628769ioi.18.2016.11.08.11.09.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 08 Nov 2016 11:09:57 -0800 (PST) In-Reply-To: <83h97iggcy.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 08 Nov 2016 17:07:25 +0200") 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:125483 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii writes: > Thanks, this is fine, except that the new function's name should be > better as indent-relative-first-indent-point or somesuch. That name does better describe how (indent-relative t) works, but I figured that indent-relative-whitespace is a better name for what people seem to use it for (indent according to the whitespace on the previous nonblank line). Though if you still disagree then `indent-relative-first-indent-point' seems fine (if not a bit long). I suppose this diff goes over the accepted limit for non-assigned submissions? I mailed my copyright forms about a month ago but unfortunately the FSF hasn't informed me that the process is complete yet. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=indent4.diff Content-Description: 4th time diff --git a/lisp/indent.el b/lisp/indent.el index 0f6c68d..6d04192 100644 --- a/lisp/indent.el +++ b/lisp/indent.el @@ -559,26 +559,32 @@ indent-region ;; by hand. (setq deactivate-mark t)) -(defun indent-relative-maybe () - "Indent a new line like previous nonblank line. -If the previous nonblank line has no indent points beyond the -column point starts at, this command does nothing. +(define-obsolete-function-alias 'indent-relative-maybe + 'indent-relative-first-indent-point "26.1") + +(defun indent-relative-first-indent-point () + "Indent the current line like the previous nonblank line. +Indent to the first indentation position in the previous nonblank +line if that position is greater than the current column. See also `indent-relative'." (interactive) (indent-relative 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. ^ ^ ^ ^ ^ ^ ^ ^ ^ +If FIRST-ONLY is non-nil, then only the first indent point is +considered. + If the previous nonblank line has no indent points beyond the -column point starts at, `tab-to-tab-stop' is done instead, unless -this command is invoked with a numeric argument, in which case it -does nothing. +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. -See also `indent-relative-maybe'." +See also `indent-relative-first-indent-point'." (interactive "P") (if (and abbrev-mode (eq (char-syntax (preceding-char)) ?w)) @@ -594,17 +600,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'. --=-=-=--