[email protected]
[Top] [All Lists]

Re: Mc Digest, Vol 68, Issue 18

Subject: Re: Mc Digest, Vol 68, Issue 18
From: "Yury V. Zaytsev"
Date: Tue, 29 Dec 2009 09:24:09 +0100
On Tue, 2009-12-29 at 06:17 +0300, chris glur wrote:

> AFAICS you are just guessing.
> I need info from someone who's been there and done it.

AFAICS you must be wasting peoples time by not even trying to follow the
advice that you are given. I attach below the section of the man that I
am referring to and be SURE that it DOES apply to the editor's menu just
as I already noted previously. Come back when you have actually read it.

    Menu File Edit
       The user menu is a menu of useful actions that can be customized by the
       user. When you access the user menu, the file .mc.menu from the current
       directory is used if it exists, but only if it is owned by user or root
       and is not world-writable.  If no such file found, ~/.mc/menu is  tried
       in  the  same  way,  and otherwise mc uses the default system-wide menu
       /usr/local/share/mc/mc.menu.

       The format of the menu file is very simple. Lines that start with  anyâ
       thing but space or tab are considered entries for the menu (in order to
       be able to use it like a hot key, the first character should be a  letâ
       ter).  All  the lines that start with a space or a tab are the commands
       that will be executed when the entry is selected.

       When an option is selected all the command  lines  of  the  option  are
       copied  to  a  temporary  file  in  the  temporary  directory  (usually
       /usr/tmp) and then that file is executed. This allows the user  to  put
       normal  shell  constructs  in the menus. Also simple macro substitution
       takes place before executing the menu code. For more  information,  see
       macro substitution.

       Here is a sample mc.menu file:

       A    Dump the currently selected file
            od -c %f

       B    Edit a bug report and send it to root
            I=âmktemp ${MC_TMPDIR:-/tmp}/mail.XXXXXXâ || exit 1
            vi $I
            mail -s "Midnight Commander bug" root < $I
            rm -f $I

       M    Read mail
            emacs -f rmail

       N    Read Usenet news
            emacs -f gnus

       H    Call the info hypertext browser
            info

       J    Copy current directory to other panel recursively
            tar cf - . | (cd %D && tar xvpf -)

       K    Make a release of the current subdirectory
            echo -n "Name of distribution file: "
            read tar
            ln -s %d âdirname %dâ/$tar
            cd ..
            tar cvhf ${tar}.tar $tar

       = f *.tar.gz | f *.tgz & t n
       X       Extract the contents of a compressed tar file
            tar xzvf %f

       Default Conditions

       Each  menu  entry  may  be  preceded by a condition. The condition must
       start from the first column with a â=â character. If the  condition  is
       true, the menu entry will be the default entry.

       Condition syntax:   = <sub-cond>
         or:               = <sub-cond> | <sub-cond> ...
         or:               = <sub-cond> & <sub-cond> ...

       Sub-condition is one of following:

         y <pattern>       syntax of current file matching pattern?
                      (for edit menu only)
         f <pattern>       current file matching pattern?
         F <pattern>       other file matching pattern?
         d <pattern>       current directory matching pattern?
         D <pattern>       other directory matching pattern?
         t <type>          current file of type?
         T <type>          other file of type?
         x <filename>      is it executable filename?
         ! <sub-cond>      negate the result of sub-condition

       Pattern is a normal shell pattern or a regular expression, according to
       the shell patterns option. You can override the  global  value  of  the
       shell  patterns  option by writing "shell_patterns=x" on the first line
       of the menu file (where "x" is either 0 or 1).

       Type is one or more of the following characters:

         n  not a directory
         r  regular file
         d  directory
         l  link
         c  character device
         b  block device
         f  FIFO (pipe)
         s  socket
         x  executable file
         t  tagged

       For example ârlfâ means either regular file, link or fifo. The âtâ type
       is  a  little special because it acts on the panel instead of the file.
       The condition â=t tâ is true if there are tagged files in  the  current
       panel and false if not.

       If  the condition starts with â=?â instead of â=â a debug trace will be
       shown whenever the value of the condition is calculated.

       The conditions are calculated from left to right. This means
            = f *.tar.gz | f *.tgz & t n
       is calculated as
            ( (f *.tar.gz) | (f *.tgz) ) & (t n)

       Here is a sample of the use of conditions:

       = f *.tar.gz | f *.tgz & t n
       L    List the contents of a compressed tar-archive
            gzip -cd %f | tar xvf -

       Addition Conditions

       If the condition begins with â+â (or â+?â) instead of â=â (or â=?â)  it
       is  an addition condition. If the condition is true the menu entry will
       be included in the menu. If the condition is false the menu entry  will
       not be included in the menu.

       You  can  combine default and addition conditions by starting condition
       with â+=â or â=+â (or â+=?â or â=+?â if you want debug trace).  If  you
       want  to  use  two different conditions, one for adding and another for
       defaulting, you can precede a menu entry with two condition lines,  one
       starting with â+â and another starting with â=â.

       Comments  are started with â#â. The additional comment lines must start
       with â#â, space or tab.

 
-- 
Sincerely yours,
Yury V. Zaytsev

_______________________________________________
Mc mailing list
http://mail.gnome.org/mailman/listinfo/mc
<Prev in Thread] Current Thread [Next in Thread>