]> code.delx.au - gnu-emacs/commitdiff
* progmodes/octave.el (octave-lookfor): Handle empty lookfor
authorRĂ¼diger Sonderfeld <ruediger@c-plusplus.de>
Fri, 25 Oct 2013 00:49:33 +0000 (08:49 +0800)
committerLeo Liu <sdl.web@gmail.com>
Fri, 25 Oct 2013 00:49:33 +0000 (08:49 +0800)
result.  Ask user to retry using '-all' flag.

Fixes: debbugs:15701
lisp/ChangeLog
lisp/progmodes/octave.el

index 98a80fb21c7e370e48022f9055f38090a8cb6350..00d8c4240bde15aef664b72be6b837d91d5e67e1 100644 (file)
@@ -1,3 +1,8 @@
+2013-10-25  RĂ¼diger Sonderfeld  <ruediger@c-plusplus.de>
+
+       * progmodes/octave.el (octave-lookfor): Handle empty lookfor
+       result.  Ask user to retry using '-all' flag.  (Bug#15701)
+
 2013-10-24  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * emacs-lisp/smie.el: New smie-config system.
index 899bf151a2c025c9abd8b749460d5b4e28174abe..1803ea62c131a096328b54157b371733f3a1ea92 100644 (file)
@@ -1724,20 +1724,32 @@ sentence."
                  (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