From e3625acb54c578981d571ae10a0176d7e77a7bc9 Mon Sep 17 00:00:00 2001 From: dickmao Date: Sun, 20 Oct 2019 15:59:29 -0400 Subject: [PATCH 1/5] restore TRAVIS_PULL_REQUEST_SLUG --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 2215e19..4416858 100644 --- a/Makefile +++ b/Makefile @@ -2,8 +2,8 @@ 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`) +ifeq ($(TRAVIS_PULL_REQUEST_SLUG),) +TRAVIS_PULL_REQUEST_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) @@ -58,7 +58,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) \ -- 2.34.1 From ac26234b9181b2e362d3f2e5973e5997cb3aaa7a Mon Sep 17 00:00:00 2001 From: dickmao Date: Thu, 24 Oct 2019 17:25:21 -0400 Subject: [PATCH 2/5] don't modify hooks if nnhackernews is not configured --- nnhackernews.el | 51 +++++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/nnhackernews.el b/nnhackernews.el index 57b5acc..3a4f6e8 100644 --- a/nnhackernews.el +++ b/nnhackernews.el @@ -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) -- 2.34.1 From 0d8b00e5bc94b200cc4366a6b8c2eac54c86988d Mon Sep 17 00:00:00 2001 From: dickmao Date: Thu, 24 Oct 2019 17:29:07 -0400 Subject: [PATCH 3/5] sort out travis_repo_slug and travis_pull_request_branch --- Makefile | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 4416858..9125cb8 100644 --- a/Makefile +++ b/Makefile @@ -2,14 +2,19 @@ EMACS ?= $(shell which emacs) SRC=$(shell cask files) PKBUILD=2.3 ELCFILES = $(SRC:.el=.elc) -ifeq ($(TRAVIS_PULL_REQUEST_SLUG),) -TRAVIS_PULL_REQUEST_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 -- 2.34.1 From e055de8599c9c37a3bc4312b9a7e5696453439e1 Mon Sep 17 00:00:00 2001 From: dickmao Date: Thu, 24 Oct 2019 18:01:13 -0400 Subject: [PATCH 4/5] unwind-protect is apropos here --- nnhackernews.el | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/nnhackernews.el b/nnhackernews.el index 3a4f6e8..d06406a 100644 --- a/nnhackernews.el +++ b/nnhackernews.el @@ -1565,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 -- 2.34.1 From 7d3f1b5a3d7addaf7f66c0ddd332df286e5ee2c2 Mon Sep 17 00:00:00 2001 From: dickmao Date: Thu, 24 Oct 2019 18:24:22 -0400 Subject: [PATCH 5/5] failing on 25.1 --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 58175e2..0c3ad63 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,6 +15,8 @@ addons: - python3-setuptools - dirmngr - libxml2-dev + - libxml2 + - libxml2-utils cache: directories: -- 2.34.1