emacs-orgmode
[Top][All Lists]
Advanced

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

bug#12972: [PATCH] Avoid regression in mailcap-view-file similar to Bug#


From: Maxim Nikulin
Subject: bug#12972: [PATCH] Avoid regression in mailcap-view-file similar to Bug#44824
Date: Fri, 2 Jul 2021 19:21:55 +0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0

On 02/07/2021 01:38, Eli Zaretskii wrote:
From: Maxim Nikulin Date: Fri, 2 Jul 2021 00:01:59 +0700

--- a/lisp/net/mailcap.el
+++ b/lisp/net/mailcap.el
-    (start-process-shell-command command nil command)))
...
+    (make-process
+     :name "mailcap-view-file" :connection-type 'pipe :noquery t
+     :buffer nil ; "*Messages*" may be suitable for debugging
+     :sentinel (lambda (proc event)
+                 (when (and (memq (process-status proc) '(exit signal))
+                            (/= (process-exit-status proc) 0))
+                   (message
+                    "Command %s: %s."
+                    (mapconcat #'identity (process-command proc) " ")
+                    (substring event 0 -1))))
+     :command (list shell-file-name shell-command-switch command))))

First, you replace start-process-shell-command with make-process, and
I'm not sure I understand why.  If all you want is to use pipes, why
not simply bind process-connection-type around the call to
start-process-shell-command?

+    ;; An alternative is `process-connection-type' let-bound to nil for
+    ;; `start-process-shell-command' call (with no chance to report failure).
-----------------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

If main process of the handler fails then show a message with exit
reason.
---^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

And with other handlers, this could be an
incompatible behavior change if the handler behaves differently when
its standard handles are connected to a pipe rather than a terminal
device.

Example of such handler, please.





reply via email to

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