Skip to content

Commit

Permalink
kotl-mode - fix kill and yank commands not moving to valid pos first
Browse files Browse the repository at this point in the history
Fix improper use of `hkey-value' as tag when it was not a string.
  • Loading branch information
rswgnu committed Dec 29, 2023
1 parent ee453d1 commit 7adb441
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 30 deletions.
15 changes: 13 additions & 2 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
2023-12-29 Bob Weiner <[email protected]>

* hmouse-tag.el (smart-lisp-find-tag): Fix issue where 'hkey-value' was used
as tag when it was not a string, causing failures on known function lookups.

2023-12-28 Bob Weiner <[email protected]>

* kotl/kotl-mode.el (kotl-mode:pre-self-insert-command): Add these kotl-mode
commands: kill-line, kill-region, kill-sentence, kill-or-copy-region, yank,
yank-from-kill-ring, yank-pop, and yank-rectangle.
(kotl-mode:to-valid-position-commands): Make list of commands
modifiable.

* hypb-ert.el (hypb-ert-def-at-p): Add support for `ert-deftest-async' from the
"ert-async.el" package.

Expand Down Expand Up @@ -42,13 +53,13 @@

2023-12-26 Bob Weiner <[email protected]>

* hpath.el (hpath:to-markup-anchor): If referent-regexp starts with '^', add
* hpath.el (hpath:to-markup-anchor): If 'referent-regexp' starts with '^', add
"[ \t]*" instead of "[ \t]+" to the expression in case it matches the whole line.

* hui.el (hui:link-possible-types): Change outline heading line link to trigger only
for outline, org and kotl modes when point is anywhere on the heading line.
Include non-zero column in pathname so returns to the original point. Produce a
link-to-string-match type.
'link-to-string-match' type.
hbut.el (ibut:insert-text): Change 'actypes::link-to-string-match' to use a pathname
format ibut rather than a <link-to-string-match> action button when the occurrence
number is 1.
Expand Down
4 changes: 2 additions & 2 deletions hmouse-tag.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; Author: Bob Weiner
;;
;; Orig-Date: 24-Aug-91
;; Last-Mod: 28-Dec-23 at 11:16:10 by Bob Weiner
;; Last-Mod: 29-Dec-23 at 00:52:05 by Bob Weiner
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
Expand Down Expand Up @@ -699,7 +699,7 @@ Use `hpath:display-buffer' to show definition or documentation."
"Show doc for" "Find")))
current-prefix-arg))
(unless (stringp tag)
(setq tag (or hkey-value (smart-lisp-at-tag-p t))))
(setq tag (if (stringp hkey-value) hkey-value (smart-lisp-at-tag-p t))))
(let* ((elisp-flag (smart-emacs-lisp-mode-p))
(tag-sym (intern-soft tag)))
(cond ((and show-doc elisp-flag)
Expand Down
63 changes: 37 additions & 26 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: 25-Dec-23 at 23:33:09 by Bob Weiner
;; Last-Mod: 29-Dec-23 at 02:05:41 by Bob Weiner
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
Expand Down Expand Up @@ -38,18 +38,11 @@
;;; Public variables
;;; ************************************************************************

(defvar kotl-mode-map nil
"Keymap containing koutliner editing and viewing commands.")

(defvar kotl-previous-mode nil
"Default mode of koutline buffers prior to invocation of kotl-mode.")

(defcustom kotl-mode:shrink-region-flag nil
"*Non-nil means Koutliner commands automatically shrink the region.
The region is shrinked within the visible bounds of a single cell
before editing it. The region then falls within the first
visible cell that was part of the region or that followed it.
Default value is nil."
(defcustom kotl-mode:indent-tabs-mode t
"*Non-nil means {\\[kotl-mode:tab-command]} may insert literal tab characters.
Tab characters are inserted rather than space characters when
`kotl-mode:tab-flag' is non-nil. Default value is t. The value
of this variable is local to each Koutline buffer."
:type 'boolean
:group 'hyperbole-koutliner)

Expand All @@ -61,20 +54,41 @@ during such operations, regardless of the value of this flag."
:type 'boolean
:group 'hyperbole-koutliner)

(defcustom kotl-mode:shrink-region-flag nil
"*Non-nil means Koutliner commands automatically shrink the region.
The region is shrinked within the visible bounds of a single cell
before editing it. The region then falls within the first
visible cell that was part of the region or that followed it.
Default value is nil."
:type 'boolean
:group 'hyperbole-koutliner)

(defcustom kotl-mode:tab-flag nil
"*Non-nil means {\\[kotl-mode:tab-command]} inserts a literal tab character and {\\[kotl-mode:untab-command]} deletes backward.
Nil means {\\[kotl-mode:tab-command]} demotes the current tree and
{\\[kotl-mode:untab-command]} promotes the tree. The default is nil."
:type 'boolean
:group 'hyperbole-koutliner)

(defcustom kotl-mode:indent-tabs-mode t
"*Non-nil means {\\[kotl-mode:tab-command]} may insert literal tab characters.
Tab characters are inserted rather than space characters when
`kotl-mode:tab-flag' is non-nil. Default value is t. The value
of this variable is local to each Koutline buffer."
:type 'boolean
:group 'hyperbole-koutliner)
(defvar kotl-mode:to-valid-position-commands
'(kotl-mode:orgtbl-self-insert-command
kotl-mode:kill-or-copy-region
kotl-mode:kill-line
kotl-mode:kill-region
kotl-mode:kill-sentence
kotl-mode:yank
kotl-mode:yank-pop
orgtbl-self-insert-command
self-insert-command
yank-from-kill-ring
yank-rectangle)
"List of command symbols to move to a valid Koutline position before executing.")

(defvar kotl-mode-map nil
"Keymap containing koutliner editing and viewing commands.")

(defvar kotl-previous-mode nil
"Default mode of koutline buffers prior to invocation of kotl-mode.")

;; Define these newer Emacs variables if Emacs has not already done so.
(defvar yank-window-start nil)
Expand Down Expand Up @@ -1364,8 +1378,8 @@ Leave point at original location but return the tree's new start point."
More precisely, reinsert the most recent kill, which is the
stretch of killed text most recently killed OR yanked. Put point
at the end, and set mark at the beginning without activating it.
With just \\[universal-argument] as argument, put point at beginning, and mark at end.
With argument N, reinsert the Nth most recent kill.
With just \\[universal-argument] as argument, put point at beginning,
and mark at end. With argument N, reinsert the Nth most recent kill.
When this command inserts text into the buffer, it honors the
`yank-handled-properties' and `yank-excluded-properties'
Expand Down Expand Up @@ -3390,10 +3404,7 @@ newlines at end of tree."
Mouse may have moved point outside of an editable area.
`kotl-mode' adds this function to `pre-command-hook'."
(when (and
(memq this-command '(kotl-mode:orgtbl-self-insert-command
;; kotl-mode:self-insert-command
orgtbl-self-insert-command
self-insert-command))
(memq this-command kotl-mode:to-valid-position-commands)
(not (kview:valid-position-p))
;; Prevent repeatedly moving point to valid position when moving trees
;; (not (hyperb:stack-frame '(kcell-view:to-label-end)))
Expand Down

0 comments on commit 7adb441

Please sign in to comment.