diff options
author | Eric Abrahamsen <eric@ericabrahamsen.net> | 2018-04-26 16:26:27 -0700 |
---|---|---|
committer | Eric Abrahamsen <eric@ericabrahamsen.net> | 2019-03-22 10:23:30 -0700 |
commit | c1b63af4458e92bad33da0def2b15c206656e2fa (patch) | |
tree | 267503989ec0475b76800bb309f6cdc1da53e74e /lisp/gnus/gnus-async.el | |
parent | 3375d08299bbc1e224d19a871012cdbbf5d787ee (diff) | |
download | emacs-c1b63af4458e92bad33da0def2b15c206656e2fa.tar.gz |
Change Gnus hash tables into real hash tables
Gnus has used obarrays as makeshift hash tables for groups: group
names are coerced to unibyte and interned in custom obarrays, and
their symbol-value set to whatever value needs to be stored. This
patch replaces those obarrays with actual hash tables.
* lisp/gnus/gnus-util.el (gnus-intern-safe, gnus-create-hash-size):
Remove functions.
(gnus-make-hashtable): Change to return a real hash table.
(gnus-text-property-search): Utility similar to `text-property-any',
but compares on `equal'. Needed because the 'gnus-group text
property is now a string.
* lisp/gnus/gnus.el (gnus-gethash, gnus-gethash-safe, gnus-sethash):
Remove macros.
(gnus-group-list): New variable holding all group names as an
ordered list. Used because `gnus-newsrc-hashtb' used to preserve
`gnus-newsrc-alist' ordering, but now doesn't.
* lisp/gnus/nnmaildir.el (nnmaildir--servers): Change from obarray to
alist.
(nnmaildir--up2-1): Remove function.
* lisp/thingatpt.el (thing-at-point-newsgroup-p): This was making use
of Gnus obarrays, replace with a cond that can handle many different
possibilities.
* lisp/gnus/gnus-bcklg.el (gnus-backlog-articles): Remove
gnus-backlog-hashtb, which wasn't doing anything. Just keep a list
of ident strings in gnus-backlog-articles.
(gnus-backlog-setup): Delete unnecessary function.
(gnus-backlog-enter-article, gnus-backlog-remove-oldest-article,
gnus-backlog-remove-article, gnus-backlog-request-article): Alter
calls accordingly.
* lisp/gnus/gnus-dup.el (gnus-duplicate-list-max-length): Rename from
`gnus-duplicate-list-length', for accuracy.
* lisp/gnus/gnus-start.el (gnus-active-to-gnus-format,
gnus-groups-to-gnus-format, gnus-newsrc-to-gnus-format): Read group
names as strings.
(gnus-gnus-to-quick-newsrc-format): Write `gnus-newsrc-alist' using
the ordering in `gnus-group-list'.
* lisp/gnus/gnus-agent.el:
* lisp/gnus/gnus-async.el:
* lisp/gnus/gnus-cache.el:
* lisp/gnus/gnus-group.el:
* lisp/gnus/gnus-score.el:
* lisp/gnus/gnus-sum.el:
* lisp/gnus/gnus-topic.el:
* lisp/gnus/message.el:
* lisp/gnus/mml.el:
* lisp/gnus/nnagent.el:
* lisp/gnus/nnbabyl.el:
* lisp/gnus/nnvirtual.el:
* lisp/gnus/nnweb.el: In all files, change obarrays to hash-tables,
and swap `gnus-sethash' for `puthash', `gnus-gethash' for `gethash',
`mapatoms' for `maphash', etc.
* test/lisp/gnus/gnus-test-headers.el (gnus-headers-make-dependency-table,
gnus-headers-loop-dependencies): New tests to make sure we're
building `gnus-newsgroup-dependencies' correctly.
Diffstat (limited to 'lisp/gnus/gnus-async.el')
-rw-r--r-- | lisp/gnus/gnus-async.el | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/lisp/gnus/gnus-async.el b/lisp/gnus/gnus-async.el index 00e91425798..4e2723e8d27 100644 --- a/lisp/gnus/gnus-async.el +++ b/lisp/gnus/gnus-async.el @@ -84,7 +84,6 @@ that was fetched." (defvar gnus-async-article-alist nil) (defvar gnus-async-article-semaphore '(nil)) (defvar gnus-async-fetch-list nil) -(defvar gnus-async-hashtb nil) (defvar gnus-async-current-prefetch-group nil) (defvar gnus-async-current-prefetch-article nil) (defvar gnus-async-timer nil) @@ -127,14 +126,11 @@ that was fetched." (defun gnus-async-close () (gnus-kill-buffer gnus-async-prefetch-article-buffer) (gnus-kill-buffer gnus-async-prefetch-headers-buffer) - (setq gnus-async-hashtb nil - gnus-async-article-alist nil + (setq gnus-async-article-alist nil gnus-async-header-prefetched nil)) (defun gnus-async-set-buffer () - (nnheader-set-temp-buffer gnus-async-prefetch-article-buffer t) - (unless gnus-async-hashtb - (setq gnus-async-hashtb (gnus-make-hashtable 1023)))) + (nnheader-set-temp-buffer gnus-async-prefetch-article-buffer t)) (defun gnus-async-halt-prefetch () "Stop prefetching." @@ -242,13 +238,10 @@ that was fetched." (when gnus-async-post-fetch-function (funcall gnus-async-post-fetch-function summary)))) (gnus-async-with-semaphore - (setq - gnus-async-article-alist - (cons (list (intern (format "%s-%d" group article) - gnus-async-hashtb) - mark (point-max-marker) - group article) - gnus-async-article-alist)))) + (push (list (format "%s-%d" group article) + mark (point-max-marker) + group article) + gnus-async-article-alist))) (if (not (gnus-buffer-live-p summary)) (gnus-async-with-semaphore (setq gnus-async-fetch-list nil)) @@ -314,8 +307,7 @@ that was fetched." (set-marker (caddr entry) nil)) (gnus-async-with-semaphore (setq gnus-async-article-alist - (delq entry gnus-async-article-alist)) - (unintern (car entry) gnus-async-hashtb))) + (delete entry gnus-async-article-alist)))) (defun gnus-async-prefetch-remove-group (group) "Remove all articles belonging to GROUP from the prefetch buffer." @@ -331,9 +323,8 @@ that was fetched." "Return the entry for ARTICLE in GROUP if it has been prefetched." (let ((entry (save-excursion (gnus-async-set-buffer) - (assq (intern-soft (format "%s-%d" group article) - gnus-async-hashtb) - gnus-async-article-alist)))) + (assoc (format "%s-%d" group article) + gnus-async-article-alist)))) ;; Perhaps something has emptied the buffer? (if (and entry (= (cadr entry) (caddr entry))) @@ -342,7 +333,7 @@ that was fetched." (set-marker (cadr entry) nil) (set-marker (caddr entry) nil)) (setq gnus-async-article-alist - (delq entry gnus-async-article-alist)) + (delete entry gnus-async-article-alist)) nil) entry))) |