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

435Re: [jasspa] improved buffer popup: ordered by file extension

Expand Messages
  • dgroth@gmx.de
    Aug 22, 2001
    • 0 Attachment
      So finally I got it working, here is the ordered buffer-popup using the
      user registry. It is similar to the right-mouse-click quick open
      function but only shows already opened buffers.

      This function emulates the gnu-emacs-lisp-function (msb.el,
      about 1000 lines of elisp-code) in less than 100 lines of emf-code.
      You can customize the file extensions via Help->User Setup->File types....

      OS tested: win2000, linux

      regards, Detlef

      add in your <user>.emf
      define-macro-file dgbuffer dg-buffer-popup
      global-bind-key "dg-buffer-popup" "C-mouse-pick-1" ; like in gnu-emacs
      global-bind-key "dg-buffer-popup" "C-mouse-drop-1"

      ; dgbuffer.emf start
      define-macro dg-buffer-popup
      !if ¬ &exi .osd.dgroth-buffer
      set-variable .osd.dgroth-buffer &pinc .osd.next 1 ; buffer-main
      set-variable .osd.dgroth-buffer-starfiles &pinc .osd.next 1 ; buffer with *
      osd .osd.dgroth-buffer 0 "b"
      osd .osd.dgroth-buffer 1 "Mde" "&*-files" .osd.dgroth-buffer-starfiles
      osd .osd.dgroth-buffer 2 "-"
      set-variable #l0 &cat ® "/history" "file-type" "\b" "All files\b"
      set-variable #l1 &cat ® "/history" "file-mask" "\b" ".*\b"
      set-variable :counter 1
      set-variable :osd-file-counter 11000
      !while ¬ &seq &lget #l0 :counter ""
      set-variable #l3 &lget #l0 :counter
      set-variable #l4 &lget #l1 :counter
      set-variable .osd.files :osd-file-counter
      osd .osd.dgroth-buffer &pinc :osd-file-counter 3 "Mde" #l3 .osd.files
      process-submenu #l3 #l4
      set-variable :counter &inc :counter 1
      .osd.dgroth-buffer osd 0 "ba" &add $cursor-x 1 &sub $cursor-y 1
      define-macro process-submenu
      set-variable :regex &cat &cat "," @2 ","
      !if ¬ &isin "All files" @1
      filemask-to-regex :regex
      -1 osd .osd.files
      osd .osd.files 0 "b"
      set-variable :fileflag 0
      set-variable $buffer-names ".*"
      !while ¬ &seq &set #l0 $buffer-names ""
      ; a hack for 5 possible fileendings
      !if &xisequal #l0 &lget :regex 1
      set-variable :fileflag &inc :fileflag 1
      osd .osd.files :fileflag "" #l0 f dg-buffer-osd-goto
      !elif &xisequal #l0 &lget :regex 2
      ; 300 ml-write "something is equal"
      set-variable :fileflag &inc :fileflag 1
      osd .osd.files :fileflag "" #l0 f dg-buffer-osd-goto
      !elif &xisequal #l0 &lget :regex 3
      set-variable :fileflag &inc :fileflag 1
      osd .osd.files :fileflag "" #l0 f dg-buffer-osd-goto
      !elif &xisequal #l0 &lget :regex 4
      set-variable :fileflag &inc :fileflag 1
      osd .osd.files :fileflag "" #l0 f dg-buffer-osd-goto
      !elif &xisequal #l0 &lget :regex 5
      set-variable :fileflag &inc :fileflag 1
      osd .osd.files :fileflag "" #l0 f dg-buffer-osd-goto
      !if &equ :fileflag 0
      osd .osd.files 1 "" "None found"

      define-macro process-starfiles
      -1 osd .osd.dgroth-buffer-starfiles
      osd .osd.dgroth-buffer-starfiles 0 "b"
      set-variable :star-file 1
      set-variable $buffer-names ".*"
      !while ¬ &seq &set #l0 $buffer-names ""
      !if &seq &lef #l0 1 "*"
      set-variable :star-file &inc :star-file 1
      osd .osd.dgroth-buffer-starfiles :star-file "" #l0 f dg-buffer-osd-goto
      !if &equ :star-file 1
      osd .osd.dgroth-buffer-starfiles 1 "" "None found"
      0 define-macro dg-buffer-osd-goto
      find-buffer $result

      ; end dgbuffer.emf
      >this works well,
      >so I should build the menus on the fly using two nested while's
      >(OK one while, one goto -- nested while's are in ME impossible - a
      >pitty ...) getting the infos from the registry. After studying osd.emf
      >this seems to be possible, however I am still confused by these #l0,
      >#l1, #l2, etc vars. It's difficult to manage so it takes a little bit
      >time to understand the code ...
      >But what is @# ??? It is used a lot but not described in the docs.

      Dr. Detlef Groth
      Neue Scheune 5
      14548 Ferch
      Tel. 033209-80278
      e-mail: dgroth@...
    • Show all 10 messages in this topic