branch: elpa/with-editor
commit 939e825382e66e9cf09089d0034cf19ceaac0d8d
Author: Jonas Bernoulli <jo...@bernoul.li>
Commit: Jonas Bernoulli <jo...@bernoul.li>

    with-editor-sleeping-editor-filter: Restore significant return value
    
    For some callers (going through `with-editor-output-filter'), the
    return value is significant.  Fix the previous commit, which failed
    to take that into account.  Likewise return the string even if it
    does not end with a newline character once the process has finished.
    
    Closes #102.
---
 with-editor.el | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/with-editor.el b/with-editor.el
index 90eac9c..a61940e 100644
--- a/with-editor.el
+++ b/with-editor.el
@@ -652,8 +652,11 @@ may not insert the text into the PROCESS's buffer.  Then 
it calls
     (setq string (concat incomplete string)))
   (save-match-data
     (cond
-     ((and process (not (string-match-p "\n\\'" string)))
-      (process-put process 'incomplete string))
+     ((and process
+           (not (string-match-p "\n\\'" string))
+           (not (memq (process-status process) '(exit signal))))
+      (process-put process 'incomplete string)
+      nil)
      ((string-match with-editor-sleeping-editor-regexp string)
       (when process
         (process-put process 'incomplete nil))
@@ -670,7 +673,9 @@ may not insert the text into the PROCESS's buffer.  Then it 
calls
           (run-hooks 'with-editor-filter-visit-hook)
           (funcall (or (with-editor-server-window) 'switch-to-buffer)
                    (current-buffer))
-          (kill-local-variable 'server-window)))))))
+          (kill-local-variable 'server-window)))
+      nil)
+     (t string))))
 
 (defun with-editor-process-filter
     (process string &optional no-default-filter)

Reply via email to