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

Re: single file history

Expand Messages
  • Lechee.Lai
    dirty work for single file history ... define-macro save-history set-variable #l9 &spr %s %s n $buffer-fname $window-line set-variable #l7 $buffer-fname
    Message 1 of 3 , Dec 12, 2009
    • 0 Attachment
      dirty work for single file history
      ---
      define-macro save-history
      set-variable #l9 &spr "%s %s\n" $buffer-fname $window-line
      set-variable #l7 $buffer-fname
      set-variable #l8 &cat $home ".jasspa/history.est"
      find-file #l8
      beginning-of-buffer
      ;;; find the duplicate file replace it otherwise just insert
      !force 0 search-forward &cat "^" #l7 &cat " [0-9].*"
      !if $status
      beginning-of-line
      1 kill-line
      beginning-of-line
      !else
      beginning-of-buffer
      !endif
      insert-string #l9
      0 save-buffer
      0 delete-buffer $buffer-bname
      !emacro

      define-macro le-quit
      set-variable #l0 $buffer-fname
      set-variable #l1 0
      next-buffer
      !if &xse $buffer-fname ".*[^/]"
      save-history
      !endif
      set-variable #l9 0
      !repeat
      !if ¬ &seq $buffer-fname #l0
      next-buffer
      !if &xse $buffer-fname ".*[^/]"
      save-history
      !endif
      !endif
      ;; stupid method prevent dead lock
      set-variable #l8 &inc #l9 1
      !if &seq #l8 "10"
      set-variable #l0 $buffer-fname
      !endif
      !until &seq #l0 $buffer-fname
      save-buffers-exit-emacs
      !emacro

      0 define-macro le-goto-line
      set-variable #l0 $buffer-fname
      set-variable #l1 &cat $home ".jasspa/history.est"
      find-file #l1
      beginning-of-buffer
      !force 0 search-forward &cat "^" #l0
      !if $status
      set-variable #l2 $window-col
      set-variable #l3 &rig @wl &inc #l2 1
      !force 0 delete-buffer $buffer-bname
      goto-line #l3
      !else
      !force 0 delete-buffer $buffer-bname
      !endif
      !emacro
      -----
      following add inside me.emf
      >>>>
      define-macro start-up
      set-variable #l0 $buffer-fname
      set-variable #l1 &cat $home ".jasspa/history.est"
      find-file #l1
      beginning-of-buffer
      !force 0 search-forward &cat "^" #l0
      !if $status
      set-variable #l2 $window-col
      set-variable #l3 &rig @wl &inc #l2 1
      !force 0 delete-buffer $buffer-bname
      goto-line #l3
      !else
      !force 0 delete-buffer $buffer-bname
      !endif
      !emacro

      <<<< the only problem is conflict with session
      don't know it's session start or history match
    Your message has been successfully submitted and would be delivered to recipients shortly.