home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / p / plbin.zip / pl / lisp / qpdelete.el < prev    next >
Lisp/Scheme  |  1992-05-26  |  4KB  |  139 lines

  1. ;;;  SCCS: @(#)89/11/20 qpdelete.el    2.2
  2. ;;;            Quintus Prolog - GNU Emacs Interface
  3. ;;;                         Support Functions
  4. ;;;
  5. ;;;                       Sitaram Muralidhar
  6. ;;;
  7. ;;;                   sitaram@quintus.com
  8. ;;;              Quintus Computer Systems, Inc.
  9. ;;;                  2 May 1989       
  10. ;;;
  11. ;;; This file defines functions that support the Quintus Prolog - GNU Emacs
  12. ;;; interface.
  13. ;;;
  14. ;;;                   Acknowledgements
  15. ;;;
  16. ;;;
  17. ;;; This interface was made possible by contributions from Fernando
  18. ;;; Pereira and various customers of Quintus Computer Systems, Inc.,
  19. ;;; based on code for Quintus's Unipress Emacs interface.
  20.  
  21. ;;  The functions in this file are:
  22. ;;
  23. ;   1) qp-backward-kill-character
  24. ;   2) qp-backward-kill-word
  25. ;   3) qp-kill-character
  26. ;   4) qp-kill-word
  27. ;   5) qp-kill-lines
  28. ;   6) qp-backward-kill-sentence
  29. ;   7) qp-kill-sentence
  30. ;   8) qp-kill-region
  31. ;;  The only one not being handled is ESC C-k - kill sexp,
  32. ;;  and is the only key sequence that can delete the prolog prompt.
  33. ;;
  34.  
  35. ;---------------------------------------------------------------------------
  36.  
  37. (defun qp-backward-kill-character (arg)
  38.   (interactive "p")
  39.   (set-mark (point))
  40.   (error-occurred (backward-char arg))
  41.   (qp-kill-region)
  42. )
  43.  
  44. ;---------------------------------------------------------------------------
  45.  
  46. (defun qp-backward-kill-word (arg)
  47.   (interactive "p")
  48.   (set-mark (point))
  49.   (error-occurred (forward-word (- arg)))
  50.   (qp-kill-region)
  51. )
  52.  
  53.  
  54. ;---------------------------------------------------------------------------
  55.  
  56. (defun qp-kill-character (arg)
  57.   (interactive "p")
  58.   (cond ((eobp)
  59.      (message "Use ^C^D to send an end-of-file signal"))
  60.     (t (set-mark (point))
  61.        (error-occurred (forward-char arg))
  62.        (qp-kill-region))
  63.   )
  64. )
  65.  
  66. ;---------------------------------------------------------------------------
  67.  
  68. (defun qp-kill-word (arg)
  69.   (interactive "p")
  70.   (set-mark (point))
  71.   (error-occurred (forward-word arg))
  72.   (qp-kill-region)
  73. )
  74.  
  75. ;---------------------------------------------------------------------------
  76.  
  77. (defun qp-kill-lines (arg)
  78.   (interactive "p")
  79.   (set-mark (point))
  80.   (error-occurred (forward-line arg))
  81.   (qp-kill-region)
  82. )
  83.  
  84. ;---------------------------------------------------------------------------
  85.  
  86. (defun qp-bacward-kill-sentence (arg)
  87.   (interactive "p")
  88.   (set-mark (point))
  89.   (error-occurred (backward-sentence arg))
  90.   (qp-kill-region)
  91. )
  92.  
  93. ;---------------------------------------------------------------------------
  94.  
  95. (defun qp-kill-sentence (arg)
  96.   (interactive "p")
  97.   (set-mark (point))
  98.   (error-occurred (forward-sentence arg))
  99.   (qp-kill-region)
  100. )
  101.  
  102.  
  103. ;---------------------------------------------------------------------------
  104. ; returns the character position of the newline immediately before the
  105. ; current Prolog prompt
  106.  
  107. (defun &qpfind-ln-start ()
  108.   (save-excursion        
  109.     (goto-char 
  110.       (process-mark (get-buffer-process "*prolog*")))
  111.     (beginning-of-line)
  112. ;    (backward-char)
  113.     (setq ans (dot))
  114.   )
  115.   ans
  116. )
  117.  
  118. ;---------------------------------------------------------------------------
  119.  
  120. (defun qp-kill-region ()
  121.   (interactive)
  122.   (let ((prompt-start (&qpfind-ln-start)))
  123.     (cond ((or (and (>= (dot)
  124.             (process-mark (get-buffer-process "*prolog*")))
  125.             (>= (mark) 
  126.             (process-mark (get-buffer-process "*prolog*")))
  127.            )
  128.            (and (<= (dot) prompt-start)
  129.             (<= (mark) prompt-start)
  130.            )
  131.        )
  132.            (kill-region (mark) (point)))
  133.       (t (message "Cannot delete the Prolog prompt")
  134.          (goto-char 
  135.            (process-mark (get-buffer-process "*prolog*"))))
  136.     )
  137.    )
  138. )
  139.