From 05f554bb5633d48e1ffb053aa3cca462c52600cf Mon Sep 17 00:00:00 2001 From: doglooksgood Date: Thu, 15 Feb 2018 02:46:41 +0800 Subject: [PATCH 01/23] UPDATE DOC --- README.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.org b/README.org index 844ba92..35a2ef3 100644 --- a/README.org +++ b/README.org @@ -6,7 +6,7 @@ [[file:images/logo.png]] * About Smart Mode -Currently this project is rewriting for providing smart mode on branch `v3`. +Currently this project is rewriting for providing smart mode on branch `smart`. * Demo [[file:images/demo.gif]] From be5d7da16b65ce32fd1a88bef733af5cea2c66d5 Mon Sep 17 00:00:00 2001 From: Andrew Jarrett Date: Mon, 26 Feb 2018 20:22:29 -0700 Subject: [PATCH 02/23] remove duplicate definition of parinfer-delete-indentation --- parinfer.el | 6 ------ 1 file changed, 6 deletions(-) diff --git a/parinfer.el b/parinfer.el index 79dbd0d..ce6271a 100644 --- a/parinfer.el +++ b/parinfer.el @@ -1032,12 +1032,6 @@ invoke parinfer after every semicolon input." (parinfer--invoke-parinfer)))) (call-interactively 'self-insert-command))) -(defun parinfer-delete-indentation () - "Replacement in 'parinfer-mode' for 'delete-indentation' command." - (interactive) - (parinfer-paren-run - (call-interactively 'delete-indentation))) - (defun parinfer-toggle-mode () "Switch parinfer mode between Indent Mode and Paren Mode." (interactive) From f08de411fd016461bdf190443c3bf30a8636a1b5 Mon Sep 17 00:00:00 2001 From: richardsonpaul Date: Thu, 28 Jun 2018 11:58:42 -0600 Subject: [PATCH 03/23] remove dependency on package.el I use `use-package` and `straight`, and the lispy extensions isn't working because it requires package.el, which I don't have --- parinfer-ext.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/parinfer-ext.el b/parinfer-ext.el index 53ba1b1..2f26631 100644 --- a/parinfer-ext.el +++ b/parinfer-ext.el @@ -205,9 +205,8 @@ Use rainbow-delimiters for Paren Mode, and dim-style parens for Indent Mode." (call-interactively 'self-insert-command))) (defun parinfer-lispy:init () - (if (package-installed-p 'lispy) + (if (fboundp 'lispy) (progn - (require 'lispy) (define-key parinfer-mode-map (kbd "(") 'parinfer-lispy:parens) (define-key parinfer-mode-map (kbd "{") 'parinfer-lispy:braces) (define-key parinfer-mode-map (kbd "[") 'parinfer-lispy:brackets) From 33b2996ed8040dd77720f9a216b152db891cbb43 Mon Sep 17 00:00:00 2001 From: Robert Irelan Date: Wed, 11 Jul 2018 16:36:22 -0700 Subject: [PATCH 04/23] Print error message and line number when indent mode fails Fixes https://github.com/DogLooksGood/parinfer-mode/issues/56. --- parinfer.el | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/parinfer.el b/parinfer.el index ce6271a..240145a 100644 --- a/parinfer.el +++ b/parinfer.el @@ -858,11 +858,18 @@ If There's no change, switch to Indent Mode." (text (buffer-substring-no-properties (point-min) (point-max))) (result (parinferlib-indent-mode text opts)) (success (plist-get result :success)) + (err (plist-get result :error)) + (error-message (plist-get err :message)) + (error-line-no (plist-get err :line-no)) (changed-lines (plist-get result :changed-lines))) (if (not success) (progn - (message (concat "Parinfer: Pairs unmatched, switch to Paren mode. " - "When pair fixed, You can switch to indent mode.")) + (message (concat "Parinfer: Error%s: \"%s\" - switch to Paren mode. " + "When error fixed, you can switch to indent mode.") + (if (null error-line-no) + "" + (format " on line %d" error-line-no)) + error-message) nil) (if (and changed-lines (not (string= text (plist-get result :text)))) @@ -886,11 +893,18 @@ If there's any change, display a confirm message in minibuffer." (text (buffer-substring-no-properties (point-min) (point-max))) (result (parinferlib-indent-mode text opts)) (success (plist-get result :success)) + (err (plist-get result :error)) + (error-message (plist-get err :message)) + (error-line-no (plist-get err :line-no)) (changed-lines (plist-get result :changed-lines))) (if (not success) (progn - (message (concat "Pairs unmatched, switch to Paren mode. " - "When pair fixed, You can switch to indent mode.")) + (message (concat "Parinfer: Error%s: \"%s\" - switch to Paren mode. " + "When error fixed, you can switch to indent mode.") + (if (null error-line-no) + "" + (format " on line %d" error-line-no)) + error-message) nil) (if (and changed-lines (not (string= text (plist-get result :text)))) From 306e0b19145f63137b173103286f69bb75646fd3 Mon Sep 17 00:00:00 2001 From: yqrashawn Date: Tue, 31 Jul 2018 16:26:09 +0800 Subject: [PATCH 05/23] extension fboundp lispy -> lispy-mode --- parinfer-ext.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parinfer-ext.el b/parinfer-ext.el index 2f26631..f487dd4 100644 --- a/parinfer-ext.el +++ b/parinfer-ext.el @@ -205,7 +205,7 @@ Use rainbow-delimiters for Paren Mode, and dim-style parens for Indent Mode." (call-interactively 'self-insert-command))) (defun parinfer-lispy:init () - (if (fboundp 'lispy) + (if (fboundp 'lispy-mode) (progn (define-key parinfer-mode-map (kbd "(") 'parinfer-lispy:parens) (define-key parinfer-mode-map (kbd "{") 'parinfer-lispy:braces) From fe1182d4b8961f03a5316b45f01ccf10d8ff213d Mon Sep 17 00:00:00 2001 From: yqrashawn Date: Tue, 7 Aug 2018 14:31:30 +0800 Subject: [PATCH 06/23] make parinfer evil more reactive --- parinfer-ext.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/parinfer-ext.el b/parinfer-ext.el index f487dd4..3e22bfc 100644 --- a/parinfer-ext.el +++ b/parinfer-ext.el @@ -271,11 +271,11 @@ Use rainbow-delimiters for Paren Mode, and dim-style parens for Indent Mode." (parinfer-strategy-add 'instantly '(evil-delete evil-change evil-change-line evil-paste-before evil-paste-after evil-delete-line evil-delete-char evil-delete-backward-char evil-substitute - evil-change-whole-line evil-force-normal-state evil-normal-state - evil-shift-left evil-shift-right)) + evil-change-whole-line evil-force-normal-state evil-normal-state evil-open-below + evil-shift-left evil-shift-right evil-previous-line evil-next-line evil-forward-char + evil-backward-char)) (parinfer-strategy-add 'skip - '(evil-previous-line evil-forward-char evil-backward-char evil-next-line - evil-forward-word evil-forward-word-begin evil-backward-word-begin + '(evil-forward-word evil-forward-word-begin evil-backward-word-begin evil-backward-end evil-scroll-page-down evil-scroll-up))) ;; ----------------------------------------------------------------------------- From 6e83167fc419d9d935e52c03c1f3d09fcdbf9b74 Mon Sep 17 00:00:00 2001 From: yqrashawn Date: Tue, 7 Aug 2018 14:49:49 +0800 Subject: [PATCH 07/23] add evil support for smart-yank and smart-tab --- parinfer-ext.el | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/parinfer-ext.el b/parinfer-ext.el index 3e22bfc..35febc0 100644 --- a/parinfer-ext.el +++ b/parinfer-ext.el @@ -246,7 +246,6 @@ Use rainbow-delimiters for Paren Mode, and dim-style parens for Indent Mode." (parinfer-define-extension lispy "Integration with Lispy." - :mount (require 'eldoc) (eldoc-add-command-completions "lispy-" "parinfer-") @@ -306,6 +305,8 @@ Use rainbow-delimiters for Paren Mode, and dim-style parens for Indent Mode." (parinfer-define-extension smart-yank "Yank depend on current mode." :mount + (if (fboundp 'evil-define-key) + (evil-define-key 'normal parinfer-mode-map [remap evil-paste-after] 'parinfer-smart-yank:yank)) (define-key parinfer-mode-map [remap yank] 'parinfer-smart-yank:yank)) ;; ----------------------------------------------------------------------------- @@ -354,7 +355,7 @@ Use rainbow-delimiters for Paren Mode, and dim-style parens for Indent Mode." (save-excursion (end-of-line) (while (eq (char-before) 32) - (backward-delete-char 1))) + (backward-delete-char 1))) (save-excursion (parinfer--goto-line parinfer-smart-tab:indicator-line) (when (parinfer--empty-line-p) @@ -485,7 +486,7 @@ Use rainbow-delimiters for Paren Mode, and dim-style parens for Indent Mode." (delete-indentation) (backward-char)) (end-of-line) - (while (eq 32 (char-before)) + (while (eq 32 (char-before)) (backward-delete-char 1)) (-distinct pos-list)))))) @@ -664,7 +665,12 @@ Use rainbow-delimiters for Paren Mode, and dim-style parens for Indent Mode." (define-key parinfer-mode-map [remap backward-char] 'parinfer-smart-tab:backward-char) (define-key parinfer-region-mode-map [remap parinfer-shift-right] 'parinfer-smart-tab:shift-right) (define-key parinfer-region-mode-map [remap parinfer-shift-left] 'parinfer-smart-tab:shift-left) - + (if (fboundp 'evil-define-key) + (evil-define-key 'normal parinfer-mode-map [remap evil-forward-char] 'parinfer-smart-tab:forward-char) + (evil-define-key 'normal parinfer-mode-map [remap evil-backward-char] 'parinfer-smart-tab:backward-char) + (evil-define-key 'insert parinfer-region-mode-map [remap evil-shift-right-line] 'parinfer-smart-tab:shift-right) + (evil-define-key 'insert parinfer-region-mode-map [remap evil-shift-left-line] 'parinfer-smart-tab:shift-left)) + :unmount (remove-hook 'post-command-hook 'parinfer-smart-tab:clean-indicator t) (remove-hook 'pre-command-hook 'parinfer-smart-tab:clean-indicator-pre t)) @@ -756,7 +762,7 @@ Use rainbow-delimiters for Paren Mode, and dim-style parens for Indent Mode." (forward-sexp) (insert (parinfer-one:get-close-paren key))) (parinfer-one:paren))) - + ((-contains-p parinfer-one:indent-trigger-keys key) (progn (parinfer--invoke-parinfer-when-necessary))) @@ -830,15 +836,7 @@ Use rainbow-delimiters for Paren Mode, and dim-style parens for Indent Mode." :unmount (remove-hook 'post-command-hook 'parinfer-one:invoke-when-necessary-auto t) (remove-hook 'pre-command-hook 'parinfer-one:update-context t)) - + (provide 'parinfer-ext) ;;; parinfer-ext.el ends here - - - - - - - - From 15da36552afa959bb003953f9cd0ca3fd384ed7d Mon Sep 17 00:00:00 2001 From: yqrashawn Date: Wed, 8 Aug 2018 07:30:20 +0800 Subject: [PATCH 08/23] yank prblem --- parinfer-ext.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/parinfer-ext.el b/parinfer-ext.el index 35febc0..920e643 100644 --- a/parinfer-ext.el +++ b/parinfer-ext.el @@ -305,8 +305,8 @@ Use rainbow-delimiters for Paren Mode, and dim-style parens for Indent Mode." (parinfer-define-extension smart-yank "Yank depend on current mode." :mount - (if (fboundp 'evil-define-key) - (evil-define-key 'normal parinfer-mode-map [remap evil-paste-after] 'parinfer-smart-yank:yank)) + ;; (if (fboundp 'evil-define-key) + ;; (evil-define-key 'normal parinfer-mode-map [remap evil-paste-before] 'parinfer-smart-yank:yank)) (define-key parinfer-mode-map [remap yank] 'parinfer-smart-yank:yank)) ;; ----------------------------------------------------------------------------- From daec246c15229dd6579de440b0bc4308849f2bc0 Mon Sep 17 00:00:00 2001 From: yqrashawn Date: Thu, 9 Aug 2018 15:13:30 +0800 Subject: [PATCH 09/23] add evil shift line --- parinfer-ext.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/parinfer-ext.el b/parinfer-ext.el index 920e643..d061697 100644 --- a/parinfer-ext.el +++ b/parinfer-ext.el @@ -272,6 +272,7 @@ Use rainbow-delimiters for Paren Mode, and dim-style parens for Indent Mode." evil-delete-line evil-delete-char evil-delete-backward-char evil-substitute evil-change-whole-line evil-force-normal-state evil-normal-state evil-open-below evil-shift-left evil-shift-right evil-previous-line evil-next-line evil-forward-char + evil-shift-right-line evil-shift-left-line evil-backward-char)) (parinfer-strategy-add 'skip '(evil-forward-word evil-forward-word-begin evil-backward-word-begin @@ -666,10 +667,10 @@ Use rainbow-delimiters for Paren Mode, and dim-style parens for Indent Mode." (define-key parinfer-region-mode-map [remap parinfer-shift-right] 'parinfer-smart-tab:shift-right) (define-key parinfer-region-mode-map [remap parinfer-shift-left] 'parinfer-smart-tab:shift-left) (if (fboundp 'evil-define-key) - (evil-define-key 'normal parinfer-mode-map [remap evil-forward-char] 'parinfer-smart-tab:forward-char) + (progn (evil-define-key 'normal parinfer-mode-map [remap evil-forward-char] 'parinfer-smart-tab:forward-char) (evil-define-key 'normal parinfer-mode-map [remap evil-backward-char] 'parinfer-smart-tab:backward-char) (evil-define-key 'insert parinfer-region-mode-map [remap evil-shift-right-line] 'parinfer-smart-tab:shift-right) - (evil-define-key 'insert parinfer-region-mode-map [remap evil-shift-left-line] 'parinfer-smart-tab:shift-left)) + (evil-define-key 'insert parinfer-region-mode-map [remap evil-shift-left-line] 'parinfer-smart-tab:shift-left))) :unmount (remove-hook 'post-command-hook 'parinfer-smart-tab:clean-indicator t) From c8ddee65d05c38ddb49cd37626c4015ea0c00a55 Mon Sep 17 00:00:00 2001 From: yqrashawn Date: Thu, 9 Aug 2018 15:32:17 +0800 Subject: [PATCH 10/23] add evil normal state --- parinfer-ext.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/parinfer-ext.el b/parinfer-ext.el index d061697..0b47376 100644 --- a/parinfer-ext.el +++ b/parinfer-ext.el @@ -273,7 +273,7 @@ Use rainbow-delimiters for Paren Mode, and dim-style parens for Indent Mode." evil-change-whole-line evil-force-normal-state evil-normal-state evil-open-below evil-shift-left evil-shift-right evil-previous-line evil-next-line evil-forward-char evil-shift-right-line evil-shift-left-line - evil-backward-char)) + evil-backward-char evil-normal-state)) (parinfer-strategy-add 'skip '(evil-forward-word evil-forward-word-begin evil-backward-word-begin evil-backward-end evil-scroll-page-down evil-scroll-up))) @@ -668,8 +668,8 @@ Use rainbow-delimiters for Paren Mode, and dim-style parens for Indent Mode." (define-key parinfer-region-mode-map [remap parinfer-shift-left] 'parinfer-smart-tab:shift-left) (if (fboundp 'evil-define-key) (progn (evil-define-key 'normal parinfer-mode-map [remap evil-forward-char] 'parinfer-smart-tab:forward-char) - (evil-define-key 'normal parinfer-mode-map [remap evil-backward-char] 'parinfer-smart-tab:backward-char) - (evil-define-key 'insert parinfer-region-mode-map [remap evil-shift-right-line] 'parinfer-smart-tab:shift-right) + (evil-define-key 'normal parinfer-mode-map [remap evil-backward-char] 'parinfer-smart-tab:backward-char) + (evil-define-key 'insert parinfer-region-mode-map [remap evil-shift-right-line] 'parinfer-smart-tab:shift-right) (evil-define-key 'insert parinfer-region-mode-map [remap evil-shift-left-line] 'parinfer-smart-tab:shift-left))) :unmount From 554cb701b9324c0d58f9b026eeac21d9723e25ef Mon Sep 17 00:00:00 2001 From: yqrashawn Date: Thu, 9 Aug 2018 15:45:40 +0800 Subject: [PATCH 11/23] add evil-exit-visual-state --- parinfer-ext.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parinfer-ext.el b/parinfer-ext.el index 0b47376..3486cc3 100644 --- a/parinfer-ext.el +++ b/parinfer-ext.el @@ -272,7 +272,7 @@ Use rainbow-delimiters for Paren Mode, and dim-style parens for Indent Mode." evil-delete-line evil-delete-char evil-delete-backward-char evil-substitute evil-change-whole-line evil-force-normal-state evil-normal-state evil-open-below evil-shift-left evil-shift-right evil-previous-line evil-next-line evil-forward-char - evil-shift-right-line evil-shift-left-line + evil-shift-right-line evil-shift-left-line evil-exit-visual-state evil-backward-char evil-normal-state)) (parinfer-strategy-add 'skip '(evil-forward-word evil-forward-word-begin evil-backward-word-begin From 129c06b0c6fc3b87606b89d5278aa84d4f572bac Mon Sep 17 00:00:00 2001 From: yqrashawn Date: Sun, 12 Aug 2018 10:47:48 +0800 Subject: [PATCH 12/23] add comment line --- parinfer.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/parinfer.el b/parinfer.el index 240145a..44764cd 100644 --- a/parinfer.el +++ b/parinfer.el @@ -118,8 +118,8 @@ close-parens after it.") (defvar parinfer-strategy '((default - self-insert-command delete-indentation kill-line - comment-dwim kill-word delete-char newline kill-region comment-or-uncomment-region newline-and-indent) + self-insert-command delete-indentation kill-line comment-line + comment-dwim kill-word delete-char newline kill-region comment-or-uncomment-region newline-and-indent) (instantly delete-region newline) (skip)) From 253252e1810c710b47abc9916bc9b747036a220c Mon Sep 17 00:00:00 2001 From: yqrashawn Date: Sun, 12 Aug 2018 10:49:00 +0800 Subject: [PATCH 13/23] fix evil forward backward char --- parinfer-ext.el | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/parinfer-ext.el b/parinfer-ext.el index 3486cc3..614e9b6 100644 --- a/parinfer-ext.el +++ b/parinfer-ext.el @@ -667,9 +667,7 @@ Use rainbow-delimiters for Paren Mode, and dim-style parens for Indent Mode." (define-key parinfer-region-mode-map [remap parinfer-shift-right] 'parinfer-smart-tab:shift-right) (define-key parinfer-region-mode-map [remap parinfer-shift-left] 'parinfer-smart-tab:shift-left) (if (fboundp 'evil-define-key) - (progn (evil-define-key 'normal parinfer-mode-map [remap evil-forward-char] 'parinfer-smart-tab:forward-char) - (evil-define-key 'normal parinfer-mode-map [remap evil-backward-char] 'parinfer-smart-tab:backward-char) - (evil-define-key 'insert parinfer-region-mode-map [remap evil-shift-right-line] 'parinfer-smart-tab:shift-right) + (progn (evil-define-key 'insert parinfer-region-mode-map [remap evil-shift-right-line] 'parinfer-smart-tab:shift-right) (evil-define-key 'insert parinfer-region-mode-map [remap evil-shift-left-line] 'parinfer-smart-tab:shift-left))) :unmount From 53beb44e8bf09a977fb46e826fc87aaafdd63b57 Mon Sep 17 00:00:00 2001 From: yqrashawn Date: Wed, 22 Aug 2018 12:22:03 +0800 Subject: [PATCH 14/23] lispy parins --- parinfer-ext.el | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/parinfer-ext.el b/parinfer-ext.el index 614e9b6..52e8ff2 100644 --- a/parinfer-ext.el +++ b/parinfer-ext.el @@ -207,9 +207,11 @@ Use rainbow-delimiters for Paren Mode, and dim-style parens for Indent Mode." (defun parinfer-lispy:init () (if (fboundp 'lispy-mode) (progn - (define-key parinfer-mode-map (kbd "(") 'parinfer-lispy:parens) - (define-key parinfer-mode-map (kbd "{") 'parinfer-lispy:braces) - (define-key parinfer-mode-map (kbd "[") 'parinfer-lispy:brackets) + (mapc (lambda (x) (lispy-define-key parinfer-mode-map (format "%d" x) 'digit-argument)) + (number-sequence 0 9)) + (define-key parinfer-mode-map (kbd "(") 'lispy-parens) + (define-key parinfer-mode-map (kbd "{") 'lispy-braces) + (define-key parinfer-mode-map (kbd "[") 'lispy-brackets) (define-key parinfer-mode-map (kbd "d") 'special-lispy-different) (define-key parinfer-mode-map (kbd "-") 'special-lispy-ace-subword) (define-key parinfer-mode-map (kbd "q") 'special-lispy-ace-paren) @@ -251,6 +253,9 @@ Use rainbow-delimiters for Paren Mode, and dim-style parens for Indent Mode." (eldoc-add-command-completions "lispy-" "parinfer-") (parinfer-strategy-add 'default '(parinfer-lispy:parens + lispy-parens + lispy-braces + lispy-brackets parinfer-lispy:braces parinfer-lispy:brackets parinfer-lispy:space)) From 24e8b5d93c809093e0304731ab1bc0cc68dd182b Mon Sep 17 00:00:00 2001 From: yqrashawn Date: Wed, 22 Aug 2018 13:58:09 +0800 Subject: [PATCH 15/23] add lispy tab --- parinfer-ext.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/parinfer-ext.el b/parinfer-ext.el index 52e8ff2..bd7c3b0 100644 --- a/parinfer-ext.el +++ b/parinfer-ext.el @@ -231,19 +231,19 @@ Use rainbow-delimiters for Paren Mode, and dim-style parens for Indent Mode." (define-key parinfer-mode-map (kbd "M-m") 'lispy-mark-symbol) (define-key parinfer-mode-map (kbd "b") 'special-lispy-back) (define-key parinfer-mode-map (kbd "f") 'special-lispy-flow) - (define-key parinfer-mode-map (kbd "f") 'special-lispy-flow) (define-key parinfer-mode-map (kbd "e") 'special-lispy-eval) (define-key parinfer-mode-map (kbd "o") 'special-lispy-other-mode) (define-key parinfer-mode-map (kbd "O") 'special-lispy-oneline) (define-key parinfer-mode-map (kbd "M") 'special-lispy-alt-multiline) (define-key parinfer-mode-map (kbd "y") 'special-lispy-occur) + (define-key parinfer-mode-map (kbd "i") 'special-lispy-tab) (define-key parinfer-mode-map (kbd "r") 'special-lispy-raise) (define-key parinfer-mode-map (kbd "C-a") 'lispy-move-beginning-of-line) (define-key parinfer-mode-map (kbd "g") 'special-lispy-goto) (define-key parinfer-mode-map (kbd ">") 'special-lispy-slurp) (define-key parinfer-mode-map (kbd "<") 'special-lispy-barf) (define-key parinfer-mode-map (kbd "n") 'special-lispy-new-copy) - (define-key parinfer-mode-map (kbd "SPC" )'parinfer-lispy:space)) + (define-key parinfer-mode-map (kbd "SPC") 'parinfer-lispy:space)) (message "Parinfer extension lispy: It seems Lispy is not installed!"))) (parinfer-define-extension lispy From 2dd0f9f6b2bb83824ebb2abf920ea00168bbeb8a Mon Sep 17 00:00:00 2001 From: yqrashawn Date: Tue, 28 Aug 2018 15:41:22 +0800 Subject: [PATCH 16/23] disable lispy-parins, need better solution --- parinfer-ext.el | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/parinfer-ext.el b/parinfer-ext.el index bd7c3b0..c432554 100644 --- a/parinfer-ext.el +++ b/parinfer-ext.el @@ -207,11 +207,14 @@ Use rainbow-delimiters for Paren Mode, and dim-style parens for Indent Mode." (defun parinfer-lispy:init () (if (fboundp 'lispy-mode) (progn - (mapc (lambda (x) (lispy-define-key parinfer-mode-map (format "%d" x) 'digit-argument)) - (number-sequence 0 9)) - (define-key parinfer-mode-map (kbd "(") 'lispy-parens) - (define-key parinfer-mode-map (kbd "{") 'lispy-braces) - (define-key parinfer-mode-map (kbd "[") 'lispy-brackets) + (define-key parinfer-mode-map (kbd "(") 'parinfer-lispy:parens) + (define-key parinfer-mode-map (kbd "{") 'parinfer-lispy:braces) + (define-key parinfer-mode-map (kbd "[") 'parinfer-lispy:brackets) + ;; (mapc (lambda (x) (lispy-define-key parinfer-mode-map (format "%d" x) 'digit-argument)) + ;; (number-sequence 0 9)) + ;; (define-key parinfer-mode-map (kbd "(") 'lispy-parens) + ;; (define-key parinfer-mode-map (kbd "{") 'lispy-braces) + ;; (define-key parinfer-mode-map (kbd "[") 'lispy-brackets) (define-key parinfer-mode-map (kbd "d") 'special-lispy-different) (define-key parinfer-mode-map (kbd "-") 'special-lispy-ace-subword) (define-key parinfer-mode-map (kbd "q") 'special-lispy-ace-paren) From 96759d02a78b061d249779b0f3085d5949eb296f Mon Sep 17 00:00:00 2001 From: yqrashawn Date: Thu, 30 Aug 2018 16:27:13 +0800 Subject: [PATCH 17/23] evil forward backward char don't invoke reindent --- parinfer-ext.el | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/parinfer-ext.el b/parinfer-ext.el index c432554..13cfea9 100644 --- a/parinfer-ext.el +++ b/parinfer-ext.el @@ -279,9 +279,8 @@ Use rainbow-delimiters for Paren Mode, and dim-style parens for Indent Mode." '(evil-delete evil-change evil-change-line evil-paste-before evil-paste-after evil-delete-line evil-delete-char evil-delete-backward-char evil-substitute evil-change-whole-line evil-force-normal-state evil-normal-state evil-open-below - evil-shift-left evil-shift-right evil-previous-line evil-next-line evil-forward-char - evil-shift-right-line evil-shift-left-line evil-exit-visual-state - evil-backward-char evil-normal-state)) + evil-shift-left evil-shift-right evil-previous-line evil-next-line + evil-shift-right-line evil-shift-left-line evil-exit-visual-state evil-normal-state)) (parinfer-strategy-add 'skip '(evil-forward-word evil-forward-word-begin evil-backward-word-begin evil-backward-end evil-scroll-page-down evil-scroll-up))) From 422b0f3cd42466d668a4a6d54eee779df2a24843 Mon Sep 17 00:00:00 2001 From: yqrashawn Date: Tue, 4 Sep 2018 14:07:58 +0800 Subject: [PATCH 18/23] fix parinfer lispy parens --- parinfer-ext.el | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/parinfer-ext.el b/parinfer-ext.el index 13cfea9..3de6680 100644 --- a/parinfer-ext.el +++ b/parinfer-ext.el @@ -186,21 +186,21 @@ Use rainbow-delimiters for Paren Mode, and dim-style parens for Indent Mode." (parinfer-lispy:paren-char-p ca) (parinfer-lispy:paren-char-p cb)))) -(defun parinfer-lispy:parens () - (interactive) - (if (region-active-p) +(defun parinfer-lispy:parens (arg) + (interactive "P") + (if (or (region-active-p) arg) (call-interactively 'lispy-parens) (call-interactively 'self-insert-command))) -(defun parinfer-lispy:brackets () - (interactive) - (if (region-active-p) +(defun parinfer-lispy:brackets (arg) + (interactive "P") + (if (or (region-active-p) arg) (call-interactively 'lispy-brackets) (call-interactively 'self-insert-command))) -(defun parinfer-lispy:braces () - (interactive) - (if (region-active-p) +(defun parinfer-lispy:braces (arg) + (interactive "P") + (if (or (region-active-p) arg) (call-interactively 'lispy-braces) (call-interactively 'self-insert-command))) @@ -210,11 +210,8 @@ Use rainbow-delimiters for Paren Mode, and dim-style parens for Indent Mode." (define-key parinfer-mode-map (kbd "(") 'parinfer-lispy:parens) (define-key parinfer-mode-map (kbd "{") 'parinfer-lispy:braces) (define-key parinfer-mode-map (kbd "[") 'parinfer-lispy:brackets) - ;; (mapc (lambda (x) (lispy-define-key parinfer-mode-map (format "%d" x) 'digit-argument)) - ;; (number-sequence 0 9)) - ;; (define-key parinfer-mode-map (kbd "(") 'lispy-parens) - ;; (define-key parinfer-mode-map (kbd "{") 'lispy-braces) - ;; (define-key parinfer-mode-map (kbd "[") 'lispy-brackets) + (mapc (lambda (x) (lispy-define-key parinfer-mode-map (format "%d" x) 'digit-argument)) + (number-sequence 0 9)) (define-key parinfer-mode-map (kbd "d") 'special-lispy-different) (define-key parinfer-mode-map (kbd "-") 'special-lispy-ace-subword) (define-key parinfer-mode-map (kbd "q") 'special-lispy-ace-paren) @@ -246,6 +243,10 @@ Use rainbow-delimiters for Paren Mode, and dim-style parens for Indent Mode." (define-key parinfer-mode-map (kbd ">") 'special-lispy-slurp) (define-key parinfer-mode-map (kbd "<") 'special-lispy-barf) (define-key parinfer-mode-map (kbd "n") 'special-lispy-new-copy) + (define-key parinfer-mode-map (kbd "t") 'special-lispy-teleport) + (define-key parinfer-mode-map (kbd "H") 'special-lispy-ace-symbol-replace) + (define-key parinfer-mode-map (kbd "p") 'special-lispy-paste) + (define-key parinfer-mode-map (kbd "/") 'special-lispy-splice) (define-key parinfer-mode-map (kbd "SPC") 'parinfer-lispy:space)) (message "Parinfer extension lispy: It seems Lispy is not installed!"))) From 0d4558d12f850c8ace82a80f43214fd75a9ce720 Mon Sep 17 00:00:00 2001 From: yqrashawn Date: Tue, 4 Sep 2018 14:25:58 +0800 Subject: [PATCH 19/23] cleanup --- parinfer-ext.el | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/parinfer-ext.el b/parinfer-ext.el index 3de6680..ccad7c0 100644 --- a/parinfer-ext.el +++ b/parinfer-ext.el @@ -71,7 +71,6 @@ (parinfer-define-extension pretty-parens "Pretty parens. - Use rainbow-delimiters for Paren Mode, and dim-style parens for Indent Mode." :mount (require 'font-lock) @@ -257,9 +256,6 @@ Use rainbow-delimiters for Paren Mode, and dim-style parens for Indent Mode." (eldoc-add-command-completions "lispy-" "parinfer-") (parinfer-strategy-add 'default '(parinfer-lispy:parens - lispy-parens - lispy-braces - lispy-brackets parinfer-lispy:braces parinfer-lispy:brackets parinfer-lispy:space)) @@ -280,10 +276,11 @@ Use rainbow-delimiters for Paren Mode, and dim-style parens for Indent Mode." '(evil-delete evil-change evil-change-line evil-paste-before evil-paste-after evil-delete-line evil-delete-char evil-delete-backward-char evil-substitute evil-change-whole-line evil-force-normal-state evil-normal-state evil-open-below - evil-shift-left evil-shift-right evil-previous-line evil-next-line - evil-shift-right-line evil-shift-left-line evil-exit-visual-state evil-normal-state)) + evil-shift-left evil-shift-right evil-shift-right-line evil-shift-left-line + evil-exit-visual-state evil-normal-state)) (parinfer-strategy-add 'skip - '(evil-forward-word evil-forward-word-begin evil-backward-word-begin + '(evil-previous-line evil-forward-char evil-backward-char evil-next-line + evil-forward-word evil-forward-word-begin evil-backward-word-begin evil-backward-end evil-scroll-page-down evil-scroll-up))) ;; ----------------------------------------------------------------------------- @@ -314,8 +311,6 @@ Use rainbow-delimiters for Paren Mode, and dim-style parens for Indent Mode." (parinfer-define-extension smart-yank "Yank depend on current mode." :mount - ;; (if (fboundp 'evil-define-key) - ;; (evil-define-key 'normal parinfer-mode-map [remap evil-paste-before] 'parinfer-smart-yank:yank)) (define-key parinfer-mode-map [remap yank] 'parinfer-smart-yank:yank)) ;; ----------------------------------------------------------------------------- From 371a44110f61ef8bd711e14febd8dbb5ef58858d Mon Sep 17 00:00:00 2001 From: yqrashawn Date: Tue, 4 Sep 2018 14:36:40 +0800 Subject: [PATCH 20/23] delay on evil shift --- parinfer-ext.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/parinfer-ext.el b/parinfer-ext.el index ccad7c0..3b087c0 100644 --- a/parinfer-ext.el +++ b/parinfer-ext.el @@ -271,13 +271,13 @@ Use rainbow-delimiters for Paren Mode, and dim-style parens for Indent Mode." "Integration with Evil." :mount (parinfer-strategy-add 'default - 'evil-delete-char) + 'evil-delete-char evil-shift-left evil-shift-right evil-shift-right-line + evil-shift-left-line) (parinfer-strategy-add 'instantly '(evil-delete evil-change evil-change-line evil-paste-before evil-paste-after evil-delete-line evil-delete-char evil-delete-backward-char evil-substitute - evil-change-whole-line evil-force-normal-state evil-normal-state evil-open-below - evil-shift-left evil-shift-right evil-shift-right-line evil-shift-left-line - evil-exit-visual-state evil-normal-state)) + evil-change-whole-line evil-force-normal-state evil-normal-state + evil-exit-visual-state)) (parinfer-strategy-add 'skip '(evil-previous-line evil-forward-char evil-backward-char evil-next-line evil-forward-word evil-forward-word-begin evil-backward-word-begin From be939a986df4f077333c73d05aab7926f6024d0f Mon Sep 17 00:00:00 2001 From: yqrashawn Date: Tue, 4 Sep 2018 14:50:14 +0800 Subject: [PATCH 21/23] cleanup --- parinfer-ext.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/parinfer-ext.el b/parinfer-ext.el index 3b087c0..2e24370 100644 --- a/parinfer-ext.el +++ b/parinfer-ext.el @@ -206,11 +206,11 @@ Use rainbow-delimiters for Paren Mode, and dim-style parens for Indent Mode." (defun parinfer-lispy:init () (if (fboundp 'lispy-mode) (progn + (mapc (lambda (x) (lispy-define-key parinfer-mode-map (format "%d" x) 'digit-argument) + (number-sequence 0 9))) (define-key parinfer-mode-map (kbd "(") 'parinfer-lispy:parens) (define-key parinfer-mode-map (kbd "{") 'parinfer-lispy:braces) (define-key parinfer-mode-map (kbd "[") 'parinfer-lispy:brackets) - (mapc (lambda (x) (lispy-define-key parinfer-mode-map (format "%d" x) 'digit-argument)) - (number-sequence 0 9)) (define-key parinfer-mode-map (kbd "d") 'special-lispy-different) (define-key parinfer-mode-map (kbd "-") 'special-lispy-ace-subword) (define-key parinfer-mode-map (kbd "q") 'special-lispy-ace-paren) From 2466b761f55356d9f2aabab45213f407bd4db801 Mon Sep 17 00:00:00 2001 From: yqrashawn Date: Tue, 4 Sep 2018 15:30:51 +0800 Subject: [PATCH 22/23] bugfix --- parinfer-ext.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/parinfer-ext.el b/parinfer-ext.el index 2e24370..33fffed 100644 --- a/parinfer-ext.el +++ b/parinfer-ext.el @@ -206,8 +206,8 @@ Use rainbow-delimiters for Paren Mode, and dim-style parens for Indent Mode." (defun parinfer-lispy:init () (if (fboundp 'lispy-mode) (progn - (mapc (lambda (x) (lispy-define-key parinfer-mode-map (format "%d" x) 'digit-argument) - (number-sequence 0 9))) + (mapc (lambda (x) (lispy-define-key parinfer-mode-map (format "%d" x) 'digit-argument)) + (number-sequence 0 9)) (define-key parinfer-mode-map (kbd "(") 'parinfer-lispy:parens) (define-key parinfer-mode-map (kbd "{") 'parinfer-lispy:braces) (define-key parinfer-mode-map (kbd "[") 'parinfer-lispy:brackets) @@ -271,8 +271,8 @@ Use rainbow-delimiters for Paren Mode, and dim-style parens for Indent Mode." "Integration with Evil." :mount (parinfer-strategy-add 'default - 'evil-delete-char evil-shift-left evil-shift-right evil-shift-right-line - evil-shift-left-line) + '(evil-delete-char evil-shift-left evil-shift-right evil-shift-right-line + evil-shift-left-line)) (parinfer-strategy-add 'instantly '(evil-delete evil-change evil-change-line evil-paste-before evil-paste-after evil-delete-line evil-delete-char evil-delete-backward-char evil-substitute From 6347269b0e55ca73281f41e636e036cd65aec963 Mon Sep 17 00:00:00 2001 From: yqrashawn Date: Tue, 4 Sep 2018 15:35:27 +0800 Subject: [PATCH 23/23] doc --- parinfer-ext.el | 1 + 1 file changed, 1 insertion(+) diff --git a/parinfer-ext.el b/parinfer-ext.el index 33fffed..62c6d6a 100644 --- a/parinfer-ext.el +++ b/parinfer-ext.el @@ -71,6 +71,7 @@ (parinfer-define-extension pretty-parens "Pretty parens. + Use rainbow-delimiters for Paren Mode, and dim-style parens for Indent Mode." :mount (require 'font-lock)