Dev #9

Merged
dickmao merged 5 commits from dev into master 2019-10-24 22:41:47 +00:00
3 changed files with 43 additions and 39 deletions

View File

@ -15,6 +15,8 @@ addons:
- python3-setuptools - python3-setuptools
- dirmngr - dirmngr
- libxml2-dev - libxml2-dev
- libxml2
- libxml2-utils
cache: cache:
directories: directories:

View File

@ -2,14 +2,19 @@ EMACS ?= $(shell which emacs)
SRC=$(shell cask files) SRC=$(shell cask files)
PKBUILD=2.3 PKBUILD=2.3
ELCFILES = $(SRC:.el=.elc) ELCFILES = $(SRC:.el=.elc)
ifeq ($(TRAVIS_REPO_SLUG),)
TRAVIS_REPO_SLUG := $(shell git config --global user.name)/$(shell basename `git rev-parse --show-toplevel`)
endif
ifeq ($(TRAVIS_PULL_REQUEST_BRANCH),) ifeq ($(TRAVIS_PULL_REQUEST_BRANCH),)
TRAVIS_PULL_REQUEST_BRANCH := $(shell git rev-parse --abbrev-ref HEAD) TRAVIS_PULL_REQUEST_BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
endif endif
ifeq ($(TRAVIS_PULL_REQUEST_SLUG),)
ifeq ($(TRAVIS_PULL_REQUEST_BRANCH),HEAD)
TRAVIS_PULL_REQUEST_SLUG := $(TRAVIS_REPO_SLUG)
else
TRAVIS_PULL_REQUEST_SLUG := $(shell git config --global user.name)/$(shell basename `git rev-parse --show-toplevel`)
endif
endif
ifeq ($(TRAVIS_PULL_REQUEST_SHA),) ifeq ($(TRAVIS_PULL_REQUEST_SHA),)
TRAVIS_PULL_REQUEST_SHA := $(shell git rev-parse $(TRAVIS_PULL_REQUEST_BRANCH)) TRAVIS_PULL_REQUEST_SHA := $(shell git rev-parse origin/$(TRAVIS_PULL_REQUEST_BRANCH))
endif endif
.DEFAULT_GOAL := test-compile .DEFAULT_GOAL := test-compile
@ -58,7 +63,7 @@ test-install:
--eval "(setq rcp (package-recipe-lookup \"nnhackernews\"))" \ --eval "(setq rcp (package-recipe-lookup \"nnhackernews\"))" \
--eval "(unless (file-exists-p package-build-archive-dir) \ --eval "(unless (file-exists-p package-build-archive-dir) \
(make-directory package-build-archive-dir))" \ (make-directory package-build-archive-dir))" \
--eval "(let* ((my-repo \"$(TRAVIS_REPO_SLUG)\") \ --eval "(let* ((my-repo \"$(TRAVIS_PULL_REQUEST_SLUG)\") \
(my-branch \"$(TRAVIS_PULL_REQUEST_BRANCH)\") \ (my-branch \"$(TRAVIS_PULL_REQUEST_BRANCH)\") \
(my-commit \"$(TRAVIS_PULL_REQUEST_SHA)\")) \ (my-commit \"$(TRAVIS_PULL_REQUEST_SHA)\")) \
(oset rcp :repo my-repo) \ (oset rcp :repo my-repo) \

View File

@ -549,7 +549,7 @@ Originally written by Paul Issartel."
"Call `gnus-summary-exit' without the hackery." "Call `gnus-summary-exit' without the hackery."
(remove-function (symbol-function 'gnus-summary-exit) (remove-function (symbol-function 'gnus-summary-exit)
(symbol-function 'nnhackernews--score-pending)) (symbol-function 'nnhackernews--score-pending))
(gnus-summary-exit) (gnus-summary-exit nil t)
(add-function :after (symbol-function 'gnus-summary-exit) (add-function :after (symbol-function 'gnus-summary-exit)
(symbol-function 'nnhackernews--score-pending))) (symbol-function 'nnhackernews--score-pending)))
@ -563,7 +563,7 @@ Originally written by Paul Issartel."
(error nil)) (error nil))
t)) t))
(defsubst nnhackernews--rescore (group &optional force) (defun nnhackernews--rescore (group &optional force)
"Can't figure out GROUP hook that can remove itself (quine conundrum). "Can't figure out GROUP hook that can remove itself (quine conundrum).
FORCE is generally t unless coming from `nnhackernews--score-pending'." FORCE is generally t unless coming from `nnhackernews--score-pending'."
@ -584,7 +584,7 @@ FORCE is generally t unless coming from `nnhackernews--score-pending'."
0))) 0)))
(unless (zerop seen) (unless (zerop seen)
(when (or force (> num-headers seen)) (when (or force (> num-headers seen))
(save-excursion (save-window-excursion
(let ((gnus-auto-select-subject nil) (let ((gnus-auto-select-subject nil)
(gnus-summary-next-group-on-exit nil)) (gnus-summary-next-group-on-exit nil))
(gnus-summary-read-group group nil t) (gnus-summary-read-group group nil t)
@ -1492,12 +1492,14 @@ Written by John Wiegley (https://github.com/jwiegley/dot-emacs).")
(when (nnhackernews--gate) (when (nnhackernews--gate)
(nnhackernews-summary-mode))) (nnhackernews-summary-mode)))
;; I believe I did try buffer-localizing hooks, and it wasn't sufficient (when (or (gnus-native-method-p '(nnhackernews ""))
(add-hook 'gnus-article-mode-hook #'nnhackernews-article-mode-activate) (gnus-secondary-method-p '(nnhackernews "")))
(add-hook 'gnus-summary-mode-hook #'nnhackernews-summary-mode-activate) ;; 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-summary-mode-hook #'nnhackernews-summary-mode-activate)
;; Avoid having to select the GROUP to make the unread number go down. ;; Avoid having to select the GROUP to make the unread number go down.
(mapc (lambda (hook) (mapc (lambda (hook)
(add-hook hook (add-hook hook
(lambda () (mapc (lambda (group) (lambda () (mapc (lambda (group)
(nnhackernews--score-unread group)) (nnhackernews--score-unread group))
@ -1506,15 +1508,14 @@ Written by John Wiegley (https://github.com/jwiegley/dot-emacs).")
,nnhackernews--group-job ,nnhackernews--group-job
,nnhackernews--group-stories))))) ,nnhackernews--group-stories)))))
'(gnus-started-hook gnus-after-getting-new-news-hook)) '(gnus-started-hook gnus-after-getting-new-news-hook))
(add-hook 'gnus-started-hook
(add-hook 'gnus-started-hook
(lambda () (mapc (lambda (group) (lambda () (mapc (lambda (group)
(nnhackernews--mark-scored-as-read group)) (nnhackernews--mark-scored-as-read group))
`(,nnhackernews--group-ask `(,nnhackernews--group-ask
,nnhackernews--group-show ,nnhackernews--group-show
,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)
@ -1564,16 +1565,12 @@ Written by John Wiegley (https://github.com/jwiegley/dot-emacs).")
(cond ((nnhackernews--gate) (cond ((nnhackernews--gate)
(let* ((dont-ask (lambda (prompt) (let* ((dont-ask (lambda (prompt)
(when (cl-search "mpty article" prompt) t))) (when (cl-search "mpty article" prompt) t)))
(link-p (not (null (message-fetch-field "Link")))) (link-p (message-fetch-field "Link"))
(message-shoot-gnksa-feet (if link-p t message-shoot-gnksa-feet))) (message-shoot-gnksa-feet (if link-p t message-shoot-gnksa-feet)))
(condition-case err
(progn
(when link-p (when link-p
(add-function :before-until (symbol-function 'y-or-n-p) dont-ask)) (add-function :before-until (symbol-function 'y-or-n-p) dont-ask))
(prog1 (apply f args) (unwind-protect (apply f args)
(remove-function (symbol-function 'y-or-n-p) dont-ask))) (remove-function (symbol-function 'y-or-n-p) dont-ask))))
(error (remove-function (symbol-function 'y-or-n-p) dont-ask)
(error (error-message-string err))))))
(t (apply f args))))) (t (apply f args)))))
(add-function (add-function