jed-users mailing list

[2009 Date Index] [2009 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: Trouble with mail_mode (email.sl et al.)


On Fri, Jul 03 2009, at 23:32:42 +0200, G. Milde wrote:

> 1. You can call Jed with the mode.
> 
> In my muttrc, I have:
> 
>    set editor="xjed %s -tmp --mail_mode"

Ah!  So that's where my mistake was.  In my attempts to turn on
mail_mode, I'd always put "-f mail_mode" or "--mail_mode" *before* the
name of the file to be edited instead of after.  I guess I'm just so
much used to putting parameters first and file name(s) last (as it is
common with most programs) so I didn't try it the other way around. 
But as I think about it, doing it "the usual way" probably wouldn't
work well with jed as one can open multiple files at once, and if all
parameters were to be put first, it would be difficult to tell which
file was to be opened in which mode.

> % set modes based on filename or more complicated patterns
> static define set_modes_hook(ext)
> {
>    switch (path_basename(buffer_filename()))
>      { case ".pycmailrc":  python_mode(); return 1; }
>      { case "Makefile":    make_mode();   return 1; }
>      { case ".bashrc":     sh_mode();  return 1; }
>    return(0);
> }
> append_to_hook("_jed_set_mode_hooks", &set_modes_hook);

Well, it seems I don't need to do something like this now, as the above
solution is good enough for me, but I'm glad to see how it could be
done, so thanks a lot for that!  I probably would have had to use a
string_match() with some regular expression to select the desired mode
for certain filenames in my case.


Jens

Attachment: signature.asc
Description: Digital signature


[2009 date index] [2009 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]