From 2d127b2398c6602ae64e09efadb4bf510b7cfbde Mon Sep 17 00:00:00 2001 From: Justin Guenther Date: Mon, 22 Jan 2018 12:49:43 -0600 Subject: [PATCH 1/2] Deal with breaking change to `helm-display-function' * This function now has an additional optional arg, `RESUME'. * Make `helm-swoop-split-window-function' customizable, and move the previous default lambda value to a named function, `helm-swoop--split-window-default'. * Fixes #123 --- helm-swoop.el | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/helm-swoop.el b/helm-swoop.el index 92c0dfc..e478186 100644 --- a/helm-swoop.el +++ b/helm-swoop.el @@ -140,16 +140,21 @@ "If t, use fuzzy matching functions as well as exact matches." :group 'helm-swoop :type 'boolean) -(defvar helm-swoop-split-window-function - (lambda ($buf) - (if helm-swoop-split-with-multiple-windows - (funcall helm-swoop-split-direction) - (when (one-window-p) - (funcall helm-swoop-split-direction))) - (other-window 1) - (switch-to-buffer $buf)) - "Change the way to split window only when `helm-swoop' is calling") +(defun helm-swoop--split-window-default ($buf &optional resume) + "Split window according to `helm-swoop-split-with-multiple-windows' +and `helm-swoop-split-direction' settings." + (if helm-swoop-split-with-multiple-windows + (funcall helm-swoop-split-direction) + (when (one-window-p) + (funcall helm-swoop-split-direction))) + (other-window 1) + (switch-to-buffer $buf) + ) +(defcustom helm-swoop-split-window-function #'helm-swoop--split-window-default + "Function to use as `helm-display-function'." + :group 'helm-swoop + :type 'function) (defcustom helm-swoop-after-goto-line-action-hook nil "hooks run after `helm-swoop--goto-line" :group 'helm-swoop @@ -685,6 +690,7 @@ If $linum is number, lines are separated by $linum" (or $source (helm-c-source-swoop)) :buffer helm-swoop-buffer + :display-function helm-swoop-split-window-function :input $query :prompt helm-swoop-prompt :preselect @@ -1162,6 +1168,7 @@ If $linum is number, lines are separated by $linum" (helm-completion-window-scroll-margin 5)) (helm :sources $contents :buffer helm-multi-swoop-buffer + :display-function helm-swoop-split-window-function :input (or $query helm-multi-swoop-query "") :prompt helm-swoop-prompt :candidate-number-limit From a3233cda8c97457ef0b9356518618608862b0cc9 Mon Sep 17 00:00:00 2001 From: Justin Guenther Date: Thu, 1 Feb 2018 13:44:53 -0600 Subject: [PATCH 2/2] fixup! Deal with breaking change to `helm-display-function' --- helm-swoop.el | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/helm-swoop.el b/helm-swoop.el index e478186..c598b51 100644 --- a/helm-swoop.el +++ b/helm-swoop.el @@ -148,8 +148,7 @@ and `helm-swoop-split-direction' settings." (when (one-window-p) (funcall helm-swoop-split-direction))) (other-window 1) - (switch-to-buffer $buf) - ) + (switch-to-buffer $buf)) (defcustom helm-swoop-split-window-function #'helm-swoop--split-window-default "Function to use as `helm-display-function'." @@ -690,7 +689,6 @@ If $linum is number, lines are separated by $linum" (or $source (helm-c-source-swoop)) :buffer helm-swoop-buffer - :display-function helm-swoop-split-window-function :input $query :prompt helm-swoop-prompt :preselect @@ -1168,7 +1166,6 @@ If $linum is number, lines are separated by $linum" (helm-completion-window-scroll-margin 5)) (helm :sources $contents :buffer helm-multi-swoop-buffer - :display-function helm-swoop-split-window-function :input (or $query helm-multi-swoop-query "") :prompt helm-swoop-prompt :candidate-number-limit