Dev #18

Merged
dickmao merged 6 commits from dev into master 2020-02-17 12:06:54 +00:00
5 changed files with 59 additions and 48 deletions

View File

@ -1,5 +1,10 @@
EMACS ?= $(shell which emacs) EMACS ?= $(shell which emacs)
SRC=$(shell cask files) export CASK := $(shell which cask)
ifeq ($(CASK),)
$(error Please install CASK at https://cask.readthedocs.io/en/latest/guide/installation.html)
endif
CASK_DIR := $(shell EMACS=$(EMACS) cask package-directory || exit 1)
SRC=$(shell $(CASK) files)
PKBUILD=2.3 PKBUILD=2.3
ELCFILES = $(SRC:.el=.elc) ELCFILES = $(SRC:.el=.elc)
@ -31,18 +36,24 @@ README.rst: README.in.rst nnhackernews.el
test-clean: test-clean:
rm -rf tests/.emacs* tests/.newsrc* tests/Mail tests/News tests/request tests/request-log rm -rf tests/.emacs* tests/.newsrc* tests/Mail tests/News tests/request tests/request-log
.PHONY: cask
cask: $(CASK_DIR)
$(CASK_DIR): Cask
$(CASK) install
touch $(CASK_DIR)
.PHONY: clean .PHONY: clean
clean: test-clean clean: test-clean
cask clean-elc $(CASK) clean-elc
rm -f tests/log/* rm -f tests/log/*
rm -rf tests/test-install rm -rf tests/test-install
.PHONY: test-compile .PHONY: test-compile
test-compile: test-compile: cask
cask install
sh -ex tools/package-lint.sh nnhackernews.el sh -ex tools/package-lint.sh nnhackernews.el
! (cask eval "(let ((byte-compile-error-on-warn t)) (cask-cli/build))" 2>&1 | egrep -a "(Warning|Error):") ! ($(CASK) eval "(let ((byte-compile-error-on-warn t)) (cask-cli/build))" 2>&1 | egrep -a "(Warning|Error):")
cask clean-elc $(CASK) clean-elc
.PHONY: test-install .PHONY: test-install
test-install: test-install:
@ -74,14 +85,14 @@ test-install:
.PHONY: test-unit .PHONY: test-unit
test-unit: test-unit:
cask exec ert-runner -L . -L tests tests/test*.el $(CASK) exec ert-runner -L . -L tests tests/test*.el
.PHONY: test .PHONY: test
test: test-compile test-unit test-int test: test-compile test-unit test-int
.PHONY: test-int .PHONY: test-int
test-int: test-clean test-int: test-clean
cask exec ecukes --reporter magnars --debug $(CASK) exec ecukes --reporter magnars --debug
.PHONY: dist-clean .PHONY: dist-clean
dist-clean: dist-clean:
@ -89,7 +100,7 @@ dist-clean:
.PHONY: dist .PHONY: dist
dist: dist-clean dist: dist-clean
cask package $(CASK) package
.PHONY: install .PHONY: install
install: test-compile dist install: test-compile dist

View File

@ -30,6 +30,7 @@ Then
:: ::
M-x package-refresh-contents RET M-x package-refresh-contents RET
M-x package-initialize RET
M-x package-install RET nnhackernews RET M-x package-install RET nnhackernews RET
Alternatively, copy ``nnhackernews.el`` to a directory among ``C-h v RET load-path`` and add ``(require 'nnhackernews)`` to ``.emacs``. Alternatively, copy ``nnhackernews.el`` to a directory among ``C-h v RET load-path`` and add ``(require 'nnhackernews)`` to ``.emacs``.

View File

@ -30,6 +30,7 @@ Then
:: ::
M-x package-refresh-contents RET M-x package-refresh-contents RET
M-x package-initialize RET
M-x package-install RET nnhackernews RET M-x package-install RET nnhackernews RET
Alternatively, copy ``nnhackernews.el`` to a directory among ``C-h v RET load-path`` and add ``(require 'nnhackernews)`` to ``.emacs``. Alternatively, copy ``nnhackernews.el`` to a directory among ``C-h v RET load-path`` and add ``(require 'nnhackernews)`` to ``.emacs``.

View File

@ -483,7 +483,7 @@ If GROUP classification omitted, figure it out."
(defmacro nnhackernews--with-group (group &rest body) (defmacro nnhackernews--with-group (group &rest body)
"Disambiguate GROUP if it's empty and execute BODY." "Disambiguate GROUP if it's empty and execute BODY."
(declare (debug (form &rest form)) (declare (debug (form &rest form))
(indent 1)) (indent defun))
`(let* ((group (or ,group (gnus-group-real-name gnus-newsgroup-name))) `(let* ((group (or ,group (gnus-group-real-name gnus-newsgroup-name)))
(gnus-newsgroup-name (gnus-group-full-name group "nnhackernews:"))) (gnus-newsgroup-name (gnus-group-full-name group "nnhackernews:")))
,@body)) ,@body))
@ -631,9 +631,11 @@ FORCE is generally t unless coming from `nnhackernews--score-pending'."
"Filter unread messages for GROUP now. "Filter unread messages for GROUP now.
Otherwise *Group* buffer annoyingly overrepresents unread." Otherwise *Group* buffer annoyingly overrepresents unread."
(when (or (gnus-native-method-p '(nnhackernews ""))
(gnus-secondary-method-p '(nnhackernews "")))
(nnhackernews--with-group group (nnhackernews--with-group group
(unless (nnhackernews-extant-summary-buffer gnus-newsgroup-name) (unless (nnhackernews-extant-summary-buffer gnus-newsgroup-name)
(nnhackernews--rescore gnus-newsgroup-name t)))) (nnhackernews--rescore gnus-newsgroup-name t)))))
(defun nnhackernews--mark-scored-as-read (group) (defun nnhackernews--mark-scored-as-read (group)
"If a root article (story) is scored in GROUP, that means we've already read it." "If a root article (story) is scored in GROUP, that means we've already read it."
@ -1539,8 +1541,6 @@ Written by John Wiegley (https://github.com/jwiegley/dot-emacs).")
(when (nnhackernews--gate) (when (nnhackernews--gate)
(nnhackernews-summary-mode))) (nnhackernews-summary-mode)))
(when (or (gnus-native-method-p '(nnhackernews ""))
(gnus-secondary-method-p '(nnhackernews "")))
;; I believe I did try buffer-localizing hooks, and it wasn't sufficient ;; I believe I did try buffer-localizing hooks, and it wasn't sufficient
(add-hook 'gnus-article-mode-hook #'nnhackernews-article-mode-activate) (add-hook 'gnus-article-mode-hook #'nnhackernews-article-mode-activate)
(add-hook 'gnus-summary-mode-hook #'nnhackernews-summary-mode-activate) (add-hook 'gnus-summary-mode-hook #'nnhackernews-summary-mode-activate)
@ -1563,7 +1563,7 @@ Written by John Wiegley (https://github.com/jwiegley/dot-emacs).")
;; ,nnhackernews--group-job ;; ,nnhackernews--group-job
;; ,nnhackernews--group-stories))) ;; ,nnhackernews--group-stories)))
;; t) ;; t)
)
;; "Can't figure out hook that can remove itself (quine conundrum)" ;; "Can't figure out hook that can remove itself (quine conundrum)"
(add-function :around (symbol-function 'gnus-summary-exit) (add-function :around (symbol-function 'gnus-summary-exit)
@ -1669,11 +1669,9 @@ Written by John Wiegley (https://github.com/jwiegley/dot-emacs).")
(add-function :around (add-function :around
(symbol-function 'message-fetch-field) (symbol-function 'message-fetch-field)
concat-func)) concat-func))
(condition-case err (unwind-protect
(prog1 (apply f args) (apply f args)
(remove-function (symbol-function 'message-fetch-field) concat-func)) (remove-function (symbol-function 'message-fetch-field) concat-func)))))
(error (remove-function (symbol-function 'message-fetch-field) concat-func)
(error (error-message-string err)))))))
(let ((protect (lambda (caller) (let ((protect (lambda (caller)
(add-function (add-function

View File

@ -13,8 +13,8 @@ if [ "x$TRAVIS_OS_NAME" = "xosx" ]; then
case "${TOXENV}" in case "${TOXENV}" in
py27) py27)
pyenv install -s 2.7.12 pyenv install -s 2.7.13
pyenv virtualenv -f 2.7.12 py27 pyenv virtualenv -f 2.7.13 py27
;; ;;
py35) py35)
pyenv install -s 3.5.2 pyenv install -s 3.5.2