emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r112383: * progmodes/octave.el (octav


From: Leo Liu
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r112383: * progmodes/octave.el (octave-completion-at-point-function): Make
Date: Fri, 26 Apr 2013 00:23:56 +0800
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 112383
committer: Leo Liu <address@hidden>
branch nick: trunk
timestamp: Fri 2013-04-26 00:23:56 +0800
message:
  * 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.
modified:
  lisp/ChangeLog
  lisp/progmodes/octave.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-04-25 16:07:33 +0000
+++ b/lisp/ChangeLog    2013-04-25 16:23:56 +0000
@@ -1,3 +1,12 @@
+2013-04-25  Leo Liu  <address@hidden>
+
+       * 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.
+
 2013-04-25  Stefan Monnier  <address@hidden>
 
        * progmodes/opascal.el: Use font-lock and syntax-propertize.

=== modified file 'lisp/progmodes/octave.el'
--- a/lisp/progmodes/octave.el  2013-04-25 14:51:08 +0000
+++ b/lisp/progmodes/octave.el  2013-04-25 16:23:56 +0000
@@ -330,12 +330,6 @@
   :type 'string
   :group 'octave)
 
-(defvar octave-completion-alist nil
-  "Alist of Octave symbols for completion in Octave mode.
-Each element looks like (VAR . VAR), where the car and cdr are the same
-symbol (an Octave command or variable name).
-Currently, only builtin variables can be completed.")
-
 (defvar octave-mode-imenu-generic-expression
   (list
    ;; Functions
@@ -639,8 +633,7 @@
   (set (make-local-variable 'beginning-of-defun-function)
        'octave-beginning-of-defun)
 
-  (easy-menu-add octave-mode-menu)
-  (octave-initialize-completions))
+  (easy-menu-add octave-mode-menu))
 
 
 (defcustom inferior-octave-program "octave"
@@ -874,6 +867,15 @@
     ;; won't have detrimental effects.
     (inferior-octave-resync-dirs)))
 
+(defun inferior-octave-completion-table ()
+  (unless inferior-octave-complete-impossible
+    (completion-table-dynamic
+     (lambda (command)
+       (inferior-octave-send-list-and-digest
+        (list (concat "completion_matches (\"" command "\");\n")))
+       (sort (delete-dups inferior-octave-output-list)
+             'string-lessp)))))
+
 (defun inferior-octave-completion-at-point ()
   "Return the data to complete the Octave symbol at point."
   (let* ((end (point))
@@ -887,15 +889,7 @@
                      "Your Octave does not have `completion_matches'.  "
                      "Please upgrade to version 2.X."))
            nil)
-         (t
-           (list
-            start end
-            (completion-table-dynamic
-             (lambda (command)
-               (inferior-octave-send-list-and-digest
-                (list (concat "completion_matches (\"" command "\");\n")))
-               (sort (delete-dups inferior-octave-output-list)
-                     'string-lessp))))))))
+         (t (list start end (inferior-octave-completion-table))))))
 
 (define-obsolete-function-alias 'inferior-octave-complete
   'completion-at-point "24.1")
@@ -1296,14 +1290,6 @@
 
 
 ;;; Completions
-(defun octave-initialize-completions ()
-  "Create an alist for Octave completions."
-  (if octave-completion-alist
-      ()
-    (setq octave-completion-alist
-          (append octave-reserved-words
-                  octave-text-functions
-                  octave-variables))))
 
 (defun octave-completion-at-point-function ()
   "Find the text to complete and the corresponding table."
@@ -1313,7 +1299,12 @@
         ;; Extend region past point, if applicable.
         (save-excursion (skip-syntax-forward "w_")
                         (setq end (point))))
-    (list beg end octave-completion-alist)))
+    (list beg end (or (and inferior-octave-process
+                           (process-live-p inferior-octave-process)
+                           (inferior-octave-completion-table))
+                      (append octave-reserved-words
+                              octave-text-functions
+                              octave-variables)))))
 
 (define-obsolete-function-alias 'octave-complete-symbol
   'completion-at-point "24.1")


reply via email to

[Prev in Thread] Current Thread [Next in Thread]