From: "Rüdiger Sonderfeld" <ruediger@c-plusplus.de>
To: 15701@debbugs.gnu.org
Cc: Leo Liu <sdl.web@gmail.com>
Subject: bug#15701: [PATCH] octave-mode: Handle empty lookfor result.
Date: Thu, 24 Oct 2013 18:58:53 +0200 [thread overview]
Message-ID: <1836189.W366bmrAnb@descartes> (raw)
* 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
next reply other threads:[~2013-10-24 16:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-24 16:58 Rüdiger Sonderfeld [this message]
2013-10-25 0:51 ` bug#15701: [PATCH] octave-mode: Handle empty lookfor result 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=1836189.W366bmrAnb@descartes \
--to=ruediger@c-plusplus.de \
--cc=15701@debbugs.gnu.org \
--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.