Commit a1617483 authored by Jonas Bernoulli's avatar Jonas Bernoulli

Split several libraries into more sections

parent 8c42fe28
......@@ -30,6 +30,8 @@
(require 'autorevert)
;;; Options
(defgroup magit-auto-revert nil
"Revert buffers when files in repository change."
:link '(custom-group-link auto-revert)
......@@ -97,6 +99,8 @@ seconds of user inactivity. That is not desirable."
:group 'magit-auto-revert
:type 'boolean)
;;; Mode
(defun magit-turn-on-auto-revert-mode-if-desired (&optional file)
(if file
(--when-let (find-buffer-visiting file)
......
......@@ -29,6 +29,8 @@
(require 'magit)
;;; Options
(defcustom magit-bisect-show-graph t
"Whether to use `--graph' in the log showing commits yet to be bisected."
:package-version '(magit . "2.8.0")
......@@ -50,6 +52,8 @@
"Face for bad bisect revisions."
:group 'magit-faces)
;;; Commands
;;;###autoload (autoload 'magit-bisect-popup "magit-bisect" nil t)
(magit-define-popup magit-bisect-popup
"Popup console for bisect commands."
......@@ -134,6 +138,8 @@ bisect run'."
(magit-run-git-with-logfile
(magit-git-dir "BISECT_CMD_OUTPUT") "bisect" subcommand args)))
;;; Sections
(defun magit-bisect-in-progress-p ()
(file-exists-p (magit-git-dir "BISECT_LOG")))
......
......@@ -118,7 +118,7 @@ and then turned on again when turning off the latter."
"Face for dates in blame headings."
:group 'magit-faces)
;;; Code
;;; Mode
(defvar magit-blame-mode-map
(let ((map (make-sparse-keymap)))
......@@ -197,6 +197,8 @@ and then turned on again when turning off the latter."
(advice-add 'auto-revert-handler :before-until
'auto-revert-handler--unless-magit-blame-mode)
;;; Popup
;;;###autoload (autoload 'magit-blame-popup "magit-blame" nil t)
(magit-define-popup magit-blame-popup
"Popup console for blame commands."
......@@ -209,6 +211,8 @@ and then turned on again when turning off the latter."
:default-arguments '("-w")
:default-action 'magit-blame)
;;; Process
;;;###autoload
(defun magit-blame (revision file &optional args line)
"Display edit history of FILE up to REVISION.
......@@ -361,6 +365,8 @@ This is intended for debugging purposes.")
(kill-process process)
(user-error "Buffer being blamed has been killed")))
;;; Display
(defun magit-blame-make-overlay (chunk)
(let ((ov (save-excursion
(save-restriction
......@@ -424,6 +430,8 @@ This is intended for debugging purposes.")
(format-time-string
format (seconds-to-time (+ time (* (/ tz 100) 60 60) (* (% tz 100) 60)))))
;;; Commands
(defun magit-blame-quit ()
"Turn off Magit-Blame mode.
If the buffer was created during a recursive blame,
......@@ -502,6 +510,8 @@ like `kill-ring-save' would."
(copy-region-as-kill nil nil 'region)
(kill-new (message "%s" (magit-blame-chunk-get :hash)))))
;;; Utilities
(defun magit-blame-chunk-get (key &optional pos)
(--when-let (magit-blame-overlay-at pos)
(plist-get (overlay-get it 'magit-blame) key)))
......
......@@ -85,7 +85,7 @@ an error while using those is harder to recover from."
:group 'magit-commands
:type 'boolean)
;;; Code
;;; Popup
(defun magit-commit-popup (&optional arg)
"Popup console for commit commands."
......@@ -142,6 +142,8 @@ an error while using those is harder to recover from."
(car (or magit-gpg-secret-key-hist keys)))
" "))))
;;; Commands
;;;###autoload
(defun magit-commit (&optional args)
"Create a new commit on HEAD.
......@@ -311,6 +313,8 @@ depending on the value of option `magit-commit-squash-confirm'."
(t
(user-error "Nothing staged"))))
;;; Pending Diff
(defun magit-commit-diff ()
(-when-let (fn (and git-commit-mode
magit-commit-show-diff
......@@ -339,6 +343,8 @@ depending on the value of option `magit-commit-squash-confirm'."
(add-to-list 'with-editor-server-window-alist
(cons git-commit-filename-regexp 'switch-to-buffer))
;;; Message Utilities
(defun magit-commit-message-buffer ()
(let* ((find-file-visit-truename t) ; git uses truename of COMMIT_EDITMSG
(topdir (magit-toplevel)))
......
......@@ -35,6 +35,8 @@
(defvar smerge-ediff-buf)
(defvar smerge-ediff-windows)
;;; Options
(defgroup magit-ediff nil
"Ediff support for Magit."
:link '(info-link "(magit)Ediffing")
......@@ -97,6 +99,8 @@ tree at the time of stashing."
:group 'magit-ediff
:type 'boolean)
;;; Commands
(defvar magit-ediff-previous-winconf nil)
;;;###autoload (autoload 'magit-ediff-popup "magit-ediff" nil t)
......
......@@ -325,6 +325,7 @@ the upstream isn't ahead of the current branch) show."
:type '(repeat (string :tag "Argument")))
;;; Commands
;;;; Popups
(defvar magit-log-popup
'(:variable magit-log-arguments
......@@ -498,6 +499,8 @@ buffer."
magit-log-section-arguments))))
(magit-invoke-popup 'magit-log-refresh-popup nil arg)))
;;;; Refresh Commands
(defun magit-log-refresh (args files)
"Set the local log arguments for the current buffer."
(interactive (magit-log-arguments t))
......@@ -546,6 +549,8 @@ buffer."
((derived-mode-p 'magit-cherry-mode)
(user-error "Cannot change log arguments in cherry buffers"))))
;;;; Log Commands
(defvar magit-log-read-revs-map
(let ((map (make-sparse-keymap)))
(set-keymap-parent map crm-local-completion-map)
......@@ -681,6 +686,8 @@ With a prefix argument or when `--follow' is part of
(interactive)
(magit-reflog "HEAD"))
;;;; Limit Commands
(defun magit-log-toggle-commit-limit ()
"Toggle the number of commits the current log buffer is limited to.
If the number of commits is currently limited, then remove that
......@@ -715,6 +722,8 @@ limit. Otherwise set it to 256."
(car (magit-log-arguments t)))
(string-to-number (match-string 1 it))))
;;;; Other Commands
(defun magit-log-bury-buffer (&optional arg)
"Bury the current buffer or the revision buffer in the same frame.
Like `magit-mode-bury-buffer' (which see) but with a negative
......
......@@ -25,6 +25,8 @@
(require 'magit)
;;; Popup
;;;###autoload (autoload 'magit-subtree-popup "magit-subtree" nil t)
(magit-define-popup magit-subtree-popup
"Popup console for subtree commands."
......@@ -61,6 +63,8 @@
(user-error "%s isn't inside the repository at %s" prefix topdir))
prefix)))
;;; Commands
(defun magit-subtree-prefix (prompt)
(--if-let (--first (string-prefix-p "--prefix=" it)
(magit-subtree-arguments))
......
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