GNU bug report logs - #15701
[PATCH] octave-mode: Handle empty lookfor result.

Previous Next

Package: emacs;

Reported by: Rüdiger Sonderfeld <ruediger <at> c-plusplus.de>

Date: Thu, 24 Oct 2013 17:17:01 UTC

Severity: normal

Tags: patch

Done: Leo Liu <sdl.web <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 15701 in the body.
You can then email your comments to 15701 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#15701; Package emacs. (Thu, 24 Oct 2013 17:17:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Rüdiger Sonderfeld <ruediger <at> c-plusplus.de>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 24 Oct 2013 17:17:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Rüdiger Sonderfeld <ruediger <at> c-plusplus.de>
To: bug-gnu-emacs <at> gnu.org
Cc: Leo Liu <sdl.web <at> gmail.com>
Subject: [PATCH] octave-mode: Handle empty lookfor result.
Date: Thu, 24 Oct 2013 18:58:53 +0200
* lisp/progmodes/octave.el (octave-lookfor): Handle empty lookfor
  result.  Ask user to retry using '-all' flag.

Signed-off-by: Rüdiger Sonderfeld <ruediger <at> 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





Reply sent to Leo Liu <sdl.web <at> gmail.com>:
You have taken responsibility. (Fri, 25 Oct 2013 00:52:02 GMT) Full text and rfc822 format available.

Notification sent to Rüdiger Sonderfeld <ruediger <at> c-plusplus.de>:
bug acknowledged by developer. (Fri, 25 Oct 2013 00:52:02 GMT) Full text and rfc822 format available.

Message #10 received at 15701-done <at> debbugs.gnu.org (full text, mbox):

From: Leo Liu <sdl.web <at> gmail.com>
To: Rüdiger Sonderfeld <ruediger <at> c-plusplus.de>
Cc: 15701-done <at> debbugs.gnu.org
Subject: Re: bug#15701: [PATCH] octave-mode: Handle empty lookfor result.
Date: Fri, 25 Oct 2013 08:51:08 +0800
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




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 22 Nov 2013 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 165 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.