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