From da5684acb7e2d9aaa22eb558bace65ca4e27a52a Mon Sep 17 00:00:00 2001 From: Thierry Volpiatto Date: Wed, 9 Mar 2016 07:01:04 +0100 Subject: [PATCH 1/3] Divers improvements. * helm-dictionary.el (helm-dictionary-transformer): Don't use helm-pattern. (helm-source-dictionary): Use helm-build-in-file-source. (helm-source-dictionary-online): Use helm-build-sync-source. --- helm-dictionary.el | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/helm-dictionary.el b/helm-dictionary.el index b9bd0a8..5c4b970 100644 --- a/helm-dictionary.el +++ b/helm-dictionary.el @@ -214,8 +214,6 @@ browser in `helm-browse-url-default-browser-alist'" and append (cl-loop for l1term in l1terms for l2term in l2terms - if (or (string-match helm-pattern l1term) - (string-match helm-pattern l2term)) collect (cons (concat @@ -237,24 +235,22 @@ browser in `helm-browse-url-default-browser-alist'" (defvar helm-source-dictionary - '((name . "Search dictionary") - (candidates-file . helm-dictionary-database) - (candidate-transformer . helm-dictionary-transformer) - (action . (("Insert source language term" . helm-dictionary-insert-l1term) - ("Insert target language term" . helm-dictionary-insert-l2term))))) + (helm-build-in-file-source "Search dictionary" helm-dictionary-database + :candidate-transformer 'helm-dictionary-transformer + :action '(("Insert source language term" . helm-dictionary-insert-l1term) + ("Insert target language term" . helm-dictionary-insert-l2term)))) (defvar helm-source-dictionary-online - '((name . "Look up online") - (match (lambda (_candidate) t)) - (candidates . helm-dictionary-online-dicts) - (no-matchplugin) - (nohighlight) - (action - . (lambda (cand) - (let ((browse-url-browser-function - (or helm-dictionary-browser-function - browse-url-browser-function))) - (helm-browse-url (format cand (url-hexify-string helm-pattern))))))) + (helm-build-sync-source "Look up online" + :match (lambda (_candidate) t) + :candidates helm-dictionary-online-dicts + :matchplugin nil + :nohighlight t + :action (lambda (cand) + (let ((browse-url-browser-function + (or helm-dictionary-browser-function + browse-url-browser-function))) + (helm-browse-url (format cand (url-hexify-string helm-pattern)))))) "Source for online look-up.") ;;;###autoload From 36fa663b9ebc9dc5f555f0232e938fa7321853cd Mon Sep 17 00:00:00 2001 From: Thierry Volpiatto Date: Wed, 9 Mar 2016 07:27:54 +0100 Subject: [PATCH 2/3] Require helm-easymenu and no need to require helm-plugin. --- helm-dictionary.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-dictionary.el b/helm-dictionary.el index 5c4b970..ff5820d 100644 --- a/helm-dictionary.el +++ b/helm-dictionary.el @@ -115,7 +115,7 @@ (require 'cl-lib) (require 'helm) (require 'helm-net) -(require 'helm-plugin) +(require 'helm-easymenu) (defgroup helm-dictionary nil "Helm plugin for looking up a dictionary." From 88c2fae63ceb8965d822fec2f800f2f440ce17b8 Mon Sep 17 00:00:00 2001 From: Thierry Volpiatto Date: Wed, 9 Mar 2016 11:02:12 +0100 Subject: [PATCH 3/3] Reenable matching in the transformer. * helm-dictionary.el (helm-dictionary-transformer): Do it. --- helm-dictionary.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/helm-dictionary.el b/helm-dictionary.el index ff5820d..6a09399 100644 --- a/helm-dictionary.el +++ b/helm-dictionary.el @@ -214,6 +214,8 @@ browser in `helm-browse-url-default-browser-alist'" and append (cl-loop for l1term in l1terms for l2term in l2terms + if (or (string-match helm-pattern l1term) + (string-match helm-pattern l2term)) collect (cons (concat