Skip to content

Commit

Permalink
Declare helm-swoop-last-prefix-number as buffer local variable
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
syohex committed Apr 17, 2016
1 parent 002338d commit d0749f9
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions helm-swoop.el
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 ()
Expand Down

0 comments on commit d0749f9

Please sign in to comment.