Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
2026-05-16 Bob Weiner <rsw@gnu.org>

* kotl/kotl-mode.el (kotl-mode:split-cell): Fix to ensure point within a
valid cell position and fix to not modify label-separator and leave
a stray character in the original cell when splitting at the first
character of that cell, i.e. all contents move to the second cell.
test/kotl-mode-tests.el (kotl-mode-split-cell): Add test of split on
first character.

2026-05-16 Mats Lidell <matsl@gnu.org>

* hload-path.el (hload-path--make-directory-autoloads-in-sync-subprocess):
Expand Down
11 changes: 7 additions & 4 deletions kotl/kotl-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; Author: Bob Weiner
;;
;; Orig-Date: 6/30/93
;; Last-Mod: 11-May-26 at 12:50:49 by Bob Weiner
;; Last-Mod: 16-May-26 at 11:55:50 by Bob Weiner
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
Expand Down Expand Up @@ -3054,9 +3054,12 @@ With optional universal ARG, {\\`C-u'}, the new cell is added as the child of
the current cell. Non-read-only attributes from the current cell are
replicated in the new cell."
(interactive "*P")
;; delete any surrounding whitespace
(delete-horizontal-space)
(delete-region (point) (progn (skip-chars-backward "\n\r\t ") (point)))
(kotl-mode:to-valid-position)
(kcell-view:operate
(lambda ()
;; delete any surrounding whitespace
(delete-horizontal-space)
(delete-region (point) (progn (skip-chars-backward "\n\r\t ") (point)))))
(let ((new-cell-contents (kotl-mode:kill-region
(point) (kcell-view:end-contents) 'string))
(start (kcell-view:start))
Expand Down
15 changes: 13 additions & 2 deletions test/kotl-mode-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; Author: Mats Lidell <matsl@gnu.org>
;;
;; Orig-Date: 18-May-21 at 22:14:10
;; Last-Mod: 12-Apr-26 at 15:11:30 by Bob Weiner
;; Last-Mod: 16-May-26 at 12:04:54 by Bob Weiner
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
Expand Down Expand Up @@ -491,7 +491,18 @@
(kotl-mode:previous-line 1)
(kotl-mode:end-of-line)
(kotl-mode:split-cell)
(should (= (line-number-at-pos) 3))))
(should (= (line-number-at-pos) 3)))
(ert-info ("Split on first char in cell")
(kotl-mode:kill-tree 0)
(insert "first")
(kotl-mode:beginning-of-line)
(kotl-mode:split-cell)
(should (= (line-number-at-pos) 3))
(should (string= (kcell-view:contents) "first"))
(kotl-mode:previous-cell 1)
(should (string= (kcell-view:contents) ""))
(should (string= " 1. " (buffer-substring-no-properties
(line-beginning-position) (point))))))
(hy-delete-file-and-buffer kotl-file))))

(ert-deftest kotl-mode-append-cell ()
Expand Down