annotate lisp/hyperbole/hui-mouse.el @ 138:6608ceec7cf8 r20-2b3

Import from CVS: tag r20-2b3
author cvs
date Mon, 13 Aug 2007 09:31:46 +0200
parents 4be1180a9e89
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;!emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;; FILE: hui-mouse.el
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;; SUMMARY: Use key or mouse key for many functions, e.g. Hypb menus.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; See the "${data-directory}/hypb-mouse.txt" file and the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;; documentation strings for functions herein.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;; USAGE: GNU Emacs Lisp Library
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;; KEYWORDS: hypermedia, mouse
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;; AUTHOR: Bob Weiner
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
11 ;; ORG: InfoDock Associates
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;; ORIG-DATE: 04-Feb-89
138
6608ceec7cf8 Import from CVS: tag r20-2b3
cvs
parents: 100
diff changeset
14 ;; LAST-MOD: 24-Apr-97 at 22:37:14 by Bob Weiner
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;; This file is part of Hyperbole.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;; Available for use and distribution under the same terms as GNU Emacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 ;; Copyright (C) 1989-1995, Free Software Foundation, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;; Developed with support from Motorola Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 ;; DESCRIPTION:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 ;; This code is machine independent. It works best with a pointing device but
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 ;; may also be used from a keyboard. When used with a pointing device it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 ;; requires an Emacs command that sets point to the location of the pointing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 ;; device's cursor.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 ;; If you want to use your shift-middle mouse button to select Hyperbole menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 ;; items and Hyperbole buttons, follow these instructions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 ;; If you plan to use a mouse only with X windows (Lucid Emacs, GNU Emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 ;; 19, or Epoch), NEXTSTEP, SunView, Apollo's DM, and you want to use the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 ;; shift-middle and shift-right buttons, you need not do any mouse
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 ;; configuration. Your Emacs executable must have been built so as to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 ;; include the mouse support files for your window system, however. These
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 ;; are in the Emacs "src" directory: for X "x*.c", for SunView "sunfns.c",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 ;; and for Apollo DM "apollo.c" and "apollo.el".
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 ;; To use a different mouse key or a different window system, modify the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 ;; mouse key bindings in "hmouse-key.el".
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 ;; Using the Action Mouse Key to browse through and delete files from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 ;; Dired listings is exceptionally nice, just as it is when reading mail.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 ;; DESCRIP-END.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 ;;; Public variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 (defvar hmouse-set-point-command nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 "*Command that sets point to mouse cursor position.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 (defvar action-key-default-function 'hui:menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 "*Symbol name of function run by the Action Key in an unspecified context.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 (defvar assist-key-default-function 'hkey-summarize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 "*Symbol name of function run by the Assist Key in an unspecified context.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 ;;; Hyperbole context-sensitive keys dispatch table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 (defvar hkey-value nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 "Communicates a value between a Smart Key predicate and its actions.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 (defvar hkey-alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 '(
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 ;; If click in the minibuffer and reading an argument,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 ;; accept argument or give completion help.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 ((and (> (minibuffer-depth) 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 (eq (selected-window) (minibuffer-window))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 (not (eq hargs:reading-p 'hmenu))) .
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 ((exit-minibuffer) . (smart-completion-help)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 ;; If reading a Hyperbole menu item or a Hyperbole completion-based
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 ;; argument, allow selection of an item at point.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 ((if (> (minibuffer-depth) 0) (setq hkey-value (hargs:at-p))) .
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 ((hargs:select-p hkey-value) .
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 (hargs:select-p hkey-value 'assist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 ;;
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
84 ;; The ID-edit package supports rapid killing, copying, yanking and
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
85 ;; display management. It is available only as a part of InfoDock.
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
86 ;; It is not included with Hyperbole.
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
87 ((and (boundp 'id-edit-mode) id-edit-mode
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
88 (not buffer-read-only)) .
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
89 ((id-edit-yank) . (id-edit-yank)))
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
90 ;;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 ((if (not (eobp))
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
92 (or (eolp) (if selective-display
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
93 (= (following-char) ?\^M)))) .
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 ((smart-scroll-up) . (smart-scroll-down)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 ((eq major-mode 'smart-menu-mode) .
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 ((smart-menu-select) . (smart-menu-help)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 ;; If on a Hyperbole button, perform action or give help.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 ((if (fboundp 'hbut:at-p) (or (hbut:at-p) (hbut:label-p))) .
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 ((hui:hbut-act 'hbut:current) . (hui:hbut-help 'hbut:current)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 ;;
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
103 ;; The Smart Menu system provides menus within Emacs on a dumb terminal.
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
104 ;; It is a part of InfoDock, but may also be obtained as a separate
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
105 ;; package. It is not included with Hyperbole.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 ((and (fboundp 'smart-menu-choose-menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 (setq hkey-value (and hkey-always-display-menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 (smart-menu-choose-menu)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 (not (and (get-buffer-window *smart-menu-buffer*)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 (eq hkey-value *smart-menu-curr*)))) .
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 ((smart-menu hkey-value) .
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 (smart-menu hkey-value)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 ;; View minor mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 ((if (boundp 'view-minor-mode) view-minor-mode) .
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 ((cond ((last-line-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 (view-quit))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 ((pos-visible-in-window-p (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 (goto-char (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 (t (scroll-up))) .
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 (scroll-down)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 ;; View major mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 ((eq major-mode 'view-mode) .
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 ((View-scroll-lines-forward) . (View-scroll-lines-backward)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 ((eq major-mode 'kotl-mode) .
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 ((kotl-mode:action-key) . (kotl-mode:help-key)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 ;;
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
131 ;; Rdb-mode Supports direct selection and viewing on in-memory relational
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
132 ;; databases. Rdb-mode is available only as a part of InfoDock.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 ;; It is not included with Hyperbole.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 ((eq major-mode 'rdb-mode) . ((smart-rdb) . (smart-rdb-assist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 ;; Restore window config and hide help buffer when click at buffer end.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 ((if (= (point) (point-max)) (string-match "Help\\*$" (buffer-name))) .
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 ((hkey-help-hide) . (hkey-help-hide)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 ((and (memq major-mode '(c-mode c++-c-mode))
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
141 buffer-file-name (smart-c-at-tag-p)) .
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 ((smart-c) . (smart-c nil 'next-tag)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 ((and (eq major-mode 'asm-mode)
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
145 buffer-file-name (smart-asm-at-tag-p)) .
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 ((smart-asm) . (smart-asm nil 'next-tag)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 ((if (smart-lisp-mode-p) (smart-lisp-at-tag-p)) .
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 ((smart-lisp) . (smart-lisp 'next-tag)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 ;;
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
151 ((and (eq major-mode 'java-mode) buffer-file-name
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
152 (or (smart-java-at-tag-p)
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
153 ;; Also handle Java @see cross-references.
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
154 (looking-at "@see[ \t]+")
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
155 (save-excursion
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
156 (and (re-search-backward "[@\n\r\f]" nil t)
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
157 (looking-at "@see[ \t]+"))))) .
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
158 ((smart-java) . (smart-java nil 'next-tag)))
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
159 ;;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 ((and (eq major-mode 'c++-mode) buffer-file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 ;; Don't use smart-c++-at-tag-p here since it will prevent #include
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 ;; lines from matching.
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
163 (smart-c-at-tag-p)) .
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
164 ((smart-c++) . (smart-c++ nil 'next-tag)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 ((and (eq major-mode 'objc-mode) buffer-file-name
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
167 (smart-objc-at-tag-p)) .
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
168 ((smart-objc) . (smart-objc nil 'next-tag)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 ((and (eq major-mode 'fortran-mode)
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
171 buffer-file-name (smart-fortran-at-tag-p)) .
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 ((smart-fortran) . (smart-fortran nil 'next-tag)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 ((eq major-mode 'occur-mode) .
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 ((occur-mode-goto-occurrence) . (occur-mode-goto-occurrence)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 ((eq major-mode 'moccur-mode) .
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 ((moccur-mode-goto-occurrence) . (moccur-mode-goto-occurrence)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 ((eq major-mode 'calendar-mode) .
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 ((smart-calendar) . (smart-calendar-assist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 ((eq major-mode 'unix-apropos-mode) .
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 ((smart-apropos) . (smart-apropos-assist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 ((eq major-mode 'outline-mode) .
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 ((smart-outline) . (smart-outline-assist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 ((eq major-mode 'Info-mode) .
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 ((smart-info) . (smart-info-assist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 ((if (boundp 'hmail:reader)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 (or (eq major-mode hmail:reader)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 (eq major-mode hmail:lister))) .
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 ((smart-hmail) . (smart-hmail-assist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 ((eq major-mode 'gnus-group-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 (smart-gnus-group) . (smart-gnus-group-assist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 ((eq major-mode 'gnus-summary-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 (smart-gnus-summary) . (smart-gnus-summary-assist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 ((eq major-mode 'gnus-article-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 (smart-gnus-article) . (smart-gnus-article-assist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 ((eq major-mode 'Buffer-menu-mode) .
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 ((smart-buffer-menu) . (smart-buffer-menu-assist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 ((eq major-mode 'dired-mode) .
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 ((smart-dired) . (smart-dired-assist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 ((eq major-mode 'tar-mode) .
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 ((smart-tar) . (smart-tar-assist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 ;; Follow references in man pages.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 ((setq hkey-value (smart-man-entry-ref)) .
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 ((smart-man-display hkey-value) .
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 (smart-man-display hkey-value)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 ((eq major-mode 'w3-mode) .
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 ((w3-follow-link) . (w3-goto-last-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 ((if (boundp 'rolo-display-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 (equal (buffer-name) rolo-display-buffer)) .
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 ((smart-wrolo) . (smart-wrolo-assist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 ;; Gomoku game
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 ((eq major-mode 'gomoku-mode) .
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 ((gomoku-human-plays) . (gomoku-human-takes-back)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 ;;
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
231 ;; Support the OO-Browser, a part of InfoDock and XEmacs, and an add on
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
232 ;; to Emacs. It is not included with Hyperbole.
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
233 ((or (br-in-browser) (eq major-mode 'br-mode)) .
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
234 ((smart-br-dispatch) . (smart-br-assist-dispatch)))
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
235 ;;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 ;; Outline minor mode is on and usable.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 (selective-display .
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 ((smart-outline) . (smart-outline-assist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 "Alist of predicates and form-conses for Action and Assist Keys.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 When the Action or Assist Key is pressed, the first or second form,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 respectively, associated with the first non-nil predicate is evaluated.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 ;;; driver code
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 ;; The following autoload is needed if another subsystem besides
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 ;; Hyperbole uses this mouse handling code.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 (autoload 'var:append "hvar" "Append to a list variable." nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 (require 'hargs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 (require 'hmouse-key)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 (if hyperb:window-system
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 (defvar hmouse-alist hkey-alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 "Alist of predicates and form-conses for context-sensitive smart key mouse actions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 When the action-key or the assist-key is pressed, the first or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 second form, respectively, associated with the first non-nil predicate is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 evaluated.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 (load "hui-window")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 ;;; support code
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 ;; The 'load' line below loads any local Smart Key function definitions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 ;; The public distribution contains none. You may leave it commented out if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 ;; you prefer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 ;; (load "smart-local" t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 ;;; Required Init functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 (defun first-line-p ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 "Returns true if point is on the first line of the buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 (save-excursion (beginning-of-line) (bobp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 (defun last-line-p ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 "Returns true if point is on the last line of the buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 (save-excursion (end-of-line) (eobp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 (defun smart-completion-help ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 "Offer completion help for current minibuffer argument, if any."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 (if (where-is-internal 'minibuffer-completion-help (current-local-map))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 (minibuffer-completion-help)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 (defun smart-symlink-expand (path)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 "Returns referent for possible symbolic link, PATH."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 (if (not (fboundp 'symlink-referent))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 path
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 (let ((start 0) (len (length path)) (ref) (part))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 (while (and (< start len) (setq part (string-match "/[^/]*" path start)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 (setq part (concat ref
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 (substring path start (setq start (match-end 0))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 ref (symlink-referent part)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 ref)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 ;;; smart-buffer-menu functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 (defun smart-buffer-menu (&optional in-browser)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 "Uses a single key or mouse key to manipulate buffer-menu entries.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 Invoked via a key press when in Buffer-menu-mode. It assumes that its
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 caller has already checked that the key was pressed in an appropriate buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 and has moved the cursor there.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 Optional non-nil IN-BROWSER indicates use within the OO-Browser.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 If key is pressed:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 (1) on the first column of an entry, the selected buffer is marked for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 display;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 (2) on the second column of an entry, the selected buffer is marked to be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 saved;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 (3) anywhere else within an entry line, all saves and deletes are done, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 selected buffers are displayed, including the one just clicked on (if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 IN-BROWSER, only the selected buffer is displayed);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 (4) on or after the last line in the buffer, all saves and deletes are done."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 (cond ((last-line-p) (Buffer-menu-execute))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 ((bolp) (Buffer-menu-mark))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 ((save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 (goto-char (1- (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 (bolp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 (Buffer-menu-save))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 (in-browser (br-buffer-menu-select))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 (t (Buffer-menu-select))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 (defun smart-buffer-menu-assist ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 "Uses a single assist-key or mouse assist-key to manipulate buffer-menu entries.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 Invoked via an assist-key press when in Buffer-menu-mode. It assumes that its
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 caller has already checked that the assist-key was pressed in an appropriate
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 buffer and has moved the cursor there.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 If assist-key is pressed:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 (1) on the first or second column of an entry, the selected buffer is unmarked
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 for display and for saving or deletion;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 (2) anywhere else within an entry line, the selected buffer is marked for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 deletion;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 (3) on or after the last line in the buffer, all display, save, and delete
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 marks on all entries are undone."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 (cond ((last-line-p) (progn (list-buffers) (forward-line 3)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 ((bolp) (Buffer-menu-unmark))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 ((save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 (goto-char (1- (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 (bolp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 (Buffer-menu-unmark))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 (t (Buffer-menu-delete))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 ;;; smart-calendar functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 (defun smart-calendar ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 "Uses a single key or mouse key to manipulate the scrolling calendar.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 Invoked via a key press when in calendar-mode. It assumes that its
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 caller has already checked that the key was pressed in an appropriate buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 and has moved the cursor there.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 If key is pressed:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 (1) at the end of the buffer, the calendar is scrolled forward 3 months;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 (2) to the left of any dates on a calendar line, the calendar is scrolled
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 backward 3 months;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 (3) on a date, the diary entries for the date, if any, are displayed."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 (cond ((eobp) (calendar-cursor-to-nearest-date)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 (scroll-calendar-left-three-months 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 ((< (current-column) 5) (calendar-cursor-to-nearest-date)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 (scroll-calendar-right-three-months 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 (t (calendar-cursor-to-nearest-date)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 (view-diary-entries 1))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 (defun smart-calendar-assist ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 "Uses a single assist-key or mouse assist-key to manipulate the scrolling calendar.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 Invoked via an assist-key press when in calendar-mode. It assumes that its
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 caller has already checked that the assist-key was pressed in an appropriate
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 buffer and has moved the cursor there.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 If assist-key is pressed:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 (1) at the end of the buffer, the calendar is scrolled backward 3 months;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 (2) to the left of any dates on a calendar line, the calendar is scrolled
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 forward 3 months;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 (3) anywhere else, all dates with marking diary entries are marked in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 calendar window."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 (cond ((eobp) (calendar-cursor-to-nearest-date)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 (scroll-calendar-right-three-months 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 ((< (current-column) 5) (calendar-cursor-to-nearest-date)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 (scroll-calendar-left-three-months 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 (t (mark-diary-entries))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 ;;; smart-dired functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 (defun smart-dired ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 "Uses a single key or mouse key to manipulate directory entries.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 Invoked via a key press when in dired-mode. It assumes that its
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 caller has already checked that the key was pressed in an appropriate buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 and has moved the cursor there.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 If key is pressed:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 (1) within an entry line, the selected file/directory is displayed for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 editing in the other window;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 (2) on or after the last line in the buffer, if any deletes are to be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 performed, they are executed after user verification, otherwise, this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 dired invocation is quit."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 (cond ((last-line-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 (let (flagged)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 (goto-char 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 (setq flagged (re-search-forward "^D" nil t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 (if flagged
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 (cond ((fboundp 'dired-do-deletions)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 (dired-do-deletions))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 ;; For Tree-dired compatibility
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 ((fboundp 'dired-do-flagged-delete)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 (dired-do-flagged-delete))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 (t (error "(smart-dired): No Dired expunge function.")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 (dired-quit))))
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
436 (t (hpath:find (dired-get-filename)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 (defun smart-dired-assist ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 "Uses a single assist-key or mouse assist-key to manipulate directory entries.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 Invoked via an assist-key press when in dired-mode. It assumes that its
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 caller has already checked that the assist-key was pressed in an appropriate
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 buffer and has moved the cursor there.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 If assist-key is pressed:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 (1) on a '~' character, all backup files in the directory are marked for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 deletion;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 (2) on a '#' character, all auto-save files in the directory are marked for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 deletion;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 (3) anywhere else within an entry line, the current entry is marked for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 deletion;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 (4) on or after the last line in the buffer, all delete marks on all entries
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 are undone."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 (cond ((last-line-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 (dired-unflag (- (count-lines (point-min) (point-max))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 (goto-char (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 ((looking-at "~") (dired-flag-backup-files))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 ((looking-at "#") (dired-flag-auto-save-files))
138
6608ceec7cf8 Import from CVS: tag r20-2b3
cvs
parents: 100
diff changeset
461 (t (if (fboundp 'dired-flag-file-deletion)
6608ceec7cf8 Import from CVS: tag r20-2b3
cvs
parents: 100
diff changeset
462 (dired-flag-file-deletion 1)
6608ceec7cf8 Import from CVS: tag r20-2b3
cvs
parents: 100
diff changeset
463 (dired-flag-file-deleted 1)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 ;;; smart-gnus functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 (defun smart-gnus-group ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 "Uses a key or mouse key to move through Gnus Newsgroup listings.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 Invoked via a key press when in gnus-group-mode. It assumes that its caller
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 has already checked that the key was pressed in an appropriate buffer and has
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 moved the cursor to the selected buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 If key is pressed within:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 (1) a GNUS-GROUP line, that newsgroup is read;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 (2) to the left of any GNUS-GROUP line, on any of the whitespace, the current
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 group is unsubscribed or resubscribed;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 (3) at the end of the GNUS-GROUP buffer, after all lines, checks for new
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 news."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 (cond ((last-line-p) (gnus-group-get-new-news))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 ((progn (skip-chars-backward " U") (bolp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 (gnus-group-unsubscribe-current-group))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 (t (gnus-group-read-group nil))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 (defun smart-gnus-group-assist ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 "Uses an assist-key or assist-mouse key to move through Gnus Newsgroup listings.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 Invoked via an assist-key press when in gnus-group-mode. It assumes that its
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 caller has already checked that the key was pressed in an appropriate buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 and has moved the cursor to the selected buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 If key is pressed within:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 (1) a GNUS-GROUP line, that newsgroup is read;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 (2) to the left of any GNUS-GROUP line, on any of the whitespace, the user is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 prompted for a group name to subscribe or unsubscribe to;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 (3) at the end of the GNUS-GROUP buffer, after all lines, quits from the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 newsreader."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 (cond ((last-line-p) (gnus-group-exit))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 ((progn (skip-chars-backward " U") (bolp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 (call-interactively 'gnus-group-unsubscribe-group))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 (t (gnus-group-read-group nil))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 (defun smart-gnus-summary ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 "Uses a key or mouse key to move through Gnus News article listings.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 Invoked via a key press when in gnus-summary-mode. It assumes that its caller
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 has already checked that the key was pressed in an appropriate buffer and has
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 moved the cursor to the selected buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 If key is pressed within:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 (1) to the left of an article number, that article is marked as unread;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 (2) a GNUS-SUMMARY line, that article is read, marked deleted, and scrolled
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 forward;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 (3) at the end of the GNUS-SUMMARY buffer, the next undeleted article
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 is read or the next group is entered."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 (cond ((last-line-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 (if gnus-current-article
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 (progn (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 (re-search-forward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 (format "^.[ ]+%d:" gnus-current-article) nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 (setq this-command 'gnus-summary-next-page)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 (call-interactively 'gnus-summary-next-page))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529 (setq this-command 'gnus-summary-first-unread-article)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 (call-interactively 'gnus-summary-first-unread-article)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 ((save-excursion (skip-chars-backward " D") (bolp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 (gnus-summary-mark-as-unread-forward 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 (t (setq this-command 'gnus-summary-next-page)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 (call-interactively 'gnus-summary-next-page))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 (defun smart-gnus-summary-assist ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537 "Uses an assist-key or assist-mouse key to move through Gnus News articles.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 Invoked via an assist-key press when in gnus-summary-mode. It assumes that its
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 caller has already checked that the key was pressed in an appropriate buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 and has moved the cursor to the selected buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 If key is pressed within:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 (1) to the left of an article number, that article is marked as unread;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 (2) a GNUS-SUMMARY line, that article is read and scrolled backward;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 (3) at the end of the GNUS-SUMMARY buffer, the summary is exited, the user
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 is returned to group mode."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 (cond ((last-line-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 (setq this-command 'gnus-summary-prev-page)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 (call-interactively 'gnus-summary-exit))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 ((save-excursion (skip-chars-backward " D") (bolp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553 (gnus-summary-mark-as-unread-backward 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 (t (setq this-command 'gnus-summary-prev-page)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 (call-interactively 'gnus-summary-prev-page))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557 (defun smart-gnus-article ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558 "Uses a key or mouse key to move through Gnus netnews articles.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 Invoked via a key press when in gnus-article-mode.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 It assumes that its caller has already checked that the key was pressed in an
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562 appropriate buffer and has moved the cursor to the selected buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 If key is pressed within:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 (1) the first line or end of an article, the next unread message is displayed;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 (2) the first line of an Info cross reference, the reference is followed;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567 (3) anywhere else, the window is scrolled up a windowful."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 (cond ((or (last-line-p) (and (not (eolp)) (first-line-p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 (progn (set-buffer gnus-summary-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 (setq this-command 'gnus-summary-next-unread-article)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 (gnus-summary-next-unread-article)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 (gnus-summary-goto-subject gnus-current-article)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 (let ((artic (get-buffer-window gnus-article-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 (if artic (select-window artic)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578 ((and (not (eolp)) (Info-handle-in-note)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 (t (smart-scroll-up))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581 (defun smart-gnus-article-assist ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582 "Uses an assist-key or mouse assist-key to move through Gnus netnews articles.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584 Invoked via an assist-key press when in gnus-article-mode.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585 It assumes that its caller has already checked that the assist-key was pressed in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586 an appropriate buffer and has moved the cursor to the selected buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588 If assist-key is pressed within:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 (1) the first line or end of an article, the previous message is displayed;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590 (2) the first line of an Info cross reference, the reference is followed;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591 (3) anywhere else, the window is scrolled down a windowful."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 (cond ((or (last-line-p) (and (not (eolp)) (first-line-p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595 (progn (set-buffer gnus-summary-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596 (setq this-command 'gnus-summary-prev-article)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597 (gnus-summary-prev-article nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 (gnus-summary-goto-subject gnus-current-article)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600 (let ((artic (get-buffer-window gnus-summary-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 (if artic (select-window artic)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 ((and (not (eolp)) (Info-handle-in-note)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603 (t (smart-scroll-down))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606 ;;; smart-hmail functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609 (defun smart-hmail ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
610 "Uses a key or mouse key to move through e-mail messages and summaries.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612 Invoked via a key press when in hmail:reader or hmail:lister mode.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613 It assumes that its caller has already checked that the key was pressed in an
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614 appropriate buffer and has moved the cursor to the selected buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
615
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616 If key is pressed within:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617 (1) a msg buffer, within the first line or at the end of a message,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618 the next undeleted message is displayed;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
619 (2) a msg buffer within the first line of an Info cross reference, the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620 reference is followed;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621 (3) anywhere else in a msg buffer, the window is scrolled up a windowful;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622 (4) a msg summary buffer on a header entry, the message corresponding to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623 the header is displayed in the msg window;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624 (5) a msg summary buffer, on or after the last line, the messages marked
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625 for deletion are expunged."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629 ;; Branch on buffer type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631 (cond ((eq major-mode hmail:reader)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632 (cond ((or (last-line-p) (and (not (eolp)) (first-line-p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
633 (rmail:msg-next))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
634 ((and (not (eolp)) (Info-handle-in-note)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
635 ((smart-scroll-up))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
636 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637 ;; Assume are in msg summary buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639 ((last-line-p) (lmail:expunge))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640 (t (lmail:goto))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642 (defun smart-hmail-assist ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643 "Uses an assist key or mouse key to move through e-mail messages and summaries.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
644
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645 Invoked via an assist key press when in hmail:reader or hmail:lister mode.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646 It assumes that its caller has already checked that the assist-key was pressed in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
647 an appropriate buffer and has moved the cursor to the selected buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
648
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
649 If assist-key is pressed within:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
650 (1) a msg buffer, within the first line or at the end of a message,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
651 the previous undeleted message is displayed;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
652 (2) a msg buffer within the first line of an Info cross reference, the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653 reference is followed;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654 (3) anywhere else in a msg buffer, the window is scrolled down a windowful;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655 (4) a msg summary buffer on a header entry, the message corresponding to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
656 the header is marked as deleted;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
657 (5) a msg summary buffer, on or after the last line, all messages are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658 marked undeleted."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
659
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
660 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
661 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
662 ;; Branch on buffer type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
663 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
664 (cond ((eq major-mode hmail:reader)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
665 (cond ((or (last-line-p) (and (not (eolp)) (first-line-p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
666 (rmail:msg-prev))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667 ((and (not (eolp)) (Info-handle-in-note)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
668 ((smart-scroll-down))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
669 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
670 ;; Assume are in msg summary buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
671 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
672 ((last-line-p) (lmail:undelete-all))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
673 (t (lmail:delete))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
674
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
675
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
676 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
677 ;;; smart-info functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
678 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
679 ;;; Autoloaded in "hyperbole.el".
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
680
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
681 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
682 ;;; smart-man functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
683 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
684
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
685 ;; "unix-apropos.el" is a publicly available Emacs Lisp package that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
686 ;; allows man page browsing from apropos listings. "superman.el" is a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
687 ;; newer, much more complete package that you would probably prefer at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
688 ;; this point, but there is no Smart Key apropos support for it. There
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
689 ;; is smart key support within the man page buffers it produces, however.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
690 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
691
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
692 (defun smart-apropos ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
693 "Moves through UNIX man apropos listings by using one key or mouse key.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
694
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
695 Invoked via a key press when in unix-apropos-mode. It assumes that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
696 its caller has already checked that the key was pressed in an appropriate
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
697 buffer and has moved the cursor to the selected buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
698
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
699 If key is pressed:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
700 (1) on a UNIX man apropos entry, the man page for that entry is displayed in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
701 another window;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
702 (2) on or after the last line, the buffer in the other window is scrolled up
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
703 a windowful."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
704
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
705 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
706 (if (last-line-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
707 (scroll-other-window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
708 (unix-apropos-get-man)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
709
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
710 (defun smart-apropos-assist ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
711 "Moves through UNIX man apropos listings by using one assist-key or mouse assist-key.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
712
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
713 Invoked via an assist-key press when in unix-apropos-mode. It assumes that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
714 its caller has already checked that the assist-key was pressed in an appropriate
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
715 buffer and has moved the cursor to the selected buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
716
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
717 If assist-key is pressed:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
718 (1) on a UNIX man apropos entry, the man page for that entry is displayed in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
719 another window;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
720 (2) on or after the last line, the buffer in the other window is scrolled down
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
721 a windowful."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
722
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
723 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
724 (if (last-line-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
725 (scroll-other-window (- 3 (window-height)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
726 (unix-apropos-get-man)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
727
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
728 (defun smart-man-display (lisp-form)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
729 "Evaluates LISP-FORM returned from 'smart-man-entry-ref' to display a man page."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
730 (eval lisp-form))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
731
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
732 (defun smart-man-entry-ref ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
733 "Returns form which displays referenced manual entry that point is on or nil.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
734 Handles references in sections: NAME, SEE ALSO, or PACKAGES USED. Also can
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
735 display C routine definitions selected in a man page, see
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
736 'smart-man-c-routine-ref'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
737
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
738 Man page buffer must either have an attached file or else a `man-path'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
739 local variable containing its pathname."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
740 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
741 (let ((ref ""))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
742 (if (not (or (if (string-match "Manual Entry\\|\\*man "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
743 (buffer-name (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
744 (progn (and (boundp 'man-path) man-path
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
745 (setq ref (smart-symlink-expand man-path)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
746 t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
747 (if buffer-file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
748 (string-match "/man/" (setq ref (smart-symlink-expand
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
749 buffer-file-name))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
750 (setq ref nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
751 (or (setq ref (or (smart-man-file-ref)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
752 (smart-man-c-routine-ref)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
753 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
754 (let ((opoint (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
755 (case-fold-search))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
756 (and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
757 (re-search-backward "^[.A-Z]" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
758 (looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
759 "\\(\\.SH[ \t]+\\)?\\(SEE ALSO\\|NAME\\|PACKAGES USED\\)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
760 (progn (goto-char opoint)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
761 (skip-chars-backward "-_a-zA-Z0-9?.(")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
762 (let ((start (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
763 (skip-chars-forward "-_a-zA-Z0-9?.()")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
764 (setq ref (buffer-substring start (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
765 ;; Leave only one char within ref parens
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
766 (if ref
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
767 (if (string-match "(\\(.\\)\\(.+\\))" ref)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
768 (setq ref (concat (substring ref 0 (match-end 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
769 "\)"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
770 )))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
771 (cond ((equal ref "") nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
772 ((stringp ref) (list 'manual-entry ref))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
773 (t ref))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
774
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
775 (defun smart-man-c-routine-ref ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
776 "Returns form to jump to def of C function whose name is at point, if any.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
777 Valid sections within the man page are: ROUTINES, MACROS or FUNCTIONS.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
778 Uses (smart-tags-file) function to determine etags file from which to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
779 locate the definition.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
780
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
781 Returns etags file name if point is on an identifier in the appropriate
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
782 section and the jump is done, otherwise, returns nil."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
783 (let ((ref)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
784 (opoint (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
785 (case-fold-search))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
786 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
787 (and (re-search-backward "^[.A-Z]" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
788 (looking-at "^\\(FUNCTIONS\\|ROUTINES\\|MACROS\\)[ \t\n]")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
789 (progn (goto-char opoint)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
790 (skip-chars-backward "_~<>:a-zA-Z0-9(")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
791 (if (or (looking-at "\\([_~<>:a-zA-Z0-9]+\\)[ \t\n]*(")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
792 (looking-at "\\([_~<:A-Z][_<>:A-Z0-9]+\\)"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
793 (setq ref (buffer-substring
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
794 (match-beginning 1) (match-end 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
795 )))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
796 (if ref
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
797 (let ((tags-file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
798 (smart-tags-file (if (and (boundp 'man-path) man-path)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
799 man-path
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
800 default-directory))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
801 (and (file-exists-p tags-file-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
802 (file-readable-p tags-file-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
803 (list 'let (list (list 'tags-file-name tags-file-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
804 (list (if (br-in-browser)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
805 'find-tag 'find-tag-other-window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
806 ref)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
807
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
808 (defun smart-man-file-ref ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
809 "Returns form to eval to display file whose name point is on, within a FILES man page section.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
810 If not on a file name, returns nil."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
811 (let ((ref)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
812 (opoint (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
813 (case-fold-search))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
814 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
815 (and (re-search-backward "^[.A-Z]" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
816 (looking-at "^FILES[ \t\n]")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
817 (progn (goto-char opoint)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
818 (skip-chars-backward "^ \t")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
819 (if (looking-at "/[^ \t\n]+")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
820 (setq ref (buffer-substring
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
821 (match-beginning 0) (match-end 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
822 )))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
823 (if ref
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
824 (list (if (br-in-browser)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
825 'find-file 'find-file-other-window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
826 ref))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
827
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
828 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
829 ;;; smart-outline functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
830 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
831
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
832 ;; The functions in this section require InfoDock's version of outline.el
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
833 ;; in order to work properly.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
834
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
835 (defvar smart-outline-cut nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
836 "Non-nil means outline region was cut and is ready to be pasted at point.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
837
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
838 (let ((proc
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
839 '((lambda ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
840 (make-local-variable 'smart-outline-cut)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
841 ;; Non-nil means outline region was cut and is available to be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
842 ;; pasted at point.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
843 (setq smart-outline-cut nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
844 ))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
845 (if (boundp 'outline-mode-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
846 (eval proc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
847 (var:append 'outline-mode-hook proc)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
848
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
849 (defun smart-outline ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
850 "Collapses, expands, and moves outline entries.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
851 Invoked via a key press when in outline-mode. It assumes that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
852 its caller has already checked that the key was pressed in an appropriate
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
853 buffer and has moved the cursor to the selected buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
854
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
855 If key is pressed:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
856 (1) after an outline heading has been cut via the Action Key, then paste the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
857 cut heading at point;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
858 (2) at the end of buffer, show all buffer text
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
859 (3) at the beginning of a heading line, cut the headings subtree from the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
860 buffer;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
861 (4) on a header line but not at the beginning or end, if headings subtree is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
862 hidden then show it, otherwise hide it;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
863 (5) anywhere else, scroll up a windowful."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
864
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
865 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
866 (cond (smart-outline-cut
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
867 (setq smart-outline-cut nil) (yank))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
868 ((eobp) (show-all))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
869 ((and (bolp) (looking-at outline-regexp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
870 (setq smart-outline-cut t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
871 (kill-region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
872 (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
873 (or (outline-get-next-sibling)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
874 ;; Skip past start of current entry
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
875 (progn (re-search-forward outline-regexp nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
876 (smart-outline-to-entry-end t (outline-level))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
877
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
878 ((or (eolp) (zerop (save-excursion (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
879 (outline-level))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
880 (smart-scroll-up))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
881 ;; On an outline header line but not at the start/end of line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
882 ((smart-outline-subtree-hidden-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
883 (show-subtree))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
884 (t (hide-subtree))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
885
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
886
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
887 (defun smart-outline-assist ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
888 "Collapses, expands, and moves outline entries.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
889 Invoked via an assist-key press when in outline-mode. It assumes that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
890 its caller has already checked that the assist-key was pressed in an appropriate
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
891 buffer and has moved the cursor to the selected buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
892
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
893 If assist-key is pressed:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
894 (1) after an outline heading has been cut via the action-key, allow multiple
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
895 pastes throughout the buffer (last paste should be done with the Action Key,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
896 not the Assist Key);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
897 (2) at the end of buffer, hide all bodies in buffer;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
898 (3) at the beginning of a heading line, cut the current heading (sans
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
899 subtree) from the buffer;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
900 (4) on a header line but not at the beginning or end, if heading body is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
901 hidden then show it, otherwise hide it;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
902 (5) anywhere else, scroll down a windowful."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
903
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
904 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
905 (cond (smart-outline-cut (yank))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
906 ((eobp) (hide-body ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
907 ((and (bolp) (looking-at outline-regexp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
908 (setq smart-outline-cut t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
909 (kill-region (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
910 ;; Skip past start of current entry
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
911 (progn (re-search-forward outline-regexp nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
912 (smart-outline-to-entry-end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
913 nil (outline-level)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
914 ((or (eolp) (zerop (save-excursion (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
915 (outline-level))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
916 (smart-scroll-down))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
917 ;; On an outline header line but not at the start/end of line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
918 ((smart-outline-subtree-hidden-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
919 (show-entry))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
920 (t (hide-entry))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
921
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
922 (defun smart-outline-to-entry-end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
923 (&optional include-sub-entries curr-entry-level)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
924 "Goes to end of whole entry if optional INCLUDE-SUB-ENTRIES is non-nil.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
925 CURR-ENTRY-LEVEL is an integer representing the length of the current level
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
926 string which matched to 'outline-regexp'. If INCLUDE-SUB-ENTRIES is nil,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
927 CURR-ENTRY-LEVEL is not needed."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
928 (let (next-entry-exists)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
929 (while (and (setq next-entry-exists
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
930 (re-search-forward outline-regexp nil t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
931 include-sub-entries
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
932 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
933 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
934 (> (outline-level)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
935 curr-entry-level))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
936 (if next-entry-exists
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
937 (progn (beginning-of-line) (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
938 (goto-char (point-max)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
939
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
940 (defun smart-outline-subtree-hidden-p ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
941 "Returns t if at least initial subtree of heading is hidden, else nil."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
942 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
943 (if (re-search-forward "[\n\^M]" nil t) (= (preceding-char) ?\^M))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
944
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
945 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
946 ;;; smart-tar functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
947 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
948
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
949 (defun smart-tar ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
950 "Uses a single key or mouse key to manipulate tar file entries.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
951
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
952 Invoked via a key press when in tar-mode. It assumes that its
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
953 caller has already checked that the key was pressed in an appropriate buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
954 and has moved the cursor there.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
955
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
956 If key is pressed:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
957 (1) within an entry line, the selected file/directory is displayed for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
958 editing in the other window;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
959 (2) on or after the last line in the buffer, if any deletes are to be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
960 performed, they are executed after user verification, otherwise, this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
961 tar file browser is quit."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
962
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
963 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
964 (cond ((last-line-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
965 (let (flagged)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
966 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
967 (goto-char 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
968 (setq flagged (re-search-forward "^D" nil t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
969 (if flagged
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
970 (tar-expunge)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
971 (kill-buffer nil))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
972 (t (tar-extract-other-window))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
973
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
974 (defun smart-tar-assist ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
975 "Uses a single assist-key or mouse assist-key to manipulate tar file entries.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
976
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
977 Invoked via an assist-key press when in dired-mode. It assumes that its
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
978 caller has already checked that the assist-key was pressed in an appropriate
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
979 buffer and has moved the cursor there.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
980
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
981 If assist-key is pressed:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
982 (1) on an entry line, the current entry is marked for deletion;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
983 (2) on or after the last line in the buffer, all delete marks on all entries
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
984 are undone."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
985
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
986 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
987 (cond ((last-line-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
988 (tar-unflag (- (count-lines (point-min) (point-max))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
989 (goto-char (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
990 (t (tar-flag-deleted 1))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
991
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
992 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
993 ;;; smart-wrolo functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
994 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
995
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
996 (defun smart-wrolo ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
997 "In wrolo match buffer, edits current entry.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
998 Uses one key or mouse key.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
999
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1000 Invoked via a key press when in the 'rolo-display-buffer'. It assumes that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1001 its caller has already checked that the key was pressed in an appropriate
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1002 buffer and has moved the cursor to the selected buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1003 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1004 (rolo-edit-entry))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1005
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1006 (fset 'smart-wrolo-assist 'smart-wrolo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1007
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1008 (provide 'hui-mouse)