Changeset 93d8a1 in git
- Timestamp:
- Jul 31, 1998, 10:04:32 AM (25 years ago)
- Branches:
- (u'spielwiese', '2fa36c576e6a4ddbb1093b43c7f8e9835e17e52a')
- Children:
- 2135c8a06a9817b86fc58aecf22ccade2ea478fe
- Parents:
- 564067c7ad8ba9c901a7d4d2059f976e1029afb2
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
emacs/singular.el
r564067c r93d8a1 1 1 ;;; singular.el --- Emacs support for Computer Algebra System Singular 2 2 3 ;; $Id: singular.el,v 1.1 3 1998-07-30 16:22:55 schmidtExp $3 ;; $Id: singular.el,v 1.14 1998-07-31 08:04:32 wichmann Exp $ 4 4 5 5 ;;; Commentary: … … 586 586 ;;}}} 587 587 588 ;;{{{ Simple section stuff for XEmacs 589 (defun singular-xemacs-simple-sec-create (type end) 590 "Create a new simple section of type TYPE. 591 Creates the section from end of previous simple section up to END. 592 END should be larger than `singular-simple-sec-last-end'. 593 Returns the new simple section or `empty' if no simple section has 594 been created. 595 Assumes that no narrowing is in effect. 596 Updates `singular-simple-sec-last-end'." 597 (let ((last-end (marker-position singular-simple-sec-last-end)) 598 ;; `simple-sec' is the new simple section or `empty' 599 simple-sec) 600 601 ;; get beginning of line before END. At this point we need that there 602 ;; are no restrictions. 603 (setq end (let ((old-point (point))) 604 (goto-char end) (beginning-of-line) 605 (prog1 (point) (goto-char old-point)))) 606 607 (cond 608 ;; do not create empty sections 609 ((eq end last-end) (setq simple-sec 'empty)) 610 ;; create only non-clear simple sections 611 ((not (eq type singular-simple-sec-clear-type)) 612 ;; if type has not changed we only have to extend the previous 613 ;; simple section 614 (setq simple-sec (singular-xemacs-simple-sec-before last-end)) 615 (if (eq type (singular-xemacs-simple-sec-type simple-sec)) 616 ;; move existing extent 617 (setq simple-sec (set-extent-endpoints simple-sec 618 (extent-start-position simple-sec) end)) 619 ;; create new extent 620 (setq simple-sec (make-extent last-end end)) 621 ;; set type property 622 (set-extent-property simple-sec 'singular-type type) 623 ;; set face 624 (set-extent-property simple-sec 'face (singular-lookup-face type))))) 625 626 ;; update end of last simple section 627 (set-marker singular-simple-sec-last-end end) 628 simple-sec)) 629 630 (defun singular-xemacs-simple-sec-reset-last (pos) 631 "Reset end of last simple section to POS after accidental extension. 632 Updates `singular-simple-sec-last-end', too." 633 (let ((simple-sec (singular-xemacs-simple-sec-at pos))) 634 (if simple-sec 635 (set-extent-endpoints simple-sec (extent-start-position simple-sec) pos)) 636 (set-marker singular-simple-sec-last-end pos))) 637 638 (defun singular-xemacs-simple-sec-start (simple-sec) 639 "Return start of non-clear simple section SIMPLE-SEC." 640 (extent-start-position simple-sec)) 641 642 (defun singular-xemacs-simple-sec-end (simple-sec) 643 "Return end of non-clear simple section SIMPLE-SEC." 644 (extent-end-position simple-sec)) 645 646 (defun singular-xemacs-simple-sec-start-at (pos) 647 "Return start of clear section at position POS. 648 Assumes that no narrowing is in effect." 649 (let ((previous-extent-change (1+ (point)))) 650 ;; this `while' loop at last will run into the end of the next 651 ;; non-clear extent or stop at bob. Since POS may be right at the end 652 ;; of a previous non-clear location, we have to search at least one 653 ;; time from POS+1 backwards. 654 (while (not (or (singular-xemacs-simple-sec-before previous-extent-change) 655 (eq previous-extent-change (point-min)))) 656 (setq previous-extent-change 657 (previous-extent-change previous-extent-change))) 658 previous-extent-change)) 659 660 (defun singular-xemacs-simple-sec-end-at (pos) 661 "Return end of clear section at position POS. 662 Assumes that no narrowing is in effect." 663 (let ((next-extent-change (next-extent-change (point)))) 664 ;; this `while' loop at last will run into the beginning of the next 665 ;; non-clear extent or stop at eob. Since POS may not be at the 666 ;; beginning of a non-clear simple section we may start searching 667 ;; immediately. 668 (while (not (or (singular-xemacs-simple-sec-at next-extent-change) 669 (eq next-extent-change (point-max)))) 670 (setq next-extent-change 671 (next-extent-change next-extent-change))) 672 next-extent-change)) 673 674 (defun singular-xemacs-simple-sec-type (simple-sec) 675 "Return type of SIMPLE-SEC." 676 (if simple-sec 677 (extent-property simple-sec 'singular-type) 678 singular-simple-sec-clear-type)) 679 680 (defun singular-xemacs-simple-sec-at (pos) 681 "Return simple section at position POS." 682 (map-extents (function (lambda (ext args) ext)) 683 ;; is this pos-pos-region OK? I think so. 684 (current-buffer) pos pos nil nil 'singular-type)) 685 686 (defun singular-xemacs-simple-sec-before (pos) 687 "Return simple section before position POS. 688 This is the same as `singular-simple-section-at' except if POS falls 689 on a section border. In this case `singular-simple-section-before' 690 returns the previous simple section instead of the current one." 691 (singular-xemacs-simple-sec-at (max 1 (1- pos)))) 692 693 (defun singular-xemacs-simple-sec-in (beg end) 694 "Return a list of all simple sections intersecting with the region from BEG to END. 695 A simple section intersects the region if the section and the region 696 have at least one character in common. 697 The result contains both clear and non-clear simple sections in the 698 order they appear in the region." 699 ;; NOT READY 700 nil) 701 ;;}}} 702 588 703 ;;{{{ Section stuff 589 704
Note: See TracChangeset
for help on using the changeset viewer.