Skip to content

Commit 062c756

Browse files
stgit.el: Replace ad-hoc make-local-variable' with defvar-local'
Eliminates lots of "reference to free variable" warnings.
1 parent 45fb0a0 commit 062c756

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

contrib/stgit.el

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,14 @@
7373
(defvar-local stgit-show-svn)
7474
(defvar-local stgit-show-unknown)
7575
(defvar-local stgit-show-worktree)
76+
(defvar-local stgit-ewoc)
77+
(defvar-local stgit-edit-patchsym)
78+
(defvar-local stgit-refresh-after-new)
79+
(defvar-local stgit-refresh-after-new)
80+
(defvar-local stgit-sink-to)
81+
(defvar-local stgit-patchsyms)
82+
(defvar-local old-process-sentinel)
83+
(defvar-local stgit-buffer)
7684

7785
(defun stgit-set-default (symbol value)
7886
"Set default value of SYMBOL to VALUE using `set-default' and
@@ -440,8 +448,8 @@ Argument DIR is the repository path."
440448
(with-current-buffer buf
441449
(setq default-directory dir)
442450
(stgit-mode)
443-
(set (make-local-variable 'stgit-ewoc)
444-
(ewoc-create #'stgit-patch-pp "Branch:\n\n" "--\n" t))
451+
(setq stgit-ewoc
452+
(ewoc-create #'stgit-patch-pp "Branch:\n\n" "--\n" t))
445453
(setq buffer-read-only t))
446454
buf))
447455

@@ -1119,7 +1127,7 @@ at point."
11191127
'switch-to-buffer-other-window
11201128
'switch-to-buffer)
11211129
(find-file-noselect filename))
1122-
(set (make-local-variable 'vc-parent-buffer) filename)))
1130+
(setq vc-parent-buffer filename)))
11231131

11241132
(defun stgit-find-file (&optional other-window this-rev)
11251133
(let* ((file (or (stgit-patched-file-at-point)
@@ -2609,7 +2617,7 @@ file ended up. You can then jump to the file with \
26092617
(edit-buf (get-buffer-create "*StGit edit*"))
26102618
(dir default-directory))
26112619
(log-edit 'stgit-confirm-edit t nil edit-buf)
2612-
(set (make-local-variable 'stgit-edit-patchsym) patchsym)
2620+
(setq stgit-edit-patchsym patchsym)
26132621
(setq default-directory dir)
26142622
(let ((standard-output edit-buf))
26152623
(save-excursion
@@ -2665,8 +2673,8 @@ that name (a symbol)."
26652673
(dir default-directory))
26662674
(log-edit 'stgit-confirm-new t nil edit-buf)
26672675
(setq default-directory dir)
2668-
(set (make-local-variable 'stgit-refresh-after-new) refresh)
2669-
(set (make-local-variable 'stgit-sink-to) sink-to)
2676+
(setq stgit-refresh-after-new refresh)
2677+
(setq stgit-sink-to sink-to)
26702678
(when add-sign
26712679
(save-excursion
26722680
(let ((standard-output (current-buffer)))
@@ -2840,7 +2848,7 @@ deepest patch had before the squash."
28402848
(dir default-directory)
28412849
(sorted-patchsyms (stgit-sort-patches patchsyms)))
28422850
(log-edit 'stgit-confirm-squash t nil edit-buf)
2843-
(set (make-local-variable 'stgit-patchsyms) sorted-patchsyms)
2851+
(setq stgit-patchsyms sorted-patchsyms)
28442852
(setq default-directory dir)
28452853
(let ((result (let ((standard-output edit-buf))
28462854
(save-excursion
@@ -2944,10 +2952,8 @@ When the command has finished, reload the stgit buffer."
29442952
(let ((old-buffer (current-buffer)))
29452953
(with-current-buffer buffer
29462954
(let ((process (get-buffer-process buffer)))
2947-
(set (make-local-variable 'old-process-sentinel)
2948-
(process-sentinel process))
2949-
(set (make-local-variable 'stgit-buffer)
2950-
old-buffer)
2955+
(setq old-process-sentinel (process-sentinel process))
2956+
(setq stgit-buffer old-buffer)
29512957
(set-process-filter process 'stgit-execute-process-filter)
29522958
(set-process-sentinel process 'stgit-execute-process-sentinel))))
29532959
(with-current-buffer buffer

0 commit comments

Comments
 (0)