Skip to content

Commit

Permalink
Fix package-lint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
yasuyk committed Nov 5, 2016
1 parent 21ae752 commit eef84d4
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 35 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,3 @@
.elc*
elpa
test/fixture/*
test/test-package-install.log
test/test-checkdoc.log
1 change: 1 addition & 0 deletions Cask
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

(development
(depends-on "cask")
(depends-on "package-lint")
(depends-on "f")
(depends-on "ert") ; Unit test library
(depends-on "ert-runner") ; Unit test runner
Expand Down
33 changes: 16 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@ SRC ?= helm-git-grep.el
FIXTURE_GIT_VERSION ?= v1.0.0
FIXTURE_GIT_WORK_DIR ?= test/fixture/git
TEST_CHECKDOC_EL ?= test/test-checkdoc.el
TEST_CHECKDOC_LOG ?= test/test-checkdoc.log
TEST_PACKAGE_INSTALL_EL ?= test/test-package-install.el
TEST_PACKAGE_INSTALL_LOG ?= test/test-package-install.log
LOADPATH = -L .
ELPA_DIR = $(shell EMACS=$(EMACS) $(CASK) package-directory)

INIT_PACKAGE_EL="(progn (require 'cask) (cask-initialize \".\"))"

.PHONY : test
test: test-checkdoc test-package-install unit-tests
test: test-checkdoc package-lint test-package-install unit-tests

.PHONY : travis-ci
travis-ci: print-deps package-lint test-package-install unit-tests

.PHONY : unit-tests
# `clean-elc` task needs to remove byte-compiled files to collect coverage by undercover.el.
Expand All @@ -26,7 +29,7 @@ clean-elpa:

.PHONY : clean-elc
clean-elc:
cask clean-elc
${CASK} clean-elc

.PHONY : clean
clean: clean-elpa clean-elc clean-fixture
Expand All @@ -39,22 +42,18 @@ print-deps:
.PHONY : test-checkdoc
test-checkdoc: elpa
@echo "-- test ckeckdoc --"
$(CASK) exec $(EMACS) -batch -Q $(LOADPATH) -l $(TEST_CHECKDOC_EL) 2>&1 | tee $(TEST_CHECKDOC_LOG)
@cat $(TEST_CHECKDOC_LOG) | [ $$(wc -l) -gt 0 ] && exit 1 || exit 0
$(CASK) exec $(EMACS) -batch -Q $(LOADPATH) -l $(TEST_CHECKDOC_EL) 2>&1 | tee /dev/tty | [ $$(wc -l) -gt 0 ] && exit 1 || exit 0

.PHONY : test-package-install
test-package-install: elpa clean-package-install
@echo "-- test install package --"
$(CASK) exec $(EMACS) -batch -Q $(LOADPATH) -l $(TEST_PACKAGE_INSTALL_EL) 2>&1 | tee $(TEST_PACKAGE_INSTALL_LOG)
@grep Error $(TEST_PACKAGE_INSTALL_LOG) && exit 1 || exit 0

.PHONY : clean-package-install
clean-package-install:
rm -rf $(ELPA_DIR)/helm-git-grep*
rm -rf $(TEST_PACKAGE_INSTALL_LOG)
.PHONY : package-lint
package-lint: elpa
@echo "-- package lint --"
$(CASK) exec $(EMACS) -batch -Q --eval $(INIT_PACKAGE_EL) -l package-lint.el -f package-lint-batch-and-exit $(SRC)

.PHONY : travis-ci
travis-ci: print-deps test-package-install unit-tests
.PHONY : test-package-install
test-package-install: elpa
@echo "-- test install package --"
$(CASK) exec $(EMACS) -batch -Q $(LOADPATH) -l $(TEST_PACKAGE_INSTALL_EL) 2>&1 | tee /dev/tty | grep Error > /dev/null && exit 1 || exit 0

.PHONY : elpa
elpa: $(ELPA_DIR)
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,13 @@ A buffer name is `*helm git grep*` without ignore case option.

#### `helm-git-grep-sources`

**(Default: `'(helm-source-git-grep helm-source-git-submodule-grep)`)**
**(Default: `'(helm-git-grep-source helm-git-grep-submodule-source)`)**

Default helm sources for `helm-git-grep`.

If you don't want to search in submodules, Set only `helm-source-git-grep` like this:
If you don't want to search in submodules, Set only `helm-git-grep-source` like this:

(setq helm-git-grep-sources '(helm-source-git-grep))
(setq helm-git-grep-sources '(helm-git-grep-sources))

#### `helm-git-grep-candidate-number-limit`

Expand Down
34 changes: 21 additions & 13 deletions helm-git-grep.el
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
;; Version: 0.10.0-snapshot
;; URL: https://github.com/yasuyk/helm-git-grep
;; Package-Requires: ((helm-core "2.2.0"))
;; Keywords: helm, git

;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -60,13 +59,13 @@
:group 'helm)

(defcustom helm-git-grep-sources
'(helm-source-git-grep helm-source-git-submodule-grep)
'(helm-git-grep-source helm-git-grep-submodule-source)
"Default helm sources for `helm-git-grep'.
If you don't want to search in submodules, \
Set only `helm-source-git-grep' like this:
Set only `helm-git-grep-source' like this:
(setq helm-git-grep-sources '(helm-source-git-grep))"
(setq helm-git-grep-sources '(helm-git-grep-source))"
:group 'helm-gi-grep
:type '(repeat (choice symbol)))

Expand Down Expand Up @@ -261,7 +260,7 @@ newline return an empty string."
(split-string helm-pattern " +" t))))
(helm-git-grep-pathspec-args))))

(defun helm-git-submodule-grep-command ()
(defun helm-git-grep-submodule-grep-command ()
"Create command of `helm-git-submodule-grep-process' in `helm-git-grep'."
(list "git" "--no-pager" "submodule" "--quiet" "foreach"
(format "git grep -n --no-color %s %s %s | sed s!^!$path/!"
Expand All @@ -278,12 +277,12 @@ newline return an empty string."
(let ((default-directory it))
(apply 'start-process "git-grep-process" nil "git" (helm-git-grep-args))) '()))

(defun helm-git-submodule-grep-process ()
(defun helm-git-grep-submodule-grep-process ()
"Retrieve candidates from result of git grep submodules."
(helm-aif (helm-attr 'base-directory)
(let ((default-directory it))
(apply 'start-process "git-submodule-grep-process" nil
(helm-git-submodule-grep-command)))
(helm-git-grep-submodule-grep-command)))
'()))

(define-compilation-mode helm-git-grep-mode "Helm Git Grep"
Expand Down Expand Up @@ -642,7 +641,7 @@ You can save your results in a helm-git-grep-mode buffer, see below.
(delq nil map))
"Keymap used in Git Grep sources.")

(eval `(defclass helm-git-grep-source (helm-source-async)
(eval `(defclass helm-git-grep-class (helm-source-async)
((header-name :initform helm-git-grep-header-name)
(default-directory :initform nil)
(requires-pattern :initform 2)
Expand All @@ -657,13 +656,13 @@ You can save your results in a helm-git-grep-mode buffer, see below.
(keymap :initform ,helm-git-grep-map)
(init :initform helm-git-grep-init))))

(defvar helm-source-git-grep
(helm-make-source "Git Grep" 'helm-git-grep-source
(defvar helm-git-grep-source
(helm-make-source "Git Grep" 'helm-git-grep-class
:candidates-process 'helm-git-grep-process))

(defvar helm-source-git-submodule-grep
(helm-make-source "Git Submodule Grep" 'helm-git-grep-source
:candidates-process 'helm-git-submodule-grep-process))
(defvar helm-git-grep-submodule-source
(helm-make-source "Git Submodule Grep" 'helm-git-grep-class
:candidates-process 'helm-git-grep-submodule-grep-process))

(defun helm-git-grep-1 (&optional input)
"Execute helm git grep.
Expand Down Expand Up @@ -735,6 +734,15 @@ if region exists.
'helm-git-grep-with-exclude-file-pattern
helm-git-grep-with-exclude-file-pattern-obsolete-message "0.10.0")

(define-obsolete-function-alias 'helm-git-submodule-grep-command
'helm-git-grep-submodule-grep-command "0.10.0")

(define-obsolete-function-alias 'helm-git-submodule-grep-process
'helm-git-grep-submodule-grep-process "0.10.0")

(define-obsolete-variable-alias 'helm-source-git-grep
'helm-git-grep-source "0.10.0")


(provide 'helm-git-grep)

Expand Down

0 comments on commit eef84d4

Please sign in to comment.