comparison src/oct-hist.cc @ 3332:7c03933635c6

[project @ 1999-11-02 06:57:12 by jwe]
author jwe
date Tue, 02 Nov 1999 06:57:16 +0000
parents 4964d5391acc
children 15cddaacbc2d
comparison
equal deleted inserted replaced
3331:13cdcb7e5066 3332:7c03933635c6
532 532
533 unlink (name.c_str ()); 533 unlink (name.c_str ());
534 } 534 }
535 535
536 DEFUN_TEXT (edit_history, args, , 536 DEFUN_TEXT (edit_history, args, ,
537 "edit_history [first] [last]\n\ 537 "-*- texinfo -*-\n\
538 \n\ 538 @deffn {Command} edit_history options\n\
539 edit commands from the history list") 539 If invoked with no arguments, @code{edit_history} allows you to edit the\n\
540 history list using the editor named by the variable @code{EDITOR}. The\n\
541 commands to be edited are first copied to a temporary file. When you\n\
542 exit the editor, Octave executes the commands that remain in the file.\n\
543 It is often more convenient to use @code{edit_history} to define functions \n\
544 rather than attempting to enter them directly on the command line.\n\
545 By default, the block of commands is executed as soon as you exit the\n\
546 editor. To avoid executing any commands, simply delete all the lines\n\
547 from the buffer before exiting the editor.\n\
548 \n\
549 The @code{edit_history} command takes two optional arguments specifying\n\
550 the history numbers of first and last commands to edit. For example,\n\
551 the command\n\
552 \n\
553 @example\n\
554 edit_history 13\n\
555 @end example\n\
556 \n\
557 @noindent\n\
558 extracts all the commands from the 13th through the last in the history\n\
559 list. The command\n\
560 \n\
561 @example\n\
562 edit_history 13 169\n\
563 @end example\n\
564 \n\
565 @noindent\n\
566 only extracts commands 13 through 169. Specifying a larger number for\n\
567 the first command than the last command reverses the list of commands\n\
568 before placing them in the buffer to be edited. If both arguments are\n\
569 omitted, the previous command in the history list is used.\n\
570 @end deffn\n\
571 ")
540 { 572 {
541 octave_value_list retval; 573 octave_value_list retval;
542 574
543 int argc = args.length () + 1; 575 int argc = args.length () + 1;
544 576
551 583
552 return retval; 584 return retval;
553 } 585 }
554 586
555 DEFUN_TEXT (history, args, , 587 DEFUN_TEXT (history, args, ,
556 "history [N] [-w file] [-r file] [-q]\n\ 588 "-*- texinfo -*-\n\
557 \n\ 589 @deffn {Command} history options\n\
558 display, save, or load command history") 590 If invoked with no arguments, @code{history} displays a list of commands\n\
591 that you have executed. Valid options are:\n\
592 \n\
593 @table @code\n\
594 @item -w @var{file}\n\
595 Write the current history to the file @var{file}. If the name is\n\
596 omitted, use the default history file (normally @file{~/.octave_hist}).\n\
597 \n\
598 @item -r @var{file}\n\
599 Read the file @var{file}, replacing the current history list with its\n\
600 contents. If the name is omitted, use the default history file\n\
601 (normally @file{~/.octave_hist}).\n\
602 \n\
603 @item @var{N}\n\
604 Only display the most recent @var{N} lines of history.\n\
605 \n\
606 @item -q\n\
607 Don't number the displayed lines of history. This is useful for cutting\n\
608 and pasting commands if you are using the X Window System.\n\
609 @end table\n\
610 \n\
611 For example, to display the five most recent commands that you have\n\
612 typed without displaying line numbers, use the command\n\
613 @kbd{history -q 5}.\n\
614 @end deffn\n\
615 ")
559 { 616 {
560 octave_value_list retval; 617 octave_value_list retval;
561 618
562 int argc = args.length () + 1; 619 int argc = args.length () + 1;
563 620
570 627
571 return retval; 628 return retval;
572 } 629 }
573 630
574 DEFUN_TEXT (run_history, args, , 631 DEFUN_TEXT (run_history, args, ,
575 "run_history [first] [last]\n\ 632 "-*- texinfo -*-\n\
576 \n\ 633 @deffn {Command} run_history [first] [last]\n\
577 run commands from the history list") 634 Similar to @code{edit_history}, except that the editor is not invoked,\n\
635 and the commands are simply executed as they appear in the history list.\n\
636 @end deffn\n\
637 ")
578 { 638 {
579 octave_value_list retval; 639 octave_value_list retval;
580 640
581 int argc = args.length () + 1; 641 int argc = args.length () + 1;
582 642
642 702
643 void 703 void
644 symbols_of_oct_hist (void) 704 symbols_of_oct_hist (void)
645 { 705 {
646 DEFVAR (history_file, default_history_file (), history_file, 706 DEFVAR (history_file, default_history_file (), history_file,
647 "name of command history file"); 707 "-*- texinfo -*-\n\
708 @defvr {Built-in Variable} history_file\n\
709 This variable specifies the name of the file used to store command\n\
710 history. The default value is @code{\"~/.octave_hist\"}, but may be\n\
711 overridden by the environment variable @code{OCTAVE_HISTFILE}.\n\
712 @end defvr\n\
713 ");
648 714
649 double tmp_hist_size = default_history_size (); 715 double tmp_hist_size = default_history_size ();
650 716
651 DEFVAR (history_size, tmp_hist_size, history_size, 717 DEFVAR (history_size, tmp_hist_size, history_size,
652 "number of commands to save in the history list"); 718 "-*- texinfo -*-\n\
719 @defvr {Built-in Variable} history_size\n\
720 This variable specifies how many entries to store in the history file.\n\
721 The default value is @code{1024}, but may be overridden by the\n\
722 environment variable @code{OCTAVE_HISTSIZE}.\n\
723 @end defvr\n\
724 ");
653 725
654 DEFVAR (saving_history, 1.0, saving_history, 726 DEFVAR (saving_history, 1.0, saving_history,
655 "save command history"); 727 "-*- texinfo -*-\n\
728 @defvr {Built-in Variable} saving_history\n\
729 If the value of @code{saving_history} is nonzero, command entered\n\
730 on the command line are saved in the file specified by the variable\n\
731 @code{history_file}.\n\
732 @end defvr\n\
733 ");
656 } 734 }
657 735
658 /* 736 /*
659 ;;; Local Variables: *** 737 ;;; Local Variables: ***
660 ;;; mode: C++ *** 738 ;;; mode: C++ ***