Mercurial > hg > xemacs-beta
comparison lisp/list-mode.el @ 398:74fd4e045ea6 r21-2-29
Import from CVS: tag r21-2-29
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:13:30 +0200 |
parents | 6240c7796c7a |
children | 2f8bb876ab1d |
comparison
equal
deleted
inserted
replaced
397:f4aeb21a5bad | 398:74fd4e045ea6 |
---|---|
75 (make-local-hook 'pre-command-hook) | 75 (make-local-hook 'pre-command-hook) |
76 (add-hook 'pre-command-hook 'list-mode-extent-pre-hook nil t) | 76 (add-hook 'pre-command-hook 'list-mode-extent-pre-hook nil t) |
77 (make-local-variable 'next-line-add-newlines) | 77 (make-local-variable 'next-line-add-newlines) |
78 (setq next-line-add-newlines nil) | 78 (setq next-line-add-newlines nil) |
79 (setq list-mode-extent nil) | 79 (setq list-mode-extent nil) |
80 (set-specifier text-cursor-visible-p nil (current-buffer)) | 80 ;; It is visually disconcerting to have the text cursor disappear within list |
81 ;; buffers, especially when moving from window to window, so leave it | |
82 ;; visible. -- Bob Weiner, 06/20/1999 | |
83 ; (set-specifier text-cursor-visible-p nil (current-buffer)) | |
81 (setq buffer-read-only t) | 84 (setq buffer-read-only t) |
82 (goto-char (point-min)) | 85 (goto-char (point-min)) |
83 (run-hooks 'list-mode-hook)) | 86 (run-hooks 'list-mode-hook)) |
84 | 87 |
85 ;; List mode is suitable only for specially formatted data. | 88 ;; List mode is suitable only for specially formatted data. |
456 (sort completions #'string-lessp)))))) | 459 (sort completions #'string-lessp)))))) |
457 | 460 |
458 (define-derived-mode completion-list-mode list-mode | 461 (define-derived-mode completion-list-mode list-mode |
459 "Completion List" | 462 "Completion List" |
460 "Major mode for buffers showing lists of possible completions. | 463 "Major mode for buffers showing lists of possible completions. |
461 Type \\<completion-list-mode-map>\\[choose-completion] in the completion list\ | 464 \\{completion-list-mode-map}" |
462 to select the completion near point. | |
463 Use \\<completion-list-mode-map>\\[mouse-choose-completion] to select one\ | |
464 with the mouse." | |
465 (make-local-variable 'completion-base-size) | 465 (make-local-variable 'completion-base-size) |
466 (setq completion-base-size nil)) | 466 (setq completion-base-size nil)) |
467 | 467 |
468 (let ((map completion-list-mode-map)) | 468 (let ((map completion-list-mode-map)) |
469 (define-key map 'button2up 'mouse-choose-completion) | |
470 (define-key map 'button2 'undefined) | |
471 (define-key map "\C-m" 'choose-completion) | |
469 (define-key map "\e\e\e" 'delete-completion-window) | 472 (define-key map "\e\e\e" 'delete-completion-window) |
470 (define-key map "\C-g" 'minibuffer-keyboard-quit) | 473 (define-key map "\C-g" 'minibuffer-keyboard-quit) |
471 (define-key map "q" 'abort-recursive-edit) | 474 (define-key map "q" 'completion-list-mode-quit) |
472 (define-key map " " (lambda () (interactive) | 475 (define-key map " " 'completion-switch-to-minibuffer) |
473 (select-window (minibuffer-window)))) | 476 ;; [Tab] used to switch to the minibuffer but since [space] does that and |
474 (define-key map "\t" (lambda () (interactive) | 477 ;; since most applications in the world use [Tab] to select the next item |
475 (select-window (minibuffer-window))))) | 478 ;; in a list, do that in the *Completions* buffer too. -- Bob Weiner, |
479 ;; BeOpen.com, 06/23/1999. | |
480 (define-key map "\t" 'next-list-mode-item)) | |
476 | 481 |
477 (defvar completion-reference-buffer nil | 482 (defvar completion-reference-buffer nil |
478 "Record the buffer that was current when the completion list was requested. | 483 "Record the buffer that was current when the completion list was requested. |
479 This is a local variable in the completion list buffer. | 484 This is a local variable in the completion list buffer. |
480 Initial value is nil to avoid some compiler warnings.") | 485 Initial value is nil to avoid some compiler warnings.") |
483 "Number of chars at beginning of minibuffer not involved in completion. | 488 "Number of chars at beginning of minibuffer not involved in completion. |
484 This is a local variable in the completion list buffer | 489 This is a local variable in the completion list buffer |
485 but it talks about the buffer in `completion-reference-buffer'. | 490 but it talks about the buffer in `completion-reference-buffer'. |
486 If this is nil, it means to compare text to determine which part | 491 If this is nil, it means to compare text to determine which part |
487 of the tail end of the buffer's text is involved in completion.") | 492 of the tail end of the buffer's text is involved in completion.") |
493 | |
494 ;; These names are referenced in the doc string for `completion-list-mode'. | |
495 (defalias 'choose-completion 'list-mode-item-keyboard-selected) | |
496 (defalias 'mouse-choose-completion 'list-mode-item-mouse-selected) | |
488 | 497 |
489 (defun delete-completion-window () | 498 (defun delete-completion-window () |
490 "Delete the completion list window. | 499 "Delete the completion list window. |
491 Go to the window from which completion was requested." | 500 Go to the window from which completion was requested." |
492 (interactive) | 501 (interactive) |
493 (let ((buf completion-reference-buffer)) | 502 (let ((buf completion-reference-buffer)) |
494 (delete-window (selected-window)) | 503 (delete-window (selected-window)) |
495 (if (get-buffer-window buf) | 504 (if (get-buffer-window buf) |
496 (select-window (get-buffer-window buf))))) | 505 (select-window (get-buffer-window buf))))) |
506 | |
507 (defun completion-switch-to-minibuffer () | |
508 "Move from a completions buffer to the active minibuffer window." | |
509 (interactive) | |
510 (select-window (minibuffer-window))) | |
511 | |
512 (defun completion-list-mode-quit () | |
513 "Abort any recursive edit and bury the completions buffer." | |
514 (interactive) | |
515 (condition-case () | |
516 (abort-recursive-edit) | |
517 (error nil)) | |
518 ;; If there was no recursive edit to abort, simply bury the completions | |
519 ;; list buffer. | |
520 (if (eq major-mode 'completion-list-mode) (bury-buffer))) | |
497 | 521 |
498 (defun completion-do-in-minibuffer () | 522 (defun completion-do-in-minibuffer () |
499 (interactive "_") | 523 (interactive "_") |
500 (save-excursion | 524 (save-excursion |
501 (set-buffer (window-buffer (minibuffer-window))) | 525 (set-buffer (window-buffer (minibuffer-window))) |