Skip to content

Commit 45fb0a0

Browse files
stgit.el: Use defvar-local instead of make-local-variable
This silences warnings like "reference to free variable" and allows us to add docstrings.
1 parent b50c8f0 commit 45fb0a0

File tree

1 file changed

+25
-15
lines changed

1 file changed

+25
-15
lines changed

contrib/stgit.el

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,21 @@
5959
(require 'easymenu)
6060
(require 'format-spec)
6161

62+
(defvar-local stgit-marked-patches nil
63+
"List of marked patches.")
64+
65+
(defvar-local stgit-index-node nil)
66+
(defvar-local stgit-worktree-node nil)
67+
(defvar-local stgit-expanded-patches '(:work :index))
68+
(defvar-local stgit-svn-find-rev-hash nil)
69+
(defvar-local stgit-committed-count)
70+
(defvar-local stgit-show-committed)
71+
(defvar-local stgit-show-ignored)
72+
(defvar-local stgit-show-patch-names)
73+
(defvar-local stgit-show-svn)
74+
(defvar-local stgit-show-unknown)
75+
(defvar-local stgit-show-worktree)
76+
6277
(defun stgit-set-default (symbol value)
6378
"Set default value of SYMBOL to VALUE using `set-default' and
6479
reload all StGit buffers."
@@ -1678,21 +1693,16 @@ See also \\[customize-group] for the \"stgit\" group."
16781693
major-mode 'stgit-mode
16791694
goal-column 2)
16801695
(use-local-map stgit-mode-map)
1681-
(mapc (lambda (x) (set (make-local-variable (car x)) (cdr x)))
1682-
`((list-buffers-directory . ,default-directory)
1683-
(parse-sexp-lookup-properties . t)
1684-
(stgit-expanded-patches . (:work :index))
1685-
(stgit-index-node . nil)
1686-
(stgit-worktree-node . nil)
1687-
(stgit-marked-patches . nil)
1688-
(stgit-svn-find-rev-hash . ,(make-hash-table :test 'equal))
1689-
(stgit-committed-count . ,stgit-default-committed-count)
1690-
(stgit-show-committed . ,stgit-default-show-committed)
1691-
(stgit-show-ignored . ,stgit-default-show-ignored)
1692-
(stgit-show-patch-names . ,stgit-default-show-patch-names)
1693-
(stgit-show-svn . ,stgit-default-show-svn)
1694-
(stgit-show-unknown . ,stgit-default-show-unknown)
1695-
(stgit-show-worktree . ,stgit-default-show-worktree)))
1696+
(setq list-buffers-directory default-directory)
1697+
(setq-local parse-sexp-lookup-properties t)
1698+
(setq stgit-svn-find-rev-hash (make-hash-table :test 'equal))
1699+
(setq stgit-committed-count stgit-default-committed-count)
1700+
(setq stgit-show-committed stgit-default-show-committed)
1701+
(setq stgit-show-ignored stgit-default-show-ignored)
1702+
(setq stgit-show-patch-names stgit-default-show-patch-names)
1703+
(setq stgit-show-svn stgit-default-show-svn)
1704+
(setq stgit-show-unknown stgit-default-show-unknown)
1705+
(setq stgit-show-worktree stgit-default-show-worktree)
16961706
(set-variable 'truncate-lines 't)
16971707
(add-hook 'after-save-hook 'stgit-update-stgit-for-buffer)
16981708
(unless stgit-did-advise

0 commit comments

Comments
 (0)