Skip to content

Commit

Permalink
fix: refactor according to basil-conto's suggests
Browse files Browse the repository at this point in the history
see issue abo-abo/swiper#1593 for more informations
  • Loading branch information
tangxinfa committed Jun 7, 2018
1 parent 050f340 commit b55ebf7
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions counsel-firefox-bookmarks.el
Expand Up @@ -31,7 +31,7 @@

(defface counsel-firefox-bookmarks-tag
'((t :inherit font-lock-comment-face))
"Face used by `counsel-firefox-bookmarks' for tag."
"Face used by `counsel-firefox-bookmarks' for tags."
:group 'ivy-faces)

(defun counsel-firefox-bookmarks-action (x)
Expand All @@ -41,7 +41,7 @@
(declare-function xml-substitute-special "xml")

(defun counsel-firefox-bookmarks--candidates ()
"Return a list of completion candidates for `counsel-firefox-bookmarks'."
"Return list of `counsel-firefox-bookmarks' candidates."
(unless (and counsel-firefox-bookmarks-file
(file-readable-p counsel-firefox-bookmarks-file))
(signal 'file-error (list "Opening `counsel-firefox-bookmarks-file'"
Expand All @@ -61,16 +61,15 @@
(save-match-data
(xml-substitute-special (match-string 2)))))
(tags (and (string-match "tags=\"\\([^\"]+?\\)\"" a)
(match-string 1 a))))
(push (cons (if tags
(concat text
" :"
(string-join
(mapcar #'(lambda (tag)
(propertize tag 'face 'counsel-firefox-bookmarks-tag))
(split-string (match-string 1 a) "," t)) ":")
":")
text)
(mapconcat
(lambda (tag)
(put-text-property 0 (length tag) 'face
'counsel-firefox-bookmarks-tag
tag)
tag)
(split-string (match-string 1 a) "," t)
":"))))
(push (cons (if tags (concat text " :" tags ":") text)
href)
candidates)))
candidates)))
Expand Down

0 comments on commit b55ebf7

Please sign in to comment.