[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 6c6b7a1: [gnorb] More little tweaks to registry searching,
From: |
Eric Abrahamsen |
Subject: |
[elpa] master 6c6b7a1: [gnorb] More little tweaks to registry searching, bump to 1.5.2 |
Date: |
Thu, 3 May 2018 18:42:02 -0400 (EDT) |
branch: master
commit 6c6b7a18e9e3f8c215919fc1bef6f2c0af15e093
Author: Eric Abrahamsen <address@hidden>
Commit: Eric Abrahamsen <address@hidden>
[gnorb] More little tweaks to registry searching, bump to 1.5.2
* packages/gnorb/gnorb-gnus.el (gnorb-gnus-search-registry): Use
case-fold-search, better parsing regexp, and be more careful about
returning valid results.
* packages/gnorb/gnorb-helm.el (gnorb-helm-gnus-registry-candidates):
Be more careful about checking gnus-ignored-from-addresses.
* packages/gnorb/gnorb.el: Bump to 1.5.2
---
packages/gnorb/gnorb-gnus.el | 79 +++++++++++++++++++++++---------------------
packages/gnorb/gnorb-helm.el | 24 ++++++++++----
packages/gnorb/gnorb.el | 2 +-
3 files changed, 60 insertions(+), 45 deletions(-)
diff --git a/packages/gnorb/gnorb-gnus.el b/packages/gnorb/gnorb-gnus.el
index 2bbe19f..96d660e 100644
--- a/packages/gnorb/gnorb-gnus.el
+++ b/packages/gnorb/gnorb-gnus.el
@@ -703,50 +703,55 @@ sender:google.com subject:\"your search results\""
(interactive
(list (read-string "Registry search terms: " nil
gnorb-registry-search-history)))
- (let (parsed found this-pass term)
+ (let ((case-fold-search t)
+ parsed found this-pass term)
(with-temp-buffer
(insert search-string)
(goto-char (point-min))
(while (re-search-forward
- "\\([[:alpha:]]+\\):\\(\\(?:\\w+\\|\"[[:alpha:] ]+\"\\)\\)"
+ "\\([[:alpha:]]+\\):\\(\\(?:[^\"[:blank:]]+\\|\"[^\"]+\"\\)\\)"
(point-at-eol) t)
(push (cons (intern (match-string 1))
(string-trim (match-string 2) "\"" "\""))
- parsed))
- (dolist (sym (slot-value gnus-registry-db 'tracked))
- (when (setq term (cdr-safe (assoc sym parsed)))
- (maphash
- (lambda (k v)
- (when (string-match-p term k)
- (setq this-pass (append v this-pass))))
- (gethash sym (slot-value gnus-registry-db 'tracker)))
- (setq found (if found
- (seq-intersection found this-pass)
- this-pass)
- this-pass nil)))
- (if found
- (let* ((server (gnorb-gnus-find-gnorb-server))
- (artlist
- (mapcar
- (lambda (msg)
- (pcase-let ((`(,group . ,artno) (gnorb-msg-id-request-head
- msg)))
- (when (and artno (integerp artno) (> artno 0))
- (vector group artno 100))))
- (delq nil (delete-dups found))))
- (name (make-temp-name "registry messages"))
- (spec (list
- (cons 'nnir-specs (list (cons 'nnir-query-spec
- `((query . "dummy")
- (articles . ,artlist)))
- (cons 'nnir-group-spec
- `((,server ,(list
name))))))
- (cons 'nnir-artlist nil))))
- (switch-to-buffer gnus-group-buffer)
- (gnus-group-read-ephemeral-group
- name `(nnir ,server) nil `(switch-to-buffer ,gnus-group-buffer)
- nil nil spec))
- (message "No results found")))))
+ parsed)))
+ (dolist (sym (slot-value gnus-registry-db 'tracked))
+ (when (setq term (cdr-safe (assoc sym parsed)))
+ (maphash
+ (lambda (k v)
+ (when (string-match-p term k)
+ (setq this-pass (append v this-pass))))
+ (gethash sym (slot-value gnus-registry-db 'tracker)))
+ (setq found (if found
+ (seq-intersection found this-pass)
+ this-pass)
+ this-pass nil)))
+ (if found
+ (let* ((server (gnorb-gnus-find-gnorb-server))
+ (artlist
+ (delq
+ nil
+ (mapcar
+ (lambda (msg)
+ (pcase-let ((`(,group . ,artno)
+ (gnorb-msg-id-request-head
+ msg (car-safe
+ (gnus-registry-get-id-key msg 'group)))))
+ (when (and group artno (integerp artno) (> artno 0))
+ (vector group artno 100))))
+ (delq nil (delete-dups found)))))
+ (name (make-temp-name "registry messages"))
+ (spec (list
+ (cons 'nnir-specs (list (cons 'nnir-query-spec
+ `((query . "dummy")
+ (articles . ,artlist)))
+ (cons 'nnir-group-spec
+ `((,server ,(list name))))))
+ (cons 'nnir-artlist nil))))
+ (switch-to-buffer gnus-group-buffer)
+ (gnus-group-read-ephemeral-group
+ name `(nnir ,server) nil `(switch-to-buffer ,gnus-group-buffer)
+ nil nil spec))
+ (message "No results found"))))
;;;###autoload
(defun gnorb-gnus-tag-message (arg &optional tags)
diff --git a/packages/gnorb/gnorb-helm.el b/packages/gnorb/gnorb-helm.el
index e9eae46..bcae4f9 100644
--- a/packages/gnorb/gnorb-helm.el
+++ b/packages/gnorb/gnorb-helm.el
@@ -33,18 +33,28 @@
(defun gnorb-helm-gnus-registry-candidates ()
"Return a list of candidates from the Gnus registry."
- (let (ret from recipient subject group)
+ (let ((check
+ (when gnus-ignored-from-addresses
+ (cond ((functionp gnus-ignored-from-addresses)
+ (lambda (adr) (funcall gnus-ignored-from-addresses adr)))
+ ((stringp gnus-ignored-from-addresses)
+ (lambda (adr)
+ (string-match-p
+ gnus-ignored-from-addresses adr))))))
+ ret from recipient subject group)
(maphash
(lambda (msg-id data)
(when (setq group (car-safe (cdr (assoc 'group data)))
from (car-safe (cdr (assoc 'sender data)))
subject (car-safe (cdr (assoc 'subject data)))
- recipient (car-safe (cdr (assoc 'recipient data))))
- (push (cons (format "%s: %s"
- (if (string-match-p gnus-ignored-from-addresses
from)
- recipient
- from)
- subject) ; display
+ recipient (cdr (assoc 'recipient data)))
+ (push (cons (format
+ "%s: %s" ; display
+ (if (and check
+ (funcall check from))
+ (mapconcat #'identity recipient " ")
+ from)
+ subject)
(cons msg-id group)) ; real
ret)))
(slot-value gnus-registry-db 'data))
diff --git a/packages/gnorb/gnorb.el b/packages/gnorb/gnorb.el
index 2253fb1..fb10287 100644
--- a/packages/gnorb/gnorb.el
+++ b/packages/gnorb/gnorb.el
@@ -2,7 +2,7 @@
;; Copyright (C) 2018 Free Software Foundation, Inc.
-;; Version: 1.5.1
+;; Version: 1.5.2
;; Package-Requires: ((cl-lib "0.5"))
;; Maintainer: Eric Abrahamsen <address@hidden>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] master 6c6b7a1: [gnorb] More little tweaks to registry searching, bump to 1.5.2,
Eric Abrahamsen <=