From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alexander Klimov Newsgroups: gmane.emacs.devel Subject: Re: patch for completion in octave Date: Wed, 9 Feb 2011 16:00:23 +0200 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: dough.gmane.org 1297260080 20535 80.91.229.12 (9 Feb 2011 14:01:20 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 9 Feb 2011 14:01:20 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Feb 09 15:01:15 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PnAbY-0003Hv-LB for ged-emacs-devel@m.gmane.org; Wed, 09 Feb 2011 15:01:12 +0100 Original-Received: from localhost ([127.0.0.1]:43291 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PnAbX-0006il-NC for ged-emacs-devel@m.gmane.org; Wed, 09 Feb 2011 09:01:11 -0500 Original-Received: from [140.186.70.92] (port=47243 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PnAb3-0006h5-Mr for emacs-devel@gnu.org; Wed, 09 Feb 2011 09:00:47 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PnAaz-0007As-Pq for emacs-devel@gnu.org; Wed, 09 Feb 2011 09:00:41 -0500 Original-Received: from www.eitan.edu ([199.203.54.24]:61011 helo=eitan.edu) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1PnAaz-0007Ac-E6 for emacs-devel@gnu.org; Wed, 09 Feb 2011 09:00:37 -0500 Original-Received: (qmail 20083 invoked from network); 9 Feb 2011 14:00:23 -0000 Original-Received: from unknown (HELO localhost) (127.0.0.1) by localhost with SMTP; 9 Feb 2011 14:00:23 -0000 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Solaris 9 X-Received-From: 199.203.54.24 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:135793 Archived-At: Hi. On Tue, 8 Feb 2011, Stefan Monnier wrote: > So, could you try the patch below instead for a little while and see if > it fixes your problem (it should) and if it doesn't introduce > other issues? Your patch is also a good idea since it removes a code duplication, but besides fixing the original problem, it evinces that we have (modify-syntax-entry ?. "w" table) (modify-syntax-entry ?_ "w" table) in octave-mod.el, that makes M-f or M-b on something like var.field.subfield_1 too greedy. I must admit that I am too new to octave-mode, so I suspect I am not qualified to test the changes. Besides the original problem with completion, during testing I noticed that octave-help is not a command (btw, would not it be a good idea for define-key to warn that its argument is not a command, instead of reporting an error when the key is pressed?). In the menu "Lookup Octave Index" does not work since info-lookup-mode is not set (maybe we should set lookup mode "globally" instead and remove octave-help?). There is also a problem with completion-addsuffix, since `v' gives `var ' and now the user has to press DEL to continue with `.field' (btw, since the structure completion is possible, I added `.' into the skip pattern below). Together with your patch the following is supposed to fix all the problems (but, again, I doubt the quality of my testing): === modified file 'lisp/progmodes/octave-inf.el' --- lisp/progmodes/octave-inf.el 2011-01-26 08:36:39 +0000 +++ lisp/progmodes/octave-inf.el 2011-02-09 13:20:42 +0000 @@ -267,7 +264,7 @@ (let* ((end (point)) (command (save-excursion - (skip-syntax-backward "w_" (comint-line-beginning-position)) + (skip-chars-backward "a-zA-Z_." (comint-line-beginning-position)) (buffer-substring-no-properties (point) end))) (proc (get-buffer-process inferior-octave-buffer))) (cond (inferior-octave-complete-impossible @@ -290,9 +287,10 @@ (setcdr x (setq y (cdr y))) (setq x y y (cdr y))))) - ;; And let comint handle the rest - (comint-dynamic-simple-complete - command inferior-octave-output-list))))) + ;; And let comint handle the rest (without adding a suffix) + (let (comint-completion-addsuffix) + (comint-dynamic-simple-complete + command inferior-octave-output-list)))))) (defun inferior-octave-dynamic-list-input-ring () "List the buffer's input history in a help buffer." === modified file 'lisp/progmodes/octave-mod.el' --- lisp/progmodes/octave-mod.el 2011-01-25 04:08:28 +0000 +++ lisp/progmodes/octave-mod.el 2011-02-09 13:03:07 +0000 @@ -279,7 +279,7 @@ ["Submit Bug Report" octave-submit-bug-report t] "-" ["Describe Octave Mode" describe-mode t] - ["Lookup Octave Index" info-lookup-symbol t])) + ["Lookup Octave Index" octave-help t])) (defvar octave-mode-syntax-table (let ((table (make-syntax-table))) @@ -299,8 +299,8 @@ ;; Was "w" for abbrevs, but now that it's not necessary any more, (modify-syntax-entry ?\` "." table) (modify-syntax-entry ?\" "\"" table) - (modify-syntax-entry ?. "w" table) - (modify-syntax-entry ?_ "w" table) + (modify-syntax-entry ?. "." table) + (modify-syntax-entry ?_ "." table) ;; The "b" flag only applies to the second letter of the comstart ;; and the first letter of the comend, i.e. the "4b" below is ineffective. ;; If we try to put `b' on the single-line comments, we get a similar @@ -661,6 +661,7 @@ (defun octave-help () "Get help on Octave symbols from the Octave info files. Look up symbol in the function, operator and variable indices of the info files." + (interactive) (let ((info-lookup-mode 'octave-mode)) (call-interactively 'info-lookup-symbol))) -- Regards, ASK