Bump rack from 2.2.3 to 2.2.6.4 in /nndiscourse #15

Open
dependabot[bot] wants to merge 0 commits from dependabot/bundler/nndiscourse/rack-2.2.6.4 into master
18 changed files with 268 additions and 129 deletions

View File

@ -19,13 +19,18 @@ jobs:
strategy: strategy:
matrix: matrix:
os: [ubuntu-latest] os: [ubuntu-latest]
emacs_version: [27.2, 28.2, 29.2] emacs_version: [25.3, 26.3, 27.2]
ruby_version: [2.6] ruby_version: [2.6]
python_version: [3.6]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1 - uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python_version }}
- uses: actions/setup-ruby@v1
with: with:
ruby-version: ${{ matrix.ruby_version }} ruby-version: ${{ matrix.ruby_version }}
@ -33,27 +38,10 @@ jobs:
with: with:
version: ${{ matrix.emacs_version }} version: ${{ matrix.emacs_version }}
- uses: actions/cache@v2
id: cache-cask-packages
with:
path: .cask
key: cache-cask-packages-000
- uses: actions/cache@v2
id: cache-cask-executable
with:
path: ~/.cask
key: cache-cask-executable-000
- uses: conao3/setup-cask@master
if: steps.cache-cask-executable.outputs.cache-hit != 'true'
with:
version: snapshot
- name: paths - name: paths
run: | run: |
echo "$HOME/local/bin" >> $GITHUB_PATH echo "$HOME/local/bin" >> $GITHUB_PATH
echo "$HOME/.cask/bin" >> $GITHUB_PATH echo "$HOME/local/cask/bin" >> $GITHUB_PATH
echo "$HOME/.local/bin" >> $GITHUB_PATH echo "$HOME/.local/bin" >> $GITHUB_PATH
echo "LD_LIBRARY_PATH=$HOME/.local/lib" >> $GITHUB_ENV echo "LD_LIBRARY_PATH=$HOME/.local/lib" >> $GITHUB_ENV
@ -74,6 +62,11 @@ jobs:
path: ~/local path: ~/local
key: ${{ runner.os }}-local-000 key: ${{ runner.os }}-local-000
- uses: actions/cache@v2
with:
path: ~/melpazoid-master
key: melpazoid-000
- uses: actions/cache@v2 - uses: actions/cache@v2
with: with:
path: ~/.emacs.d path: ~/.emacs.d
@ -93,7 +86,7 @@ jobs:
- name: bundler - name: bundler
run: | run: |
gem install --user-install bundler:2.0.2 gem install --user-install bundler
- name: apt-get - name: apt-get
if: startsWith(runner.os, 'Linux') if: startsWith(runner.os, 'Linux')
@ -114,6 +107,11 @@ jobs:
emacs --version emacs --version
gpg --version gpg --version
- name: cask
run: |
sh tools/install-cask.sh
cask link list
- name: test - name: test
run: | run: |
make test-run make test-run

1
.gitignore vendored
View File

@ -11,3 +11,4 @@ tests/Mail
tests/News tests/News
tests/.newsrc tests/.newsrc
.ecukes* .ecukes*
melpazoid-master

2
Cask
View File

