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

Zap to chararcter macro

Expand Messages
  • neeraj
    Hi All I am new to jasspa esp its macro lang (new as in a week old). I love the editor its fast and small and its emacs. One thing I am missing dearly is the
    Message 1 of 3 , Feb 9, 2010
    • 0 Attachment
      Hi All
      I am new to jasspa esp its macro lang (new as in a week old). I love the editor its fast and small and its emacs.

      One thing I am missing dearly is the zap to character (Meta-z) in emacs. It should not be overly complicated to write one, I was wondering if anyone has hacked it already or has any pointers.

      Thanks
      neeraj
    • Steven Phillips
      This should do what you what, copy this into your user emf file... Steve ... define-macro zap !force set-variable #l0 @1 !if ¬ $status set-variable #l0 @mc
      Message 2 of 3 , Feb 9, 2010
      • 0 Attachment
        This should do what you what, copy this into your user emf file...

        Steve

        ----- zap macro ----------------------
        define-macro zap
          !force set-variable #l0 @1
          !if &not $status
            set-variable #l0 @mc "Zap to char: "
          !elif &sub &len #l0 1
            ml-write "[Error: invalid argument, must be a single char]"
            !abort
          !endif
          set-mark
          !if &les @# 0
            !force !force &abs @# search-buffer "bM" #l0
          !else
            !force !force &abs @# search-buffer "M" #l0
          !endif
          !if &not $status
            ml-write &spr "[Search for '%s' failed]" #l0
            !abort
          !endif
          kill-region
        !emacro
        --------------- end -------------------

        neeraj wrote:
         

        Hi All
        I am new to jasspa esp its macro lang (new as in a week old). I love the editor its fast and small and its emacs.

        One thing I am missing dearly is the zap to character (Meta-z) in emacs. It should not be overly complicated to write one, I was wondering if anyone has hacked it already or has any pointers.

        Thanks
        neeraj

      • lechee lai
        ; a quick hack try this :-) define-macro zap set-variable #l0 @ml1 zap-char: !if &less &len #l0 1 ml-write Cancel! !return !endif !if ¬ &xse @wc #l0
        Message 3 of 3 , Feb 9, 2010
        • 0 Attachment
          ; a quick hack try this :-)
          define-macro zap
          set-variable #l0 @ml1 "zap-char:" ""
          !if &less &len #l0 1
          ml-write "Cancel!"
          !return
          !endif
          !if ¬ &xse @wc #l0
          !while ¬ &sin @wc #l0
          forward-delete-char
          !done
          forward-delete-char
          !endif
          !emacro


          ___________________________________________________
          您的生活即時通 - 溝通、娛樂、生活、工作一次搞定!
          http://messenger.yahoo.com.tw/
        Your message has been successfully submitted and would be delivered to recipients shortly.