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

[jasspa] Re: Syntax-hilighting for Info-Browsing

Expand Messages
  • Detlef Groth
    Jon, My problem was in the beginning that the info-files does not start with the `File: but with the `This is info file ... statement. I was a victim of this
    Message 1 of 7 , Dec 13, 1999
    • 0 Attachment
      Jon,

      My problem was in the beginning that the info-files does not start with the `File:' but with the `This is info file'... statement. I was a victim of this narrowing ME-features which are difficult to understand but great to use.

      I was adding some filehooks (see below) to allow also syntax-hilighting for info-files currently not in info-mode. The hilighting is now really great and should be work sufficently well. It is a pleasure to read info-files. You can even use bookmarks...

      There is only one problem still with not working links if they contain regular expressions like:
      `* What is Bash?:: A short description of Bash.'
      To find this info I have to set-a bookmark, jump to any link then jump-to-the bookmark just unnarrowing the buffer and searching for the regexpression string. Or alternativly change the node and the link names to something nonregexpressiones like `C++' to `Cpp'. May be this can be also used in a more convinient way.

      It follows your and my changes in my info.emf file.

      ;To hilight the .info and also the dir file
      add-file-hook ".info dir " fhook-info ; Info-files
      ;To hilight all info files without the extension .info
      ;but starting with the text "This is info file..
      -2 add-file-hook "This is Info file" fhook-info

      !if &seq .hilight.info "ERROR"
      set-variable .hilight.info &pinc .hilight.next 1
      !endif
      0 hilight .hilight.info 0 $global-scheme
      ; just for headers substrikes
      hilight .hilight.info 2 "^*\\*\\*" .scheme.header
      hilight .hilight.info 2 "^===" .scheme.header
      hilight .hilight.info 2 "^---" .scheme.header
      ; Menus, appear at the start of the line and extend to
      ; a colon or double colon character.
      hilight .hilight.info 0 "^*\\{[^:]*\\}:" .scheme.link
      ; I would prefere not to label the whoole line
      hilight .hilight.info 1 "^File:" .scheme.link
      hilight .hilight.info 1 "Node:" .scheme.link
      hilight .hilight.info 1 "Next:" .scheme.link
      hilight .hilight.info 1 "Prev:" .scheme.link
      hilight .hilight.info 1 "Up:" .scheme.link
      ; your note-feature was not working at my machine so I use...
      hilight .hilight.info 0x44 "*Note" "*Note" ":" ":" "" .scheme.link
      ; Formatting
      hilight .hilight.info 0x44 "`" "" "'" "" "" .scheme.bold
      hilight .hilight.info 1 "* Menu:" .scheme.header

      0 define-macro fhook-info
      set-variable $buffer-hilight .hilight.info
      ; execute user extensions if enabled
      !if &exist my-fhook-info
      my-fhook-info
      !endif
      !emacro

      Put together the best...and stay informed...

      best regards,
      Detlef

      At 18:54 11.12.99 +0000, you wrote:
      >Detlef,
      >
      > You are right - this needs to be done.
      >
      > The trick here is that we do not need to use a hook file because
      > the info macros (in info.emf) generate their own buffers
      > internally. Hence we force the hilighting to be applied when we
      > create the buffer for the info. Therefore the hilighting is
      > defined and used within this file only.
      >
      > I picked up on what you were trying to hilight, the 'bold'
      > encoding is probably best done with the look-back enabled. I've
      > kept this short (10 lines), which seems to be more than reasonable
      > - arguably it is too generous !!
      >
      > I was not quite sure what the "^=" is, I have not come across any
      > of these - so no support for that in here :-(
      >
      > The changes that I have made to the "info.emf" are below - this
      > seems to work OK.
      >
      > NOTE: The changes are for the *LATEST* Novemeber '99 release only,
      > because they use the new hilighting scheme variables. If you
      > are using a previous release then the hilighting will have
      > to be changed accordingly.
      >
      >Regards
      >Jon
      >
      >cd c:/text/
      >diff --context --minimal --ignore-space-change --report-identical-files --recursive "C:/Program Files/JASSPA/MicroEmacs/macros/info.emf.orig" "C:/Program Files/JASSPA/MicroEmacs/macros/info.emf"
      >
      >*** C:/Program Files/JASSPA/MicroEmacs/macros/info.emf.orig Tue Aug 24 08:24:40 1999
      >--- C:/Program Files/JASSPA/MicroEmacs/macros/info.emf Sat Dec 11 18:32:41 1999
      >***************
      >*** 3,9 ****
      > ; Author : $Author$
      > ; Created By : Steven Phillips
      > ; Created : Fri Apr 23 13:14:46 1999
      >! ; Last Modified : <991211.1846>
      > ;
      > ; Description
      > ;
      >--- 3,9 ----
      > ; Author : $Author$
      > ; Created By : Steven Phillips
      > ; Created : Fri Apr 23 13:14:46 1999
      >! ; Last Modified : <991211.1832>
      > ;
      > ; Description
      > ;
      >***************
      >*** 17,22 ****
      >--- 17,45 ----
      > set-variable .osd.info-help &pinc .osd.next 1
      > !endif
      >
      >+ ; Quick check to make sure that hilighting is required.
      >+ !if &band .hilight.flags 0x02
      >+ !if ¬ &exist .hilight.info
      >+ set-variable .hilight.info &pinc .hilight.next 1
      >+ !endif
      >+
      >+ ; Make the hilighting look back (10 lines) and case insensitive
      >+ 0 hilight .hilight.info 3 10 $global-scheme
      >+
      >+ ; First line of the file is the menu line always commences
      >+ ; with File:, hilight the whole line here.
      >+ hilight .hilight.info 2 "^File:" .scheme.link
      >+ ; Menus, appear at the start of the line and extend to
      >+ ; a colon or double colon character.
      >+ hilight .hilight.info 0 "^*\\{[^:]*\\}:" .scheme.link
      >+ ; Notes appear embedded in text and may span multiple
      >+ ; lines, again these are branches.
      >+ hilight .hilight.info 4 "*note" ":" "" .scheme.link
      >+ ; Hilighted items are in a open/close quote pairs, these
      >+ ; can span multiple lines so use a branch.
      >+ hilight .hilight.info 0x4 "`" "'" "" .scheme.bold
      >+ !endif
      >+
      > 0 define-macro fhook-info
      > !emacro
      >
      >***************
      >*** 142,147 ****
      >--- 165,174 ----
      > !endif
      > -1 buffer-mode "edit"
      > 1 buffer-mode "view"
      >+ ; Force hilighting on the buffer
      >+ !if &band .hilight.flags 0x02
      >+ set-variable $buffer-hilight .hilight.info
      >+ !endif
      > beginning-of-buffer
      > buffer-bind-key info-jump-link "return"
      > 1 buffer-bind-key info-jump-link "n"
      >[EXIT]
      >
      >
      <snip>
    • Jon Green
      Detlef, Sorry, I understand what you are doing now - I did something else !! If you also add the following:- ; Hide the special characters. hilight
      Message 2 of 7 , Dec 13, 1999
      • 0 Attachment
        Detlef,

        Sorry, I understand what you are doing now - I did
        something else !!

        If you also add the following:-

        ; Hide the special characters.
        hilight .hilight.info 64 "\x7f" " --> " .scheme.link
        hilight .hilight.info 64 "\x1f" "--- Page Break ---" .scheme.bold

        Then you can make the special characters a little
        more palatable. Change the text replacement to suite
        your requirements.

        Regards
        Jon.

        Detlef Groth wrote:
        >
        > Jon,
        >
        > My problem was in the beginning that the info-files does not start with the `File:' but with the `This is info file'... statement. I was a victim of this narrowing ME-features which are difficult to understand but great to use.
        >
        > I was adding some filehooks (see below) to allow also syntax-hilighting for info-files currently not in info-mode. The hilighting is now really great and should be work sufficently well. It is a pleasure to read info-files. You can even use bookmarks...
        >
        > There is only one problem still with not working links if they contain regular expressions like:
        > `* What is Bash?:: A short description of Bash.'
        > To find this info I have to set-a bookmark, jump to any link then jump-to-the bookmark just unnarrowing the buffer and searching for the regexpression string. Or alternativly change the node and the link names to something nonregexpressiones like `C++' to `Cpp'. May be this can be also used in a more convinient way.
        >
        > It follows your and my changes in my info.emf file.
        >
        > ;To hilight the .info and also the dir file
        > add-file-hook ".info dir " fhook-info ; Info-files
        > ;To hilight all info files without the extension .info
        > ;but starting with the text "This is info file..
        > -2 add-file-hook "This is Info file" fhook-info
        >
        > !if &seq .hilight.info "ERROR"
        > set-variable .hilight.info &pinc .hilight.next 1
        > !endif
        > 0 hilight .hilight.info 0 $global-scheme
        > ; just for headers substrikes
        > hilight .hilight.info 2 "^*\\*\\*" .scheme.header
        > hilight .hilight.info 2 "^===" .scheme.header
        > hilight .hilight.info 2 "^---" .scheme.header
        > ; Menus, appear at the start of the line and extend to
        > ; a colon or double colon character.
        > hilight .hilight.info 0 "^*\\{[^:]*\\}:" .scheme.link
        > ; I would prefere not to label the whoole line
        > hilight .hilight.info 1 "^File:" .scheme.link
        > hilight .hilight.info 1 "Node:" .scheme.link
        > hilight .hilight.info 1 "Next:" .scheme.link
        > hilight .hilight.info 1 "Prev:" .scheme.link
        > hilight .hilight.info 1 "Up:" .scheme.link
        > ; your note-feature was not working at my machine so I use...
        > hilight .hilight.info 0x44 "*Note" "*Note" ":" ":" "" .scheme.link
        > ; Formatting
        > hilight .hilight.info 0x44 "`" "" "'" "" "" .scheme.bold
        > hilight .hilight.info 1 "* Menu:" .scheme.header
        >
        > 0 define-macro fhook-info
        > set-variable $buffer-hilight .hilight.info
        > ; execute user extensions if enabled
        > !if &exist my-fhook-info
        > my-fhook-info
        > !endif
        > !emacro
        >
        > Put together the best...and stay informed...
        >
        > best regards,
        > Detlef
        >
        > At 18:54 11.12.99 +0000, you wrote:
        > >Detlef,
        > >
        > > You are right - this needs to be done.
        > >
        > > The trick here is that we do not need to use a hook file because
        > > the info macros (in info.emf) generate their own buffers
        > > internally. Hence we force the hilighting to be applied when we
        > > create the buffer for the info. Therefore the hilighting is
        > > defined and used within this file only.
        > >
        > > I picked up on what you were trying to hilight, the 'bold'
        > > encoding is probably best done with the look-back enabled. I've
        > > kept this short (10 lines), which seems to be more than reasonable
        > > - arguably it is too generous !!
        > >
        > > I was not quite sure what the "^=" is, I have not come across any
        > > of these - so no support for that in here :-(
        > >
        > > The changes that I have made to the "info.emf" are below - this
        > > seems to work OK.
        > >
        > > NOTE: The changes are for the *LATEST* Novemeber '99 release only,
        > > because they use the new hilighting scheme variables. If you
        > > are using a previous release then the hilighting will have
        > > to be changed accordingly.
        > >
        > >Regards
        > >Jon
        > >
        > >cd c:/text/
        > >diff --context --minimal --ignore-space-change --report-identical-files --recursive "C:/Program Files/JASSPA/MicroEmacs/macros/infoo.emf.orig" "C:/Program Files/JASSPA/MicroEmacs/macros/info.emf"
        > >
        > >*** C:/Program Files/JASSPA/MicroEmacs/macros/info.emf.orig Tue Aug 24 08:24:40 1999
        > >--- C:/Program Files/JASSPA/MicroEmacs/macros/info.emf Sat Dec 11 18:32:41 1999
        > >***************
        > >*** 3,9 ****
        > > ; Author : $Author$
        > > ; Created By : Steven Phillips
        > > ; Created : Fri Apr 23 13:14:46 1999
        > >! ; Last Modified : <991211.1846>
        > > ;
        > > ; Description
        > > ;
        > >--- 3,9 ----
        > > ; Author : $Author$
        > > ; Created By : Steven Phillips
        > > ; Created : Fri Apr 23 13:14:46 1999
        > >! ; Last Modified : <991211.1832>
        > > ;
        > > ; Description
        > > ;
        > >***************
        > >*** 17,22 ****
        > >--- 17,45 ----
        > > set-variable .osd.info-help &pinc .osd.next 1
        > > !endif
        > >
        > >+ ; Quick check to make sure that hilighting is required.
        > >+ !if &band .hilight.flags 0x02
        > >+ !if ¬ &exist .hilight.info
        > >+ set-variable .hilight.info &pinc .hilight.next 1
        > >+ !endif
        > >+
        > >+ ; Make the hilighting look back (10 lines) and case insensitive
        > >+ 0 hilight .hilight.info 3 10 $global-scheme
        > >+
        > >+ ; First line of the file is the menu line always commences
        > >+ ; with File:, hilight the whole line here.
        > >+ hilight .hilight.info 2 "^File:" .scheme.link
        > >+ ; Menus, appear at the start of the line and extend to
        > >+ ; a colon or double colon character.
        > >+ hilight .hilight.info 0 "^*\\{[^:]*\\}:" .scheme.link
        > >+ ; Notes appear embedded in text and may span multiple
        > >+ ; lines, again these are branches.
        > >+ hilight .hilight.info 4 "*note" ":" "" .scheme.link
        > >+ ; Hilighted items are in a open/close quote pairs, these
        > >+ ; can span multiple lines so use a branch.
        > >+ hilight .hilight.info 0x4 "`" "'" "" .scheme.bold
        > >+ !endif
        > >+
        > > 0 define-macro fhook-info
        > > !emacro
        > >
        > >***************
        > >*** 142,147 ****
        > >--- 165,174 ----
        > > !endif
        > > -1 buffer-mode "edit"
        > > 1 buffer-mode "view"
        > >+ ; Force hilighting on the buffer
        > >+ !if &band .hilight.flags 0x02
        > >+ set-variable $buffer-hilight .hilight.info
        > >+ !endif
        > > beginning-of-buffer
        > > buffer-bind-key info-jump-link "return"
        > > 1 buffer-bind-key info-jump-link "n"
        > >[EXIT]
        > >
        > >
        > <snip>
        >
        > ------------------------------------------------------------------------
        > __________________________________________________________________________
        >
        > This is an unmoderated list. JASSPA is not responsible for the content of
        >
        > any material posted to this list.
        >
        > ------------------------------------------------------------------------
        > Don’t have the time or patience to search for unique
        > products & services? Then click to let us find them for you.
        > You Request, We Respond. http://clickhere.egroups.com/click/1957
        >
        > eGroups.com Home: http://www.egroups.com/group/jasspa/
        > http://www.egroups.com - Simplifying group communications
      • Steven Phillips
        ... The following diff log should fix the above problem, I say should because I ve not tested this (don t know where What is Bash? is). The line numbers may
        Message 3 of 7 , Dec 13, 1999
        • 0 Attachment
          > There is only one problem still with not working links if they contain regular
          > expressions like: `* What is Bash?:: A short description of Bash.' To find
          > this info I have to set-a bookmark, jump to any link then jump-to-the bookmark
          > just unnarrowing the buffer and searching for the regexpression string. Or
          > alternativly change the node and the link names to something
          > nonregexpressiones like `C++' to `Cpp'. May be this can be also used in a more
          > convinient way.

          The following diff log should fix the above problem, I say should because I've
          not tested this (don't know where "What is Bash?" is). The line numbers may be
          different depending on the version of your info.emf.

          Steve
          ------------------------------------------------------------------------------

          *** /home/stevenp/me/macros/info.emf.~0~ Sun Dec 12 19:01:08 1999
          --- /home/stevenp/me/macros/info.emf Tue Dec 14 07:18:44 1999
          ***************
          *** 480,486 ****
          !if &seq #l0 ""
          set-variable #l0 "Top"
          !endif
          ! var-str-sub #l0 "\\" "\\\\"
          !force search-forward &spr "^File: .* Node:[ \t]+%s[,\n]" #l0
          !if ¬ $status
          !if &seq #l0 "Top"
          --- 480,486 ----
          !if &seq #l0 ""
          set-variable #l0 "Top"
          !endif
          ! str-to-regex #l0
          !force search-forward &spr "^File: .* Node:[ \t]+%s[,\n]" #l0
          !if ¬ $status
          !if &seq #l0 "Top"
        Your message has been successfully submitted and would be delivered to recipients shortly.