Loading ...
Sorry, an error occurred while loading the content.

Re: perl - prolog

Expand Messages
  • Thomas Köhler
    ... Well, surely none of the perl-included nor one of the perl modules from CPAN start that strange. It s more the quick-and-dirty hacks some people write
    Message 1 of 23 , Mar 3, 2002
    • 0 Attachment
      Bram Moolenaar wrote [020228 07:56]:
      > Thomas Koehler wrote:
      > > Bram Moolenaar wrote [020227 20:10]:
      > > > Kontra Gergely wrote:
      > > [...]
      > > > Wouldn't ":-" appear somewhere in the first line of a perl file?
      > > > Or have a line that starts with "%" or "/*"?
      > >
      > > Any perl script may start like this:
      > >
      > > %hash=();
      > >
      > > Ugly. :-(
      >
      > Are there enough Perl files that start with a line like this that we
      > should worry about the file being recognized as prolog?

      Well, surely none of the perl-included nor one of the perl
      modules from CPAN start that strange. It's more the
      quick-and-dirty hacks some people write after too much beer (or
      before having had enough coffee, or whatever ;) that worry me
      here ;)

      Side note: Is there any global variable that can override vim's
      autodetection for .pl in either direction? So if, for example,
      the user starts with an empty file, the filetype gets set as he
      wants it?

      (That whole .pl<->.pl issue is surely worth a note in the docs)

      > We could require a blank after the %, assuming that's how most
      > people write comments.

      This perl code also works:
      % hash = ();

      :-}

      Ciao,
      Thomas

      --
      Thomas Köhler Email: jean-luc@... | LCARS - Linux
      <>< WWW: http://jeanluc-picard.de | for Computers
      IRC: jeanluc | on All Real
      PGP public key available from Homepage! | Starships
    • Bram Moolenaar
      ... In that state of mind you experience the wrong highlighting as a psygedelic effect, thus you might actually enjoy it! :-) ... Yes, I added g:filetype_pl
      Message 2 of 23 , Mar 4, 2002
      • 0 Attachment
        Thomas Koehler wrote:

        > > > [...]
        > > > > Wouldn't ":-" appear somewhere in the first line of a perl file?
        > > > > Or have a line that starts with "%" or "/*"?
        > > >
        > > > Any perl script may start like this:
        > > >
        > > > %hash=();
        > > >
        > > > Ugly. :-(
        > >
        > > Are there enough Perl files that start with a line like this that we
        > > should worry about the file being recognized as prolog?
        >
        > Well, surely none of the perl-included nor one of the perl
        > modules from CPAN start that strange. It's more the
        > quick-and-dirty hacks some people write after too much beer (or
        > before having had enough coffee, or whatever ;) that worry me
        > here ;)

        In that state of mind you experience the wrong highlighting as a
        psygedelic effect, thus you might actually enjoy it! :-)

        > Side note: Is there any global variable that can override vim's
        > autodetection for .pl in either direction? So if, for example,
        > the user starts with an empty file, the filetype gets set as he
        > wants it?

        Yes, I added g:filetype_pl for this.

        > (That whole .pl<->.pl issue is surely worth a note in the docs)

        Suggestion?

        > > We could require a blank after the %, assuming that's how most
        > > people write comments.
        >
        > This perl code also works:
        > % hash = ();
        >
        > :-}

        How often does this occur? The filetype check needs to be as good as
        possible. That includes not recognizing a Prolog file as being Perl.
        Thus we have to do some statistics based guesses.

        --
        hundred-and-one symptoms of being an internet addict:
        114. You are counting items, you go "0,1,2,3,4,5,6,7,8,9,A,B,C,D...".

        /// Bram Moolenaar -- Bram@... -- http://www.moolenaar.net \\\
        /// Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim \\\
        \\\ Project leader for A-A-P -- http://www.a-a-p.org ///
        \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///
      • Thomas Köhler
        ... hehehe :-) ... Fine. I d better have a look into that some time later... ... Hm. Is that the right place to put it? ~/vim/TEST/doc diff -u filetype.txt~
        Message 3 of 23 , Mar 4, 2002
        • 0 Attachment
          Bram Moolenaar wrote [020304 18:51]:
          > Thomas Koehler wrote:
          > > > > [...]
          > > > > > Wouldn't ":-" appear somewhere in the first line of a
          > > > > > perl file? Or have a line that starts with "%" or "/*"?
          > > > > Any perl script may start like this:
          > > > >
          > > > > %hash=();
          > > > >
          > > > > Ugly. :-(
          > > > Are there enough Perl files that start with a line like
          > > > this that we should worry about the file being recognized
          > > > as prolog?
          > > Well, surely none of the perl-included nor one of the perl
          > > modules from CPAN start that strange. It's more the
          > > quick-and-dirty hacks some people write after too much beer (or
          > > before having had enough coffee, or whatever ;) that worry me
          > > here ;)
          > In that state of mind you experience the wrong highlighting as a
          > psygedelic effect, thus you might actually enjoy it! :-)

          hehehe :-)

          > > Side note: Is there any global variable that can override vim's
          > > autodetection for .pl in either direction? So if, for example,
          > > the user starts with an empty file, the filetype gets set as he
          > > wants it?
          >
          > Yes, I added g:filetype_pl for this.

          Fine. I'd better have a look into that some time later...

          > > (That whole .pl<->.pl issue is surely worth a note in the docs)
          >
          > Suggestion?

          Hm. Is that the right place to put it?

          ~/vim/TEST/doc> diff -u filetype.txt~ filetype.txt
          --- filetype.txt~ Mon Mar 4 19:51:07 2002
          +++ filetype.txt Mon Mar 4 19:55:18 2002
          @@ -19,7 +19,8 @@

          Vim can detect the type of file that is edited. This is done by checking the
          file name and sometimes by inspecting the contents of the file for specific
          -text.
          +text. This is necessary for files matching *.pl, for example: These are
          +either perl or prolog script files!

          *:filetype* *:filet*
          To enable file type detection, use this command in your vimrc: >


          > > > We could require a blank after the %, assuming that's how most
          > > > people write comments.
          > >
          > > This perl code also works:
          > > % hash = ();
          > >
          > > :-}
          >
          > How often does this occur? The filetype check needs to be as
          > good as possible. That includes not recognizing a Prolog file
          > as being Perl. Thus we have to do some statistics based
          > guesses.

          _This_ really only occurs if you're out for psygedelic effects,
          and vim doesn't even highlight that hash as a perl hash ;-)

          Ciao,
          Thomas

          --
          Thomas Köhler Email: jean-luc@... | LCARS - Linux
          <>< WWW: http://jeanluc-picard.de | for Computers
          IRC: jeanluc | on All Real
          PGP public key available from Homepage! | Starships
        • Kontra, Gergely
          ... Another good question is how to open a new file, which must be a prolog file :) Or, if you have templates, how to know, that you will edit a prolog file?
          Message 4 of 23 , Mar 6, 2002
          • 0 Attachment
            >> > Side note: Is there any global variable that can override vim's
            >> > autodetection for .pl in either direction? So if, for example,
            >> > the user starts with an empty file, the filetype gets set as he
            >> > wants it?
            >>
            >> Yes, I added g:filetype_pl for this.
            >

            Another good question is how to open a new file, which must be a prolog
            file :)
            Or, if you have templates, how to know, that you will edit a prolog
            file? (I assume you edit perl files also)

            Gergo

            +-[Kontra, Gergely @ Budapest University of Technology and Economics]-+
            | Email: kgergely@..., kgergely@... |
            | URL: turul.eet.bme.hu/~kgergely Mobile: (+36 20) 356 9656 |
            +-------"Olyan langesz vagyok, hogy poroltoval kellene jarnom!"-------+
            .
            Magyar php mirror es magyar php dokumentacio: http://hu.php.net
          • Thomas Köhler
            ... Indeed. But... setting g:filetype_pl solves that, too... ... In fact, I only use templates for C and LaTeX so far, so not much of a problem there (yet) ;-)
            Message 5 of 23 , Mar 6, 2002
            • 0 Attachment
              Kontra, Gergely wrote [020306 18:07]:
              > >> > Side note: Is there any global variable that can override vim's
              > >> > autodetection for .pl in either direction? So if, for example,
              > >> > the user starts with an empty file, the filetype gets set as he
              > >> > wants it?
              > >>
              > >> Yes, I added g:filetype_pl for this.
              > >
              >
              > Another good question is how to open a new file, which must be
              > a prolog file :)

              Indeed. But... setting g:filetype_pl solves that, too...

              > Or, if you have templates, how to know, that you will edit a prolog
              > file? (I assume you edit perl files also)

              In fact, I only use templates for C and LaTeX so far, so not much
              of a problem there (yet) ;-)

              > Gergo

              Ciao,
              Thomas

              --
              Thomas Köhler Email: jean-luc@... | LCARS - Linux
              <>< WWW: http://jeanluc-picard.de | for Computers
              IRC: jeanluc | on All Real
              PGP public key available from Homepage! | Starships
            • Kontra, Gergely
              ... Yes and NO. If you edit both perl and prolog files, you don t want to set filetype_pl, do you? And this problem stands for other filetypes, where the name
              Message 6 of 23 , Mar 6, 2002
              • 0 Attachment
                >> Another good question is how to open a new file, which must be
                >> a prolog file :)
                >
                >Indeed. But... setting g:filetype_pl solves that, too...

                Yes and NO.
                If you edit both perl and prolog files, you don't want to set
                filetype_pl, do you?

                And this problem stands for other filetypes, where the name is not
                sufficient to determine filetype...

                Gergo


                +-[Kontra, Gergely @ Budapest University of Technology and Economics]-+
                | Email: kgergely@..., kgergely@... |
                | URL: turul.eet.bme.hu/~kgergely Mobile: (+36 20) 356 9656 |
                +-------"Olyan langesz vagyok, hogy poroltoval kellene jarnom!"-------+
                .
                Magyar php mirror es magyar php dokumentacio: http://hu.php.net
              • Thomas Köhler
                ... In such cases, you always loose :-} ... Ciao, Thomas -- Thomas Köhler Email: jean-luc@picard.franken.de | LCARS - Linux
                Message 7 of 23 , Mar 7, 2002
                • 0 Attachment
                  Kontra, Gergely wrote [020307 09:54]:
                  > >> Another good question is how to open a new file, which must be
                  > >> a prolog file :)
                  > >
                  > >Indeed. But... setting g:filetype_pl solves that, too...
                  >
                  > Yes and NO.
                  > If you edit both perl and prolog files, you don't want to set
                  > filetype_pl, do you?
                  >
                  > And this problem stands for other filetypes, where the name is not
                  > sufficient to determine filetype...

                  In such cases, you always loose :-}

                  > Gergo

                  Ciao,
                  Thomas

                  --
                  Thomas Köhler Email: jean-luc@... | LCARS - Linux
                  <>< WWW: http://jeanluc-picard.de | for Computers
                  IRC: jeanluc | on All Real
                  PGP public key available from Homepage! | Starships
                • Kontra, Gergely
                  ... Should I recommend to extend the sp and new and e commands to optionally give the filetype? I mean ... Gergo +-[Kontra, Gergely @ Budapest University of
                  Message 8 of 23 , Mar 7, 2002
                  • 0 Attachment
                    >> If you edit both perl and prolog files, you don't want to set
                    >> filetype_pl, do you?
                    >>
                    >> And this problem stands for other filetypes, where the name is not
                    >> sufficient to determine filetype...
                    >
                    >In such cases, you always loose :-}

                    Should I recommend to extend the sp and new and e commands to optionally
                    give the filetype?
                    I mean
                    :e myperl.pl perl
                    :sp myprolog.pl prolog

                    Gergo
                    +-[Kontra, Gergely @ Budapest University of Technology and Economics]-+
                    | Email: kgergely@..., kgergely@... |
                    | URL: turul.eet.bme.hu/~kgergely Mobile: (+36 20) 356 9656 |
                    +-------"Olyan langesz vagyok, hogy poroltoval kellene jarnom!"-------+
                    .
                    Magyar php mirror es magyar php dokumentacio: http://hu.php.net
                  • Thomas Köhler
                    ... Hm. Don t know, what does it buy you? And what goes wrong in turn? Ciao, Thomas -- Thomas Köhler Email: jean-luc@picard.franken.de | LCARS - Linux
                    Message 9 of 23 , Mar 8, 2002
                    • 0 Attachment
                      Kontra, Gergely wrote [020308 10:25]:
                      > >> If you edit both perl and prolog files, you don't want to set
                      > >> filetype_pl, do you?
                      > >>
                      > >> And this problem stands for other filetypes, where the name is not
                      > >> sufficient to determine filetype...
                      > >
                      > >In such cases, you always loose :-}
                      >
                      > Should I recommend to extend the sp and new and e commands to
                      > optionally give the filetype?
                      > I mean
                      > :e myperl.pl perl
                      > :sp myprolog.pl prolog

                      Hm. Don't know, what does it buy you? And what goes wrong in
                      turn?

                      Ciao,
                      Thomas

                      --
                      Thomas Köhler Email: jean-luc@... | LCARS - Linux
                      <>< WWW: http://jeanluc-picard.de | for Computers
                      IRC: jeanluc | on All Real
                      PGP public key available from Homepage! | Starships
                    • Kontra, Gergely
                      ... It will allow me to tell to vim, which template to load, the perl one, or the prolog one, if I start editing a new file. Gergo +-[Kontra, Gergely @
                      Message 10 of 23 , Mar 12, 2002
                      • 0 Attachment
                        >> >> If you edit both perl and prolog files, you don't want to set
                        >> >> filetype_pl, do you?
                        >> >>
                        >> >> And this problem stands for other filetypes, where the name is not
                        >> >> sufficient to determine filetype...
                        >> >
                        >> >In such cases, you always loose :-}
                        >>
                        >> Should I recommend to extend the sp and new and e commands to
                        >> optionally give the filetype?
                        >> I mean
                        >> :e myperl.pl perl
                        >> :sp myprolog.pl prolog
                        >
                        >Hm. Don't know, what does it buy you? And what goes wrong in
                        >turn?

                        It will allow me to tell to vim, which template to load, the perl one,
                        or the prolog one, if I start editing a new file.

                        Gergo

                        +-[Kontra, Gergely @ Budapest University of Technology and Economics]-+
                        | Email: kgergely@..., kgergely@... |
                        | URL: turul.eet.bme.hu/~kgergely Mobile: (+36 20) 356 9656 |
                        +-------"Olyan langesz vagyok, hogy poroltoval kellene jarnom!"-------+
                        .
                        Magyar php mirror es magyar php dokumentacio: http://hu.php.net
                      • Vince Negri
                        ... That could be done with a user Ex command... Vince
                        Message 11 of 23 , Mar 12, 2002
                        • 0 Attachment
                          > perhaps explicit filetype specification could be handled
                          >via

                          > :ef myperl.pl perl

                          >("edit with filetype")

                          That could be done with a user Ex command...

                          Vince
                        • Charles E. Campbell
                          ... How about sticky filetypes -- ie. if one is currently editing a perl file, barring explicit specification such as that shown above (:e myperl.pl perl),
                          Message 12 of 23 , Mar 12, 2002
                          • 0 Attachment
                            Thus saith Kontra, Gergely:
                            > >> Should I recommend to extend the sp and new and e commands to
                            > >> optionally give the filetype?
                            > >> I mean
                            > >> :e myperl.pl perl
                            > >> :sp myprolog.pl prolog
                            > >
                            > >Hm. Don't know, what does it buy you? And what goes wrong in
                            > >turn?
                            >
                            > It will allow me to tell to vim, which template to load, the perl one,
                            > or the prolog one, if I start editing a new file.
                            ---------------------------------------------------------------------

                            How about "sticky filetypes" -- ie. if one is currently editing
                            a perl file, barring explicit specification such as that shown
                            above (:e myperl.pl perl), assume perl, etc.

                            Personally I'd rather an extended :e handle multiple files (:e file1
                            file2 ....); perhaps explicit filetype specification could be handled
                            via

                            :ef myperl.pl perl

                            ("edit with filetype")

                            Regards,
                            Charles Campbell

                            --
                            Charles E Campbell, Jr, PhD _ __ __
                            Goddard Space Flight Center / /_/\_\_/ /
                            cec@... /_/ \/_//_/
                            PGP public key: http://www.erols.com/astronaut/pgp.html
                          Your message has been successfully submitted and would be delivered to recipients shortly.