Mercurial > emacs
annotate lisp/calc/calc-trail.el @ 43977:633c9f5b4b14
(describe-char-after): Use `internal-describe-syntax-value' again.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Sun, 17 Mar 2002 21:51:26 +0000 |
parents | fcd507927105 |
children | f4d68f97221e |
rev | line source |
---|---|
41271
fcd507927105
Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
1 ;;; calc-trail.el --- functions for manipulating the Calc "trail" |
fcd507927105
Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
2 |
41047
73f364fd8aaa
Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents:
40785
diff
changeset
|
3 ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc. |
41271
fcd507927105
Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
4 |
fcd507927105
Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
5 ;; Author: David Gillespie <daveg@synaptics.com> |
fcd507927105
Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
6 ;; Maintainer: Colin Walters <walters@debian.org> |
40785 | 7 |
8 ;; This file is part of GNU Emacs. | |
9 | |
10 ;; GNU Emacs is distributed in the hope that it will be useful, | |
11 ;; but WITHOUT ANY WARRANTY. No author or distributor | |
12 ;; accepts responsibility to anyone for the consequences of using it | |
13 ;; or for whether it serves any particular purpose or works at all, | |
14 ;; unless he says so in writing. Refer to the GNU Emacs General Public | |
15 ;; License for full details. | |
16 | |
17 ;; Everyone is granted permission to copy, modify and redistribute | |
18 ;; GNU Emacs, but only under the conditions described in the | |
19 ;; GNU Emacs General Public License. A copy of this license is | |
20 ;; supposed to have been given to you along with GNU Emacs so you | |
21 ;; can know your rights and responsibilities. It should be in a | |
22 ;; file named COPYING. Among other things, the copyright notice | |
23 ;; and this notice must be preserved on all copies. | |
24 | |
41271
fcd507927105
Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
25 ;;; Commentary: |
40785 | 26 |
41271
fcd507927105
Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
27 ;;; Code: |
40785 | 28 |
29 ;; This file is autoloaded from calc-ext.el. | |
30 (require 'calc-ext) | |
31 | |
32 (require 'calc-macs) | |
33 | |
34 (defun calc-Need-calc-trail () nil) | |
35 | |
36 | |
37 ;;; Trail commands. | |
38 | |
39 (defun calc-trail-in () | |
40 (interactive) | |
41 (let ((win (get-buffer-window (calc-trail-display t)))) | |
41047
73f364fd8aaa
Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents:
40785
diff
changeset
|
42 (and win (select-window win)))) |
40785 | 43 |
44 (defun calc-trail-out () | |
45 (interactive) | |
46 (calc-select-buffer) | |
47 (let ((win (get-buffer-window (current-buffer)))) | |
48 (if win | |
49 (progn | |
50 (select-window win) | |
51 (calc-align-stack-window)) | |
41047
73f364fd8aaa
Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents:
40785
diff
changeset
|
52 (calc)))) |
40785 | 53 |
54 (defun calc-trail-next (n) | |
55 (interactive "p") | |
56 (calc-with-trail-buffer | |
57 (forward-line n) | |
41047
73f364fd8aaa
Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents:
40785
diff
changeset
|
58 (calc-trail-here))) |
40785 | 59 |
60 (defun calc-trail-previous (n) | |
61 (interactive "p") | |
62 (calc-with-trail-buffer | |
63 (forward-line (- n)) | |
41047
73f364fd8aaa
Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents:
40785
diff
changeset
|
64 (calc-trail-here))) |
40785 | 65 |
66 (defun calc-trail-first (n) | |
67 (interactive "p") | |
68 (calc-with-trail-buffer | |
69 (goto-char (point-min)) | |
70 (forward-line n) | |
41047
73f364fd8aaa
Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents:
40785
diff
changeset
|
71 (calc-trail-here))) |
40785 | 72 |
73 (defun calc-trail-last (n) | |
74 (interactive "p") | |
75 (calc-with-trail-buffer | |
76 (goto-char (point-max)) | |
77 (forward-line (- n)) | |
41047
73f364fd8aaa
Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents:
40785
diff
changeset
|
78 (calc-trail-here))) |
40785 | 79 |
80 (defun calc-trail-scroll-left (n) | |
81 (interactive "P") | |
82 (let ((curwin (selected-window))) | |
83 (calc-with-trail-buffer | |
84 (unwind-protect | |
85 (progn | |
86 (select-window (get-buffer-window (current-buffer))) | |
87 (calc-scroll-left n)) | |
41047
73f364fd8aaa
Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents:
40785
diff
changeset
|
88 (select-window curwin))))) |
40785 | 89 |
90 (defun calc-trail-scroll-right (n) | |
91 (interactive "P") | |
92 (let ((curwin (selected-window))) | |
93 (calc-with-trail-buffer | |
94 (unwind-protect | |
95 (progn | |
96 (select-window (get-buffer-window (current-buffer))) | |
97 (calc-scroll-right n)) | |
41047
73f364fd8aaa
Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents:
40785
diff
changeset
|
98 (select-window curwin))))) |
40785 | 99 |
100 (defun calc-trail-forward (n) | |
101 (interactive "p") | |
102 (calc-with-trail-buffer | |
103 (forward-line (* n (1- (window-height)))) | |
41047
73f364fd8aaa
Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents:
40785
diff
changeset
|
104 (calc-trail-here))) |
40785 | 105 |
106 (defun calc-trail-backward (n) | |
107 (interactive "p") | |
108 (calc-with-trail-buffer | |
109 (forward-line (- (* n (1- (window-height))))) | |
41047
73f364fd8aaa
Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents:
40785
diff
changeset
|
110 (calc-trail-here))) |
40785 | 111 |
112 (defun calc-trail-isearch-forward () | |
113 (interactive) | |
114 (calc-with-trail-buffer | |
115 (save-window-excursion | |
116 (select-window (get-buffer-window (current-buffer))) | |
117 (let ((search-exit-char ?\r)) | |
118 (isearch-forward))) | |
41047
73f364fd8aaa
Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents:
40785
diff
changeset
|
119 (calc-trail-here))) |
40785 | 120 |
121 (defun calc-trail-isearch-backward () | |
122 (interactive) | |
123 (calc-with-trail-buffer | |
124 (save-window-excursion | |
125 (select-window (get-buffer-window (current-buffer))) | |
126 (let ((search-exit-char ?\r)) | |
127 (isearch-backward))) | |
41047
73f364fd8aaa
Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents:
40785
diff
changeset
|
128 (calc-trail-here))) |
40785 | 129 |
130 (defun calc-trail-yank (arg) | |
131 (interactive "P") | |
132 (calc-wrapper | |
133 (or arg (calc-set-command-flag 'hold-trail)) | |
134 (calc-enter-result 0 "yank" | |
135 (calc-with-trail-buffer | |
136 (if arg | |
137 (forward-line (- (prefix-numeric-value arg)))) | |
138 (if (or (looking-at "Emacs Calc") | |
139 (looking-at "----") | |
140 (looking-at " ? ? ?[^ \n]* *$") | |
141 (looking-at "..?.?$")) | |
142 (error "Can't yank that line")) | |
143 (if (looking-at ".*, \\.\\.\\., ") | |
144 (error "Can't yank (vector was abbreviated)")) | |
145 (forward-char 4) | |
146 (search-forward " ") | |
147 (let* ((next (save-excursion (forward-line 1) (point))) | |
148 (str (buffer-substring (point) (1- next))) | |
149 (val (save-excursion | |
150 (set-buffer save-buf) | |
151 (math-read-plain-expr str)))) | |
152 (if (eq (car-safe val) 'error) | |
153 (error "Can't yank that line: %s" (nth 2 val)) | |
41047
73f364fd8aaa
Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents:
40785
diff
changeset
|
154 val)))))) |
40785 | 155 |
156 (defun calc-trail-marker (str) | |
157 (interactive "sText to insert in trail: ") | |
158 (calc-with-trail-buffer | |
159 (forward-line 1) | |
160 (let ((buffer-read-only nil)) | |
161 (insert "---- " str "\n")) | |
162 (forward-line -1) | |
41047
73f364fd8aaa
Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents:
40785
diff
changeset
|
163 (calc-trail-here))) |
40785 | 164 |
165 (defun calc-trail-kill (n) | |
166 (interactive "p") | |
167 (calc-with-trail-buffer | |
168 (let ((buffer-read-only nil)) | |
169 (save-restriction | |
170 (narrow-to-region ; don't delete "Emacs Trail" header | |
171 (save-excursion | |
172 (goto-char (point-min)) | |
173 (forward-line 1) | |
174 (point)) | |
175 (point-max)) | |
176 (kill-line n))) | |
41047
73f364fd8aaa
Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents:
40785
diff
changeset
|
177 (calc-trail-here))) |
40785 | 178 |
41047
73f364fd8aaa
Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents:
40785
diff
changeset
|
179 ;;; calc-trail.el ends here |