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

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

[nongnu] elpa/inf-ruby 1d6fef6eba 171/265: Wrap SMIE tokenizer functions


From: ELPA Syncer
Subject: [nongnu] elpa/inf-ruby 1d6fef6eba 171/265: Wrap SMIE tokenizer functions to bind inhibit-field-text-motion
Date: Sat, 9 Jul 2022 21:59:23 -0400 (EDT)

branch: elpa/inf-ruby
commit 1d6fef6eba227f72632de858e4702947fc2e476d
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: Dmitry Gutov <dgutov@yandex.ru>

    Wrap SMIE tokenizer functions to bind inhibit-field-text-motion
    
    Fixes #85
---
 inf-ruby.el | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/inf-ruby.el b/inf-ruby.el
index 214d192e99..196b82c9e9 100755
--- a/inf-ruby.el
+++ b/inf-ruby.el
@@ -237,6 +237,11 @@ The following commands are available:
       (setq mode-line-process orig-mode-line-process)))
   (setq comint-prompt-regexp inf-ruby-prompt-pattern)
   (ruby-mode-variables)
+  (when (bound-and-true-p ruby-use-smie)
+    (set (make-local-variable 'smie-forward-token-function)
+         #'inf-ruby-smie--forward-token)
+    (set (make-local-variable 'smie-backward-token-function)
+         #'inf-ruby-smie--backward-token))
   (setq major-mode 'inf-ruby-mode)
   (setq mode-name "Inf-Ruby")
   (use-local-map inf-ruby-mode-map)
@@ -793,6 +798,14 @@ Gemfile, it should use the `gemspec' instruction."
           (match-string match-group)
         t))))
 
+(defun inf-ruby-smie--forward-token ()
+  (let ((inhibit-field-text-motion t))
+    (ruby-smie--forward-token)))
+
+(defun inf-ruby-smie--backward-token ()
+  (let ((inhibit-field-text-motion t))
+    (ruby-smie--backward-token)))
+
 ;;;###autoload (dolist (mode ruby-source-modes) (add-hook (intern (format 
"%s-hook" mode)) 'inf-ruby-minor-mode))
 
 (provide 'inf-ruby)



reply via email to

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