<<< Date Index >>>     <<< Thread Index >>>

[mutt-guile digest] run-control files



Here is a quasi-digest sort of thing of a thread about sourcing
muttrc and mutt.scm files.
 LC = Ludovic Courtès
 AM = Allister MacLeod


AM> Now, on to actual mutt-guile stuff :)
AM> I was wondering why you chose to make it so that a user's .muttrc must
AM> be explicitly sourced from their .mutt.scm.  I would think that it
AM> would be more natural to keep parsing the muttrc as usual, and allow
AM> .mutt.scm to alter it afterward.  That way the migration path for
AM> people using mutt-guile for the first time is as easy as possible.


LC> Well, I thought about it the other way: since the purpose of the Guile
LC> extension is in part to use it to configure Mutt, I found it natural to
LC> look only for a .mutt.scm file first.  The user can still have a
LC> .mutt.scm file that does nothing but source the original muttrc file.
LC> At least, it creates an incentive to look at how things can be done in
LC> the Guile way. ;)

LC> Also, the extension language is "above" the muttrc language in the sense
LC> that it sees some Mutt internals; for instance, it can modify how the
LC> muttrc language is interpreted.

LC> However, what we could do is automatically source the muttrc file when
LC> no mutt.scm file is available.


AM> Hmm, yeah.  Good point. [about language "above"] 
AM> If both were to be sourced automatically by
AM> mutt, would there be any problems with doing all of .mutt.scm before
AM> .muttrc?

[re: source muttrc if no mutt.scm]
AM> Yes, I think that would be a nicer way to do it. Perhaps it could
AM> print a warning at startup if no mutt.scm is available.  That way
AM> people would still have a reminder as incentive to try the Guile way,
AM> but they would be able to get started right away without having to
AM> know to put (source-rc-file "/home/username/.muttrc") in.

AM> I wonder.. is there an easy way for mutt to know whether a given rc
AM> file has been sourced or not?  If there is, it could go like this:
AM>  1. source /etc/mutt.scm
AM>  2. source ~/.mutt.scm
AM>  3. (if (not-sourced "/etc/Muttrc") (source-rc-file "/etc/Muttrc"))
AM>  4. (if (not-sourced "~/.muttrc") (source-rc-file "~/.muttrc"))
AM> That way if someone wanted to have a mutt.scm that does some scheme
AM> stuff, sources the .muttrc, then does some more scheme stuff, they
AM> could do so.. but maybe that's just too complicated.


[re: source muttrc if no mutt.scm]
LC> Ok, I'll add this.  However, in case $HOME/.mutt.scm is available, I
LC> still believe that $HOME/.muttrc should not be sourced automatically.

LC> There is no built-in mechanism to know which files have been sourced.
LC> However, this seems too specific to be set into the C code base.  For
LC> files which are sourced using the `source' command (ie. after mutt.scm
LC> files have been read), the user can still modify the `source' command so
LC> that it keeps track of sourced files.