From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Kangas Newsgroups: gmane.emacs.bugs Subject: bug#37951: 27.0.50; octave completion-at-point for fieldnames Date: Fri, 08 Nov 2019 01:53:54 +0100 Message-ID: <87v9rvxk65.fsf@marxist.se> References: <87h83tzscc.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="222383"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: 37951@debbugs.gnu.org To: noah Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Nov 08 01:55:14 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iSsYT-000vi1-LO for geb-bug-gnu-emacs@m.gmane.org; Fri, 08 Nov 2019 01:55:14 +0100 Original-Received: from localhost ([::1]:48996 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iSsYR-0001XK-Fh for geb-bug-gnu-emacs@m.gmane.org; Thu, 07 Nov 2019 19:55:11 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34469) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iSsYL-0001XB-0p for bug-gnu-emacs@gnu.org; Thu, 07 Nov 2019 19:55:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iSsYI-0003iu-V9 for bug-gnu-emacs@gnu.org; Thu, 07 Nov 2019 19:55:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:35356) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iSsYI-0003iS-KI for bug-gnu-emacs@gnu.org; Thu, 07 Nov 2019 19:55:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iSsYI-0000FC-I3 for bug-gnu-emacs@gnu.org; Thu, 07 Nov 2019 19:55:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 08 Nov 2019 00:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 37951 X-GNU-PR-Package: emacs Original-Received: via spool by 37951-submit@debbugs.gnu.org id=B37951.1573174446850 (code B ref 37951); Fri, 08 Nov 2019 00:55:02 +0000 Original-Received: (at 37951) by debbugs.gnu.org; 8 Nov 2019 00:54:06 +0000 Original-Received: from localhost ([127.0.0.1]:44175 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iSsXM-0000DZ-Hi for submit@debbugs.gnu.org; Thu, 07 Nov 2019 19:54:06 -0500 Original-Received: from host.gofardesign.uk ([208.79.239.190]:57841) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iSsXK-0000Ct-BN; Thu, 07 Nov 2019 19:54:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=marxist.se; s=default; h=Content-Type:MIME-Version:Message-ID:Date:References: In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=KOQsiD9/I8dMXtTcGYgdZSUxNMVIquR8nsa0UYbKYjg=; b=RNQ0+dU9TSOhLwC0wV77A0YtDR 9ZQv+kR+xuPAnKBQ4Bcu4VrCv8By+OaOfTw3zJJDbXTRG3VNv1lXeguS22HkjR9YfLb4SOZLX8r6x ztX2H8GchIq5n/n6sPLOZuhRsUvOkvTA8NJ2sf920ILBcHVpVAFMEmHUfp3bMiXNKo+I=; Original-Received: from h-70-69.a785.priv.bahnhof.se ([155.4.70.69]:45310 helo=localhost) by host.gofardesign.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1iSsXE-0006iV-2Q; Thu, 07 Nov 2019 18:53:56 -0600 In-Reply-To: <87h83tzscc.fsf@gmail.com> (noah's message of "Sun, 27 Oct 2019 19:22:43 -0400") X-OutGoing-Spam-Status: No, score=-1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - host.gofardesign.uk X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - marxist.se X-Get-Message-Sender-Via: host.gofardesign.uk: authenticated_id: stefan@marxist.se X-Authenticated-Sender: host.gofardesign.uk: stefan@marxist.se X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:171137 Archived-At: noah writes: > This is relevant to octave.el (should I be sending to a different > list or tagging it somehow?) Yes, this is the correct list. > The completion-at-point functions in both octave source buffers > and inferior octave buffers don't complete for fieldnames of > eg. structs. For example, it would be nice to get completion > candidates after '.' in these cases > > octave> s(1) = struct('field1', [], 'field2', []) > octave> s(2) = struct('field1', [], 'field2', []) > octave> s. # case 1 > octave> s(1). # case 2 > > This is simply a matter of not capturing the correct bounds of > objects at point in `octave-completion-at-point` and > `inferior-octave-completion-at-point`. > > The octave function `completion_matches` already returns the correct > completion candidates ("s.field1" "s.field2") when passed the full > "s." or "s(1)." strings in the above example. > > The following modification to retrieve the bounds of the object > at point seems to work in both source and inferior buffers. > > (defun my-octave-bounds-of-object-at-point (&optional lim) > (let ((beg (save-excursion > (skip-syntax-backward "w_" lim) > ;; just this extra check > (when (eq ?. (char-before)) > (forward-char -1) > (and (eq ?\) (char-before)) ; struct(i). > (ignore-errors (backward-sexp))) > (skip-syntax-backward "w_" lim)) > (point))) > (end (point))) > (when (< beg end) ; extends region past point > (save-excursion > (skip-syntax-forward "w_") > (setq end (point)))) > (when (> end beg) > (cons beg end)))) > > However, being pretty new to octave, I'm not sure about all the cases > where this completion would be applicable. Could you send the above as a patch or a diff instead? That would increase the chances of us being able to integrate and use your changes. You should preferably send a patch against the latest development sources available via git. Thanks in advance. Best regards, Stefan Kangas