diff options
| author | RĂ¼diger Sonderfeld | 2013-10-25 08:49:33 +0800 |
|---|---|---|
| committer | Leo Liu | 2013-10-25 08:49:33 +0800 |
| commit | 6408a65db55664c19fda58217c4b214853cedc3d (patch) | |
| tree | 17077c61c4427cd54d59560b85b1777831757f15 | |
| parent | 357a508109504494cdc4a3fa0c53aca351890026 (diff) | |
| download | emacs-6408a65db55664c19fda58217c4b214853cedc3d.tar.gz emacs-6408a65db55664c19fda58217c4b214853cedc3d.zip | |
* progmodes/octave.el (octave-lookfor): Handle empty lookfor
result. Ask user to retry using '-all' flag.
Fixes: debbugs:15701
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/progmodes/octave.el | 22 |
2 files changed, 22 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 98a80fb21c7..00d8c4240bd 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2013-10-25 RĂ¼diger Sonderfeld <ruediger@c-plusplus.de> | ||
| 2 | |||
| 3 | * progmodes/octave.el (octave-lookfor): Handle empty lookfor | ||
| 4 | result. Ask user to retry using '-all' flag. (Bug#15701) | ||
| 5 | |||
| 1 | 2013-10-24 Stefan Monnier <monnier@iro.umontreal.ca> | 6 | 2013-10-24 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 7 | ||
| 3 | * emacs-lisp/smie.el: New smie-config system. | 8 | * emacs-lisp/smie.el: New smie-config system. |
diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el index 899bf151a2c..1803ea62c13 100644 --- a/lisp/progmodes/octave.el +++ b/lisp/progmodes/octave.el | |||
| @@ -1724,20 +1724,32 @@ sentence." | |||
| 1724 | (if all "'-all', " "") | 1724 | (if all "'-all', " "") |
| 1725 | str))) | 1725 | str))) |
| 1726 | (let ((lines inferior-octave-output-list)) | 1726 | (let ((lines inferior-octave-output-list)) |
| 1727 | (when (string-match "error: \\(.*\\)$" (car lines)) | 1727 | (when (and (stringp (car lines)) |
| 1728 | (string-match "error: \\(.*\\)$" (car lines))) | ||
| 1728 | (error "%s" (match-string 1 (car lines)))) | 1729 | (error "%s" (match-string 1 (car lines)))) |
| 1729 | (with-help-window octave-help-buffer | 1730 | (with-help-window octave-help-buffer |
| 1730 | (princ (mapconcat 'identity lines "\n")) | ||
| 1731 | (with-current-buffer octave-help-buffer | 1731 | (with-current-buffer octave-help-buffer |
| 1732 | (if lines | ||
| 1733 | (insert (mapconcat 'identity lines "\n")) | ||
| 1734 | (insert (format "Nothing found for \"%s\".\n" str))) | ||
| 1732 | ;; Bound to t so that `help-buffer' returns current buffer for | 1735 | ;; Bound to t so that `help-buffer' returns current buffer for |
| 1733 | ;; `help-setup-xref'. | 1736 | ;; `help-setup-xref'. |
| 1734 | (let ((help-xref-following t)) | 1737 | (let ((help-xref-following t)) |
| 1735 | (help-setup-xref (list 'octave-lookfor str all) | 1738 | (help-setup-xref (list 'octave-lookfor str all) |
| 1736 | (called-interactively-p 'interactive))) | 1739 | (called-interactively-p 'interactive))) |
| 1737 | (goto-char (point-min)) | 1740 | (goto-char (point-min)) |
| 1738 | (while (re-search-forward "^\\([^[:blank:]]+\\) " nil 'noerror) | 1741 | (when lines |
| 1739 | (make-text-button (match-beginning 1) (match-end 1) | 1742 | (while (re-search-forward "^\\([^[:blank:]]+\\) " nil 'noerror) |
| 1740 | :type 'octave-help-function)) | 1743 | (make-text-button (match-beginning 1) (match-end 1) |
| 1744 | :type 'octave-help-function))) | ||
| 1745 | (unless all | ||
| 1746 | (goto-char (point-max)) | ||
| 1747 | (insert "\nRetry with ") | ||
| 1748 | (insert-text-button "'-all'" | ||
| 1749 | 'follow-link t | ||
| 1750 | 'action #'(lambda (b) | ||
| 1751 | (octave-lookfor str '-all))) | ||
| 1752 | (insert ".\n")) | ||
| 1741 | (octave-help-mode))))) | 1753 | (octave-help-mode))))) |
| 1742 | 1754 | ||
| 1743 | (defcustom octave-source-directories nil | 1755 | (defcustom octave-source-directories nil |