diff options
| author | Stefan Monnier | 2009-12-03 02:58:16 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2009-12-03 02:58:16 +0000 |
| commit | 69a94a37cdf891955fd062d4c12dc2962ae1daab (patch) | |
| tree | f8d2df70c25d118d09219b27957a064808aba6b9 | |
| parent | 8d2221483a384a61971b7742a73edfff4c230063 (diff) | |
| download | emacs-69a94a37cdf891955fd062d4c12dc2962ae1daab.tar.gz emacs-69a94a37cdf891955fd062d4c12dc2962ae1daab.zip | |
(octave-complete-symbol): Use completion-in-region.
| -rw-r--r-- | lisp/ChangeLog | 3 | ||||
| -rw-r--r-- | 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 @@ | |||
| 1 | 2009-12-03 Stefan Monnier <monnier@iro.umontreal.ca> | 1 | 2009-12-03 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 2 | ||
| 3 | * progmodes/octave-mod.el (octave-complete-symbol): | ||
| 4 | Use completion-in-region. | ||
| 5 | |||
| 3 | Misc cleanup. | 6 | Misc cleanup. |
| 4 | * progmodes/idlwave.el (idlwave-comment-hook): Simplify with `or'. | 7 | * progmodes/idlwave.el (idlwave-comment-hook): Simplify with `or'. |
| 5 | (idlwave-code-abbrev, idlwave-display-user-catalog-widget) | 8 | (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." | |||
| 1237 | "Perform completion on Octave symbol preceding point. | 1237 | "Perform completion on Octave symbol preceding point. |
| 1238 | Compare that symbol against Octave's reserved words and builtin | 1238 | Compare that symbol against Octave's reserved words and builtin |
| 1239 | variables." | 1239 | variables." |
| 1240 | ;; This code taken from lisp-complete-symbol | ||
| 1241 | (interactive) | 1240 | (interactive) |
| 1242 | (let* ((end (point)) | 1241 | (let* ((end (point)) |
| 1243 | (beg (save-excursion (backward-sexp 1) (point))) | 1242 | (beg (save-excursion (backward-sexp 1) (point)))) |
| 1244 | (string (buffer-substring-no-properties beg end)) | 1243 | (completion-in-region beg end octave-completion-alist))) |
| 1245 | (completion (try-completion string octave-completion-alist))) | ||
| 1246 | (cond ((eq completion t)) ; ??? | ||
| 1247 | ((null completion) | ||
| 1248 | (message "Can't find completion for \"%s\"" string) | ||
| 1249 | (ding)) | ||
| 1250 | ((not (string= string completion)) | ||
| 1251 | (delete-region beg end) | ||
| 1252 | (insert completion)) | ||
| 1253 | (t | ||
| 1254 | (let ((list (all-completions string octave-completion-alist)) | ||
| 1255 | (conf (current-window-configuration))) | ||
| 1256 | ;; Taken from comint.el | ||
| 1257 | (message "Making completion list...") | ||
| 1258 | (with-output-to-temp-buffer "*Completions*" | ||
| 1259 | (display-completion-list list string)) | ||
| 1260 | (message "Hit space to flush") | ||
| 1261 | (let (key first) | ||
| 1262 | (if (with-current-buffer (get-buffer "*Completions*") | ||
| 1263 | (setq key (read-key-sequence nil) | ||
| 1264 | first (aref key 0)) | ||
| 1265 | (and (consp first) (consp (event-start first)) | ||
| 1266 | (eq (window-buffer (posn-window (event-start | ||
| 1267 | first))) | ||
| 1268 | (get-buffer "*Completions*")) | ||
| 1269 | (eq (key-binding key) 'mouse-choose-completion))) | ||
| 1270 | (progn | ||
| 1271 | (if (fboundp 'mouse-choose-completion) | ||
| 1272 | (mouse-choose-completion first) | ||
| 1273 | (choose-completion first)) ; Emacs >= 23.2 | ||
| 1274 | (set-window-configuration conf)) | ||
| 1275 | (if (eq first ?\ ) | ||
| 1276 | (set-window-configuration conf) | ||
| 1277 | (setq unread-command-events | ||
| 1278 | (listify-key-sequence key)))))))))) | ||
| 1279 | 1244 | ||
| 1280 | 1245 | ||
| 1281 | ;;; Electric characters && friends | 1246 | ;;; Electric characters && friends |