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
- dirmngr
- libxml2-dev
- libxml2
- libxml2-utils
cache:
directories:

View File

@ -2,14 +2,19 @@ EMACS ?= $(shell which emacs)
SRC=$(shell cask files)
PKBUILD=2.3
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),)
TRAVIS_PULL_REQUEST_BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
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),)
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
.DEFAULT_GOAL := test-compile
@ -58,7 +63,7 @@ test-install:
--eval "(setq rcp (package-recipe-lookup \"nnhackernews\"))" \
--eval "(unless (file-exists-p 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-commit \"$(TRAVIS_PULL_REQUEST_SHA)\")) \
(oset rcp :repo my-repo) \

View File

@ -549,7 +549,7 @@ Originally written by Paul Issartel."
"Call `gnus-summary-exit' without the hackery."
(remove-function (symbol-function 'gnus-summary-exit)
(symbol-function 'nnhackernews--score-pending))
(gnus-summary-exit)
(gnus-summary-exit nil t)
(add-function :after (symbol-function 'gnus-summary-exit)
(symbol-function 'nnhackernews--score-pending)))
@ -563,7 +563,7 @@ Originally written by Paul Issartel."
(error nil))
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).
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)))
(unless (zerop seen)
(when (or force (> num-headers seen))
(save-excursion
(save-window-excursion
(let ((gnus-auto-select-subject nil)
(gnus-summary-next-group-on-exit nil))
(gnus-summary-read-group group nil t)
@ -1492,29 +1492,30 @@ Written by John Wiegley (https://github.com/jwiegley/dot-emacs).")
(when (nnhackernews--gate)
(nnhackernews-summary-mode)))
;; 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)
(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
(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.
(mapc (lambda (hook)
(add-hook hook
(lambda () (mapc (lambda (group)
(nnhackernews--score-unread group))
`(,nnhackernews--group-ask
,nnhackernews--group-show
,nnhackernews--group-job
,nnhackernews--group-stories)))))
'(gnus-started-hook gnus-after-getting-new-news-hook))
(add-hook 'gnus-started-hook
(lambda () (mapc (lambda (group)
(nnhackernews--mark-scored-as-read group))
`(,nnhackernews--group-ask
,nnhackernews--group-show
,nnhackernews--group-job
,nnhackernews--group-stories)))
t)
;; Avoid having to select the GROUP to make the unread number go down.
(mapc (lambda (hook)
(add-hook hook
(lambda () (mapc (lambda (group)
(nnhackernews--score-unread group))
`(,nnhackernews--group-ask
,nnhackernews--group-show
,nnhackernews--group-job
,nnhackernews--group-stories)))))
'(gnus-started-hook gnus-after-getting-new-news-hook))
(add-hook 'gnus-started-hook
(lambda () (mapc (lambda (group)
(nnhackernews--mark-scored-as-read group))
`(,nnhackernews--group-ask
,nnhackernews--group-show
,nnhackernews--group-job
,nnhackernews--group-stories)))
t))
;; "Can't figure out hook that can remove itself (quine conundrum)"
(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)
(let* ((dont-ask (lambda (prompt)
(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)))
(condition-case err
(progn
(when link-p
(add-function :before-until (symbol-function 'y-or-n-p) dont-ask))
(prog1 (apply f args)
(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))))))
(when link-p
(add-function :before-until (symbol-function 'y-or-n-p) dont-ask))
(unwind-protect (apply f args)
(remove-function (symbol-function 'y-or-n-p) dont-ask))))
(t (apply f args)))))
(add-function