Gnus development mailing list
 help / color / mirror / Atom feed
From: Hrvoje Niksic <hniksic@xemacs.org>
Subject: [patch] Display what's really being executed
Date: Tue, 13 Aug 2002 20:35:40 +0200	[thread overview]
Message-ID: <sxslm7ay5c3.fsf@florida.munich.redhat.com> (raw)

This is a somewhat related followup on my previous bug report.

In mm-display-external, we're calling an external command to display
an article MIME part.  We display "Displaying " followed by the
expanded inline method.  This has several problems:

1) The expansion is executed simple-mindedly, using (format method
   file), which will fail when method is something like "display %s -x
   %s".  (But mm-mailcap-command handles this correctly.)

2) We don't show any of the quoting done by mm-mailcap-command.  This
   is confusing in the cases where the quoting displayed is "obviously
   wrong", such as "Displaying xv foo bar.jpg", but Gnus gets it
   right.  It's also confusing in the cases where the displayed
   quoting is obviously right, such as in "Displaying 'foo bar.jpg'",
   but Gnus gets it wrong.

3) A corollary of #2 is that it's simply wrong to show something other
   than what is being executed.  Either show structured information to
   the user, such as "Applying filename FOO to method 'FROB %s'" or
   show the actual command that *is* going to be executed, such as
   "Displaying xv foo\ bar.jpg".  I opted for the latter.

Since this function always executes an external command, I believe
that it is safe to simply always print that command after
"Displaying..."

BTW isn't mm-* supposed to be independent from Gnus?  What's the call
to gnus-configure-windows doing in the guts of mm-display-external?

The patch follows.  Note that indentation makes it appear much larger
than it is.  The only change is the addition of `let' forms and of
using those variables as the arguments to both `start-process' and
`message'.

I will apply the patch unless someone objects.

2002-08-13  Hrvoje Niksic  <hniksic@xemacs.org>

	* (mm-display-external): Display the actual command that has been
	executed in the echo area.

--- lisp/mm-decode.el.orig	Tue Aug 13 20:16:59 2002
+++ lisp/mm-decode.el	Tue Aug 13 20:20:56 2002
@@ -700,36 +700,33 @@
 	  (message "Viewing with %s" method)
 	  (cond
 	   (needsterm
-	    (unwind-protect
-		(if window-system
-		    (start-process "*display*" nil
-				   mm-external-terminal-program
-				   "-e" shell-file-name
-				   shell-command-switch
-				   (mm-mailcap-command
-				    method file (mm-handle-type handle)))
-		  (require 'term)
-		  (require 'gnus-win)
-		  (set-buffer
-		   (setq buffer
-			 (make-term "display"
-				    shell-file-name
-				    nil
-				    shell-command-switch
-				    (mm-mailcap-command
-				     method file
-				     (mm-handle-type handle)))))
-		  (term-mode)
-		  (term-char-mode)
-		  (set-process-sentinel
-		   (get-buffer-process buffer)
-		   `(lambda (process state)
-		      (if (eq 'exit (process-status process))
-			  (gnus-configure-windows
-			   ',gnus-current-window-configuration))))
-		  (gnus-configure-windows 'display-term))
-	      (mm-handle-set-external-undisplayer handle (cons file buffer)))
-	    (message "Displaying %s..." (format method file))
+	    (let ((command (mm-mailcap-command
+			    method file (mm-handle-type handle))))
+	      (unwind-protect
+		  (if window-system
+		      (start-process "*display*" nil
+				     mm-external-terminal-program
+				     "-e" shell-file-name
+				     shell-command-switch command)
+		    (require 'term)
+		    (require 'gnus-win)
+		    (set-buffer
+		     (setq buffer
+			   (make-term "display"
+				      shell-file-name
+				      nil
+				      shell-command-switch command)))
+		    (term-mode)
+		    (term-char-mode)
+		    (set-process-sentinel
+		     (get-buffer-process buffer)
+		     `(lambda (process state)
+			(if (eq 'exit (process-status process))
+			    (gnus-configure-windows
+			     ',gnus-current-window-configuration))))
+		    (gnus-configure-windows 'display-term))
+		(mm-handle-set-external-undisplayer handle (cons file buffer)))
+	      (message "Displaying %s..." command))
 	    'external)
 	   (copiousoutput
 	    (with-current-buffer outbuf
@@ -756,17 +753,17 @@
 		   (ignore-errors (kill-buffer buffer))))))
 	    'inline)
 	   (t
-	    (unwind-protect
-		(start-process "*display*"
-			       (setq buffer
-				     (generate-new-buffer " *mm*"))
-			       shell-file-name
-			       shell-command-switch
-			       (mm-mailcap-command
-				method file (mm-handle-type handle)))
-	      (mm-handle-set-external-undisplayer
-	       handle (cons file buffer)))
-	    (message "Displaying %s..." (format method file))
+	    (let ((command (mm-mailcap-command
+			    method file (mm-handle-type handle))))
+	      (unwind-protect
+		  (start-process "*display*"
+				 (setq buffer
+				       (generate-new-buffer " *mm*"))
+				 shell-file-name
+				 shell-command-switch command)
+		(mm-handle-set-external-undisplayer
+		 handle (cons file buffer)))
+	      (message "Displaying %s..." command))
 	    'external)))))))
 
 (defun mm-mailcap-command (method file type-list)



             reply	other threads:[~2002-08-13 18:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-13 18:35 Hrvoje Niksic [this message]
2002-12-29 22:45 ` Lars Magne Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sxslm7ay5c3.fsf@florida.munich.redhat.com \
    --to=hniksic@xemacs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).