From 6442e00b2eede2952666ce65110f60de83c3b986 Mon Sep 17 00:00:00 2001 From: Fabien Dubosson Date: Thu, 8 Oct 2015 17:07:14 +0200 Subject: [PATCH] Use a temp buffer to read the FAQ in helm-spacemacs Correct a bug in helm-spacemacs: Whenever a function was needing the FAQ's candidates in helm-spacemancs (`SPC f e h` and `SPC f e f`), the `FAQ.org` file was open in a buffer and not closed. This commit corrects this by loading the content of `FAQ.org` in a temp buffer and switch it to `org-mode` in order to get the candidates. --- .../spacemacs-base/local/helm-spacemacs/helm-spacemacs.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/layers/+distribution/spacemacs-base/local/helm-spacemacs/helm-spacemacs.el b/layers/+distribution/spacemacs-base/local/helm-spacemacs/helm-spacemacs.el index 6ccd3d2e2..4136e50d6 100644 --- a/layers/+distribution/spacemacs-base/local/helm-spacemacs/helm-spacemacs.el +++ b/layers/+distribution/spacemacs-base/local/helm-spacemacs/helm-spacemacs.el @@ -279,8 +279,10 @@ (cons (concat (match-string 1 str) ": " (match-string 2 str)) (cdr c))))) - (helm-get-org-candidates-in-file - (concat spacemacs-docs-directory "FAQ.org") 2 8 nil t)))) + (with-temp-buffer + (insert-file-contents (concat spacemacs-docs-directory "FAQ.org")) + (org-mode) + (helm-get-org-candidates-in-file (current-buffer) 2 8 nil t))))) (provide 'helm-spacemacs)