[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#24766: 26.0.50: [PATCH] Confusing behaviour for indent-relative-mayb
From: |
Alex |
Subject: |
bug#24766: 26.0.50: [PATCH] Confusing behaviour for indent-relative-maybe |
Date: |
Sun, 23 Oct 2016 14:43:57 -0600 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) |
Eli Zaretskii <eliz@gnu.org> 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:
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'.
- bug#24766: 26.0.50: [PATCH] Confusing behaviour for indent-relative-maybe, Alex, 2016/10/22
- bug#24766: 26.0.50: [PATCH] Confusing behaviour for indent-relative-maybe, Eli Zaretskii, 2016/10/22
- bug#24766: 26.0.50: [PATCH] Confusing behaviour for indent-relative-maybe, Alex, 2016/10/22
- bug#24766: 26.0.50: [PATCH] Confusing behaviour for indent-relative-maybe, Eli Zaretskii, 2016/10/22
- bug#24766: 26.0.50: [PATCH] Confusing behaviour for indent-relative-maybe, Alex, 2016/10/22
- bug#24766: 26.0.50: [PATCH] Confusing behaviour for indent-relative-maybe, Eli Zaretskii, 2016/10/23
- bug#24766: 26.0.50: [PATCH] Confusing behaviour for indent-relative-maybe,
Alex <=
- bug#24766: 26.0.50: [PATCH] Confusing behaviour for indent-relative-maybe, Eli Zaretskii, 2016/10/24
- bug#24766: 26.0.50: [PATCH] Confusing behaviour for indent-relative-maybe, Alex, 2016/10/24
- bug#24766: 26.0.50: [PATCH] Confusing behaviour for indent-relative-maybe, Eli Zaretskii, 2016/10/24