From: David Kågedal Date: Fri, 4 Dec 2009 07:55:01 +0000 (+0100) Subject: stgit.el: Move defcustom definitions to the top X-Git-Url: https://git.distorted.org.uk/~mdw/stgit/commitdiff_plain/4ba91e808ffaf70f3ad7ba4f17855a36d6c4b5fe stgit.el: Move defcustom definitions to the top Signed-off-by: David Kågedal --- diff --git a/contrib/stgit.el b/contrib/stgit.el index 4482e67..6fef700 100644 --- a/contrib/stgit.el +++ b/contrib/stgit.el @@ -17,6 +17,126 @@ (require 'ewoc) (require 'easymenu) +(defun stgit-set-default (symbol value) + "Set default value of SYMBOL to VALUE using `set-default' and +reload all StGit buffers." + (set-default symbol value) + (dolist (buf (buffer-list)) + (with-current-buffer buf + (when (eq major-mode 'stgit-mode) + (stgit-reload))))) + +(defgroup stgit nil + "A user interface for the StGit patch maintenance tool." + :group 'tools + :link '(function-link stgit) + :link '(url-link "http://www.procode.org/stgit/")) + +(defcustom stgit-abbreviate-copies-and-renames t + "If non-nil, abbreviate copies and renames as \"dir/{old -> new}/file\" +instead of \"dir/old/file -> dir/new/file\"." + :type 'boolean + :group 'stgit + :set 'stgit-set-default) + +(defcustom stgit-default-show-worktree t + "Set to non-nil to by default show the working tree in a new stgit buffer. + +Use \\\\[stgit-toggle-worktree] to toggle the this setting in an already-started StGit buffer." + :type 'boolean + :group 'stgit + :link '(variable-link stgit-show-worktree)) + +(defcustom stgit-find-copies-harder nil + "Try harder to find copied files when listing patches. + +When not nil, runs git diff-tree with the --find-copies-harder +flag, which reduces performance." + :type 'boolean + :group 'stgit + :set 'stgit-set-default) + +(defcustom stgit-show-worktree-mode 'center + "This variable controls where the \"Index\" and \"Work tree\" +will be shown on in the buffer. + +It can be set to 'top (above all patches), 'center (show between +applied and unapplied patches), and 'bottom (below all patches)." + :type '(radio (const :tag "above all patches (top)" top) + (const :tag "between applied and unapplied patches (center)" + center) + (const :tag "below all patches (bottom)" bottom)) + :group 'stgit + :link '(variable-link stgit-show-worktree) + :set 'stgit-set-default) + +(defface stgit-branch-name-face + '((t :inherit bold)) + "The face used for the StGit branch name" + :group 'stgit) + +(defface stgit-top-patch-face + '((((background dark)) (:weight bold :foreground "yellow")) + (((background light)) (:weight bold :foreground "purple")) + (t (:weight bold))) + "The face used for the top patch names" + :group 'stgit) + +(defface stgit-applied-patch-face + '((((background dark)) (:foreground "light yellow")) + (((background light)) (:foreground "purple")) + (t ())) + "The face used for applied patch names" + :group 'stgit) + +(defface stgit-unapplied-patch-face + '((((background dark)) (:foreground "gray80")) + (((background light)) (:foreground "orchid")) + (t ())) + "The face used for unapplied patch names" + :group 'stgit) + +(defface stgit-description-face + '((((background dark)) (:foreground "tan")) + (((background light)) (:foreground "dark red"))) + "The face used for StGit descriptions" + :group 'stgit) + +(defface stgit-index-work-tree-title-face + '((((supports :slant italic)) :slant italic) + (t :inherit bold)) + "StGit mode face used for the \"Index\" and \"Work tree\" titles" + :group 'stgit) + +(defface stgit-unmerged-file-face + '((((class color) (background light)) (:foreground "red" :bold t)) + (((class color) (background dark)) (:foreground "red" :bold t))) + "StGit mode face used for unmerged file status" + :group 'stgit) + +(defface stgit-unknown-file-face + '((((class color) (background light)) (:foreground "goldenrod" :bold t)) + (((class color) (background dark)) (:foreground "goldenrod" :bold t))) + "StGit mode face used for unknown file status" + :group 'stgit) + +(defface stgit-ignored-file-face + '((((class color) (background light)) (:foreground "grey60")) + (((class color) (background dark)) (:foreground "grey40"))) + "StGit mode face used for ignored files") + +(defface stgit-file-permission-face + '((((class color) (background light)) (:foreground "green" :bold t)) + (((class color) (background dark)) (:foreground "green" :bold t))) + "StGit mode face used for permission changes." + :group 'stgit) + +(defface stgit-modified-file-face + '((((class color) (background light)) (:foreground "purple")) + (((class color) (background dark)) (:foreground "salmon"))) + "StGit mode face used for modified file status" + :group 'stgit) + (defun stgit (dir) "Manage StGit patches for the tree in DIR. @@ -284,126 +404,6 @@ Returns nil if there was no output." (goto-line curline))) (stgit-refresh-git-status)) -(defun stgit-set-default (symbol value) - "Set default value of SYMBOL to VALUE using `set-default' and -reload all StGit buffers." - (set-default symbol value) - (dolist (buf (buffer-list)) - (with-current-buffer buf - (when (eq major-mode 'stgit-mode) - (stgit-reload))))) - -(defgroup stgit nil - "A user interface for the StGit patch maintenance tool." - :group 'tools - :link '(function-link stgit) - :link '(url-link "http://www.procode.org/stgit/")) - -(defcustom stgit-abbreviate-copies-and-renames t - "If non-nil, abbreviate copies and renames as \"dir/{old -> new}/file\" -instead of \"dir/old/file -> dir/new/file\"." - :type 'boolean - :group 'stgit - :set 'stgit-set-default) - -(defcustom stgit-default-show-worktree t - "Set to non-nil to by default show the working tree in a new stgit buffer. - -Use \\\\[stgit-toggle-worktree] to toggle the this setting in an already-started StGit buffer." - :type 'boolean - :group 'stgit - :link '(variable-link stgit-show-worktree)) - -(defcustom stgit-find-copies-harder nil - "Try harder to find copied files when listing patches. - -When not nil, runs git diff-tree with the --find-copies-harder -flag, which reduces performance." - :type 'boolean - :group 'stgit - :set 'stgit-set-default) - -(defcustom stgit-show-worktree-mode 'center - "This variable controls where the \"Index\" and \"Work tree\" -will be shown on in the buffer. - -It can be set to 'top (above all patches), 'center (show between -applied and unapplied patches), and 'bottom (below all patches)." - :type '(radio (const :tag "above all patches (top)" top) - (const :tag "between applied and unapplied patches (center)" - center) - (const :tag "below all patches (bottom)" bottom)) - :group 'stgit - :link '(variable-link stgit-show-worktree) - :set 'stgit-set-default) - -(defface stgit-branch-name-face - '((t :inherit bold)) - "The face used for the StGit branch name" - :group 'stgit) - -(defface stgit-top-patch-face - '((((background dark)) (:weight bold :foreground "yellow")) - (((background light)) (:weight bold :foreground "purple")) - (t (:weight bold))) - "The face used for the top patch names" - :group 'stgit) - -(defface stgit-applied-patch-face - '((((background dark)) (:foreground "light yellow")) - (((background light)) (:foreground "purple")) - (t ())) - "The face used for applied patch names" - :group 'stgit) - -(defface stgit-unapplied-patch-face - '((((background dark)) (:foreground "gray80")) - (((background light)) (:foreground "orchid")) - (t ())) - "The face used for unapplied patch names" - :group 'stgit) - -(defface stgit-description-face - '((((background dark)) (:foreground "tan")) - (((background light)) (:foreground "dark red"))) - "The face used for StGit descriptions" - :group 'stgit) - -(defface stgit-index-work-tree-title-face - '((((supports :slant italic)) :slant italic) - (t :inherit bold)) - "StGit mode face used for the \"Index\" and \"Work tree\" titles" - :group 'stgit) - -(defface stgit-unmerged-file-face - '((((class color) (background light)) (:foreground "red" :bold t)) - (((class color) (background dark)) (:foreground "red" :bold t))) - "StGit mode face used for unmerged file status" - :group 'stgit) - -(defface stgit-unknown-file-face - '((((class color) (background light)) (:foreground "goldenrod" :bold t)) - (((class color) (background dark)) (:foreground "goldenrod" :bold t))) - "StGit mode face used for unknown file status" - :group 'stgit) - -(defface stgit-ignored-file-face - '((((class color) (background light)) (:foreground "grey60")) - (((class color) (background dark)) (:foreground "grey40"))) - "StGit mode face used for ignored files") - -(defface stgit-file-permission-face - '((((class color) (background light)) (:foreground "green" :bold t)) - (((class color) (background dark)) (:foreground "green" :bold t))) - "StGit mode face used for permission changes." - :group 'stgit) - -(defface stgit-modified-file-face - '((((class color) (background light)) (:foreground "purple")) - (((class color) (background dark)) (:foreground "salmon"))) - "StGit mode face used for modified file status" - :group 'stgit) - (defconst stgit-file-status-code-strings (mapcar (lambda (arg) (cons (car arg)