[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master eab714f 054/272: counsel.el (counsel-at-git-issue-p): New
From: |
Oleh Krehel |
Subject: |
[elpa] master eab714f 054/272: counsel.el (counsel-at-git-issue-p): New defun |
Date: |
Mon, 25 Apr 2016 10:13:16 +0000 |
branch: master
commit eab714f4890a6d1000a8fc3ef5adebac7f1052ee
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
counsel.el (counsel-at-git-issue-p): New defun
* counsel.el (counsel-github-url-p):
(counsel-emacs-url-p): Use `counsel-at-git-issue-p'.
---
counsel.el | 61 ++++++++++++++++++++++++++++++------------------------------
1 file changed, 31 insertions(+), 30 deletions(-)
diff --git a/counsel.el b/counsel.el
index 4a523cb..c5ea288 100644
--- a/counsel.el
+++ b/counsel.el
@@ -492,42 +492,43 @@ When INITIAL-INPUT is non-nil, use it in the minibuffer
during completion."
:history 'file-name-history
:keymap counsel-find-file-map))
+(defun counsel-at-git-issue-p ()
+ "Whe point is at an issue in a Git-versioned file, return the issue string."
+ (and (looking-at "#[0-9]+")
+ (or
+ (eq (vc-backend (buffer-file-name)) 'Git)
+ (memq major-mode '(magit-commit-mode)))
+ (match-string-no-properties 0)))
+
(defun counsel-github-url-p ()
"Return a Github issue URL at point."
- (when (and (looking-at "#[0-9]+")
- (or
- (eq (vc-backend (buffer-file-name)) 'Git)
- (memq major-mode '(magit-commit-mode))))
- (let ((url (match-string-no-properties 0))
- (origin (shell-command-to-string
- "git remote get-url origin"))
- user repo)
- (cond ((string-match "address@hidden:\\([^/]+\\)/\\(.*\\)\\.git$"
- origin)
- (setq user (match-string 1 origin))
- (setq repo (match-string 2 origin)))
- ((string-match "\\`https://github.com/\\([^/]+\\)/\\(.*\\)$"
- origin)
- (setq user (match-string 1 origin))
- (setq repo (match-string 2 origin))))
- (when user
- (setq url (format "https://github.com/%s/%s/issues/%s"
- user repo (substring url 1)))))))
+ (let ((url (counsel-at-git-issue-p)))
+ (when url
+ (let ((origin (shell-command-to-string
+ "git remote get-url origin"))
+ user repo)
+ (cond ((string-match "address@hidden:\\([^/]+\\)/\\(.*\\)\\.git$"
+ origin)
+ (setq user (match-string 1 origin))
+ (setq repo (match-string 2 origin)))
+ ((string-match "\\`https://github.com/\\([^/]+\\)/\\(.*\\)$"
+ origin)
+ (setq user (match-string 1 origin))
+ (setq repo (match-string 2 origin))))
+ (when user
+ (setq url (format "https://github.com/%s/%s/issues/%s"
+ user repo (substring url 1))))))))
(add-to-list 'ivy-ffap-url-functions 'counsel-github-url-p)
(defun counsel-emacs-url-p ()
"Return a Debbugs issue URL at point."
- (when (and (looking-at "#[0-9]+")
- (or
- (eq (vc-backend (buffer-file-name)) 'Git)
- (memq major-mode '(magit-commit-mode))))
- (let ((url (match-string-no-properties 0))
- (origin (shell-command-to-string
- "git remote get-url origin")))
- (when (string-match "git.sv.gnu.org:/srv/git/emacs.git" origin)
- (format "http://debbugs.gnu.org/cgi/bugreport.cgi?bug=%s"
- (substring url 1))))))
-
+ (let ((url (counsel-at-git-issue-p)))
+ (when url
+ (let ((origin (shell-command-to-string
+ "git remote get-url origin")))
+ (when (string-match "git.sv.gnu.org:/srv/git/emacs.git" origin)
+ (format "http://debbugs.gnu.org/cgi/bugreport.cgi?bug=%s"
+ (substring url 1)))))))
(add-to-list 'ivy-ffap-url-functions 'counsel-emacs-url-p)
(defcustom counsel-find-file-ignore-regexp nil
- [elpa] master ec7da3f 075/272: ivy.el (ivy-help-file): Improve location, (continued)
- [elpa] master ec7da3f 075/272: ivy.el (ivy-help-file): Improve location, Oleh Krehel, 2016/04/25
- [elpa] master c76c005 045/272: Add feedback for sole ivy completion., Oleh Krehel, 2016/04/25
- [elpa] master 59c5f16 044/272: Special case empty ivy-count-format completion., Oleh Krehel, 2016/04/25
- [elpa] master 569c11e 017/272: ivy.el (ivy-completion-in-region): Use compact ivy-count-format, Oleh Krehel, 2016/04/25
- [elpa] master d996215 038/272: Add counsel-descbinds, Oleh Krehel, 2016/04/25
- [elpa] master 9ef344d 062/272: use imenu API to jump to position. required by org-mode, Oleh Krehel, 2016/04/25
- [elpa] master 0a9780b 046/272: ivy.el (ivy--recompute-index): Update cl-position logic, Oleh Krehel, 2016/04/25
- [elpa] master 407ce2c 051/272: counsel.el (counsel-list-processes): New command, Oleh Krehel, 2016/04/25
- [elpa] master e3e1f51 052/272: ivy.el (ivy-ffap-url-functions): Customize "C-x C-f M-n", Oleh Krehel, 2016/04/25
- [elpa] master b39f409 056/272: counsel.el (counsel-unicode-char): Display hex codes in left column, Oleh Krehel, 2016/04/25
- [elpa] master eab714f 054/272: counsel.el (counsel-at-git-issue-p): New defun,
Oleh Krehel <=
- [elpa] master 4696b89 057/272: ivy.el (ivy-switch-buffer-other-window): New command, Oleh Krehel, 2016/04/25
- [elpa] master 763d42b 048/272: Initialize `ivy-last` to empty state., Oleh Krehel, 2016/04/25
- [elpa] master c0c0f63 060/272: ivy.el (ivy-read): Fix extra actions for completing-read, Oleh Krehel, 2016/04/25
- [elpa] master 5f4bc14 058/272: counsel.el (counsel-rhythmbox-current-song): Preselect the current song, Oleh Krehel, 2016/04/25
- [elpa] master 2877ae1 063/272: ivy.el (ivy-ignore-buffers): New defcustom, Oleh Krehel, 2016/04/25
- [elpa] master 480cc85 071/272: README.md: Update, Oleh Krehel, 2016/04/25
- [elpa] master 7b08db8 094/272: ivy.el (ivy-next-history-element): Use "\\_<" instead of "\\b", Oleh Krehel, 2016/04/25
- [elpa] master e94f13e 104/272: counsel.el (counsel-imenu): Add :preselect, Oleh Krehel, 2016/04/25
- [elpa] master 3799d3d 109/272: counsel.el: Shuffle functions and rename headings, Oleh Krehel, 2016/04/25
- [elpa] master 7dd85f5 122/272: counsel.el (counsel--async-sentinel): Recognize error codes other than 1, Oleh Krehel, 2016/04/25