Henrik Frisk | 28 Apr 12:33
Picon
Picon

sortm arguments

Hi,

How do I change the arguments to sortm (mh-sort-folder) on a temporary basis? In the manual it says:

"The option mh-sortm-args holds extra arguments to pass on to the command sortm^3 when a prefix argument is
used with F S."

but how do I give F S a prefix argument? 

Until now I've used the mh_profile to change the sortm arguments but I'm thinking there must be a better way
to temporarily sort a folder by -textfield from or -textfield subject.

Thanks for any hints,

/henrik

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
Mark D. Baushke | 28 Apr 18:26
X-Face
Picon

Re: sortm arguments


Henrik Frisk <henrik.frisk <at> mhm.lu.se> writes:

> How do I change the arguments to sortm (mh-sort-folder) on a temporary
> basis? In the manual it says:
> 
> "The option mh-sortm-args holds extra arguments to pass on to the
> command sortm^3 when a prefix argument is used with F S."
> 
> but how do I give F S a prefix argument? 

First, set the mh-sortm-args as you desire. Then run witha

    C-u F S

and it will use the mh-sortm-args for you.

	-- Mark
Henrik Frisk | 28 Apr 23:05
Picon
Picon

Re: sortm arguments

> > How do I change the arguments to sortm (mh-sort-folder) on a temporary
> > basis? In the manual it says:
> > 
> > "The option mh-sortm-args holds extra arguments to pass on to the
> > command sortm^3 when a prefix argument is used with F S."
> > 
> > but how do I give F S a prefix argument? 
> 
> First, set the mh-sortm-args as you desire. Then run witha
> 
>     C-u F S
> 
> and it will use the mh-sortm-args for you.
> 
OK, I should have been able to figure that out by myself... sorry about that.

Now that I've figured out how it works I've defined a function that
easily let me sort my folder by the subject or from fields. FYI:

(defun my-mh-sort-folder (arg)
  "Sort current folder by subject or sender."
  (interactive "p")
  (if (= 1 arg)
      (setq mh-sortm-args '(-textfield subject -limit 0)))
  (if (= 2 arg)
      (setq mh-sortm-args '(-textfield from -limit 0)))
  (mh-sort-folder 4))

/henrik

(Continue reading)

Bill Wohler | 29 Apr 01:44
Picon
Picon

Re: sortm arguments

Henrik Frisk <henrik.frisk <at> mhm.lu.se> wrote:

> (defun my-mh-sort-folder (arg)
>   "Sort current folder by subject or sender."
>   (interactive "p")
>   (if (= 1 arg)
>       (setq mh-sortm-args '(-textfield subject -limit 0)))
>   (if (= 2 arg)
>       (setq mh-sortm-args '(-textfield from -limit 0)))
>   (mh-sort-folder 4))

Generally, local variables are preferred in this kind of usage to avoid
unintentional side-effects:

    (let (mh-sortm-args (cond ((= 1 arg)
                               '(-textfield subject -limit 0))
                              ((= 2 arg)
                               '(-textfield from -limit 0))))
      (mh-sort-folder 4))

--

-- 
Bill Wohler <wohler <at> newt.com>  http://www.newt.com/wohler/  GnuPG ID:610BD9AD

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
Henrik Frisk | 29 Apr 10:49
Picon
Picon

Re: sortm arguments

> > (defun my-mh-sort-folder (arg)
> >   "Sort current folder by subject or sender."
> >   (interactive "p")
> >   (if (= 1 arg)
> >       (setq mh-sortm-args '(-textfield subject -limit 0)))
> >   (if (= 2 arg)
> >       (setq mh-sortm-args '(-textfield from -limit 0)))
> >   (mh-sort-folder 4))
> 
> Generally, local variables are preferred in this kind of usage to avoid
> unintentional side-effects:
> 
>     (let (mh-sortm-args (cond ((= 1 arg)
>                                '(-textfield subject -limit 0))
>                               ((= 2 arg)
>                                '(-textfield from -limit 0))))
>       (mh-sort-folder 4))
> 
I see your point, thanks! Perhaps obvious, I'm just starting to get aquainted with emacs Lisp... I figured
the best way to learn is to get my hands dirty with it.

I realize this is getting a little off topic but running the function now results in the error: 

`let' bindings can have only one value-form: cond, ((= 1 arg) (quote (-textfield subject -limit 0))), ((= 2
arg) (quote (-textfield from -limit 0)))

/h

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
(Continue reading)

Bill Wohler | 30 Apr 09:12
Picon
Picon

Re: sortm arguments

Henrik Frisk <henrik.frisk <at> mhm.lu.se> wrote:

> > > (defun my-mh-sort-folder (arg)
> > >   "Sort current folder by subject or sender."
> > >   (interactive "p")
> > >   (if (= 1 arg)
> > >       (setq mh-sortm-args '(-textfield subject -limit 0)))
> > >   (if (= 2 arg)
> > >       (setq mh-sortm-args '(-textfield from -limit 0)))
> > >   (mh-sort-folder 4))
> > 
> > Generally, local variables are preferred in this kind of usage to avoid
> > unintentional side-effects:
> > 
> >     (let (mh-sortm-args (cond ((= 1 1)
> >                                '(-textfield subject -limit 0))
> >                               ((= 2 2)
> >                                '(-textfield from -limit 0))))
> >       (mh-sort-folder 4))
> > 
> I see your point, thanks! Perhaps obvious, I'm just starting to get
> aquainted with emacs Lisp... I figured the best way to learn is to get
> my hands dirty with it.

That's right! And read code.

> I realize this is getting a little off topic but running the function
> now results in the error:

It's on topic as far as I can tell :-).
(Continue reading)

Henrik Frisk | 30 Apr 10:44
Picon
Picon

Re: sortm arguments


> > `let' bindings can have only one value-form: cond, ((= 1 arg) (quote
> > (-textfield subject -limit 0))), ((= 2 arg) (quote (-textfield from
> > -limit 0)))
> 
> I just typed in the code so typos were expected :-). Learning Emacs Lisp
> involves using C-h f (as in `C-h f let RET' which *might* have exposed a
> little light), and the Emacs Lisp manual `C-h i g (elisp) RET' which
> with its examples would have finished the job.
> 
Excellent! This is like when I 10 years ago realized I could get
documentation on C functions on the command line! Metainformation is
more important than information...

> I missed a couple of parens (shown with the non-functional characters []
> for emphasis below).
> 
I realized it had something to do with enclosing the arguments to 'let'
but I still don't understand why it's not enough with *one*
parenthesis. I guess I should RTFM... :-)

>      (let [(mh-sortm-args (cond ((= 1 1)
>                                 '(-textfield subject -limit 0))
>                                ((= 2 2)
>                                 '(-textfield from -limit 0))))]
>        (mh-sort-folder 4))

Anyway, thanks a lot for the help.

/Henrik
(Continue reading)


Gmane