emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r114788: * progmodes/octave.el (octave-lookfor): Han


From: Leo Liu
Subject: [Emacs-diffs] trunk r114788: * progmodes/octave.el (octave-lookfor): Handle empty lookfor
Date: Fri, 25 Oct 2013 00:50:43 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 114788
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/15701
author: RĂ¼diger Sonderfeld <address@hidden>
committer: Leo Liu <address@hidden>
branch nick: trunk
timestamp: Fri 2013-10-25 08:49:33 +0800
message:
  * progmodes/octave.el (octave-lookfor): Handle empty lookfor
  result.  Ask user to retry using '-all' flag.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/progmodes/octave.el       
octavemod.el-20091113204419-o5vbwnq5f7feedwu-1028
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-10-24 21:16:20 +0000
+++ b/lisp/ChangeLog    2013-10-25 00:49:33 +0000
@@ -1,3 +1,8 @@
+2013-10-25  RĂ¼diger Sonderfeld  <address@hidden>
+
+       * progmodes/octave.el (octave-lookfor): Handle empty lookfor
+       result.  Ask user to retry using '-all' flag.  (Bug#15701)
+
 2013-10-24  Stefan Monnier  <address@hidden>
 
        * emacs-lisp/smie.el: New smie-config system.

=== modified file 'lisp/progmodes/octave.el'
--- a/lisp/progmodes/octave.el  2013-10-05 02:45:24 +0000
+++ b/lisp/progmodes/octave.el  2013-10-25 00:49:33 +0000
@@ -1724,20 +1724,32 @@
                  (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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]