From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?UTF-8?Q?R=C3=BCdiger?= Sonderfeld Newsgroups: gmane.emacs.bugs Subject: bug#15701: [PATCH] octave-mode: Handle empty lookfor result. Date: Thu, 24 Oct 2013 18:58:53 +0200 Message-ID: <1836189.W366bmrAnb@descartes> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1382635156 2992 80.91.229.3 (24 Oct 2013 17:19:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 24 Oct 2013 17:19:16 +0000 (UTC) Cc: Leo Liu To: 15701@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Oct 24 19:19:18 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VZOZ3-0001Oz-Rm for geb-bug-gnu-emacs@m.gmane.org; Thu, 24 Oct 2013 19:19:18 +0200 Original-Received: from localhost ([::1]:55525 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VZOZ3-0000VA-CX for geb-bug-gnu-emacs@m.gmane.org; Thu, 24 Oct 2013 13:19:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45073) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VZOWz-0005OM-NN for bug-gnu-emacs@gnu.org; Thu, 24 Oct 2013 13:17:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VZOWs-0006xi-KP for bug-gnu-emacs@gnu.org; Thu, 24 Oct 2013 13:17:09 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:55702) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VZOWs-0006xd-Hh for bug-gnu-emacs@gnu.org; Thu, 24 Oct 2013 13:17:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VZOWr-0004Mb-Os for bug-gnu-emacs@gnu.org; Thu, 24 Oct 2013 13:17:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?R=C3=BCdiger?= Sonderfeld Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 24 Oct 2013 17:17:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 15701 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.138263498516719 (code B ref -1); Thu, 24 Oct 2013 17:17:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 24 Oct 2013 17:16:25 +0000 Original-Received: from localhost ([127.0.0.1]:41488 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VZOWH-0004LY-9R for submit@debbugs.gnu.org; Thu, 24 Oct 2013 13:16:25 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:38304) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VZOFv-0003tv-I3 for submit@debbugs.gnu.org; Thu, 24 Oct 2013 12:59:32 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VZOFj-00054K-Cq for submit@debbugs.gnu.org; Thu, 24 Oct 2013 12:59:26 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:47319) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VZOFj-00054G-AL for submit@debbugs.gnu.org; Thu, 24 Oct 2013 12:59:19 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39974) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VZOFd-0008Qm-A2 for bug-gnu-emacs@gnu.org; Thu, 24 Oct 2013 12:59:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VZOFW-0004yH-31 for bug-gnu-emacs@gnu.org; Thu, 24 Oct 2013 12:59:13 -0400 Original-Received: from ptmx.org ([178.63.28.110]:33670) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VZOFV-0004xu-TK for bug-gnu-emacs@gnu.org; Thu, 24 Oct 2013 12:59:06 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by ptmx.org (Postfix) with ESMTP id 1B7C02B13F; Thu, 24 Oct 2013 18:59:04 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at ptmx.org Original-Received: from ptmx.org ([127.0.0.1]) by localhost (ptmx.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mVFC2xqUtfxO; Thu, 24 Oct 2013 18:59:02 +0200 (CEST) Original-Received: from descartes.localnet (chello080108246092.7.14.vie.surfer.at [80.108.246.92]) by ptmx.org (Postfix) with ESMTPSA id D10432130F; Thu, 24 Oct 2013 18:59:01 +0200 (CEST) User-Agent: KMail/4.11.2 (Linux/3.11.0-12-generic; KDE/4.11.2; x86_64; ; ) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Mailman-Approved-At: Thu, 24 Oct 2013 13:16:23 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:79596 Archived-At: * lisp/progmodes/octave.el (octave-lookfor): Handle empty lookfor result. Ask user to retry using '-all' flag. Signed-off-by: R=C3=BCdiger Sonderfeld --- 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 'noerr= or) + (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))))) =20 (defcustom octave-source-directories nil --=20 1.8.4