Browse Source

git-bug WIP

master
10sr 5 years ago
parent
commit
b0e07675dd
Signed by: 10sr GPG Key ID: 7BEC428194130EB2
1 changed files with 29 additions and 2 deletions
  1. +29
    -2
      emacs.el

+ 29
- 2
emacs.el View File

@@ -2043,9 +2043,8 @@ and search from projectile root (if projectile is available)."
"Regexp to parse line of output of git-bug ls. "Regexp to parse line of output of git-bug ls.
Used by `git-bug-ls'.") Used by `git-bug-ls'.")


(defun git-bug--bugs ()
(defun git-bug-bugs ()
"Get list of git-bug bugs." "Get list of git-bug bugs."
(interactive)
(with-temp-buffer (with-temp-buffer
(git-bug--call-process "bug" "ls") (git-bug--call-process "bug" "ls")
(goto-char (point-min)) (goto-char (point-min))
@@ -2066,6 +2065,34 @@ Used by `git-bug-ls'.")
(goto-char (point-at-bol))) (goto-char (point-at-bol)))
bugs))) bugs)))


(defun git-bug-ls-noselect (&optional directory)
"Open git bug list buffer.

If optional arg DIRECTORY is given change current directory to there before
initializing."
(setq directory (expand-file-name (or directory
default-directory)))
(cl-assert (file-directory-p directory))
(let* ((root (git-bug--get-repository-root directory))
(name (file-name-nondirectory root))
(bname (format "*GitBug<%s>*" name)))
(with-current-buffer (get-buffer-create bname)
(cd root)
(git-bug--set-tabulated-list-mode-variables)
(git-bug-mode)
(current-buffer))))

(defun git-bug--get-repository-root (dir)
"Resolve repository root of DIR.

If DIR is not inside of any git repository, signal an error."
(cl-assert (file-directory-p dir))
(with-temp-buffer
(cd dir)
(git-bug--call-process "rev-parse" "--show-toplevel")
(goto-char (point-min))
(buffer-substring-no-properties (point-at-bol) (point-at-eol))))

(defun git-bug--call-process (&rest args) (defun git-bug--call-process (&rest args)
"Start git process synchronously with ARGS. "Start git process synchronously with ARGS.




Loading…
Cancel
Save