From 455851dd0cba67f2b1ec28296e34e34ff1668251 Mon Sep 17 00:00:00 2001 From: Leo Liu Date: Thu, 9 May 2013 08:52:49 +0800 Subject: [PATCH] * progmodes/octave.el (inferior-octave-completion-at-point): Restore the broken file completion. (inferior-octave-startup): Fix incorrect highlighting for the first prompt. Fixes: debbugs:14300 --- lisp/ChangeLog | 7 +++++++ lisp/progmodes/octave.el | 23 +++++++++++++++-------- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 12e2007c126..e681469fedc 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2013-05-09 Leo Liu + + * progmodes/octave.el (inferior-octave-completion-at-point): + Restore the broken file completion. (Bug#14300) + (inferior-octave-startup): Fix incorrect highlighting for the + first prompt. + 2013-05-08 Stefan Monnier * progmodes/ruby-mode.el: First cut at SMIE support. diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el index 138c1948131..6e6e6feb772 100644 --- a/lisp/progmodes/octave.el +++ b/lisp/progmodes/octave.el @@ -716,7 +716,6 @@ startup file, `~/.emacs-octave'." (when (and inferior-octave-startup-file (file-exists-p inferior-octave-startup-file)) (format "source (\"%s\");\n" inferior-octave-startup-file)))) - ;; XXX: the first prompt is incorrectly highlighted (insert-before-markers (concat (if inferior-octave-output-list @@ -729,7 +728,9 @@ startup file, `~/.emacs-octave'." (set-process-filter proc 'comint-output-filter) ;; Just in case, to be sure a cd in the startup file ;; won't have detrimental effects. - (inferior-octave-resync-dirs))) + (inferior-octave-resync-dirs) + ;; A trick to get the prompt highlighted. + (comint-send-string proc "\n"))) (defun inferior-octave-completion-table () (completion-table-dynamic @@ -741,13 +742,19 @@ startup file, `~/.emacs-octave'." (defun inferior-octave-completion-at-point () "Return the data to complete the Octave symbol at point." - (let* ((end (point)) + ;; http://debbugs.gnu.org/14300 + (let* ((filecomp (string-match-p + "/" (or (comint--match-partial-filename) ""))) + (end (point)) (start - (save-excursion - (skip-syntax-backward "w_" (comint-line-beginning-position)) - (point)))) - (when (> end start) - (list start end (inferior-octave-completion-table))))) + (unless filecomp + (save-excursion + (skip-syntax-backward "w_" (comint-line-beginning-position)) + (point))))) + (when (and start (> end start)) + (list start end (completion-table-in-turn + (inferior-octave-completion-table) + 'comint-completion-file-name-table))))) (define-obsolete-function-alias 'inferior-octave-complete 'completion-at-point "24.1") -- 2.39.2