aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeo Liu2013-04-26 00:23:56 +0800
committerLeo Liu2013-04-26 00:23:56 +0800
commit584ea27747d10f9af3d4e3c022153a3d4fc87cc4 (patch)
tree55ad57baf97a6fbdeaa9d499282cadef8035652e
parent1693b06af53b8f81b100147e91582be7d450640f (diff)
downloademacs-584ea27747d10f9af3d4e3c022153a3d4fc87cc4.tar.gz
emacs-584ea27747d10f9af3d4e3c022153a3d4fc87cc4.zip
* progmodes/octave.el (octave-completion-at-point-function): Make
use of inferior octave process. (octave-initialize-completions): Remove. (inferior-octave-completion-table): New function. (inferior-octave-completion-at-point): Use it. (octave-completion-alist): Remove.
-rw-r--r--lisp/ChangeLog9
-rw-r--r--lisp/progmodes/octave.el43
2 files changed, 26 insertions, 26 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 8ac5b5801ef..62424265d96 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,12 @@
12013-04-25 Leo Liu <sdl.web@gmail.com>
2
3 * progmodes/octave.el (octave-completion-at-point-function): Make
4 use of inferior octave process.
5 (octave-initialize-completions): Remove.
6 (inferior-octave-completion-table): New function.
7 (inferior-octave-completion-at-point): Use it.
8 (octave-completion-alist): Remove.
9
12013-04-25 Stefan Monnier <monnier@iro.umontreal.ca> 102013-04-25 Stefan Monnier <monnier@iro.umontreal.ca>
2 11
3 * progmodes/opascal.el: Use font-lock and syntax-propertize. 12 * progmodes/opascal.el: Use font-lock and syntax-propertize.
diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el
index c652822bf47..0e540ea348a 100644
--- a/lisp/progmodes/octave.el
+++ b/lisp/progmodes/octave.el
@@ -330,12 +330,6 @@ newline or semicolon after an else or end keyword."
330 :type 'string 330 :type 'string
331 :group 'octave) 331 :group 'octave)
332 332
333(defvar octave-completion-alist nil
334 "Alist of Octave symbols for completion in Octave mode.
335Each element looks like (VAR . VAR), where the car and cdr are the same
336symbol (an Octave command or variable name).
337Currently, only builtin variables can be completed.")
338
339(defvar octave-mode-imenu-generic-expression 333(defvar octave-mode-imenu-generic-expression
340 (list 334 (list
341 ;; Functions 335 ;; Functions
@@ -639,8 +633,7 @@ including a reproducible test case and send the message."
639 (set (make-local-variable 'beginning-of-defun-function) 633 (set (make-local-variable 'beginning-of-defun-function)
640 'octave-beginning-of-defun) 634 'octave-beginning-of-defun)
641 635
642 (easy-menu-add octave-mode-menu) 636 (easy-menu-add octave-mode-menu))
643 (octave-initialize-completions))
644 637
645 638
646(defcustom inferior-octave-program "octave" 639(defcustom inferior-octave-program "octave"
@@ -874,6 +867,15 @@ startup file, `~/.emacs-octave'."
874 ;; won't have detrimental effects. 867 ;; won't have detrimental effects.
875 (inferior-octave-resync-dirs))) 868 (inferior-octave-resync-dirs)))
876 869
870(defun inferior-octave-completion-table ()
871 (unless inferior-octave-complete-impossible
872 (completion-table-dynamic
873 (lambda (command)
874 (inferior-octave-send-list-and-digest
875 (list (concat "completion_matches (\"" command "\");\n")))
876 (sort (delete-dups inferior-octave-output-list)
877 'string-lessp)))))
878
877(defun inferior-octave-completion-at-point () 879(defun inferior-octave-completion-at-point ()
878 "Return the data to complete the Octave symbol at point." 880 "Return the data to complete the Octave symbol at point."
879 (let* ((end (point)) 881 (let* ((end (point))
@@ -887,15 +889,7 @@ startup file, `~/.emacs-octave'."
887 "Your Octave does not have `completion_matches'. " 889 "Your Octave does not have `completion_matches'. "
888 "Please upgrade to version 2.X.")) 890 "Please upgrade to version 2.X."))
889 nil) 891 nil)
890 (t 892 (t (list start end (inferior-octave-completion-table))))))
891 (list
892 start end
893 (completion-table-dynamic
894 (lambda (command)
895 (inferior-octave-send-list-and-digest
896 (list (concat "completion_matches (\"" command "\");\n")))
897 (sort (delete-dups inferior-octave-output-list)
898 'string-lessp))))))))
899 893
900(define-obsolete-function-alias 'inferior-octave-complete 894(define-obsolete-function-alias 'inferior-octave-complete
901 'completion-at-point "24.1") 895 'completion-at-point "24.1")
@@ -1296,14 +1290,6 @@ otherwise."
1296 1290
1297 1291
1298;;; Completions 1292;;; Completions
1299(defun octave-initialize-completions ()
1300 "Create an alist for Octave completions."
1301 (if octave-completion-alist
1302 ()
1303 (setq octave-completion-alist
1304 (append octave-reserved-words
1305 octave-text-functions
1306 octave-variables))))
1307 1293
1308(defun octave-completion-at-point-function () 1294(defun octave-completion-at-point-function ()
1309 "Find the text to complete and the corresponding table." 1295 "Find the text to complete and the corresponding table."
@@ -1313,7 +1299,12 @@ otherwise."
1313 ;; Extend region past point, if applicable. 1299 ;; Extend region past point, if applicable.
1314 (save-excursion (skip-syntax-forward "w_") 1300 (save-excursion (skip-syntax-forward "w_")
1315 (setq end (point)))) 1301 (setq end (point))))
1316 (list beg end octave-completion-alist))) 1302 (list beg end (or (and inferior-octave-process
1303 (process-live-p inferior-octave-process)
1304 (inferior-octave-completion-table))
1305 (append octave-reserved-words
1306 octave-text-functions
1307 octave-variables)))))
1317 1308
1318(define-obsolete-function-alias 'octave-complete-symbol 1309(define-obsolete-function-alias 'octave-complete-symbol
1319 'completion-at-point "24.1") 1310 'completion-at-point "24.1")