From 7c329c2b3ee4e326225d330e32da2126c30c9ad8 Mon Sep 17 00:00:00 2001 From: tomo Date: Tue, 6 Jul 1999 04:27:57 +0000 Subject: [PATCH] Sync up with r21-2-17-1999-07-05-18. --- lisp/ChangeLog | 52 +++++++++++++++++++++ lisp/help.el | 4 +- lisp/lib-complete.el | 124 ++++++++++++++++++++++++++++--------------------- lisp/list-mode.el | 44 ++++++++++++++---- lisp/menubar-items.el | 3 +- lisp/simple.el | 1 + 6 files changed, 164 insertions(+), 64 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 6f17b4a..0619ce4 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -541,6 +541,58 @@ * files.el (insert-file-contents-literally): Treat file as binary; call file-name-handlers. [sync with Emacs 20.3.10] +1999-06-24 Bob Weiner + + * lib-complete.el (find-library): + (find-library-other-window): + (find-library-other-frame): Completely rewrote + so that these functions actually work when called non-interactively. + Also made them handle LIBRARY arguments which end with .el or .elc. + +1999-06-24 Bob Weiner + + * simple.el (indent-new-comment-line): Locally bound + `block-comment-start' to `comstart' or else when this is called + from do-auto-fill, e.g. in Lisp mode, it will insert any non-nil + `block-comment-start' value, ignoring any existing spacing after a + comment prefix in the previous line and producing ugly comments. + +1999-06-23 Bob Weiner + + * list-mode.el (mouse-choose-completion): + (choose-completion): + (completion-switch-to-minibuffer): Added. + ([Tab]): [Tab] previously switched to the minibuffer + but since [space] does that and since most applications in the + world use [Tab] to select the next item in a list, do that in the + *Completions* buffer too. This will cause the least confusion + among the largest population of users. -- Bob Weiner, BeOpen.com, + 06/23/1999. + +1999-06-22 Bob Weiner + + * help.el (help-buffer-name): Added support for a null value + of `help-buffer-prefix-string' since some buffers require no + prefix. + +1999-06-20 Bob Weiner + + * list-mode.el (completion-list-mode-quit): Added and bound to {q} + in the completion-list-mode-map to bury the completions buffer + even when the minibuffer is no longer active. + +1999-06-20 Bob Weiner + + * list-mode.el (list-mode): It is visually disconcerting to have + the text cursor disappear within list buffers, especially when + moving from window to window, so leave it visible. + +1999-07-01 SL Baur + + * menubar-items.el (default-menubar): Conditionalize the bug + report menu item (which may not be possible in this XEmacs). + Reported by: Ken'ichi Handa + 1999-06-30 SL Baur * subr.el (with-current-buffer): DOC string fix. diff --git a/lisp/help.el b/lisp/help.el index eb7b1b6..abe3bfc 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -461,7 +461,9 @@ You should never set this directory, only let-bind it.") (if (and (integerp help-max-help-buffers) (> help-max-help-buffers 0) (stringp name)) - (format "*%s: %s*" help-buffer-prefix-string name) + (if help-buffer-prefix-string + (format "*%s: %s*" help-buffer-prefix-string name) + (format "*%s*" name)) (format "*%s*" help-buffer-prefix-string))) ;; Use this function for displaying help when C-h something is pressed diff --git a/lisp/lib-complete.el b/lisp/lib-complete.el index 3713295..29175a8 100644 --- a/lisp/lib-complete.el +++ b/lisp/lib-complete.el @@ -38,7 +38,6 @@ ;; Last Modified By: Heiko M|nkel ;; Additional XEmacs integration By: Chuck Thompson ;; Last Modified On: Thu Jul 1 14:23:00 1994 -;; RCS Info : $Revision: 1.3.2.2 $ $Locker: $ ;; ======================================================================== ;; NOTE: XEmacs must be redumped if this file is changed. ;; @@ -57,6 +56,7 @@ ;;; ChangeLog: ;; 4/26/97: sb Mule-ize. +;; 6/24/1999 much rewriting from Bob Weiner ;;; Code: @@ -104,24 +104,25 @@ If optional fourth argument FAST is non-nil, don't sort the completions, ;;=== Utilities =========================================================== -(defmacro progn-with-message (message &rest forms) +(defmacro progn-with-message (MESSAGE &rest FORMS) "(progn-with-message MESSAGE FORMS ...) Display MESSAGE and evaluate FORMS, returning value of the last one." ;; based on Hallvard Furuseth's funcall-with-message - `(if (eq (selected-window) (minibuffer-window)) + (` + (if (eq (selected-window) (minibuffer-window)) (save-excursion (goto-char (point-max)) (let ((orig-pmax (point-max))) (unwind-protect (progn - (insert " " ,message) (goto-char orig-pmax) + (insert " " (, MESSAGE)) (goto-char orig-pmax) (sit-for 0) ; Redisplay - ,@forms) + (,@ FORMS)) (delete-region orig-pmax (point-max))))) (prog2 - (message "%s" ,message) - (progn ,@forms) - (message "")))) + (message "%s" (, MESSAGE)) + (progn (,@ FORMS)) + (message ""))))) (put 'progn-with-message 'lisp-indent-hook 1) @@ -217,7 +218,6 @@ where each has the form (if tail (setcdr tail nil))))) ;;=== Read a filename, with completion in a search path =================== -(defvar read-library-internal-search-path) (defun read-library-internal (FILE FILTER FLAG) "Don't call this." @@ -255,79 +255,99 @@ Optional sixth argument FILTER can be used to provide a function to (cond ((equal library "") DEFAULT) (FULL (locate-file library read-library-internal-search-path - '(".el" ".el.gz" ".elc"))) + ;; decompression doesn't work with Mule -slb + (if (featurep 'mule) + ".el:.elc" + ".el:.el.gz:.el.Z:.elc"))) (t library)))) +(defun read-library-name (prompt) + "PROMPTs for and returns an existing Elisp library name (without any suffix) or the empty string." + (interactive) + (let ((read-library-internal-search-path load-path)) + (completing-read prompt + 'read-library-internal + (lambda (fn) + (cond + ;; decompression doesn't work with mule -slb + ((string-match (if (featurep 'mule) + "\\.el$" + "\\.el\\(\\.gz\\|\\.Z\\)?$") fn) + (substring fn 0 (match-beginning 0))))) + t nil))) + ;; NOTE: as a special case, read-library may be used to read a filename ;; relative to the current directory, returning a *relative* pathname ;; (read-file-name returns a full pathname). ;; ;; eg. (read-library "Local header: " '(nil) nil) -(defun get-library-path () - "Front end to read-library" - (read-library "Find Library file: " load-path nil t t - (function (lambda (fn) - (cond - ;; decompression doesn't work with mule -slb - ((string-match (if (featurep 'mule) - "\\.el$" - "\\.el\\(\\.gz\\)?$") fn) - (substring fn 0 (match-beginning 0)))))) - )) - ;;=== Replacement for load-library with completion ======================== (defun load-library (library) "Load the library named LIBRARY. This is an interface to the function `load'." (interactive - (list (read-library "Load Library: " load-path nil nil nil - (function (lambda (fn) - (cond - ((string-match "\\.elc?$" fn) - (substring fn 0 (match-beginning 0)))))) - ))) + (list (read-library "Load library: " load-path nil nil nil + (function (lambda (fn) + (cond + ((string-match "\\.elc?$" fn) + (substring fn 0 (match-beginning 0)))))) + ))) (load library)) -;;=== find-library with completion (Author: Heiko Muenkel) =================== +;;=== find-library with completion (Author: Bob Weiner) =================== -(defun find-library (library &optional codesys) - "Find and edit the source for the library named LIBRARY. -The extension of the LIBRARY must be omitted. -Under XEmacs/Mule, the optional second argument specifies the -coding system to use when decoding the file. Interactively, -with a prefix argument, you will be prompted for the coding system." +(defun find-library (library &optional codesys display-function) + "Find and display in the current window the source for the Elisp LIBRARY. +LIBRARY should be a name without any path information and may include or omit +the \".el\" suffix. Under XEmacs/Mule, the optional second argument CODESYS +specifies the coding system to use when decoding the file. Interactively, +with a prefix argument, this prompts for the coding system. Optional third +argument DISPLAY-FUNCTION must take two arguments, the filename to display +and CODESYS. The default for DISPLAY-FUNCTION is `find-file'." (interactive - (list (get-library-path) + (list (read-library-name "Find library: ") (if current-prefix-arg (read-coding-system "Coding System: ")))) - (find-file library codesys)) + (let ((path (if (or (null library) (equal library "")) + nil + (locate-file library load-path + ;; decompression doesn't work with Mule -slb + (if (featurep 'mule) + ":.el:.elc" + ":.el:.el.gz:.el.Z:.elc"))))) + (if path (funcall (if (fboundp display-function) + display-function 'find-file) + path codesys) + (error "(find-library): Cannot locate library `%s'" library)))) (defun find-library-other-window (library &optional codesys) - "Load the library named LIBRARY in another window. -Under XEmacs/Mule, the optional second argument specifies the -coding system to use when decoding the file. Interactively, -with a prefix argument, you will be prompted for the coding system." + "Find and display in another window the source for the Elisp LIBRARY. +LIBRARY should be a name without any path information and may include or omit +the \".el\" suffix. Under XEmacs/Mule, the optional second argument CODESYS +specifies the coding system to use when decoding the file. Interactively, +with a prefix argument, this prompts for the coding system." (interactive - (list (get-library-path) + (list (read-library-name "Find library in other window: ") (if current-prefix-arg - (read-coding-system "Coding System: ")))) - (find-file-other-window library codesys)) + (read-coding-system "Coding System: ")))) + (find-library library codesys 'find-file-other-window)) (defun find-library-other-frame (library &optional codesys) - "Load the library named LIBRARY in a newly-created frame. -Under XEmacs/Mule, the optional second argument specifies the -coding system to use when decoding the file. Interactively, -with a prefix argument, you will be prompted for the coding system." + "Find and display in another frame the source for the Elisp LIBRARY. +LIBRARY should be a name without any path information and may include or omit +the \".el\" suffix. Under XEmacs/Mule, the optional second argument CODESYS +specifies the coding system to use when decoding the file. Interactively, +with a prefix argument, this prompts for the coding system." (interactive - (list (get-library-path) + (list (read-library-name "Find library in other frame: ") (if current-prefix-arg (read-coding-system "Coding System: ")))) - (find-file-other-frame library codesys)) + (find-library library codesys 'find-file-other-frame)) -; This conflicts with an existing binding -;(define-key global-map "\C-xl" 'find-library) +;; This conflicts with an existing binding. +;;(define-key global-map "\C-xl" 'find-library) (define-key global-map "\C-x4l" 'find-library-other-window) (define-key global-map "\C-x5l" 'find-library-other-frame) diff --git a/lisp/list-mode.el b/lisp/list-mode.el index b3603e5..b2b828b 100644 --- a/lisp/list-mode.el +++ b/lisp/list-mode.el @@ -77,7 +77,10 @@ (make-local-variable 'next-line-add-newlines) (setq next-line-add-newlines nil) (setq list-mode-extent nil) - (set-specifier text-cursor-visible-p nil (current-buffer)) +;; It is visually disconcerting to have the text cursor disappear within list +;; buffers, especially when moving from window to window, so leave it +;; visible. -- Bob Weiner, 06/20/1999 +; (set-specifier text-cursor-visible-p nil (current-buffer)) (setq buffer-read-only t) (goto-char (point-min)) (run-hooks 'list-mode-hook)) @@ -458,21 +461,23 @@ buffer." (define-derived-mode completion-list-mode list-mode "Completion List" "Major mode for buffers showing lists of possible completions. -Type \\\\[choose-completion] in the completion list\ - to select the completion near point. -Use \\\\[mouse-choose-completion] to select one\ - with the mouse." +\\{completion-list-mode-map}" (make-local-variable 'completion-base-size) (setq completion-base-size nil)) (let ((map completion-list-mode-map)) + (define-key map 'button2up 'mouse-choose-completion) + (define-key map 'button2 'undefined) + (define-key map "\C-m" 'choose-completion) (define-key map "\e\e\e" 'delete-completion-window) (define-key map "\C-g" 'minibuffer-keyboard-quit) - (define-key map "q" 'abort-recursive-edit) - (define-key map " " (lambda () (interactive) - (select-window (minibuffer-window)))) - (define-key map "\t" (lambda () (interactive) - (select-window (minibuffer-window))))) + (define-key map "q" 'completion-list-mode-quit) + (define-key map " " 'completion-switch-to-minibuffer) + ;; [Tab] used to switch to the minibuffer but since [space] does that and + ;; since most applications in the world use [Tab] to select the next item + ;; in a list, do that in the *Completions* buffer too. -- Bob Weiner, + ;; BeOpen.com, 06/23/1999. + (define-key map "\t" 'next-list-mode-item)) (defvar completion-reference-buffer nil "Record the buffer that was current when the completion list was requested. @@ -486,6 +491,10 @@ but it talks about the buffer in `completion-reference-buffer'. If this is nil, it means to compare text to determine which part of the tail end of the buffer's text is involved in completion.") +;; These names are referenced in the doc string for `completion-list-mode'. +(defalias 'choose-completion 'list-mode-item-keyboard-selected) +(defalias 'mouse-choose-completion 'list-mode-item-mouse-selected) + (defun delete-completion-window () "Delete the completion list window. Go to the window from which completion was requested." @@ -495,6 +504,21 @@ Go to the window from which completion was requested." (if (get-buffer-window buf) (select-window (get-buffer-window buf))))) +(defun completion-switch-to-minibuffer () + "Move from a completions buffer to the active minibuffer window." + (interactive) + (select-window (minibuffer-window))) + +(defun completion-list-mode-quit () + "Abort any recursive edit and bury the completions buffer." + (interactive) + (condition-case () + (abort-recursive-edit) + (error nil)) + ;; If there was no recursive edit to abort, simply bury the completions + ;; list buffer. + (if (eq major-mode 'completion-list-mode) (bury-buffer))) + (defun completion-do-in-minibuffer () (interactive "_") (save-excursion diff --git a/lisp/menubar-items.el b/lisp/menubar-items.el index 6e757a3..bb1a875 100644 --- a/lisp/menubar-items.el +++ b/lisp/menubar-items.el @@ -955,7 +955,8 @@ ["No Warranty" describe-no-warranty] ["XEmacs License" describe-copying] ["The Latest Version" describe-distribution]) - ["Send Bug Report..." report-emacs-bug])))) + ["Send Bug Report..." report-emacs-bug + :active (fboundp 'report-emacs-bug)])))) (defun maybe-add-init-button () diff --git a/lisp/simple.el b/lisp/simple.el index 74daf55..0e45897 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -2889,6 +2889,7 @@ unless optional argument SOFT is non-nil." (if (and comcol (not fill-prefix)) ; XEmacs - (ENE) from fa-extras. (let ((comment-column comcol) (comment-start comstart) + (block-comment-start comstart) (comment-end comment-end)) (and comment-end (not (equal comment-end "")) ; (if (not comment-multi-line) -- 1.7.10.4