From 37c46180280f10fa5120a017acd04f7022d124e4 Mon Sep 17 00:00:00 2001 From: Eric Abrahamsen Date: Tue, 5 Jan 2016 17:34:28 +0800 Subject: [PATCH] Squashed 'packages/gnorb/' changes from 538b5bd..d754d2f d754d2f Fixing `gnorb-bbdb-postings-styles' eaaea81 Link extraction should return links in same order 894b96c Additional guard for non-existent headings 2660934 gnorb-bbdb.el: Use the right catch tag name b632038 gnorb-registry.el: Check for old version of registry 86f288a Fix matching of posting styles, pt 2 87137be gnorb-bbdb.el: Fix matching of posting styles 8c2fb15 nngnorb.el: Handle non-existent nnir-tmp-buffer 7fcde77 Handle renaming of Org variable 6722839 Formatting improvements d72fee7 Redundant setting of window configuration git-subtree-dir: packages/gnorb git-subtree-split: d754d2f220815a804aabe4707835a7bdbef14e77 --- gnorb-bbdb.el | 46 ++++++++++++++++++++++++++++------------------ gnorb-org.el | 20 ++++++++++++-------- gnorb-registry.el | 4 +++- gnorb-utils.el | 39 +++++++++++++++++++++------------------ nngnorb.el | 2 +- 5 files changed, 65 insertions(+), 46 deletions(-) diff --git a/gnorb-bbdb.el b/gnorb-bbdb.el index eb2f6eb02..306ea0152 100644 --- a/gnorb-bbdb.el +++ b/gnorb-bbdb.el @@ -255,24 +255,34 @@ is non-nil (as in interactive calls) be verbose." (unless (fboundp field) ;; what's the record's existing value for this field? (setq rec-val (bbdb-record-field r field))) - (when (cond - ((eq field 'address) - (dolist (a rec-val) - (unless (and label - (not (string-match label (car a)))) - (string-match val (bbdb-format-address-default a))))) - ((eq field 'phone) - (dolist (p rec-val) - (unless (and label - (not (string-match label (car p)))) - (string-match val (bbdb-phone-string p))))) - ((consp rec-val) - (dolist (f rec-val) - (string-match val f))) - ((fboundp field) - (funcall field r)) - ((stringp rec-val) - (string-match val rec-val))) + (when (catch 'match + (cond + ((eq field 'address) + (dolist (a rec-val) + (unless (and label + (not (string-match label (car a)))) + (when + (string-match-p + val + (bbdb-format-address-default a)) + (throw 'match t))))) + ((eq field 'phone) + (dolist (p rec-val) + (unless (and label + (not (string-match label (car p)))) + (when + (string-match-p val (bbdb-phone-string p)) + (throw 'match t))))) + ((consp rec-val) + (dolist (f rec-val) + (when (string-match-p val f) + (throw 'match t)))) + ((fboundp field) + (when (string-match-p (funcall field r)) + (throw 'match t))) + ((stringp rec-val) + (when (string-match-p val rec-val) + (throw 'match t))))) ;; there are matches, run through the field setters in last ;; element of the sexp (dolist (attribute style) diff --git a/gnorb-org.el b/gnorb-org.el index 99e52475a..34cd8033c 100644 --- a/gnorb-org.el +++ b/gnorb-org.el @@ -177,9 +177,10 @@ we came from." strings) ((numberp gnorb-org-mail-scan-scope) (cl-subseq - strings 0 (min - (length strings) - (1+ gnorb-org-mail-scan-scope)))) + (nreverse strings) + 0 (min + (length strings) + (1+ gnorb-org-mail-scan-scope)))) ;; We could provide more options here. 'tree vs ;; 'subtree, for instance. (t @@ -302,7 +303,7 @@ headings." ;; insert text, if any (when text (message-goto-body) - (insert"\n") + (insert "\n") (if (bufferp text) (insert-buffer-substring text) (insert text))) @@ -502,12 +503,17 @@ default set of parameters." ;; got too much hard-coded stuff. (interactive "P") (org-back-to-heading t) - (let* ((backend-string + (let* ((bkend-var + (if (boundp 'org-export--registered-backends) + org-export--registered-backends + org-export-registered-backends)) + (backend-string (org-completing-read "Export backend: " (mapcar (lambda (b) (symbol-name (org-export-backend-name b))) - org-export--registered-backends) nil t)) + bkend-var) + nil t)) (backend-symbol (intern backend-string)) (f-or-t (org-completing-read "Export as file or text? " '("file" "text") nil t)) @@ -530,8 +536,6 @@ default set of parameters." ,@opts ,gnorb-org-email-subtree-file-parameters)))) text file) - (setq gnorb-window-conf (current-window-configuration)) - (move-marker gnorb-return-marker (point)) (if (bufferp result) (setq text result) (setq file result)) diff --git a/gnorb-registry.el b/gnorb-registry.el index bcd5adc2c..92205653c 100644 --- a/gnorb-registry.el +++ b/gnorb-registry.el @@ -235,7 +235,9 @@ number of tracked messages, the number of tracked headings, and how much of the (let ((messages (length (gnorb-registry-tracked-messages))) (headings (length (gnorb-registry-tracked-headings))) (reg-size (registry-size gnus-registry-db)) - (reg-max-size (oref gnus-registry-db max-size))) + (reg-max-size (if (slot-exists-p gnus-registry-db 'max-size) + (oref gnus-registry-db max-size) + (oref gnus-registry-db max-hard)))) (with-current-buffer "*Gnorb Usage*" (let ((inhibit-read-only t)) (erase-buffer) diff --git a/gnorb-utils.el b/gnorb-utils.el index d7f5e8651..4d473f17f 100644 --- a/gnorb-utils.el +++ b/gnorb-utils.el @@ -334,24 +334,27 @@ agenda. Then let the user choose an action from the value of "Return pretty outline path of the Org heading indicated by ID. If the KW argument is true, add the TODO keyword into the path." - (org-with-point-at (org-id-find id t) - (let ((el (org-element-at-point))) - (concat - (if kw - (format "(%s): " - (org-element-property :todo-keyword el)) - "") - (org-format-outline-path - (append - (list - (file-name-nondirectory - (buffer-file-name - (org-base-buffer (current-buffer))))) - (org-get-outline-path) - (list - (replace-regexp-in-string - org-bracket-link-regexp - "\\3" (org-element-property :raw-value el))))))))) + (let ((pt (org-id-find id t))) + (if pt + (org-with-point-at pt + (let ((el (org-element-at-point))) + (concat + (if kw + (format "(%s): " + (org-element-property :todo-keyword el)) + "") + (org-format-outline-path + (append + (list + (file-name-nondirectory + (buffer-file-name + (org-base-buffer (current-buffer))))) + (org-get-outline-path) + (list + (replace-regexp-in-string + org-bracket-link-regexp + "\\3" (org-element-property :raw-value el)))))))) + "[none]"))) (defun gnorb-scan-links (bound &rest types) "Scan from point to BOUND looking for links of type in TYPES. diff --git a/nngnorb.el b/nngnorb.el index 9d03e14ad..bb0ddfdcd 100644 --- a/nngnorb.el +++ b/nngnorb.el @@ -183,7 +183,7 @@ continue to provide tracking of sent messages." ;; this summary buffer. (buffer-local-value 'nngnorb-attachment-file-list - (get-buffer nnir-tmp-buffer)))) + (get-buffer-create nnir-tmp-buffer)))) (define-key gnorb-summary-minor-mode-map [remap gnus-summary-exit] -- 2.39.2