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

function popup for perl and emf files providing autocompletion

Expand Messages
  • dgroth@gmx.de
    hello, have you ever need to remember a function you were declaring at the same file some time ago ... some sophisticated ide s give you the possiblity to
    Message 1 of 1 , Feb 22, 2002
    • 0 Attachment
      hello,

      have you ever need to remember a function you were declaring at
      the same file some time ago ...

      some sophisticated ide's give you the possiblity to search in a popup
      menu between thousends of possible elongations ...

      here is a small script that allows you to select from previos declared
      functions in the same file to select the right one from the popup ...

      example lines for emf and perl-files are shown below ..
      other file-hooks can be also implemented (don't ask me for C/Cpp/Java...).

      regards and nice weekend ,
      Detlef

      ; user.emf
      0 define-macro sub-popup
      set-variable .found 0
      set-variable #l0 11000 ; dangerous is somebody is building here an other osd
      set-variable #l1 1 ; osd incrementor for item-additions
      set-alpha-mark "p"
      set-mark
      -1 search-backward "\\W"
      forward-char
      exchange-point-and-mark
      copy-region
      set-variable :popup-string &cat :sub-string @y
      ; at first destroy possible old items
      set-variable #l5 40 ; let's say there is a max of 40 functions ??
      !while &great #l5 1
      -1 osd #l0
      set-variable #l5 &dec #l5 1
      !done
      ; constant osd
      osd #l0 0 "b"
      set-alpha-mark "p"
      beginning-of-buffer
      !force search-forward :popup-string
      ; now search for functions
      ; beginning with the same letters
      !while $status
      set-variable .found 1
      backward-word
      set-mark
      forward-word
      exchange-point-and-mark
      copy-region
      set-variable #l2 @y
      end-of-line
      osd #l0 &pinc #l1 1 "" #l2 f sub-popup-insert-sub
      !force search-forward :popup-string
      !done
      goto-alpha-mark "p"
      if &equal .found 1
      #l0 osd 0 "ba" &add $cursor-x 1 &sub $cursor-y 1
      !endif
      !emacro

      0 define-macro sub-popup-insert-sub
      backward-kill-word
      execute-string $result
      !emacro

      ; myemf.emf
      set-variable :sub-string "^0? *define-macro +"
      buffer-bind-key "sub-popup" "A-space"

      ; myperl.emf

      et-variable :sub-string "^sub +"
      buffer-bind-key "sub-popup" "A-space"

      --
      Dr. Detlef Groth
      Max-Planck-Institut
      fuer Molekulare Genetik
      Ihnestr. 63/73
      D-14195 Berlin
      Tel.: + 49 30 - 8413 1235
      Email: dgroth@...
      Email: dgroth@...
    Your message has been successfully submitted and would be delivered to recipients shortly.