diff options
author | Thierry Volpiatto <thierry.volpiatto@gmail.com> | 2013-01-13 11:44:39 +0100 |
---|---|---|
committer | Thierry Volpiatto <thierry.volpiatto@gmail.com> | 2013-01-13 11:44:39 +0100 |
commit | eb9e6b9794195a74fefdb624b296fd2e60b490cd (patch) | |
tree | dab8b4f84fba098720901193db62fa93283c3fe1 /helm-color.el | |
parent | a6a19922e0e4e784c3d5c07d92a0441335604629 (diff) |
* helm-color.el: Fix initialization of sources.
Diffstat (limited to 'helm-color.el')
-rw-r--r-- | helm-color.el | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/helm-color.el b/helm-color.el index e3cff635..ac8af97d 100644 --- a/helm-color.el +++ b/helm-color.el @@ -25,13 +25,16 @@ (defun helm-custom-faces-init () "Initialize buffer for `helm-c-source-customize-face'." (unless (helm-candidate-buffer) - (save-selected-window - (list-faces-display)) - (let ((cands (with-current-buffer (get-buffer "*Faces*") - (goto-char (point-min)) - (forward-line 3) - (buffer-substring (point) (point-max))))) - (helm-init-candidates-in-buffer "*helm faces*" cands)))) + (save-window-excursion + (list-faces-display) + (message nil)) + (helm-init-candidates-in-buffer + "*hfaces*" + (with-current-buffer (get-buffer "*Faces*") + (buffer-substring + (next-single-char-property-change (point-min) 'face) + (point-max)))) + (kill-buffer "*Faces*"))) (defvar helm-c-source-customize-face '((name . "Customize Face") @@ -49,13 +52,20 @@ ;;; Colors browser ;; ;; +(defun helm-colors-init () + (unless (helm-candidate-buffer) + (save-window-excursion + (list-colors-display) + (message nil)) + (helm-init-candidates-in-buffer + "*hcolors*" + (with-current-buffer (get-buffer "*Colors*") + (buffer-string))) + (kill-buffer "*Colors*"))) + (defvar helm-c-source-colors '((name . "Colors") - (init . (lambda () - (unless (helm-candidate-buffer) - (save-selected-window - (list-colors-display)) - (helm-candidate-buffer (get-buffer "*Colors*"))))) + (init . helm-colors-init) (candidates-in-buffer) (get-line . buffer-substring) (action |