Commit 191b046a authored by Kyle Meyer's avatar Kyle Meyer

Break up all multi-assignment setq's

Jonas notes: "Stefan says that the ability to set multiple variables
is only supported for backward compatibility."

https://github.com/magit/magit/pull/3101#discussion_r121172938
parent ab9c189f
......@@ -676,8 +676,8 @@ Added to `font-lock-extend-region-functions'."
(summary-end (match-end 0)))
(when (or (< summary-beg font-lock-beg summary-end)
(< summary-beg font-lock-end summary-end))
(setq font-lock-beg (min font-lock-beg summary-beg)
font-lock-end (max font-lock-end summary-end))))))))
(setq font-lock-beg (min font-lock-beg summary-beg))
(setq font-lock-end (max font-lock-end summary-end))))))))
(defun git-commit-mode-font-lock-keywords ()
`(;; Comments
......
......@@ -366,8 +366,8 @@ actually insert the entry."
(log (magit-commit-message-buffer)) buf pos)
(save-window-excursion
(call-interactively #'magit-diff-visit-file)
(setq buf (current-buffer)
pos (point)))
(setq buf (current-buffer))
(setq pos (point)))
(unless log
(unless (magit-commit-assert nil)
(user-error "Abort"))
......
......@@ -1324,29 +1324,29 @@ commit or stash at point, then prompt for a commit."
(let (rev cmd buf win)
(cond
(magit-blame-mode
(setq rev (magit-blame-chunk-get :hash)
cmd 'magit-show-commit
buf (magit-mode-get-buffer 'magit-revision-mode)))
(setq rev (magit-blame-chunk-get :hash))
(setq cmd 'magit-show-commit)
(setq buf (magit-mode-get-buffer 'magit-revision-mode)))
((derived-mode-p 'git-rebase-mode)
(save-excursion
(goto-char (line-beginning-position))
(--if-let (and git-rebase-line
(looking-at git-rebase-line)
(match-string 2))
(setq rev it
cmd 'magit-show-commit
buf (magit-mode-get-buffer 'magit-revision-mode))
(progn (setq rev it)
(setq cmd 'magit-show-commit)
(setq buf (magit-mode-get-buffer 'magit-revision-mode)))
(user-error "No commit on this line"))))
(t
(magit-section-case
((commit branch)
(setq rev (magit-section-value it)
cmd 'magit-show-commit
buf (magit-mode-get-buffer 'magit-revision-mode)))
(setq rev (magit-section-value it))
(setq cmd 'magit-show-commit)
(setq buf (magit-mode-get-buffer 'magit-revision-mode)))
(stash
(setq rev (magit-section-value it)
cmd 'magit-stash-show
buf (magit-mode-get-buffer 'magit-stash-mode))))))
(setq rev (magit-section-value it))
(setq cmd 'magit-stash-show)
(setq buf (magit-mode-get-buffer 'magit-stash-mode))))))
(if rev
(if (and buf
(setq win (get-buffer-window buf))
......
......@@ -300,22 +300,23 @@ mind at all, then it asks the user for a command to run."
(`unstaged (setq command #'magit-ediff-show-unstaged))
(`staged (setq command #'magit-ediff-show-staged))
(`(commit . ,value)
(setq command #'magit-ediff-show-commit
revB value))
(setq command #'magit-ediff-show-commit)
(setq revB value))
(`(stash . ,value)
(setq command #'magit-ediff-show-stash
revB value))
(setq command #'magit-ediff-show-stash)
(setq revB value))
((pred stringp)
(-let [(a b) (magit-ediff-compare--read-revisions range)]
(setq command #'magit-ediff-compare
revA a
revB b)))
(setq command #'magit-ediff-compare)
(setq revA a)
(setq revB b)))
(_
(when (derived-mode-p 'magit-diff-mode)
(pcase (magit-diff-type)
(`committed (-let [(a b) (magit-ediff-compare--read-revisions
(car magit-refresh-args))]
(setq revA a revB b)))
(setq revA a)
(setq revB b)))
((guard (not magit-ediff-dwim-show-on-hunks))
(setq command #'magit-ediff-stage))
(`unstaged (setq command #'magit-ediff-show-unstaged))
......
......@@ -65,8 +65,8 @@ blame to center around the line point is on."
(when (or current-prefix-arg
(not (setq revision "HEAD"
filename (magit-file-relative-name nil 'tracked))))
(setq revision (magit-read-branch-or-commit "Blame from revision")
filename (magit-read-file-from-rev revision "Blame file")))
(setq revision (magit-read-branch-or-commit "Blame from revision"))
(setq filename (magit-read-file-from-rev revision "Blame file")))
(list revision filename
(and (equal filename
(ignore-errors
......@@ -229,8 +229,8 @@ a position in a file-visiting buffer."
(let (buf pos)
(save-window-excursion
(call-interactively #'magit-diff-visit-file)
(setq buf (current-buffer)
pos (point)))
(setq buf (current-buffer))
(setq pos (point)))
(save-excursion
(with-current-buffer buf
(goto-char pos)
......
......@@ -1277,8 +1277,8 @@ variable whose value may be used as a default."
(defun magit-popup-export-file-args (args)
(let ((files (--first (string-prefix-p "-- " it) args)))
(when files
(setq args (remove files args)
files (split-string (substring files 3) ",")))
(setq args (remove files args))
(setq files (split-string (substring files 3) ",")))
(list args files)))
(defconst magit-popup-font-lock-keywords
......
......@@ -794,11 +794,11 @@ as argument."
(defun magit-process-finish (arg &optional process-buf command-buf
default-dir section)
(unless (integerp arg)
(setq process-buf (process-buffer arg)
command-buf (process-get arg 'command-buf)
default-dir (process-get arg 'default-dir)
section (process-get arg 'section)
arg (process-exit-status arg)))
(setq process-buf (process-buffer arg))
(setq command-buf (process-get arg 'command-buf))
(setq default-dir (process-get arg 'default-dir))
(setq section (process-get arg 'section))
(setq arg (process-exit-status arg)))
(when (featurep 'dired)
(dired-uncache default-dir))
(when (buffer-live-p process-buf)
......
......@@ -526,8 +526,8 @@ If no such sequence is in progress, do nothing."
(let ((patches (nreverse (magit-rebase-patches)))
patch commit)
(while patches
(setq patch (pop patches)
commit (magit-rev-verify-commit
(setq patch (pop patches))
(setq commit (magit-rev-verify-commit
(cadr (split-string (magit-file-line patch)))))
(cond ((and commit patches)
(magit-sequence-insert-commit
......
......@@ -487,8 +487,8 @@ ACTION is a member of option `magit-slow-confirm'."
(cl-defun magit-confirm (action &optional prompt prompt-n (items nil sitems))
(declare (indent defun))
(setq prompt-n (format (concat (or prompt-n prompt) "? ") (length items))
prompt (format (concat (or prompt (magit-confirm-make-prompt action))
(setq prompt-n (format (concat (or prompt-n prompt) "? ") (length items)))
(setq prompt (format (concat (or prompt (magit-confirm-make-prompt action))
"? ")
(car items)))
(cond ((and (not (eq action t))
......
......@@ -737,11 +737,11 @@ the minibuffer too."
"1"))))
pnt-args eob-args)
(when (listp pnt-format)
(setq pnt-args (cdr pnt-format)
pnt-format (car pnt-format)))
(setq pnt-args (cdr pnt-format))
(setq pnt-format (car pnt-format)))
(when (listp eob-format)
(setq eob-args (cdr eob-format)
eob-format (car eob-format)))
(setq eob-args (cdr eob-format))
(setq eob-format (car eob-format)))
(when pnt-format
(when idx-format
(setq pnt-format
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment