DogLooksGood / parinfer-mode

Parinfer for Emacs :)
GNU General Public License v3.0
407 stars 33 forks source link

Strategy 'instantly when reindenting region #50

Open arximboldi opened 7 years ago

arximboldi commented 7 years ago

Hi!

First of all: thanks for developing this amazing mode: editing Lisp is so much fun now!

I am however having trouble trying to always get the strategy 'instantly to work... I would like everything to be instant, I don't care about CPU usage but I find it very confusing when the indentation does not get updated inmmediatelly. In particular, I would like to get parens immediatelly rebalanced when I reindent whole regions. Here is my config:

(use-package parinfer
  :ensure t
  :config
  (parinfer-strategy-add 'instantly
    '(parinfer-smart-tab:dwim-right
      parinfer-smart-tab:dwim-left))
  :bind
  (:map parinfer-mode-map
        ("<tab>" . parinfer-smart-tab:dwim-right)
        ("S-<tab>" . parinfer-smart-tab:dwim-left)
        ("<backtab>" . parinfer-smart-tab:dwim-left)
        ("C-," . parinfer-toggle-mode)
        :map parinfer-region-mode-map
        ("<tab>" . parinfer-smart-tab:dwim-right)
        ("S-<tab>" . parinfer-smart-tab:dwim-left)
        ("<backtab>" . parinfer-smart-tab:dwim-left))
  :init
  (progn
    (setq parinfer-extensions
          '(defaults
             pretty-parens
             smart-tab
             smart-yank))))

However, when I do <tab>, <backtab> with a region selected, the parenthesis do not update inmediatelly. I also have tried things like:

  (parinfer-strategy-add 'instantly "" "*" ".*"))

But I did not get the desired effect. Do you have any suggestions on what can I do? Is this a bug?

DogLooksGood commented 7 years ago

Hi.

The strategy is used to make a command work properly, it's not the strategy that you can switch for different behaviours.

Currently, you cannot indent region and make it work instantly. I've try to implement that but failed:(