diff options
| -rw-r--r-- | lisp/progmodes/octave.el | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el index 6caf8d93d3f..76181892cdb 100644 --- a/lisp/progmodes/octave.el +++ b/lisp/progmodes/octave.el | |||
| @@ -1591,8 +1591,23 @@ code line." | |||
| 1591 | (list (format "print_usage ('%s');\n" fn))) | 1591 | (list (format "print_usage ('%s');\n" fn))) |
| 1592 | (let (result) | 1592 | (let (result) |
| 1593 | (dolist (line inferior-octave-output-list) | 1593 | (dolist (line inferior-octave-output-list) |
| 1594 | ;; The help output has changed a few times in GNU Octave. | ||
| 1595 | ;; Earlier versions output "usage: " before the function signature. | ||
| 1596 | ;; After deprecating the usage function, and up until GNU Octave 4.0.3, | ||
| 1597 | ;; the output looks like this: | ||
| 1598 | ;; -- Mapping Function: abs (Z). | ||
| 1599 | ;; After GNU Octave 4.2.0, the output is less verbose and it looks like | ||
| 1600 | ;; this: | ||
| 1601 | ;; -- abs (Z) | ||
| 1602 | ;; The following regexp matches these three formats. | ||
| 1603 | ;; The "usage: " alternative matches the symbol, because a call to | ||
| 1604 | ;; print_usage with a non-existent function (e.g., print_usage ('A')) | ||
| 1605 | ;; would output: | ||
| 1606 | ;; error: print_usage: 'A' not found | ||
| 1607 | ;; and we wouldn't like to match anything in this case. | ||
| 1608 | ;; See bug #36459. | ||
| 1594 | (when (string-match | 1609 | (when (string-match |
| 1595 | "\\s-*\\(?:--[^:]+\\|usage\\):\\s-*\\(.*\\)$" | 1610 | "\\s-*\\(?:--[^:]+:\\|\\_<usage:\\|--\\)\\s-*\\(.*\\)$" |
| 1596 | line) | 1611 | line) |
| 1597 | (push (match-string 1 line) result))) | 1612 | (push (match-string 1 line) result))) |
| 1598 | (setq octave-eldoc-cache | 1613 | (setq octave-eldoc-cache |