Skip to content

Commit

Permalink
Improvement on egg-status-buffer-stage-untracked-file
Browse files Browse the repository at this point in the history
Now egg-status-buffer-stage-untracked-file function can now stage files
in batches, from a region selected area, as opposed to adding them one
by one.
  • Loading branch information
dotemacs committed May 5, 2012
1 parent 8efd9c6 commit cecf3f6
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions egg.el
Expand Up @@ -2512,11 +2512,27 @@ rebase session."
(egg-buffer-cmd-refresh))) (egg-buffer-cmd-refresh)))


(defun egg-status-buffer-stage-untracked-file () (defun egg-status-buffer-stage-untracked-file ()
"add untracked file(s) to the repository

acts on a single file or on a region which contains the names of
untracked files"
(interactive) (interactive)
(let ((file (buffer-substring-no-properties (line-beginning-position) (line-end-position)))) ;; act on multiple files
(when (egg-sync-do-file file egg-git-command nil nil (if mark-active
(list "add" "--" file)) (let ((files ""))
(message "new file %s added" file)))) (mapc #'(lambda (file)
(egg-sync-0 "add" file)
(setq files (concat files file " ")))
(split-string
(buffer-substring-no-properties (point) (mark)) "\n" t))
(deactivate-mark)
(message "new files added: %s" files))
;; act only on single files
(let ((file (buffer-substring-no-properties
(line-beginning-position) (line-end-position))))
(when (egg-sync-do-file file egg-git-command nil nil
(list "add" "--" file))
(message "new file %s added" file)))))


(defconst egg-untracked-file-map (defconst egg-untracked-file-map
(let ((map (make-sparse-keymap "Egg:UntrackedFile"))) (let ((map (make-sparse-keymap "Egg:UntrackedFile")))
Expand Down

0 comments on commit cecf3f6

Please sign in to comment.