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