home *** CD-ROM | disk | FTP | other *** search
- Date: 04/02/90 03:59:21 GMT+1
- From: TD12%DDAGSI3@clvm.clarkson.edu
- To: Freemacs users discussion list <freemacs@sun.soe.clarkson.edu>
- Subject: command history
-
- ========================================================================
-
- Here's a quick and dirty history package for Freemacs. It defines M-n and
- M-p to scroll the history stack in the minibuffer. (Up and Down Arrow do
- the same job). Other commands: list-command-history,
- edit-command-history, and read-command-history.
-
- It's not quite the same as the similar thing in GNU Emacs, it rather works
- like the command line editors from the PC world. But it should be quite
- useful anyway. It does not only record extended commands but all
- (accepted) input from the minibuffer. This was the easiest thing to do and
- is surely useful for extensive query-replace sessions.
-
- I hope it doesn't interfere with something Russ has in his mind for future
- releases ... :-}.
-
- *Please* report bugs and feel free to make suggestions.
-
- Enjoy it!
- -Thorsten
-
- Remark: Since I had to intercept the Freadline.XXX functions anyway, I saw
- no point in putting the stuff in the User library.
-
-
- Name:Freadline.C-m
- Accept the input.
- [*]#(ds,value,##(value)##(2nd-half))
- #(Fhistory-save,##(value))
- #(an)arg1
- [*]
-
-
- Name:Freadline.Return
- Return accepts the input.
- [*]#(ds,value,##(value)##(2nd-half))
- #(Fhistory-save,##(value))
- #(an)arg1
- [*]
-
-
- Name:Freadline.M-p
- [*]#(Fhistory-previous)
- #(ds,value,#(history.##(history-ptr)))
- again
- [*]
-
-
- Name:Freadline.Up Arrow
- [*]#(Freadline.M-p)[*]
-
-
- Name:Freadline.M-n
- [*]#(Fhistory-next)
- #(ds,value,#(history.##(history-ptr)))
- again
- [*]
-
- Name:Freadline.Down Arrow
- [*]#(Freadline.M-n)[*]
-
-
- Name:Fhistory-previous
- Go down the history stack.
- [*]#(g?,##(history-ptr),0,(
- #(ds,history-ptr,#(--,##(history-ptr),1))
- ),(
- #(ds,history-ptr,0)
- #(bl)
- ))[*]
-
-
- Name:Fhistory-next
- Go up the history stack.
- [*]#(g?,##(F-history-tos),##(history-ptr),(
- #(ds,history-ptr,#(++,##(history-ptr),1))
- ),(
- #(ds,history-ptr,##(F-history-tos))
- #(bl)
- ))[*]
-
-
- Name:Fhistory-save
- Store argument on top of the history stack, but only if it's longer than two
- characters and distinct from TOS. Go to TOS in any case.
- [*]#(ds,history-ptr,##(F-history-tos))
- #(g?,##(nc,arg1),2,(
- #(==,#(history.##(history-ptr)),arg1,,(
- #(ds,F-history-tos,#(++,##(F-history-tos),1))
- #(ds,history-ptr,##(F-history-tos))
- #(ds,history.##(history-ptr),arg1)
- ))
- ))[*]
-
- Name:F-history-tos
- Initialize top of history stack.
- [*]-1[*]
-
- Name:F:list-command-history
- [*]#(ds,history-ptr,0)
- #(ds,temp)
- #(Flist-command-history)
- #(Fmore)
- [*]
-
- Name:Flist-command-history
- [*]#(ds,temp,##(temp)#(history.##(history-ptr))(,))
- #(g?,##(F-history-tos),##(history-ptr),(
- #(Fhistory-next)
- #(SELF)
- ))[*]
-
- Name:F:edit-command-history
- Write command history in buffer.
- [*]#(ds,history-ptr,0)
- #(Ffind-or-make-buffer,*command-history*)
- #(Flocal-bind-key,K.C-c C-c,F:read-command-history)
- #(an,(To install changes, type C-c C-c))
- #(Fedit-command-history)
- [*]
-
- Name:Fedit-command-history
- [*]#(is,#(history.##(history-ptr))(
- ))
- #(g?,##(F-history-tos),##(history-ptr),(
- #(Fhistory-next)
- #(SELF)
- ))[*]
-
- Name:F:read-command-history
- Read command history from the current buffer.
- [*]#(sp,[)
- #(ds,history.0,##(rm,$))
- #(ds,history-ptr,0)
- #(ds,F-history-tos,0)
- #(Fread-command-history)
- #(ds,F-history-tos,##(history-ptr))
- [*]
-
- Name:Fread-command-history
- [*]#(Fhistory-save,##(rm,$))
- #(sp,$>)
- #(==,##(rm,>),,,(
- #(SELF)
- ))[*]
-
-