Bump rack from 2.2.3 to 2.2.6.4 in /nndiscourse #15
|
@ -19,13 +19,18 @@ jobs:
|
|||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest]
|
||||
emacs_version: [27.2, 28.2, 29.2]
|
||||
emacs_version: [25.3, 26.3, 27.2]
|
||||
ruby_version: [2.6]
|
||||
python_version: [3.6]
|
||||
|
||||
steps:
|
||||
- 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:
|
||||
ruby-version: ${{ matrix.ruby_version }}
|
||||
|
||||
|
@ -33,27 +38,10 @@ jobs:
|
|||
with:
|
||||
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
|
||||
run: |
|
||||
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 "LD_LIBRARY_PATH=$HOME/.local/lib" >> $GITHUB_ENV
|
||||
|
||||
|
@ -74,6 +62,11 @@ jobs:
|
|||
path: ~/local
|
||||
key: ${{ runner.os }}-local-000
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/melpazoid-master
|
||||
key: melpazoid-000
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.emacs.d
|
||||
|
@ -93,7 +86,7 @@ jobs:
|
|||
|
||||
- name: bundler
|
||||
run: |
|
||||
gem install --user-install bundler:2.0.2
|
||||
gem install --user-install bundler
|
||||
|
||||
- name: apt-get
|
||||
if: startsWith(runner.os, 'Linux')
|
||||
|
@ -114,6 +107,11 @@ jobs:
|
|||
emacs --version
|
||||
gpg --version
|
||||
|
||||
- name: cask
|
||||
run: |
|
||||
sh tools/install-cask.sh
|
||||
cask link list
|
||||
|
||||
- name: test
|
||||
run: |
|
||||
make test-run
|
||||
|
|
|
@ -11,3 +11,4 @@ tests/Mail
|
|||
tests/News
|
||||
tests/.newsrc
|
||||
.ecukes*
|
||||
melpazoid-master
|
2
Cask
2
Cask
|
@ -2,7 +2,7 @@
|
|||
(source melpa)
|
||||
|
||||
(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
|
||||
(depends-on "ert-runner")
|
||||
|
|
41
Makefile
41
Makefile
|
@ -31,15 +31,8 @@ clean:
|
|||
rm -f tests/log/*
|
||||
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
|
||||
cask: bundler $(CASK_DIR)
|
||||
cask: $(CASK_DIR)
|
||||
|
||||
$(CASK_DIR): Cask
|
||||
$(CASK) install
|
||||
|
@ -71,22 +64,22 @@ define TESTRUN
|
|||
endef
|
||||
|
||||
.PHONY: test-run
|
||||
test-run: cask
|
||||
test-run:
|
||||
$(CASK) emacs -Q --batch -l nndiscourse \
|
||||
$(TESTRUN) \
|
||||
--eval "(gnus-open-server gnus-select-method)" \
|
||||
--eval "(sleep-for .43)" \
|
||||
--eval "(sleep-for 0 4300)" \
|
||||
--eval "(cl-assert nndiscourse-processes)" \
|
||||
--eval "(nndiscourse-dump-diagnostics (nth 1 gnus-select-method))"
|
||||
|
||||
.PHONY: test-run-interactive
|
||||
test-run-interactive: cask autoloads
|
||||
test-run-interactive:
|
||||
$(CASK) emacs -Q -l nndiscourse \
|
||||
$(TESTRUN) \
|
||||
-f gnus
|
||||
|
||||
.PHONY: test-unit
|
||||
test-unit: cask autoloads
|
||||
test-unit:
|
||||
$(CASK) exec ert-runner -L . -L tests $(TESTS)
|
||||
|
||||
.PHONY: test-clean
|
||||
|
@ -109,8 +102,30 @@ dist-clean:
|
|||
dist: dist-clean
|
||||
$(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
|
||||
install: dist bundler
|
||||
install: dist backup-melpa
|
||||
$(EMACS) -Q --batch -l package \
|
||||
--eval "(add-to-list 'package-archives '(\"melpa\" . \"https://melpa.org/packages/\"))" \
|
||||
--eval "(package-refresh-contents)" \
|
||||
|
|
|
@ -31,13 +31,22 @@ it still looks really hard and undocumented.
|
|||
|
||||
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
|
||||
git clone https://github.com/dickmao/nndiscourse.git
|
||||
make -C nndiscourse install
|
||||
M-x package-refresh-contents RET
|
||||
M-x package-install RET nndiscourse RET
|
||||
|
||||
You will also need Bundler_ for Ruby.
|
||||
|
||||
Alternatively, directly clone this repo and ``make install``.
|
||||
|
||||
Also see Troubleshooting_.
|
||||
|
||||
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.
|
||||
|
||||
.. _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
|
||||
.. _Bundler: https://bundler.io
|
||||
|
|
25
README.rst
25
README.rst
|
@ -1,5 +1,6 @@
|
|||
|build-status| |melpa-dev|
|
||||
|
||||
A Gnus backend for Discourse.
|
||||
|
||||
.. |build-status|
|
||||
image:: https://github.com/dickmao/nndiscourse/workflows/CI/badge.svg?branch=dev
|
||||
|
@ -30,13 +31,22 @@ it still looks really hard and undocumented.
|
|||
|
||||
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
|
||||
git clone https://github.com/dickmao/nndiscourse.git
|
||||
make -C nndiscourse install
|
||||
M-x package-refresh-contents RET
|
||||
M-x package-install RET nndiscourse RET
|
||||
|
||||
You will also need Bundler_ for Ruby.
|
||||
|
||||
Alternatively, directly clone this repo and ``make install``.
|
||||
|
||||
Also see Troubleshooting_.
|
||||
|
||||
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.
|
||||
|
||||
.. _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
|
||||
.. _Bundler: https://bundler.io
|
||||
|
|
|
@ -9,7 +9,7 @@ Scenario: install
|
|||
And I go to word "david"
|
||||
And I press "RET"
|
||||
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 I switch to buffer "*Summary nndiscourse+meta.discourse.org:bug*"
|
||||
And I press "q"
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
(When "^gnus \\(try \\)?start\\(\\)$"
|
||||
(lambda (demote _workaround)
|
||||
(if-let ((it (get-buffer gnus-group-buffer)))
|
||||
(aif (get-buffer gnus-group-buffer)
|
||||
(switch-to-buffer it)
|
||||
(if-demote demote
|
||||
(When "I call \"gnus\"")
|
||||
|
@ -45,10 +45,10 @@
|
|||
|
||||
(When "^gnus stop$"
|
||||
(lambda ()
|
||||
(when-let ((it (get-buffer gnus-group-buffer)))
|
||||
(switch-to-buffer it)
|
||||
(aif (get-buffer gnus-group-buffer)
|
||||
(progn (switch-to-buffer it)
|
||||
(And "I press \"q\"")
|
||||
(switch-to-buffer "*scratch*"))))
|
||||
(switch-to-buffer "*scratch*")))))
|
||||
|
||||
(When "^I open latest \"\\(.+\\)\"$"
|
||||
(lambda (relative-prefix)
|
||||
|
|
|
@ -28,9 +28,8 @@
|
|||
,@forms))
|
||||
|
||||
(defun cleanup ()
|
||||
(let ((quick-file (concat (or (bound-and-true-p gnus-newsrc-file)
|
||||
(bound-and-true-p gnus-current-startup-file))
|
||||
".eld")))
|
||||
(let* ((newsrc-file gnus-current-startup-file)
|
||||
(quick-file (concat newsrc-file ".eld")))
|
||||
(when (file-exists-p quick-file)
|
||||
(message "Deleting %s" quick-file)
|
||||
(delete-file quick-file))))
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
;; Version: 0.1.0
|
||||
;; Keywords: news
|
||||
;; 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.
|
||||
|
||||
|
@ -47,6 +47,8 @@
|
|||
(require 'cl-lib)
|
||||
(require 'json)
|
||||
(require 'subr-x)
|
||||
(require 'dash)
|
||||
(require 'anaphora)
|
||||
(require 'json-rpc)
|
||||
(require 'rbenv)
|
||||
|
||||
|
@ -83,9 +85,8 @@ Otherwise, just display link."
|
|||
(defvar nndiscourse-by-server-hashtb (gnus-make-hashtable))
|
||||
|
||||
(defsubst nndiscourse--gethash (string hashtable &optional dflt)
|
||||
"Get value of STRING from HASHTABLE, or DFLT if undefined.
|
||||
Starting in emacs-src commit c1b63af, Gnus moved from obarrays
|
||||
to normal hashtables."
|
||||
"Get corresponding value of STRING from HASHTABLE, or DFLT if undefined.
|
||||
Starting in emacs-src commit c1b63af, Gnus moved from obarrays to normal hashtables."
|
||||
(unless (stringp string)
|
||||
(setq string (format "%s" string)))
|
||||
(if (fboundp 'gnus-gethash)
|
||||
|
@ -94,9 +95,8 @@ to normal hashtables."
|
|||
(gethash string hashtable dflt)))
|
||||
|
||||
(defmacro nndiscourse--sethash (string value hashtable)
|
||||
"Set value of STRING to VALUE in HASHTABLE.
|
||||
Starting in emacs-src commit c1b63af, Gnus moved from obarrays
|
||||
to normal hashtables."
|
||||
"Set corresponding value of STRING to VALUE in HASHTABLE.
|
||||
Starting in emacs-src commit c1b63af, Gnus moved from obarrays to normal hashtables."
|
||||
(declare (indent defun))
|
||||
`(,(if (fboundp 'gnus-sethash)
|
||||
'gnus-sethash
|
||||
|
@ -151,9 +151,9 @@ Thought I could use macros here to setf it."
|
|||
(prog1 nil (backtrace))))
|
||||
|
||||
(defsubst nndiscourse--replace-hash (string func hashtable)
|
||||
"Set value of STRING to FUNC on STRING's extant value in HASHTABLE.
|
||||
Starting in emacs-src commit c1b63af, Gnus moved from obarrays
|
||||
to normal hashtables."
|
||||
"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."
|
||||
(declare (indent defun))
|
||||
(unless (stringp string)
|
||||
(setq string (prin1-to-string string)))
|
||||
|
@ -166,8 +166,7 @@ to normal hashtables."
|
|||
(defmacro nndiscourse--maphash (func table)
|
||||
"Map FUNC taking key and value over TABLE, return nil.
|
||||
|
||||
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 nil))
|
||||
(let ((workaround 'gnus-gethash-safe))
|
||||
`(,(if (fboundp 'gnus-gethash-safe)
|
||||
|
@ -479,7 +478,7 @@ Return PROC if success, nil otherwise."
|
|||
|
||||
(defun nndiscourse-deregister-process (server)
|
||||
"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)))
|
||||
(gnus-message 5 "`nndiscourse-deregister-process': deregistering %s %s pid=%s"
|
||||
server (process-name proc) (process-id proc))
|
||||
|
@ -490,7 +489,7 @@ Return PROC if success, nil otherwise."
|
|||
"Patterning after nnimap.el."
|
||||
(when (nndiscourse-good-server server)
|
||||
(nndiscourse-deregister-process server)
|
||||
(when-let ((it (nndiscourse--server-buffer server)))
|
||||
(awhen (nndiscourse--server-buffer server)
|
||||
(kill-buffer it))
|
||||
;; keep state in nndiscourse-by-server-hashtb?
|
||||
(when (nnoo-change-server 'nndiscourse server defs)
|
||||
|
@ -614,8 +613,8 @@ Originally written by Paul Issartel."
|
|||
(nndiscourse--with-group server group
|
||||
(let* ((num-headers (length (nndiscourse-get-headers server group)))
|
||||
(status (format "211 %d %d %d %s" num-headers
|
||||
(or (nndiscourse--first-article-number server group) 1)
|
||||
(or (nndiscourse--last-article-number server group) 0)
|
||||
(aif (nndiscourse--first-article-number server group) it 1)
|
||||
(aif (nndiscourse--last-article-number server group) it 0)
|
||||
group)))
|
||||
(gnus-message 7 "nndiscourse-request-group: %s" 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)
|
||||
"O(n) search for SERVER GROUP TOPIC-ID POST-NUMBER in headers."
|
||||
(declare (indent defun))
|
||||
(when-let ((headers (nndiscourse-get-headers server group))
|
||||
(-when-let* ((headers (nndiscourse-get-headers server group))
|
||||
(found (seq-position
|
||||
headers (cons topic-id post-number)
|
||||
(lambda (plst loc)
|
||||
|
@ -672,7 +671,7 @@ Originally written by Paul Issartel."
|
|||
(defun nndiscourse--earliest-header (server group topic-id)
|
||||
"O(n) search for first header satisfying SERVER GROUP TOPIC-ID."
|
||||
(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)))
|
||||
headers)))
|
||||
|
||||
|
@ -719,41 +718,37 @@ Originally written by Paul Issartel."
|
|||
(let ((counts (gnus-make-hashtable)))
|
||||
(dolist (plst new-posts)
|
||||
(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))
|
||||
(category-id (plist-get plst :category_id))
|
||||
(group (nndiscourse-get-category server category-id))
|
||||
(full-group (gnus-group-full-name
|
||||
group
|
||||
(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
|
||||
(plist-get plst :id)
|
||||
(plist-get (nndiscourse--number-to-header
|
||||
server group
|
||||
(plist-get plst :topic_id) it)
|
||||
:id))
|
||||
(when-let ((it (plist-get (nndiscourse--earliest-header
|
||||
(awhen (plist-get (nndiscourse--earliest-header
|
||||
server group
|
||||
(plist-get plst :topic_id))
|
||||
:id)))
|
||||
:id)
|
||||
(nndiscourse-set-ref server (plist-get plst :id) it)))
|
||||
(nndiscourse--replace-hash type (lambda (x) (1+ (or x 0))) counts)
|
||||
(if-let ((info (gnus-get-info full-group)))
|
||||
(progn
|
||||
(unless (gnus-info-read info)
|
||||
(with-suppressed-warnings ((obsolete gnus-range-normalize))
|
||||
(setf (gnus-info-read info)
|
||||
(gnus-range-normalize `(1 . ,(1- (plist-get plst :id)))))))
|
||||
(when-let ((last-number (nndiscourse--last-article-number server group))
|
||||
(gnus-range-normalize `(1 . ,(1- (plist-get plst :id))))))
|
||||
(-when-let* ((last-number (nndiscourse--last-article-number server group))
|
||||
(next-number (plist-get plst :id))
|
||||
(gap `(,(1+ last-number) . ,(1- next-number))))
|
||||
(when (<= (car gap) (cdr gap))
|
||||
(with-suppressed-warnings ((obsolete gnus-range-normalize)
|
||||
(obsolete gnus-range-add))
|
||||
(setf (gnus-info-read info)
|
||||
(gnus-range-add (gnus-info-read info)
|
||||
(gnus-range-normalize gap))))
|
||||
(gnus-range-add (gnus-info-read info) (gnus-range-normalize gap)))
|
||||
(when (gnus-info-marks info)
|
||||
(setf (alist-get 'unexist (gnus-info-marks info)) nil)))))
|
||||
(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"
|
||||
'charset "utf-8")
|
||||
(save-excursion (mml-insert-tag '/part))
|
||||
(when-let
|
||||
(-when-let*
|
||||
((parent (car (last (nndiscourse-get-refs server (plist-get header :id)))))
|
||||
(parent-author
|
||||
(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'
|
||||
(nndiscourse-request-list server)
|
||||
(with-current-buffer nntp-server-buffer
|
||||
(with-suppressed-warnings ((obsolete gnus-select-method))
|
||||
(let (gnus-server-method-cache
|
||||
(gnus-select-method '(nnnil)))
|
||||
(gnus-active-to-gnus-format
|
||||
(gnus-server-to-method (format "nndiscourse:%s" server))
|
||||
gnus-active-hashtb nil t))))
|
||||
gnus-active-hashtb nil t)))
|
||||
(mapc (lambda (group)
|
||||
(let ((full-name (gnus-group-full-name group `(nndiscourse ,server))))
|
||||
(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)
|
||||
(insert
|
||||
(format "%s %d %d y\n" group
|
||||
(or (nndiscourse--last-article-number server group) 0)
|
||||
(or (nndiscourse--first-article-number server group) 1))))
|
||||
(aif (nndiscourse--last-article-number server group)
|
||||
it 0)
|
||||
(aif (nndiscourse--first-article-number server group)
|
||||
it 1))))
|
||||
groups)))
|
||||
t))
|
||||
|
||||
|
@ -962,7 +958,7 @@ article header. Gnus manual does say the term `header` is oft conflated."
|
|||
|
||||
(defun nndiscourse--browse-post (&rest _args)
|
||||
"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))))
|
||||
(header (nndiscourse--get-header
|
||||
server
|
||||
|
@ -1018,7 +1014,7 @@ article header. Gnus manual does say the term `header` is oft conflated."
|
|||
|
||||
(defun nndiscourse-dump-diagnostics (server)
|
||||
"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
|
||||
,gnus-group-buffer
|
||||
"*Messages*"
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
2.6.2
|
|
@ -48,7 +48,7 @@ GEM
|
|||
parallel (1.19.1)
|
||||
parser (2.7.0.2)
|
||||
ast (~> 2.4.0)
|
||||
rack (2.2.3)
|
||||
rack (2.2.6.4)
|
||||
rainbow (3.0.0)
|
||||
rake (13.0.1)
|
||||
rest-client (1.8.0)
|
||||
|
|
|
@ -38,12 +38,12 @@
|
|||
"Wait until PREDICATE function returns non-`nil'.
|
||||
PREDARGS is argument list for the PREDICATE function.
|
||||
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))))
|
||||
(unless (or (cl-loop repeat count
|
||||
when (apply predicate predargs)
|
||||
return t
|
||||
do (sleep-for (/ int 1000.0)))
|
||||
do (sleep-for 0 int))
|
||||
continue)
|
||||
(error "Timeout: %s" predicate))))
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
;;; -*- lexical-binding: t; coding: utf-8 -*-
|
||||
(require 'nndiscourse-test)
|
||||
|
||||
;; since nndiscourse has fixed numbering, maybe we *can* use gnus-cache
|
||||
|
|
|
@ -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
|
|
@ -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
|
|
@ -1,3 +1,3 @@
|
|||
(nndiscourse :repo "dickmao/nndiscourse"
|
||||
: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")))
|
||||
|
|
|
@ -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
|
||||
}
|
Loading…
Reference in New Issue