From d0749f9933b0db2e213fbf99eb83b43310682c11 Mon Sep 17 00:00:00 2001 From: Syohei YOSHIDA Date: Sun, 17 Apr 2016 23:18:39 +0900 Subject: [PATCH] Declare helm-swoop-last-prefix-number as buffer local variable It should be buffer local variable for all buffers. And update minimum Emacs version for using defvar-local. helm requires Emacs 24.3 or higher version, so it is no problem. --- helm-swoop.el | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/helm-swoop.el b/helm-swoop.el index 543a93d..e984533 100644 --- a/helm-swoop.el +++ b/helm-swoop.el @@ -7,7 +7,7 @@ ;; URL: https://github.com/ShingoFukuyama/helm-swoop ;; Created: Oct 24 2013 ;; Keywords: helm swoop inner buffer search -;; Package-Requires: ((helm "1.0") (emacs "24")) +;; Package-Requires: ((helm "1.0") (emacs "24.3")) ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the GNU General Public License as @@ -158,7 +158,7 @@ (defvar helm-swoop-list-cache) (defvar helm-swoop-pattern) ; Keep helm-pattern value (defvar helm-swoop-last-query) ; Last search query for resume -(defvar helm-swoop-last-prefix-number) ; For multiline highlight +(defvar-local helm-swoop-last-prefix-number 1) ; For multiline highlight ;; Global variables (defvar helm-swoop-synchronizing-window nil @@ -549,14 +549,10 @@ If $linum is number, lines are separated by $linum" (match . ,(helm-swoop-match-functions)) (search . ,(helm-swoop-search-functions)))) -(defun helm-swoop--set-prefix (&optional $multiline) +(defun helm-swoop--set-prefix ($multiline) ;; Enable scrolling margin - (if (boundp 'helm-swoop-last-prefix-number) - (setq helm-swoop-last-prefix-number - (or $multiline 1)) ;; $multiline is for resume - (set (make-local-variable 'helm-swoop-last-prefix-number) - (or $multiline 1)))) -(helm-swoop--set-prefix) ;; Silence error "Warning: reference to free variable" + (setq helm-swoop-last-prefix-number + (or $multiline 1))) ;; $multiline is for resume ;; Delete cache when modified file is saved (defun helm-swoop--clear-cache ()