- Timestamp:
- Jul 6, 2007, 12:03:02 PM (17 years ago)
- Location:
- branches/ide-1.0/ccl/hemlock/src
- Files:
-
- 11 edited
-
doccoms.lisp (modified) (10 diffs)
-
echo.lisp (modified) (1 diff)
-
echocoms.lisp (modified) (2 diffs)
-
filecoms.lisp (modified) (1 diff)
-
lispmode.lisp (modified) (3 diffs)
-
listener.lisp (modified) (5 diffs)
-
macros.lisp (modified) (2 diffs)
-
modeline.lisp (modified) (1 diff)
-
morecoms.lisp (modified) (2 diffs)
-
rompsite.lisp (modified) (1 diff)
-
searchcoms.lisp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/ide-1.0/ccl/hemlock/src/doccoms.lisp
r6698 r6790 63 63 :help "Name of command to look for.") 64 64 (let ((bindings (command-bindings cmd))) 65 (with-pop-up-display (s )65 (with-pop-up-display (s :title (format nil "Bindings of ~s" nam)) 66 66 (cond 67 67 ((null bindings) … … 91 91 (attr (find-containing str *character-attribute-names*))) 92 92 (if (or coms vars attr) 93 (apropos-command-output str coms vars attr) 94 (with-pop-up-display (s :height 1) 95 (format s "No command, attribute or variable name contains ~S." 96 str))))) 93 (apropos-command-output str coms vars attr) 94 (message "No command, attribute or variable name contains ~S." str)))) 97 95 98 96 (defun apropos-command-output (str coms vars attr) 99 97 (declare (list coms vars attr)) 100 (with-pop-up-display (s )98 (with-pop-up-display (s :title "Apropos Output") 101 99 (when coms 102 100 (format s "Commands with ~S in their names:~%" str) … … 156 154 :help "Name of a command to document.") 157 155 (let ((bindings (command-bindings com))) 158 (with-pop-up-display (s )156 (with-pop-up-display (s :title (format nil "~s command documentation" nam)) 159 157 (format s "Documentation for ~S:~% ~A~%" 160 158 nam (command-documentation com)) … … 191 189 (write-char #\space *echo-area-stream*) 192 190 (cond ((commandp res) 193 (with-pop-up-display (s )191 (with-pop-up-display (s :title "Key documentation") 194 192 (hemlock-ext:print-pretty-key (copy-seq hi::*prompt-key*) s) 195 193 (format s " is bound to ~S.~%" (command-name res)) … … 203 201 (return))))))) 204 202 (setf (current-window) old-window)))) 205 206 (defcommand "Describe Pointer" (p)207 "Describe commands with any key binding that contains a \"mouse\" character208 (modified or not). Does not describe the command \"Illegal\"."209 "Describe commands with any key binding that contains a \"mouse\" character210 (modified or not). Does not describe the command \"Illegal\"."211 (declare (ignore p))212 (let ((illegal-command (getstring "Illegal" *command-names*)))213 (with-pop-up-display (s)214 (dolist (cmd (get-mouse-commands))215 (unless (eq cmd illegal-command)216 (format s "Documentation for ~S:~% ~A~%"217 (command-name cmd)218 (command-documentation cmd))219 (write-line220 "This can be invoked in the following ways:" s)221 (write-string " " s)222 (print-command-bindings (command-bindings cmd) s)223 (terpri s) (terpri s))))))224 225 (defun get-mouse-commands ()226 (let ((result nil))227 (do-strings (name cmd *command-names* result)228 (declare (ignore name))229 (dolist (b (command-bindings cmd))230 (let ((key (car b)))231 (declare (simple-vector key))232 (when (dotimes (i (length key) nil)233 (when (member (hemlock-ext:make-key-event (svref key i))234 (list #k"Leftdown" #k"Leftup" #k"Middledown"235 #k"Middleup" #k"Rightdown" #k"Rightup"))236 (push cmd result)237 (return t)))238 (return)))))))239 203 240 204 … … 283 247 (function (funcall doc :full)) 284 248 (simple-string 285 (with-pop-up-display (s )249 (with-pop-up-display (s :title (format nil "~s documentation" nam)) 286 250 (format s "Documentation for ~S:~% ~A" nam doc))) 287 251 (t (error "Bad documentation: ~S" doc)))) … … 300 264 :help "Name of variable to describe." 301 265 :prompt "Variable: ") 302 (with-pop-up-display (s )266 (with-pop-up-display (s :title (format nil "~S Variable documentation")) 303 267 (show-variable s name var)))) 304 268 … … 312 276 :help "Name of variable to describe." 313 277 :prompt "Variable: ") 314 (with-pop-up-display (s )278 (with-pop-up-display (s :title (format nil "~s" name)) 315 279 (format s "Documentation for ~S:~% ~A~&~%" 316 280 name (variable-documentation var)) … … 350 314 :default 351 315 (car (buffer-modes (current-buffer))))))) 352 (with-pop-up-display (s )316 (with-pop-up-display (s :title (format nil "~A mode" name)) 353 317 (format s "~A mode description:~%" name) 354 318 (let ((doc (mode-documentation name))) … … 383 347 "Display the last 60 characters typed." 384 348 (declare (ignore p)) 385 (with-pop-up-display (s : height 7)349 (with-pop-up-display (s :title (format nil "The last ~d characters typed") :height 7) 386 350 (let ((num (ring-length *key-event-history*))) 387 351 (format s "The last ~D characters typed:~%" num) -
branches/ide-1.0/ccl/hemlock/src/echo.lisp
r6769 r6790 754 754 (let ((help (if (listp help) 755 755 (apply #'format nil help) help))) 756 (with-pop-up-display (s )756 (with-pop-up-display (s :title "Help") 757 757 (write-string help s) 758 758 (fresh-line s) -
branches/ide-1.0/ccl/hemlock/src/echocoms.lisp
r6 r6790 71 71 ((eq *parse-type* :keyword) 72 72 (let ((strings (find-all-completions input *parse-string-tables*))) 73 (with-pop-up-display (s : height (+ (length strings) 2))73 (with-pop-up-display (s :title "input help" :height (+ (length strings) 2)) 74 74 (write-line help s) 75 75 (cond (strings … … 84 84 *parse-default*))) 85 85 (declare (list pns)) 86 (with-pop-up-display(s : height (+ (length pns) 2))86 (with-pop-up-display(s :title "Completion help" :height (+ (length pns) 2)) 87 87 (write-line help s) 88 88 (cond (pns -
branches/ide-1.0/ccl/hemlock/src/filecoms.lisp
r6770 r6790 46 46 \"Mode\" mode option is specified, then this tries to invoke the appropriate 47 47 file type hook." 48 (#_NSLog #@"processing file options")49 48 (let* ((string 50 49 (line-string (mark-line (buffer-start-mark buffer)))) -
branches/ide-1.0/ccl/hemlock/src/lispmode.lisp
r6772 r6790 1754 1754 (values (ignore-errors (string pkgname)))))))))))))) 1755 1755 1756 (defparameter *previous-in-package-search-pattern* 1757 (new-search-pattern :string-insensitive :backward "in-package" nil)) 1758 1759 (defun package-at-mark (start-mark) 1760 (let* ((pattern *previous-in-package-search-pattern*) 1761 (mark (copy-mark start-mark :temporary))) 1762 (with-mark ((start mark) 1763 (end mark) 1764 (list-end mark)) 1765 (loop 1766 (unless (find-pattern mark pattern) 1767 (return)) 1768 (pre-command-parse-check mark) 1769 (when (valid-spot mark t) 1770 (move-mark end mark) 1771 (when (form-offset end 1) 1772 (move-mark start end) 1773 (when (backward-up-list start) 1774 (move-mark list-end start) 1775 (unless (and (list-offset list-end 1) 1776 (mark<= list-end start-mark)) 1777 (return)) 1778 (when (scan-char start :lisp-syntax :constituent) 1779 (unless (or (mark= mark start) 1780 (let* ((s (nstring-upcase (region-to-string (region start end)))) 1781 (*package* (find-package "CL-USER"))) 1782 (eq (ignore-errors (values (read-from-string s))) 1783 'in-package))) 1784 (return)) 1785 (unless (form-offset end 1) (format t "~& worse") (return 4)) 1786 (move-mark start end) 1787 (form-offset start -1) 1788 (return 1789 (if (eql (next-character start) #\") 1790 (progn 1791 (character-offset start 1) 1792 (character-offset end -1) 1793 (region-to-string (region start end))) 1794 (let* ((pkgname (ignore-errors (values (read-from-string (region-to-string (region start end))))))) 1795 (if pkgname 1796 (values (ignore-errors (string pkgname))))))))))))))) 1797 1756 1798 (defun ensure-buffer-package (buffer) 1757 1799 (or (variable-value 'current-package :buffer buffer) … … 1767 1809 "The package used for evaluation of Lisp in this buffer." 1768 1810 :buffer buffer 1769 :value nil1811 :value "CL-USER" 1770 1812 :hooks (list 'package-name-change-hook)))) 1771 1813 … … 1847 1889 (return nil))))))))) 1848 1890 1891 #|| 1849 1892 (defcommand "Set Package Name" (p) 1850 1893 (variable-value 'current-package :buffer buffer) 1851 1894 ||# -
branches/ide-1.0/ccl/hemlock/src/listener.lisp
r6773 r6790 659 659 `(cond ((not (symbolp ,var)) 660 660 (,error-name "~S is not a symbol." ,var)) 661 ((special-operator-p ,var) ,var) 661 662 ((macro-function ,var)) 662 ((fboundp ,var) 663 (if (listp (symbol-function ,var)) 664 ,var 665 (symbol-function ,var))) 663 ((fboundp ,var)) 666 664 (t 667 665 (,error-name "~S is not a function." ,var)))) … … 680 678 (let* ((sym (read s)) 681 679 (fun (function-to-describe sym editor-error))) 682 (with-pop-up-display (*standard-output* )680 (with-pop-up-display (*standard-output* :title (format nil "~s" sym)) 683 681 (editor-describe-function fun sym))))))) 684 682 … … 694 692 (let ((thing (read s))) 695 693 (if (symbolp thing) 696 (with-pop-up-display (*standard-output* )694 (with-pop-up-display (*standard-output* :title (format nil "~s" thing)) 697 695 (describe thing)) 698 696 (if (and (consp thing) … … 700 698 (eq (car thing) 'function)) 701 699 (symbolp (cadr thing))) 702 (with-pop-up-display (*standard-output* )700 (with-pop-up-display (*standard-output* :title (format nil "~s" (cadr thing))) 703 701 (describe (cadr thing))) 704 702 (editor-error "~S is not a symbol, or 'symbol, or #'symbol." … … 740 738 :help "Expression to evaluate to get object to describe.")) 741 739 (obj (eval exp))) 742 (with-pop-up-display (*standard-output* )740 (with-pop-up-display (*standard-output* :title (format nil "~s" exp)) 743 741 (describe obj))))) 744 742 -
branches/ide-1.0/ccl/hemlock/src/macros.lisp
r6774 r6790 549 549 550 550 551 (defmacro with-pop-up-display ((var &key height (buffer-name "Random Typeout"))551 (defmacro with-pop-up-display ((var &key height title) 552 552 &body body) 553 (declare (ignore buffer-name))554 555 553 556 554 "Execute body in a context with var bound to a stream. Output to the stream … … 562 560 (let ((stream (gensym))) 563 561 `(let () 564 (let ((,stream (ccl::typeout-stream )))562 (let ((,stream (ccl::typeout-stream ,title))) 565 563 (clear-output ,stream) 566 564 (unwind-protect -
branches/ide-1.0/ccl/hemlock/src/modeline.lisp
r6694 r6790 129 129 :buffer buffer))) 130 130 (if val 131 (if (find-package val) 131 132 (format nil "~A: " val) 132 " ")) 133 (format nil "?~A?: " val)) 134 " ")) 133 135 " "))) 134 136 -
branches/ide-1.0/ccl/hemlock/src/morecoms.lisp
r6775 r6790 255 255 256 256 257 (defcommand "List Buffers" (p) 258 "Show a list of all buffers. 259 If the buffer is modified then a * is displayed before the name. If there 260 is an associated file then it's name is displayed last. With prefix 261 argument, only list modified buffers." 262 "Display the names of all buffers in a with-random-typeout window." 263 (with-pop-up-display (s) 264 (do-strings (n b *buffer-names*) 265 (declare (simple-string n)) 266 (unless (or (eq b *echo-area-buffer*) 267 (assoc b *random-typeout-buffers* :test #'eq)) 268 (let ((modified (buffer-modified b)) 269 (buffer-pathname (buffer-pathname b))) 270 (when (or (not p) modified) 271 (write-char (if modified #\* #\space) s) 272 (if buffer-pathname 273 (format s "~A ~25T~A~:[~68T~A~;~]~%" 274 (file-namestring buffer-pathname) 275 (directory-namestring buffer-pathname) 276 (string= (pathname-to-buffer-name buffer-pathname) n) 277 n) 278 (format s "~A~68T~D Line~:P~%" 279 n (count-lines (buffer-region b)))))))))) 280 281 (defcommand "Select Random Typeout Buffer" (p) 282 "Select last random typeout buffer." 283 "Select last random typeout buffer." 284 (declare (ignore p)) 285 (if *random-typeout-buffers* 286 (change-to-buffer (caar *random-typeout-buffers*)) 287 (editor-error "There are no random typeout buffers."))) 288 289 290 (defcommand "Room" (p) 291 "Display stats on allocated storage." 292 "Run Room into a With-Random-Typeout window." 293 (declare (ignore p)) 294 (with-pop-up-display (*standard-output*) 295 (room))) 257 296 258 297 259 … … 662 624 663 625 664 (defcommand "View Page Directory" (p) 665 "Print a listing of the first non-blank line after each page mark 666 in a pop-up window." 667 "Print a listing of the first non-blank line after each page mark 668 in a pop-up window." 669 (declare (ignore p)) 670 (let ((dir (page-directory (current-buffer)))) 671 (declare (list dir)) 672 (with-pop-up-display (s :height (1+ (the fixnum (length dir)))) 673 (display-page-directory s dir)))) 674 675 (defcommand "Insert Page Directory" (p) 676 "Insert a listing of the first non-blank line after each page mark at 677 the beginning of the buffer. A mark is dropped before going to the 678 beginning of the buffer. If an argument is supplied, insert the page 679 directory at point." 680 "Insert a listing of the first non-blank line after each page mark at 681 the beginning of the buffer." 682 (let ((point (current-point))) 683 (unless p 684 (push-buffer-mark (copy-mark point)) 685 (buffer-start point)) 686 (push-buffer-mark (copy-mark point)) 687 (display-page-directory (make-hemlock-output-stream point :full) 688 (page-directory (current-buffer)))) 689 (setf (last-command-type) :ephemerally-active)) 690 691 (defun display-page-directory (stream directory) 692 "This writes the list of strings, directory, to stream, enumerating them 693 in a field of three characters. The number and string are separated by 694 two spaces, and the first line contains headings for the numbers and 695 strings columns." 696 (write-line "Page First Non-blank Line" stream) 697 (do ((dir directory (cdr dir)) 698 (count 1 (1+ count))) 699 ((null dir)) 700 (declare (fixnum count)) 701 (format stream "~3D " count) 702 (write-line (car dir) stream))) 703 704 (defun page-directory (buffer) 705 "Return a list of strings where each is the first non-blank line 706 following a :page-delimiter in buffer." 707 (with-mark ((m (buffer-point buffer))) 708 (buffer-start m) 709 (let ((end-of-buffer (buffer-end-mark buffer)) result) 710 (loop ;over pages. 711 (loop ;for first non-blank line. 712 (cond ((not (blank-after-p m)) 713 (let* ((str (line-string (mark-line m))) 714 (len (length str))) 715 (declare (simple-string str)) 716 (push (if (and (> len 1) 717 (= (character-attribute :page-delimiter 718 (schar str 0)) 719 1)) 720 (subseq str 1) 721 str) 722 result)) 723 (unless (page-offset m 1) 724 (return-from page-directory (nreverse result))) 725 (when (mark= m end-of-buffer) 726 (return-from page-directory (nreverse result))) 727 (return)) 728 ((not (line-offset m 1 0)) 729 (return-from page-directory (nreverse result))) 730 ((= (character-attribute :page-delimiter (next-character m)) 731 1) 732 (push "" result) 733 (mark-after m) 734 (return)))))))) 735 736 737 (defcommand "Previous Page" (p) 738 "Move to the beginning of the current page. 739 With prefix argument move that many pages." 740 "Move backward P pages." 741 (let ((point (current-point))) 742 (unless (page-offset point (- (or p 1))) 743 (editor-error "No such page.")) 744 (line-start (move-mark (window-display-start (current-window)) point)))) 745 746 (defcommand "Next Page" (p) 747 "Move to the beginning of the next page. 748 With prefix argument move that many pages." 749 "Move forward P pages." 750 (let ((point (current-point))) 751 (unless (page-offset point (or p 1)) 752 (editor-error "No such page.")) 753 (line-start (move-mark (window-display-start (current-window)) point)))) 754 755 (defcommand "Mark Page" (p) 756 "Put point at beginning, mark at end of current page. 757 With prefix argument, mark the page that many pages after the current one." 758 "Mark the P'th page after the current one." 759 (let ((point (current-point))) 760 (if p 761 (unless (page-offset point (1+ p)) (editor-error "No such page.")) 762 (page-offset point 1)) ;If this loses, we're at buffer-end. 763 (with-mark ((m point)) 764 (unless (page-offset point -1) 765 (editor-error "No such page.")) 766 (push-buffer-mark (copy-mark m) t) 767 (line-start (move-mark (window-display-start (current-window)) point))))) 768 769 (defun page-offset (mark n) 770 "Move mark past n :page-delimiters that are in the zero'th line position. 771 If a :page-delimiter is the immediately next character after mark in the 772 appropriate direction, then skip it before starting." 773 (cond ((plusp n) 774 (find-attribute mark :page-delimiter #'zerop) 775 (dotimes (i n mark) 776 (unless (next-character mark) (return nil)) 777 (loop 778 (unless (find-attribute mark :page-delimiter) 779 (return-from page-offset nil)) 780 (unless (mark-after mark) 781 (return (if (= i (1- n)) mark))) 782 (when (= (mark-charpos mark) 1) (return))))) 783 (t 784 (reverse-find-attribute mark :page-delimiter #'zerop) 785 (prog1 786 (dotimes (i (- n) mark) 787 (unless (previous-character mark) (return nil)) 788 (loop 789 (unless (reverse-find-attribute mark :page-delimiter) 790 (return-from page-offset nil)) 791 (mark-before mark) 792 (when (= (mark-charpos mark) 0) (return)))) 793 (let ((buffer (line-buffer (mark-line mark)))) 794 (unless (or (not buffer) (mark= mark (buffer-start-mark buffer))) 795 (mark-after mark))))))) 796 797 798 799 800 ;;;; Counting some stuff 801 802 (defcommand "Count Lines Page" (p) 803 "Display number of lines in current page and position within page. 804 With prefix argument do on entire buffer." 805 "Count some lines, Man." 806 (let ((point (current-point))) 807 (if p 808 (let ((r (buffer-region (current-buffer)))) 809 (count-lines-function "Buffer" (region-start r) point (region-end r))) 810 (with-mark ((m1 point) 811 (m2 point)) 812 (unless (and (= (character-attribute :page-delimiter 813 (previous-character m1)) 814 1) 815 (= (mark-charpos m1) 1)) 816 (page-offset m1 -1)) 817 (unless (and (= (character-attribute :page-delimiter 818 (next-character m2)) 819 1) 820 (= (mark-charpos m2) 0)) 821 (page-offset m2 1)) 822 (count-lines-function "Page" m1 point m2))))) 823 824 (defun count-lines-function (msg start mark end) 825 (let ((before (1- (count-lines (region start mark)))) 826 (after (count-lines (region mark end)))) 827 (message "~A: ~D lines, ~D/~D" msg (+ before after) before after))) 626 828 627 829 628 (defcommand "Count Lines" (p) -
branches/ide-1.0/ccl/hemlock/src/rompsite.lisp
r781 r6790 753 753 (declare (ignorable sym)) 754 754 (describe fun) 755 #+GBNIL 756 (when (and (compiled-function-p fun) 757 (not (eq (kernel:%function-name (kernel:%closure-function fun)) 758 sym))) 759 (let ((doc (documentation sym 'function))) 760 (when doc 761 (format t "~&Function documentation for ~S:" sym) 762 (setf (lisp::indenting-stream-stream *editor-describe-stream*) 763 *standard-output*) 764 (ext:indenting-further *editor-describe-stream* 2 765 (fresh-line *editor-describe-stream*) 766 (write-string doc *editor-describe-stream*)))))) 755 (let ((doc (documentation sym 'function))) 756 (when doc 757 (format *standard-output* "~%Function documentation for ~S:~&~%" sym) 758 (write-string doc *standard-output*)))) 759 767 760 768 761 -
branches/ide-1.0/ccl/hemlock/src/searchcoms.lisp
r2100 r6790 543 543 (unless (line-offset mark 1 0) 544 544 (return)))) 545 (with-pop-up-display (s :height (length matching-lines) )545 (with-pop-up-display (s :height (length matching-lines) :title (format nil "Lines matching ~s" string)) 546 546 (dolist (line matching-lines) 547 547 (write-line line s)))))
Note:
See TracChangeset
for help on using the changeset viewer.
