The tab-to-tab-stop
command moves the point to the next tabstop; I can't find an equivalent to move to the previous tabstop and tab-to-tab-stop
doesn't accept a universal argument to reverse direction.
Indeed, looking at the source for tab-to-tab-stop
,
(defun tab-to-tab-stop ()
(interactive)
(and abbrev-mode (= (char-syntax (preceding-char)) ?w)
(expand-abbrev))
(let ((nexttab (indent-next-tab-stop (current-column))))
(delete-horizontal-space t)
(indent-to nexttab)))
it would only need to accept an optional prefix argument to pass to indent-next-tab-stop
in order to achieve the requested bidirectionality, like so:
(defun my-tab-to-tab-stop (&optional prev)
"Like `tab-to-tab-stop', but toggle direction with prefix."
(interactive "P")
(let ((nexttab (indent-next-tab-stop (current-column) prev)))
(delete-horizontal-space t)
(indent-to nexttab)))
I think the function is simple enough that you can redefine/rebind it yourself as I have shown (I left out the abbrev-mode
stuff because I don't think it makes sense to expand things when indenting backwards).
You could also look into submitting this as a feature request (I am not familiar with the process).
-
1