Function: kotl-mode:transpose-lines
kotl-mode:transpose-lines is an interactive and byte-compiled function
defined in kotl-mode.el.
Signature
(kotl-mode:transpose-lines ARG)
Documentation
Exchange current line and previous line, leaving point after both.
If no previous line, exchange current with next line. With prefix ARG, take previous line and move it past ARG lines. With prefix ARG = 0, interchange the line that contains point with the line that contains mark.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/kotl/kotl-mode.el
(defun kotl-mode:transpose-lines (arg)
"Exchange current line and previous line, leaving point after both.
If no previous line, exchange current with next line.
With prefix ARG, take previous line and move it past ARG lines.
With prefix ARG = 0, interchange the line that contains point with the line
that contains mark."
(interactive "*p")
(cond
((and (kotl-mode:first-line-p) (kotl-mode:last-line-p))
(error "(kotl-mode:transpose-lines): Only one line in outline"))
;;
;; Transpose current and previous lines or current and next lines, if no
;; previous line. Leave point after both exchanged lines.
((= arg 1)
(let* ((point (point-marker))
(mark (set-marker (make-marker)
(if (kotl-mode:first-line-p)
(kotl-mode:next-line 1)
(kotl-mode:previous-line 1)))))
(kotl-mode:transpose-lines-internal point mark)
(goto-char (max point mark))
(kotl-mode:next-line 1)
(set-marker mark nil)))
;;
;; Transpose point and mark lines, leaving point on the line of text that
;; originally contained point.
((= arg 0)
(kotl-mode:transpose-lines-internal (point-marker) (mark-marker))
(kotl-mode:exchange-point-and-mark))
;;
;; Move previous line past ARG next lines and leave point after previous
;; line text.
(t
(if (kotl-mode:first-line-p)
(error "(kotl-mode:transpose-lines): No previous line to transpose"))
(kotl-mode:previous-line 1)
(let* ((mark (set-marker (make-marker)
(save-excursion (kotl-mode:next-line arg))))
(line-to-move (kotl-mode:delete-line)))
;; Delete trailing newline if any, ignoring error.
(ignore-errors (kotl-mode:delete-char 1))
(goto-char mark)
(set-marker mark nil)
(kotl-mode:to-end-of-line)
(insert "\n")
(insert-char ?\ (kcell-view:indent))
(insert line-to-move)
(kotl-mode:beginning-of-line)))))