* bug#15701: [PATCH] octave-mode: Handle empty lookfor result.
@ 2013-10-24 16:58 Rüdiger Sonderfeld
2013-10-25 0:51 ` Leo Liu
0 siblings, 1 reply; 2+ messages in thread
From: Rüdiger Sonderfeld @ 2013-10-24 16:58 UTC (permalink / raw)
To: 15701; +Cc: Leo Liu
* lisp/progmodes/octave.el (octave-lookfor): Handle empty lookfor
result. Ask user to retry using '-all' flag.
Signed-off-by: Rüdiger Sonderfeld <ruediger@c-plusplus.de>
---
lisp/progmodes/octave.el | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el
index 899bf15..1803ea6 100644
--- a/lisp/progmodes/octave.el
+++ b/lisp/progmodes/octave.el
@@ -1724,20 +1724,32 @@ (defun octave-lookfor (str &optional all)
(if all "'-all', " "")
str)))
(let ((lines inferior-octave-output-list))
- (when (string-match "error: \\(.*\\)$" (car lines))
+ (when (and (stringp (car lines))
+ (string-match "error: \\(.*\\)$" (car lines)))
(error "%s" (match-string 1 (car lines))))
(with-help-window octave-help-buffer
- (princ (mapconcat 'identity lines "\n"))
(with-current-buffer octave-help-buffer
+ (if lines
+ (insert (mapconcat 'identity lines "\n"))
+ (insert (format "Nothing found for \"%s\".\n" str)))
;; Bound to t so that `help-buffer' returns current buffer for
;; `help-setup-xref'.
(let ((help-xref-following t))
(help-setup-xref (list 'octave-lookfor str all)
(called-interactively-p 'interactive)))
(goto-char (point-min))
- (while (re-search-forward "^\\([^[:blank:]]+\\) " nil 'noerror)
- (make-text-button (match-beginning 1) (match-end 1)
- :type 'octave-help-function))
+ (when lines
+ (while (re-search-forward "^\\([^[:blank:]]+\\) " nil 'noerror)
+ (make-text-button (match-beginning 1) (match-end 1)
+ :type 'octave-help-function)))
+ (unless all
+ (goto-char (point-max))
+ (insert "\nRetry with ")
+ (insert-text-button "'-all'"
+ 'follow-link t
+ 'action #'(lambda (b)
+ (octave-lookfor str '-all)))
+ (insert ".\n"))
(octave-help-mode)))))
(defcustom octave-source-directories nil
--
1.8.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* bug#15701: [PATCH] octave-mode: Handle empty lookfor result.
2013-10-24 16:58 bug#15701: [PATCH] octave-mode: Handle empty lookfor result Rüdiger Sonderfeld
@ 2013-10-25 0:51 ` Leo Liu
0 siblings, 0 replies; 2+ messages in thread
From: Leo Liu @ 2013-10-25 0:51 UTC (permalink / raw)
To: Rüdiger Sonderfeld; +Cc: 15701-done
On 2013-10-25 00:58 +0800, Rüdiger Sonderfeld wrote:
> * lisp/progmodes/octave.el (octave-lookfor): Handle empty lookfor
> result. Ask user to retry using '-all' flag.
Committed with thanks.
Leo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-10-25 0:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-24 16:58 bug#15701: [PATCH] octave-mode: Handle empty lookfor result Rüdiger Sonderfeld
2013-10-25 0:51 ` Leo Liu
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.