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

RE: [jasspa] some ME macros question

Expand Messages
  • Phillips, Steven
    1. &sin is equivalent, see help page for more details. 2. Yuo should probably use $buffer-fname and use &rsin . $buffer-fname to locate the last . , try
    Message 1 of 3 , Jul 23, 2008
    • 0 Attachment
      1. &sin is equivalent, see help page for more details.
       
      2. Yuo should probably use $buffer-fname and use &rsin "." $buffer-fname to locate the last '.', try executing the following macro code:
       
          !if &seq &set #l1 $buffer-fname ""
              set-variable #l1 $buffer-bname
          !endif
          !if &gre &set #l4 &rsin "." #l1 1
              set-variable #l2 &lef #l1 &sub #l4 1
              set-variable #l3 &rig #l1 &sub #l4 1
          !else
              set-variable #l2 #l1
              set-variable #l3 ""
          !endif
          ml-write &spr "File basename \"%s\", extension \"%s\"" #l2 #l3
      3) Not sure what you are trying to do here, but from the output of describe-binding command:
       
          "insert" ...................... 147 buffer-mode
      This binding is used to toggle overwrite mode and is bound to the insert key,
       
      Steve


      From: jasspa@yahoogroups.com [mailto:jasspa@yahoogroups.com] On Behalf Of Lechee.Lai
      Sent: 23 July 2008 13:58
      To: jasspa@yahoogroups.com
      Subject: [jasspa] some ME macros question

      since the first time using ME macros hope ME guys can share something
      for me
      1. is ME macros have function like strstr(...) position for first
      occurrence str

      2. how the get buffer extension, I only found $buffer-bname

      3. how to create buffer mode have own bind-key <retrun> for example
      I've trying buffer-bind- key but didn't active ... :-(

      Thanks
      Lechee

    • lechee lai
      petty help Steve, here is my fte.grp ... File: /usr/share/jasspa/macros/vgrep.emf 3:; Synopsis: vgrep command handling 11:define-macro vgrep 40:
      Message 2 of 3 , Jul 23, 2008
      • 0 Attachment
        petty help Steve,
        here is my fte.grp
        -----------------------------------------
        File: /usr/share/jasspa/macros/vgrep.emf
        3:; Synopsis: "vgrep" command handling
        11:define-macro vgrep
        40: pipe-shell-command &spr "vgrep --grep %s %s \\%s i" #l0 #l2 #l1
        File: /usr/share/jasspa/macros/hkgrp.emf
        16:;set-variable .fhook-grp.name "vGREP"
        --------------------------------------------
        so I've try my jkgrp.emf

        ; -!- emf -!-
        ; This is part of the JASSPA MicroEmacs macro files
        ; Copyright (C) 2000-2006 JASSPA (www.jasspa.com)
        ; See the file me.emf for copying and conditions.
        ;
        ; Created: 2oo8
        ; Synopsis: Hilighting for GRP files
        ; Authors: Lechee Lai
        ;
        ;
        !if ¬ &exi .hilight.grp
        set-variable .hilight.grp &pinc .hilight.next 1
        !endif

        ; buffer-init variables
        ;set-variable .fhook-grp.name "vGREP"
        ;set-variable .fhook-grp.command-kbind "|return|"
        ;$buffer-bhook

        !if &band .hilight.flags 0x02
        0 hilight .hilight.grp 0 $global-scheme
        ; Gnu grp utility, uses --context
        hilight .hilight.grp 0x101 "\\d+" .scheme.constant
        ; Common
        hilight .hilight.grp 0x102 "File" .scheme.comment

        !endif

        define-macro le-grp
        !if &seq $buffer-bname "fte.grp"
        set-variable #l0 &left @wl 5
        !if &seq #l0 "File:"
        set-variable #l2 @wl
        set-variable #l3 "FILE"
        !endif

        !if &seq #l3 "FILE"
        set-variable #l3 &right @wl 6
        ml-write #l3
        find-file #l3
        !else
        set-variable #l1 @wl
        !if &gre &set #l4 &rsin ":" #l1 1
        set-variable #l0 &lef #l1 &sub #l4 1
        !else
        set-variable #l2 #l1
        !endif
        ml-write #l0
        ; find filename
        set-variable #l9 "0"
        !repeat
        backward-line
        set-variable #l1 &left @wl 5
        !if &seq #l1 "File:"
        set-variable #l2 @wl
        set-variable #l3 "FILE"
        !if &seq #l3 "FILE"
        set-variable #l3 &right @wl 6
        ml-write #l3
        set-variable #l9 "FOUNDED"
        !endif
        !endif
        !until &seq #l9 "FOUNDED"
        !if &seq #l9 "FOUNDED"
        find-file #l3
        goto-line #l0
        !endif
        !endif
        !else
        newline
        !endif
        !emacro

        define-macro fhook-grp
        ; Set up the buffer modes
        -1 buffer-mode "time"
        !if &band .hilight.flags 0x02
        set-variable $buffer-hilight .hilight.grp
        !endif
        buffer-init-hooks
        !emacro

        global-bind-key "le-grp" "C-j"
        buffer-bind-key "le-grp" "return"

        buffer-init-fhook "grp"

        ------
        I've use another vlist vgrep.eml open the fte.grp
        define-macro vlist
        view-file "/home/foo/fte.grp"
        !emacro

        --------------------------------------
        here is dirty work,I want to use C-j instead key return in this fte.grp buffer I'm not clear how to hook return and unhook when leave the buffer :-)


        Lechee



        _______________________________________________________________________________________________________
        總會在某些時刻,突然想起舊情人?他 現在過得還好嗎?
        http://sev.search.yahoo.net
      Your message has been successfully submitted and would be delivered to recipients shortly.