Hi Tassilo,

Tassilo Horn <[EMAIL PROTECTED]> writes:
> Bill Clementson <[EMAIL PROTECTED]> writes:
>> By the way, another thing that used to bug me was having the woman
>> initialization done when I didn't configure the man pages source. In
>> the end, I got around it by defining the vars in my .emacs file before
>> the anything-config require - eg:
>>
>> (defvar anything-sources nil "Prevent loading of woman")
>> (defvar anything-c-source-man-pages nil "Prevent loading of woman")
>> (require 'anything-config)
>>
>> but, anything and anything-config should probably be making certain
>> that they don't load things that the user doesn't want loaded.
>
> I really think that's the best you can do.  The only thing to stop
> evaluation of those defvars is to wrap them in a
>
>   (when do-i-wanna-use-this-foo-source
>      (defvar foo-source ...
>
> which the user would have to set before requiring anything-config.  I
> don't think that would be better.
>
> Or do you have a better idea?

Something like the following should work:

(defvar anything-c-man-pages nil "All man pages on system")

(defvar anything-c-source-man-pages
  `((name . "Manual Pages")
    (candidates . (lambda ()
                    (if (not anything-c-man-pages)
                        (when (require 'woman nil t)
                          (woman-file-name "")
                          (setq anything-c-man-pages 
                                (sort (mapcar 'car
                                              woman-topic-all-completions)
                                      'string-lessp)))
                      anything-c-man-pages)))
    (action . (("Show with Woman" . woman)))
    (requires-pattern . 2)))

- Bill



_______________________________________________
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources

Reply via email to