all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Mauro Aranda <maurooaranda@gmail.com>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: 36459@debbugs.gnu.org, Leo Liu <sdl.web@gmail.com>
Subject: bug#36459: 27.0.50; octave-mode ElDoc support bug
Date: Tue, 6 Aug 2019 13:07:59 -0300	[thread overview]
Message-ID: <CABczVwemfQfHqysL-6_mr+C_=5gzwbROq5fr98636=v5CVwKRg@mail.gmail.com> (raw)
In-Reply-To: <CABczVwcyFQ6=DpZ1kN0iRQeJ2A9_gc9k641nzitpa1eEvnGA-A@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 407 bytes --]

tags 36459 patch
quit

I attach a patch, which I think tackles the problems presented.  It
stops matching incorrectly when there is no function defined, with the
change suggested by Leo Liu.

Also, the regexp used now matches the newer help output (GNU Octave
4.2.x and newer), while still supporting older GNU Octave versions.

I've tested with GNU Octave 4.0.0 and GNU Octave 5.1.0.

Best regards,
Mauro.

[-- Attachment #1.2: Type: text/html, Size: 498 bytes --]

[-- Attachment #2: 0001-Fix-octave-mode-ElDoc-support.patch --]
[-- Type: text/x-patch, Size: 1940 bytes --]

From 6e704f00be224371a2aab9b6bce3a792dfeb934b Mon Sep 17 00:00:00 2001
From: Mauro Aranda <maurooaranda@gmail.com>
Date: Tue, 6 Aug 2019 12:45:28 -0300
Subject: [PATCH] Fix octave-mode ElDoc support

* lisp/progmodes/octave.el (octave-eldoc-function-signatures): Fix the
regexp used, so no match happens when there is no defined function FN.
Also, tweak the regexp to support GNU Octave 4.2.x and newer.  (Bug#36459)
---
 lisp/progmodes/octave.el | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el
index b770edb..51ba34f 100644
--- a/lisp/progmodes/octave.el
+++ b/lisp/progmodes/octave.el
@@ -1616,8 +1616,23 @@ octave-eldoc-function-signatures
      (list (format "print_usage ('%s');\n" fn)))
     (let (result)
       (dolist (line inferior-octave-output-list)
+        ;; The help output has changed a few times in GNU Octave.
+        ;; Earlier versions output "usage: " before the function signature.
+        ;; After deprecating the usage function, and up until GNU Octave 4.0.3,
+        ;; the output looks like this:
+        ;; -- Mapping Function: abs (Z).
+        ;; After GNU Octave 4.2.0, the output is less verbose and it looks like
+        ;; this:
+        ;; -- abs (Z)
+        ;; The following regexp matches these three formats.
+        ;; The "usage: " alternative matches the symbol, because a call to
+        ;; print_usage with a non-existent function (e.g., print_usage ('A'))
+        ;; would output:
+        ;; error: print_usage: 'A' not found
+        ;; and we wouldn't like to match anything in this case.
+        ;; See bug #36459.
         (when (string-match
-               "\\s-*\\(?:--[^:]+\\|usage\\):\\s-*\\(.*\\)$"
+               "\\s-*\\(?:--[^:]+:\\|\\_<usage:\\|--\\)\\s-*\\(.*\\)$"
                line)
           (push (match-string 1 line) result)))
       (setq octave-eldoc-cache
-- 
2.7.4


  reply	other threads:[~2019-08-06 16:07 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-01 14:58 bug#36459: 27.0.50; octave-mode ElDoc support bug Mauro Aranda
2019-07-03 14:43 ` Dmitry Gutov
2019-07-04 16:15   ` Mauro Aranda
2019-07-06 13:02   ` Leo Liu
2019-07-08 22:28     ` Mauro Aranda
2019-07-30 14:37       ` Dmitry Gutov
2019-07-30 17:53         ` Leo Liu
2019-07-31 14:11           ` Dmitry Gutov
2019-07-31 14:43             ` Mauro Aranda
2019-08-06 16:07               ` Mauro Aranda [this message]
2019-08-08  9:54                 ` Leo Liu
2019-08-08 11:09                   ` Mauro Aranda
2019-08-08 12:39                     ` Leo Liu
2019-08-08 13:50                       ` Eli Zaretskii
2019-08-08 15:36                         ` Leo Liu

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

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

  git send-email \
    --in-reply-to='CABczVwemfQfHqysL-6_mr+C_=5gzwbROq5fr98636=v5CVwKRg@mail.gmail.com' \
    --to=maurooaranda@gmail.com \
    --cc=36459@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    --cc=sdl.web@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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.