@ -2,7 +2,7 @@
(source melpa) (source melpa)
(package-file "nndiscourse.el") (package-file "nndiscourse.el")
(files "nndiscourse.el" ("nndiscourse" "nndiscourse/.ruby-version" "nndiscourse/Gemfile" "nndiscourse/Gemfile.lock" "nndiscourse/nndiscourse.gemspec" "nndiscourse/nndiscourse.thor" "nndiscourse/lib")) (files "nndiscourse.el" ("nndiscourse" "nndiscourse/Gemfile" "nndiscourse/Gemfile.lock" "nndiscourse/nndiscourse.gemspec" "nndiscourse/nndiscourse.thor" "nndiscourse/lib"))
(development (development
(depends-on "ert-runner") (depends-on "ert-runner")

View File

@ -31,15 +31,8 @@ clean:
rm -f tests/log/* rm -f tests/log/*
rm -rf tests/test-install rm -rf tests/test-install
.PHONY: bundler
bundler:
$(MAKE) $(HOME)/.gem/ruby/2.6.0/gems/bundler-2.0.2/bundler.gemspec
$(HOME)/.gem/ruby/2.6.0/gems/bundler-2.0.2/bundler.gemspec:
cd nndiscourse ; gem install --user-install bundler:2.0.2
.PHONY: cask .PHONY: cask
cask: bundler $(CASK_DIR) cask: $(CASK_DIR)
$(CASK_DIR): Cask $(CASK_DIR): Cask
$(CASK) install $(CASK) install
@ -71,22 +64,22 @@ define TESTRUN
endef endef
.PHONY: test-run .PHONY: test-run
test-run: cask test-run:
$(CASK) emacs -Q --batch -l nndiscourse \ $(CASK) emacs -Q --batch -l nndiscourse \
$(TESTRUN) \ $(TESTRUN) \
--eval "(gnus-open-server gnus-select-method)" \ --eval "(gnus-open-server gnus-select-method)" \
--eval "(sleep-for .43)" \ --eval "(sleep-for 0 4300)" \
--eval "(cl-assert nndiscourse-processes)" \ --eval "(cl-assert nndiscourse-processes)" \
--eval "(nndiscourse-dump-diagnostics (nth 1 gnus-select-method))" --eval "(nndiscourse-dump-diagnostics (nth 1 gnus-select-method))"
.PHONY: test-run-interactive .PHONY: test-run-interactive
test-run-interactive: cask autoloads test-run-interactive:
$(CASK) emacs -Q -l nndiscourse \ $(CASK) emacs -Q -l nndiscourse \
$(TESTRUN) \ $(TESTRUN) \
-f gnus -f gnus
.PHONY: test-unit .PHONY: test-unit
test-unit: cask autoloads test-unit:
$(CASK) exec ert-runner -L . -L tests $(TESTS) $(CASK) exec ert-runner -L . -L tests $(TESTS)
.PHONY: test-clean .PHONY: test-clean
@ -109,8 +102,30 @@ dist-clean:
dist: dist-clean dist: dist-clean
$(CASK) package $(CASK) package
.PHONY: backup-melpa
backup-melpa:
$(EMACS) -Q --batch --eval "(package-initialize)" --eval \
"(with-temp-buffer \
(insert-file-contents-literally (car (file-expand-wildcards \"dist/nndiscourse-$(VERSION).tar\"))) \
(tar-mode) \
(let* ((my-desc (package-tar-file-info)) \
(name (package-desc-name my-desc)) \
(other-pkgs (cdr (assq name package-alist)))) \
(when other-pkgs \
(mapcar (lambda (odesc) \
(let* ((odir (package-desc-dir odesc)) \
(parent (file-name-directory odir)) \
(leaf (file-name-nondirectory odir))) \
(if (equal (package-desc-version my-desc) \
(package-desc-version odesc)) \
(delete-directory odir t) \
(rename-file odir \
(expand-file-name (format \"BACKUP-%s\" leaf) parent) \
t)))) \
other-pkgs))))"
.PHONY: install .PHONY: install
install: dist bundler install: dist backup-melpa
$(EMACS) -Q --batch -l package \ $(EMACS) -Q --batch -l package \
--eval "(add-to-list 'package-archives '(\"melpa\" . \"https://melpa.org/packages/\"))" \ --eval "(add-to-list 'package-archives '(\"melpa\" . \"https://melpa.org/packages/\"))" \
--eval "(package-refresh-contents)" \ --eval "(package-refresh-contents)" \

View File

@ -31,13 +31,22 @@ it still looks really hard and undocumented.
Install Install
======= =======
Alas, you'll need Cask_. Then, As described in `Getting started`_, ensure melpa's whereabouts in ``init.el`` or ``.emacs``::
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
Then
:: ::
rbenv install 2.6.2 M-x package-refresh-contents RET
git clone https://github.com/dickmao/nndiscourse.git M-x package-install RET nndiscourse RET
make -C nndiscourse install
You will also need Bundler_ for Ruby.
Alternatively, directly clone this repo and ``make install``.
Also see Troubleshooting_.
Usage Usage
===== =====
@ -67,5 +76,10 @@ From the summary buffer, ``/o`` redisplays posts already read. ``x`` undisplays
Gnus beginners may find the interface bewildering. In particular, categories with no unread posts do not display. Use ``L`` to bring them out of hiding. Gnus beginners may find the interface bewildering. In particular, categories with no unread posts do not display. Use ``L`` to bring them out of hiding.
.. _Cask: https://github.com/cask/cask Troubleshooting
===============
Clone this repo. Then install Cask_. Then try ``make test-run-interactive``.
.. _Cask: https://cask.readthedocs.io/en/latest/guide/installation.html
.. _Getting started: http://melpa.org/#/getting-started .. _Getting started: http://melpa.org/#/getting-started
.. _Bundler: https://bundler.io

View File

@ -1,5 +1,6 @@
|build-status| |melpa-dev| |build-status| |melpa-dev|
A Gnus backend for Discourse.
.. |build-status| .. |build-status|
image:: https://github.com/dickmao/nndiscourse/workflows/CI/badge.svg?branch=dev image:: https://github.com/dickmao/nndiscourse/workflows/CI/badge.svg?branch=dev
@ -30,13 +31,22 @@ it still looks really hard and undocumented.
Install Install
======= =======
Alas, you'll need Cask_. Then, As described in `Getting started`_, ensure melpa's whereabouts in ``init.el`` or ``.emacs``::
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
Then
:: ::
rbenv install 2.6.2 M-x package-refresh-contents RET
git clone https://github.com/dickmao/nndiscourse.git M-x package-install RET nndiscourse RET
make -C nndiscourse install
You will also need Bundler_ for Ruby.
Alternatively, directly clone this repo and ``make install``.
Also see Troubleshooting_.
Usage Usage
===== =====
@ -66,5 +76,10 @@ From the summary buffer, ``/o`` redisplays posts already read. ``x`` undisplays
Gnus beginners may find the interface bewildering. In particular, categories with no unread posts do not display. Use ``L`` to bring them out of hiding. Gnus beginners may find the interface bewildering. In particular, categories with no unread posts do not display. Use ``L`` to bring them out of hiding.
.. _Cask: https://github.com/cask/cask Troubleshooting
===============
Clone this repo. Then install Cask_. Then try ``make test-run-interactive``.
.. _Cask: https://cask.readthedocs.io/en/latest/guide/installation.html
.. _Getting started: http://melpa.org/#/getting-started .. _Getting started: http://melpa.org/#/getting-started
.. _Bundler: https://bundler.io

View File

@ -9,7 +9,7 @@ Scenario: install
And I go to word "david" And I go to word "david"
And I press "RET" And I press "RET"
And I switch to buffer "*Article nndiscourse+meta.discourse.org:bug*" And I switch to buffer "*Article nndiscourse+meta.discourse.org:bug*"
Then I should see "hartz" Then I should see "Recent Changes"
And prospective unreads for "nndiscourse+meta.discourse.org:bug" is 1 And prospective unreads for "nndiscourse+meta.discourse.org:bug" is 1
And I switch to buffer "*Summary nndiscourse+meta.discourse.org:bug*" And I switch to buffer "*Summary nndiscourse+meta.discourse.org:bug*"
And I press "q" And I press "q"

View File

@ -37,7 +37,7 @@
(When "^gnus \\(try \\)?start\\(\\)$" (When "^gnus \\(try \\)?start\\(\\)$"
(lambda (demote _workaround) (lambda (demote _workaround)
(if-let ((it (get-buffer gnus-group-buffer))) (aif (get-buffer gnus-group-buffer)
(switch-to-buffer it) (switch-to-buffer it)
(if-demote demote (if-demote demote
(When "I call \"gnus\"") (When "I call \"gnus\"")
@ -45,10 +45,10 @@
(When "^gnus stop$" (When "^gnus stop$"
(lambda () (lambda ()
(when-let ((it (get-buffer gnus-group-buffer))) (aif (get-buffer gnus-group-buffer)
(switch-to-buffer it) (progn (switch-to-buffer it)
(And "I press \"q\"") (And "I press \"q\"")
(switch-to-buffer "*scratch*")))) (switch-to-buffer "*scratch*")))))
(When "^I open latest \"\\(.+\\)\"$" (When "^I open latest \"\\(.+\\)\"$"
(lambda (relative-prefix) (lambda (relative-prefix)

View File

@ -28,9 +28,8 @@
,@forms)) ,@forms))
(defun cleanup () (defun cleanup ()
(let ((quick-file (concat (or (bound-and-true-p gnus-newsrc-file) (let* ((newsrc-file gnus-current-startup-file)
(bound-and-true-p gnus-current-startup-file)) (quick-file (concat newsrc-file ".eld")))
".eld")))
(when (file-exists-p quick-file) (when (file-exists-p quick-file)
(message "Deleting %s" quick-file) (message "Deleting %s" quick-file)
(delete-file quick-file)))) (delete-file quick-file))))

View File

@ -6,7 +6,7 @@
;; Version: 0.1.0 ;; Version: 0.1.0
;; Keywords: news ;; Keywords: news
;; URL: https://github.com/dickmao/nndiscourse ;; URL: https://github.com/dickmao/nndiscourse
;; Package-Requires: ((emacs "27.1") (rbenv "0.0.3") (json-rpc "0.0.1")) ;; Package-Requires: ((emacs "25.1") (dash "2.18.1") (anaphora "1.0.4") (rbenv "0.0.3") (json-rpc "0.0.1"))
;; This file is NOT part of GNU Emacs. ;; This file is NOT part of GNU Emacs.
@ -47,6 +47,8 @@
(require 'cl-lib) (require 'cl-lib)
(require 'json) (require 'json)
(require 'subr-x) (require 'subr-x)
(require 'dash)
(require 'anaphora)
(require 'json-rpc) (require 'json-rpc)
(require 'rbenv) (require 'rbenv)
@ -83,9 +85,8 @@ Otherwise, just display link."
(defvar nndiscourse-by-server-hashtb (gnus-make-hashtable)) (defvar nndiscourse-by-server-hashtb (gnus-make-hashtable))
(defsubst nndiscourse--gethash (string hashtable &optional dflt) (defsubst nndiscourse--gethash (string hashtable &optional dflt)
"Get value of STRING from HASHTABLE, or DFLT if undefined. "Get corresponding value of STRING from HASHTABLE, or DFLT if undefined.
Starting in emacs-src commit c1b63af, Gnus moved from obarrays Starting in emacs-src commit c1b63af, Gnus moved from obarrays to normal hashtables."
to normal hashtables."
(unless (stringp string) (unless (stringp string)
(setq string (format "%s" string))) (setq string (format "%s" string)))
(if (fboundp 'gnus-gethash) (if (fboundp 'gnus-gethash)
@ -94,9 +95,8 @@ to normal hashtables."
(gethash string hashtable dflt))) (gethash string hashtable dflt)))
(defmacro nndiscourse--sethash (string value hashtable) (defmacro nndiscourse--sethash (string value hashtable)
"Set value of STRING to VALUE in HASHTABLE. "Set corresponding value of STRING to VALUE in HASHTABLE.
Starting in emacs-src commit c1b63af, Gnus moved from obarrays Starting in emacs-src commit c1b63af, Gnus moved from obarrays to normal hashtables."
to normal hashtables."
(declare (indent defun)) (declare (indent defun))
`(,(if (fboundp 'gnus-sethash) `(,(if (fboundp 'gnus-sethash)
'gnus-sethash 'gnus-sethash
@ -151,9 +151,9 @@ Thought I could use macros here to setf it."
(prog1 nil (backtrace)))) (prog1 nil (backtrace))))
(defsubst nndiscourse--replace-hash (string func hashtable) (defsubst nndiscourse--replace-hash (string func hashtable)
"Set value of STRING to FUNC on STRING's extant value in HASHTABLE. "Set value of STRING to FUNC applied to existing STRING value in HASHTABLE.
Starting in emacs-src commit c1b63af, Gnus moved from obarrays
to normal hashtables." Starting in emacs-src commit c1b63af, Gnus moved from obarrays to normal hashtables."
(declare (indent defun)) (declare (indent defun))
(unless (stringp string) (unless (stringp string)
(setq string (prin1-to-string string))) (setq string (prin1-to-string string)))
@ -166,8 +166,7 @@ to normal hashtables."
(defmacro nndiscourse--maphash (func table) (defmacro nndiscourse--maphash (func table)
"Map FUNC taking key and value over TABLE, return nil. "Map FUNC taking key and value over TABLE, return nil.
Starting in emacs-src commit c1b63af, Gnus moved from obarrays Starting in emacs-src commit c1b63af, Gnus moved from obarrays to normal hashtables."
to normal hashtables."
(declare (indent nil)) (declare (indent nil))
(let ((workaround 'gnus-gethash-safe)) (let ((workaround 'gnus-gethash-safe))
`(,(if (fboundp 'gnus-gethash-safe) `(,(if (fboundp 'gnus-gethash-safe)
@ -479,7 +478,7 @@ Return PROC if success, nil otherwise."
(defun nndiscourse-deregister-process (server) (defun nndiscourse-deregister-process (server)
"Disavow any knowledge of SERVER's process." "Disavow any knowledge of SERVER's process."
(when-let ((it (nndiscourse-alist-get server nndiscourse-processes nil nil #'equal))) (awhen (nndiscourse-alist-get server nndiscourse-processes nil nil #'equal)
(let ((proc (nndiscourse-proc-info-process it))) (let ((proc (nndiscourse-proc-info-process it)))
(gnus-message 5 "`nndiscourse-deregister-process': deregistering %s %s pid=%s" (gnus-message 5 "`nndiscourse-deregister-process': deregistering %s %s pid=%s"
server (process-name proc) (process-id proc)) server (process-name proc) (process-id proc))
@ -490,7 +489,7 @@ Return PROC if success, nil otherwise."
"Patterning after nnimap.el." "Patterning after nnimap.el."
(when (nndiscourse-good-server server) (when (nndiscourse-good-server server)
(nndiscourse-deregister-process server) (nndiscourse-deregister-process server)
(when-let ((it (nndiscourse--server-buffer server))) (awhen (nndiscourse--server-buffer server)
(kill-buffer it)) (kill-buffer it))
;; keep state in nndiscourse-by-server-hashtb? ;; keep state in nndiscourse-by-server-hashtb?
(when (nnoo-change-server 'nndiscourse server defs) (when (nnoo-change-server 'nndiscourse server defs)
@ -614,8 +613,8 @@ Originally written by Paul Issartel."
(nndiscourse--with-group server group (nndiscourse--with-group server group
(let* ((num-headers (length (nndiscourse-get-headers server group))) (let* ((num-headers (length (nndiscourse-get-headers server group)))
(status (format "211 %d %d %d %s" num-headers (status (format "211 %d %d %d %s" num-headers
(or (nndiscourse--first-article-number server group) 1) (aif (nndiscourse--first-article-number server group) it 1)
(or (nndiscourse--last-article-number server group) 0) (aif (nndiscourse--last-article-number server group) it 0)
group))) group)))
(gnus-message 7 "nndiscourse-request-group: %s" status) (gnus-message 7 "nndiscourse-request-group: %s" status)
(nnheader-insert "%s\n" status)) (nnheader-insert "%s\n" status))
@ -660,7 +659,7 @@ Originally written by Paul Issartel."
(defun nndiscourse--number-to-header (server group topic-id post-number) (defun nndiscourse--number-to-header (server group topic-id post-number)
"O(n) search for SERVER GROUP TOPIC-ID POST-NUMBER in headers." "O(n) search for SERVER GROUP TOPIC-ID POST-NUMBER in headers."
(declare (indent defun)) (declare (indent defun))
(when-let ((headers (nndiscourse-get-headers server group)) (-when-let* ((headers (nndiscourse-get-headers server group))
(found (seq-position (found (seq-position
headers (cons topic-id post-number) headers (cons topic-id post-number)
(lambda (plst loc) (lambda (plst loc)
@ -672,7 +671,7 @@ Originally written by Paul Issartel."
(defun nndiscourse--earliest-header (server group topic-id) (defun nndiscourse--earliest-header (server group topic-id)
"O(n) search for first header satisfying SERVER GROUP TOPIC-ID." "O(n) search for first header satisfying SERVER GROUP TOPIC-ID."
(declare (indent defun)) (declare (indent defun))
(when-let ((headers (nndiscourse-get-headers server group))) (-when-let* ((headers (nndiscourse-get-headers server group)))
(seq-find (lambda (plst) (= topic-id (plist-get plst :topic_id))) (seq-find (lambda (plst) (= topic-id (plist-get plst :topic_id)))
headers))) headers)))
@ -719,41 +718,37 @@ Originally written by Paul Issartel."
(let ((counts (gnus-make-hashtable))) (let ((counts (gnus-make-hashtable)))
(dolist (plst new-posts) (dolist (plst new-posts)
(setf (nndiscourse-by-server server :last-id) (plist-get plst :id)) (setf (nndiscourse-by-server server :last-id) (plist-get plst :id))
(when-let ((not-deleted (not (plist-get plst :deleted_at))) (-when-let* ((not-deleted (not (plist-get plst :deleted_at)))
(type (plist-get plst :post_type)) (type (plist-get plst :post_type))
(category-id (plist-get plst :category_id)) (category-id (plist-get plst :category_id))
(group (nndiscourse-get-category server category-id)) (group (nndiscourse-get-category server category-id))
(full-group (gnus-group-full-name (full-group (gnus-group-full-name
group group
(cons 'nndiscourse (list server))))) (cons 'nndiscourse (list server)))))
(if-let ((it (plist-get plst :reply_to_post_number))) (aif (plist-get plst :reply_to_post_number)
(nndiscourse-set-ref server (nndiscourse-set-ref server
(plist-get plst :id) (plist-get plst :id)
(plist-get (nndiscourse--number-to-header (plist-get (nndiscourse--number-to-header
server group server group
(plist-get plst :topic_id) it) (plist-get plst :topic_id) it)
:id)) :id))
(when-let ((it (plist-get (nndiscourse--earliest-header (awhen (plist-get (nndiscourse--earliest-header
server group server group
(plist-get plst :topic_id)) (plist-get plst :topic_id))
:id))) :id)
(nndiscourse-set-ref server (plist-get plst :id) it))) (nndiscourse-set-ref server (plist-get plst :id) it)))
(nndiscourse--replace-hash type (lambda (x) (1+ (or x 0))) counts) (nndiscourse--replace-hash type (lambda (x) (1+ (or x 0))) counts)
(if-let ((info (gnus-get-info full-group))) (if-let ((info (gnus-get-info full-group)))
(progn (progn
(unless (gnus-info-read info) (unless (gnus-info-read info)
(with-suppressed-warnings ((obsolete gnus-range-normalize))
(setf (gnus-info-read info) (setf (gnus-info-read info)
(gnus-range-normalize `(1 . ,(1- (plist-get plst :id))))))) (gnus-range-normalize `(1 . ,(1- (plist-get plst :id))))))
(when-let ((last-number (nndiscourse--last-article-number server group)) (-when-let* ((last-number (nndiscourse--last-article-number server group))
(next-number (plist-get plst :id)) (next-number (plist-get plst :id))
(gap `(,(1+ last-number) . ,(1- next-number)))) (gap `(,(1+ last-number) . ,(1- next-number))))
(when (<= (car gap) (cdr gap)) (when (<= (car gap) (cdr gap))
(with-suppressed-warnings ((obsolete gnus-range-normalize)
(obsolete gnus-range-add))
(setf (gnus-info-read info) (setf (gnus-info-read info)
(gnus-range-add (gnus-info-read info) (gnus-range-add (gnus-info-read info) (gnus-range-normalize gap)))
(gnus-range-normalize gap))))
(when (gnus-info-marks info) (when (gnus-info-marks info)
(setf (alist-get 'unexist (gnus-info-marks info)) nil))))) (setf (alist-get 'unexist (gnus-info-marks info)) nil)))))
(gnus-message 3 "nndiscourse--incoming: cannot update read for %s" group)) (gnus-message 3 "nndiscourse--incoming: cannot update read for %s" group))
@ -846,7 +841,7 @@ article header. Gnus manual does say the term `header` is oft conflated."
'disposition "inline" 'disposition "inline"
'charset "utf-8") 'charset "utf-8")
(save-excursion (mml-insert-tag '/part)) (save-excursion (mml-insert-tag '/part))
(when-let (-when-let*
((parent (car (last (nndiscourse-get-refs server (plist-get header :id))))) ((parent (car (last (nndiscourse-get-refs server (plist-get header :id)))))
(parent-author (parent-author
(or (plist-get (nndiscourse--get-header server group parent) (or (plist-get (nndiscourse--get-header server group parent)
@ -885,12 +880,11 @@ article header. Gnus manual does say the term `header` is oft conflated."
;; and populates `gnus-active-hashtb' ;; and populates `gnus-active-hashtb'
(nndiscourse-request-list server) (nndiscourse-request-list server)
(with-current-buffer nntp-server-buffer (with-current-buffer nntp-server-buffer
(with-suppressed-warnings ((obsolete gnus-select-method))
(let (gnus-server-method-cache (let (gnus-server-method-cache
(gnus-select-method '(nnnil))) (gnus-select-method '(nnnil)))
(gnus-active-to-gnus-format (gnus-active-to-gnus-format
(gnus-server-to-method (format "nndiscourse:%s" server)) (gnus-server-to-method (format "nndiscourse:%s" server))
gnus-active-hashtb nil t)))) gnus-active-hashtb nil t)))
(mapc (lambda (group) (mapc (lambda (group)
(let ((full-name (gnus-group-full-name group `(nndiscourse ,server)))) (let ((full-name (gnus-group-full-name group `(nndiscourse ,server))))
(gnus-get-unread-articles-in-group (gnus-get-info full-name) (gnus-get-unread-articles-in-group (gnus-get-info full-name)
@ -930,8 +924,10 @@ article header. Gnus manual does say the term `header` is oft conflated."
(mapc (lambda (group) (mapc (lambda (group)
(insert (insert
(format "%s %d %d y\n" group (format "%s %d %d y\n" group
(or (nndiscourse--last-article-number server group) 0) (aif (nndiscourse--last-article-number server group)
(or (nndiscourse--first-article-number server group) 1)))) it 0)
(aif (nndiscourse--first-article-number server group)
it 1))))
groups))) groups)))
t)) t))
@ -962,7 +958,7 @@ article header. Gnus manual does say the term `header` is oft conflated."
(defun nndiscourse--browse-post (&rest _args) (defun nndiscourse--browse-post (&rest _args)
"What happens when I click on discourse Subject." "What happens when I click on discourse Subject."
(when-let ((group-article gnus-article-current) (-when-let* ((group-article gnus-article-current)
(server (nth 1 (gnus-find-method-for-group (car group-article)))) (server (nth 1 (gnus-find-method-for-group (car group-article))))
(header (nndiscourse--get-header (header (nndiscourse--get-header
server server
@ -1018,7 +1014,7 @@ article header. Gnus manual does say the term `header` is oft conflated."
(defun nndiscourse-dump-diagnostics (server) (defun nndiscourse-dump-diagnostics (server)
"Makefile recipe test-run. SERVER second element of `gnus-select-method'." "Makefile recipe test-run. SERVER second element of `gnus-select-method'."
(if-let ((it (nndiscourse-alist-get server nndiscourse-processes nil nil #'equal))) (aif (nndiscourse-alist-get server nndiscourse-processes nil nil #'equal)
(dolist (b `(,byte-compile-log-buffer (dolist (b `(,byte-compile-log-buffer
,gnus-group-buffer ,gnus-group-buffer
"*Messages*" "*Messages*"

View File

@ -1 +0,0 @@
2.6.2

View File

@ -48,7 +48,7 @@ GEM
parallel (1.19.1) parallel (1.19.1)
parser (2.7.0.2) parser (2.7.0.2)
ast (~> 2.4.0) ast (~> 2.4.0)
rack (2.2.3) rack (2.2.6.4)
rainbow (3.0.0) rainbow (3.0.0)
rake (13.0.1) rake (13.0.1)
rest-client (1.8.0) rest-client (1.8.0)

View File

@ -38,12 +38,12 @@
"Wait until PREDICATE function returns non-`nil'. "Wait until PREDICATE function returns non-`nil'.
PREDARGS is argument list for the PREDICATE function. PREDARGS is argument list for the PREDICATE function.
MS is milliseconds to wait. INTERVAL is polling interval in milliseconds." MS is milliseconds to wait. INTERVAL is polling interval in milliseconds."
(let* ((int (or interval (if ms (max 300 (/ ms 10)) 300))) (let* ((int (aif interval it (aif ms (max 300 (/ ms 10)) 300)))
(count (max 1 (if ms (truncate (/ ms int)) 25)))) (count (max 1 (if ms (truncate (/ ms int)) 25))))
(unless (or (cl-loop repeat count (unless (or (cl-loop repeat count
when (apply predicate predargs) when (apply predicate predargs)
return t return t
do (sleep-for (/ int 1000.0))) do (sleep-for 0 int))
continue) continue)
(error "Timeout: %s" predicate)))) (error "Timeout: %s" predicate))))

View File

@ -1,4 +1,3 @@
;;; -*- lexical-binding: t; coding: utf-8 -*-
(require 'nndiscourse-test) (require 'nndiscourse-test)
;; since nndiscourse has fixed numbering, maybe we *can* use gnus-cache ;; since nndiscourse has fixed numbering, maybe we *can* use gnus-cache

View File

@ -0,0 +1,47 @@
#!/bin/bash -ex
# Install cask for Travis CI
# or if already installed, then check for updates
# Author: gonewest818 https://github.com/clojure-emacs/cider/pull/2139
WORKDIR=${HOME}/local
CASKDIR=$WORKDIR/cask
. tools/retry.sh
update_elpa_keys() {
mkdir -p $HOME/.emacs.d/elpa/gnupg || true
chmod 700 $HOME/.emacs.d/elpa/gnupg
GPG=gpg
if which gpg2 ; then GPG=gpg2 ; fi
travis_retry ${GPG} --keyserver hkp://pool.sks-keyservers.net:80 --homedir $HOME/.emacs.d/elpa/gnupg --recv-keys 066DAFCB81E42C40
mkdir -p $(cask package-directory) || true
mkdir -p $HOME/.cask || true
rsync -azSHe ssh $HOME/.cask $(dirname $(dirname $(dirname $(cask package-directory))))
rsync -azSHe ssh $HOME/.emacs.d/elpa/gnupg $(cask package-directory)
}
cask_upgrade_cask_or_reset() {
cask upgrade-cask || { rm -rf $HOME/.emacs.d/.cask && false; }
}
cask_install_or_reset() {
cask install </dev/null
find $(cask package-directory)/archives -print | xargs ls -l
find $(cask package-directory)/gnupg -print | xargs ls -l
# travis cache
rsync -azSHe ssh $(dirname $(dirname $(cask package-directory))) $HOME/
}
# Bootstrap the cask tool and its dependencies
if [ ! -d $CASKDIR ] ; then
git clone https://github.com/cask/cask.git $CASKDIR
fi
# Install dependencies for cider as descriped in ./Cask
# Effect is identical to "make elpa", but here we can retry
# in the event of network failures.
update_elpa_keys
travis_retry cask_upgrade_cask_or_reset
travis_retry cask_install_or_reset && touch elpa-emacs

28
tools/melpazoid.sh 100644
View File

@ -0,0 +1,28 @@
#!/bin/bash -ex
EMACS="${EMACS:=emacs}"
BASENAME=$(basename "$1")
PYTHON=$(which python3.6)
PYTHON="${PYTHON:-python}"
if [[ -z $(du -s melpazoid-master 2>/dev/null | cut -f1) ]] || \
[[ $(du -s melpazoid-master 2>/dev/null | cut -f1) -le "100" ]] ; then
curl -sLk -O https://github.com/riscy/melpazoid/archive/master.zip
unzip master.zip
rm -f master.zip
fi
cd $(git rev-parse --show-toplevel)
PKG_PATH="$(pwd)/melpazoid-master/$(basename $(pwd))"
PKG_NAME=$(basename "$PKG_PATH")
mkdir -p ${PKG_PATH}
rsync -av --files-from=<(cask files) . ${PKG_PATH}
if [ -s "$(pwd)/LICENSE" ]; then
cp -p "$(pwd)/LICENSE" ${PKG_PATH}
fi
cd melpazoid-master
${PYTHON} -m pip install --user -U .
sed -i -e 's/ -it / -i /' Makefile
sed -i -e 's/ -ti / -i /' Makefile
if [ ! -s ./python ]; then rm -f ./python ; ln -s $PYTHON ./python ; fi
PKG_PATH=${PKG_PATH} PKG_NAME=${PKG_NAME} PATH=.:${PATH} make run

View File

@ -1,3 +1,3 @@
(nndiscourse :repo "dickmao/nndiscourse" (nndiscourse :repo "dickmao/nndiscourse"
:fetcher github :fetcher github
:files ("nndiscourse.el" ("nndiscourse" "nndiscourse/.ruby-version" "nndiscourse/Gemfile" "nndiscourse/Gemfile.lock" "nndiscourse/nndiscourse.gemspec" "nndiscourse/nndiscourse.thor" "nndiscourse/lib"))) :files ("nndiscourse.el" ("nndiscourse" "nndiscourse/Gemfile" "nndiscourse/Gemfile.lock" "nndiscourse/nndiscourse.gemspec" "nndiscourse/nndiscourse.thor" "nndiscourse/lib")))

28
tools/retry.sh 100644
View File

@ -0,0 +1,28 @@
# Copied retry logic from Travis CI [http://bit.ly/2jPDCtV]
# Author: gonewest818 https://github.com/clojure-emacs/cider/pull/2139
ANSI_RED="\033[31;1m"
ANSI_GREEN="\033[32;1m"
ANSI_RESET="\033[0m"
ANSI_CLEAR="\033[0K"
travis_retry() {
local result=0
local count=1
while [ $count -le 3 ]; do
[ $result -ne 0 ] && {
echo -e "\n${ANSI_RED}The command \"$@\" failed. Retrying, $count of 3.${ANSI_RESET}\n" >&2
}
"$@"
result=$?
[ $result -eq 0 ] && break
count=$(($count + 1))
sleep 1
done
[ $count -gt 3 ] && {
echo -e "\n${ANSI_RED}The command \"$@\" failed 3 times.${ANSI_RESET}\n" >&2
}
return $result
}