gnu-emacs-sources
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ;;; anything.el --- open anything


From: Bill Clementson
Subject: Re: ;;; anything.el --- open anything
Date: Fri, 24 Aug 2007 08:52:36 -0700
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (darwin)

Hi Tassilo,

Tassilo Horn <address@hidden> writes:
> Bill Clementson <address@hidden> 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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]