From 69a94a37cdf891955fd062d4c12dc2962ae1daab Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 3 Dec 2009 02:58:16 +0000 Subject: [PATCH] (octave-complete-symbol): Use completion-in-region. --- lisp/ChangeLog | 3 +++ lisp/progmodes/octave-mod.el | 39 ++---------------------------------- 2 files changed, 5 insertions(+), 37 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8cc536e6fb5..f0b2de4031e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2009-12-03 Stefan Monnier + * progmodes/octave-mod.el (octave-complete-symbol): + Use completion-in-region. + Misc cleanup. * progmodes/idlwave.el (idlwave-comment-hook): Simplify with `or'. (idlwave-code-abbrev, idlwave-display-user-catalog-widget) diff --git a/lisp/progmodes/octave-mod.el b/lisp/progmodes/octave-mod.el index 0671dbe807a..ab3c7781868 100644 --- a/lisp/progmodes/octave-mod.el +++ b/lisp/progmodes/octave-mod.el @@ -1237,45 +1237,10 @@ otherwise." "Perform completion on Octave symbol preceding point. Compare that symbol against Octave's reserved words and builtin variables." - ;; This code taken from lisp-complete-symbol (interactive) (let* ((end (point)) - (beg (save-excursion (backward-sexp 1) (point))) - (string (buffer-substring-no-properties beg end)) - (completion (try-completion string octave-completion-alist))) - (cond ((eq completion t)) ; ??? - ((null completion) - (message "Can't find completion for \"%s\"" string) - (ding)) - ((not (string= string completion)) - (delete-region beg end) - (insert completion)) - (t - (let ((list (all-completions string octave-completion-alist)) - (conf (current-window-configuration))) - ;; Taken from comint.el - (message "Making completion list...") - (with-output-to-temp-buffer "*Completions*" - (display-completion-list list string)) - (message "Hit space to flush") - (let (key first) - (if (with-current-buffer (get-buffer "*Completions*") - (setq key (read-key-sequence nil) - first (aref key 0)) - (and (consp first) (consp (event-start first)) - (eq (window-buffer (posn-window (event-start - first))) - (get-buffer "*Completions*")) - (eq (key-binding key) 'mouse-choose-completion))) - (progn - (if (fboundp 'mouse-choose-completion) - (mouse-choose-completion first) - (choose-completion first)) ; Emacs >= 23.2 - (set-window-configuration conf)) - (if (eq first ?\ ) - (set-window-configuration conf) - (setq unread-command-events - (listify-key-sequence key)))))))))) + (beg (save-excursion (backward-sexp 1) (point)))) + (completion-in-region beg end octave-completion-alist))) ;;; Electric characters && friends -- 2.39.5