emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] scratch/hyperbole 3eef78bc79 04/15: (kotl-mode:pre-self-insert-co


From: Stefan Monnier
Subject: [elpa] scratch/hyperbole 3eef78bc79 04/15: (kotl-mode:pre-self-insert-command): Use buffer-locally at top-level
Date: Tue, 2 May 2023 00:26:05 -0400 (EDT)

branch: scratch/hyperbole
commit 3eef78bc7922d43cb82edc37e857f76551c19340
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    (kotl-mode:pre-self-insert-command): Use buffer-locally at top-level
    
    * kotl/kotl-mode.el (kotl-mode): Don't impose our `pre-command-hook` on
    all buffers.
    (kotl-mode:pre-self-insert-command): Remove now-redundant test that
    we're in a Kotl buffer.  Remove also `hyperb:stack-frame` test which
    seems to have been added while debugging a problem around May 2021.
---
 kotl/kotl-mode.el | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/kotl/kotl-mode.el b/kotl/kotl-mode.el
index e82d58e618..a3b2271dbb 100644
--- a/kotl/kotl-mode.el
+++ b/kotl/kotl-mode.el
@@ -109,7 +109,7 @@ It provides the following keys:
   ;;
   ;; Prevent insertion of characters outside of editable bounds,
   ;; e.g. after the mouse sets point to a non-editable position
-  (add-hook 'pre-command-hook #'kotl-mode:pre-self-insert-command)
+  (add-hook 'pre-command-hook #'kotl-mode:pre-self-insert-command nil t)
   ;;
   ;; Ensure that outline structure data is saved when save-buffer is called
   ;; from save-some-buffers, {C-x s}.
@@ -3296,10 +3296,14 @@ 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 '(self-insert-command 
orgtbl-self-insert-command))
-            (eq major-mode 'kotl-mode)
             (not (kview:valid-position-p))
             ;; Prevent repeatedly moving point to valid position when moving 
trees
-            (not (hyperb:stack-frame '(kcell-view:to-label-end))))
+            ;; FIXME: This may have been useful in some older version of
+            ;; the code but now that it runs from a `pre-command-hook',
+            ;; `kcell-view:to-label-end' can never be in the call
+            ;; stack (except of course during debugging and such).
+            ;;(not (hyperb:stack-frame '(kcell-view:to-label-end)))
+            )
     (when (not (kview:valid-position-p))
       (kotl-mode:to-valid-position))))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]