unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Kangas <stefan@marxist.se>
To: noah <noah.v.peart@gmail.com>
Cc: 37951@debbugs.gnu.org
Subject: bug#37951: 27.0.50; octave completion-at-point for fieldnames
Date: Fri, 08 Nov 2019 01:53:54 +0100	[thread overview]
Message-ID: <87v9rvxk65.fsf@marxist.se> (raw)
In-Reply-To: <87h83tzscc.fsf@gmail.com> (noah's message of "Sun, 27 Oct 2019 19:22:43 -0400")

noah <noah.v.peart@gmail.com> 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





  reply	other threads:[~2019-11-08  0:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-27 23:22 bug#37951: 27.0.50; octave completion-at-point for fieldnames noah
2019-11-08  0:53 ` Stefan Kangas [this message]
2021-06-15 14:16   ` Lars Ingebrigtsen
2021-07-13 16:40     ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87v9rvxk65.fsf@marxist.se \
    --to=stefan@marxist.se \
    --cc=37951@debbugs.gnu.org \
    --cc=noah.v.peart@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).