From 4d2e94d172aa4a4f49b716c5c1c14293d6efa1f8 Mon Sep 17 00:00:00 2001 From: Leo Liu Date: Sat, 28 Sep 2013 11:15:56 +0800 Subject: [PATCH] * progmodes/octave.el (inferior-octave-completion-table) (inferior-octave-completion-at-point): Minor tweaks. --- lisp/ChangeLog | 3 +++ lisp/progmodes/octave.el | 30 +++++++++++++----------------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 39d284dac1c..971cc182448 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2013-09-28 Leo Liu + * progmodes/octave.el (inferior-octave-completion-table) + (inferior-octave-completion-at-point): Minor tweaks. + * textmodes/ispell.el (ispell-lookup-words): Rename from lookup-words. (Bug#15460) (lookup-words): Obsolete. diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el index 67a973263d1..899f2752a7e 100644 --- a/lisp/progmodes/octave.el +++ b/lisp/progmodes/octave.el @@ -1,4 +1,4 @@ -;;; octave.el --- editing octave source files under emacs -*- lexical-binding: t; -*- +;;; octave.el --- editing octave source files under emacs -*- lexical-binding: t; -*- ;; Copyright (C) 1997, 2001-2013 Free Software Foundation, Inc. @@ -804,34 +804,30 @@ startup file, `~/.emacs-octave'." ;; ;; Use cache to avoid repetitive computation of completions due to ;; bug#11906 - http://debbugs.gnu.org/11906 - which may cause - ;; noticeable delay. CACHE: (CMD TIME VALUE). + ;; noticeable delay. CACHE: (CMD . VALUE). (let ((cache)) (completion-table-dynamic (lambda (command) - (unless (and (equal (car cache) command) - (< (float-time) (+ 5 (cadr cache)))) + (unless (equal (car cache) command) (inferior-octave-send-list-and-digest (list (format "completion_matches ('%s');\n" command))) - (setq cache (list command (float-time) + (setq cache (cons command (delete-consecutive-dups (sort inferior-octave-output-list 'string-lessp))))) - (car (cddr cache)))))) + (cdr cache))))) (defun inferior-octave-completion-at-point () "Return the data to complete the Octave symbol at point." ;; http://debbugs.gnu.org/14300 - (let* ((filecomp (string-match-p - "/" (or (comint--match-partial-filename) ""))) - (end (point)) - (start - (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 + (unless (string-match-p "/" (or (comint--match-partial-filename) "")) + (let ((beg (save-excursion + (skip-syntax-backward "w_" (comint-line-beginning-position)) + (point))) + (end (point))) + (when (and beg (> end beg)) + (list beg end (completion-table-in-turn inferior-octave-completion-table - 'comint-completion-file-name-table))))) + 'comint-completion-file-name-table)))))) (define-obsolete-function-alias 'inferior-octave-complete 'completion-at-point "24.1") -- 2.39.2