Subject: 28.2; mm-mailcap-command error

From: HASM <[email-masked]>
Date: Wed, 29 Mar 2023 09:20:30 -0700

-----------------------------------------------------------------

- have your explicit shell be /bin/zsh

- configure ~/.mailcap for application abc, using program
  xyz as:

  application/abc; xyz 1>/dev/null 2>&1

- send yourself a message with an attachment of type
  application/abc

- using mh-e as your email reader this shows up in the
  show-+inbox buffer as a "button"

  [1. application/abc; file.abc]...

  not sure how it shows up in gnus email or any other emacs
  email readers

- putting the cursor within the "button" (betweeen the [])
  and typing enter, or clicking on the "button" with mouse
  button 1, invokes

  Viewing with xyz 1>/dev/null 2>&1
  Displaying xyz 1>/dev/null 2>&1</tmp/emm.uYWDyM/file.abc...done

  but this generates an error message
    zsh:1: parse error near `<'

  as the construct
     2>&1</path/to/decoded/attachment.abc
  confuses zsh

-----------------------------------------------------------------

Two solutions:

- fix abc's entry in .mailcap to be

    application/abc; xyz %s 1>/dev/null 2>&1

  which generates instead

  Viewing with xyz /path/to/decoded/attachment.abc 1>/dev/null 2>&1
  Displaying xyz /path/to/decoded/attachment.abc 1>/dev/null 2>&1...done

  which works

or, maybe better, or in addition

- change this simple construct in mm-mailcap-command

    (when uses-stdin
      (push "<" out)

  to be

    (when uses-stdin
      (push " <" out)

  which works too.

-----------------------------------------------------------------

Info on Emacs below could probably be ignored.

-- Henrique

-----------------------------------------------------------------

In GNU Emacs 28.2 (build 1, x86_64-redhat-linux-gnu, GTK+ Version 3.24.36, cairo version 1.17.6)
 of 2023-01-28 built on buildvm-x86-04.iad2.fedoraproject.org
Windowing system distributor 'The X.Org Foundation', version 11.0.12014000
System Description: Fedora Linux 37 (Workstation Edition)

Configured using:
 'configure --build=x86_64-redhat-linux-gnu
 --host=x86_64-redhat-linux-gnu --program-prefix=
 --disable-dependency-tracking --prefix=/usr
 --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin
 --sysconfdir=/etc --datadir=/usr/share
 --includedir=/usr/include --libdir=/usr/lib64
 --libexecdir=/usr/libexec --localstatedir=/var
 --sharedstatedir=/var/lib --mandir=/usr/share/man
 --infodir=/usr/share/info --with-dbus --with-gif
 --with-jpeg --with-png --with-rsvg --with-tiff --with-xpm
 --with-x-toolkit=gtk3 --with-gpm=no --with-xwidgets
 --with-modules --with-harfbuzz --with-cairo --with-json
 --with-native-compilation
 build_alias=x86_64-redhat-linux-gnu
 host_alias=x86_64-redhat-linux-gnu CC=gcc
 'CFLAGS=-DMAIL_USE_LOCKF -O2 -flto=auto -ffat-lto-objects
 -fexceptions -g -grecord-gcc-switches -pipe -Wall
 -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2
 -Wp,-D_GLIBCXX_ASSERTIONS
 -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
 -fstack-protector-strong
 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64
 -mtune=generic -fasynchronous-unwind-tables
 -fstack-clash-protection -fcf-protection'
 LDFLAGS=-Wl,-z,relro
 PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS
HARFBUZZ JPEG JSON LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2
M17N_FLT MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG
SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM
XPM XWIDGETS GTK3 ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=none
  locale-coding-system: utf-8-unix

Major mode: MH-Show

Minor modes in effect:
  filladapt-mode: t
  erc-list-mode: t
  erc-menu-mode: t
  erc-autojoin-mode: t
  erc-ring-mode: t
  erc-pcomplete-mode: t
  erc-track-mode: t
  erc-track-minor-mode: t
  erc-match-mode: t
  erc-button-mode: t
  erc-fill-mode: t
  erc-stamp-mode: t
  erc-netsplit-mode: t
  gpm-mouse-mode: t
  shell-dirtrack-mode: t
  global-flycheck-mode: t
  display-time-mode: t
  erc-services-mode: t
  erc-networks-mode: t
  erc-irccontrols-mode: t
  erc-noncommands-mode: t
  erc-move-to-prompt-mode: t
  erc-readonly-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: linux
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t

Load-path shadows:
~/emacs/custom hides /usr/share/emacs/28.2/lisp/custom
~/emacs/misc hides /usr/share/emacs/28.2/lisp/misc
/home/XXX/.emacs.d/elpa/hierarchy-20190425.842/hierarchy hides /usr/share/emacs/28.2/lisp/emacs-lisp/hierarchy

Features:
(shadow emacsbug doc-view image-mode exif macros kmacro
apropos debug backtrace eieio-opt speedbar ezimage dframe
shortdoc vc-mtn vc-hg vc-git diff-mode easy-mmode vc-bzr
vc-src vc-sccs vc-svn vc-cvs vc-rcs vc vc-dispatcher project
cus-edit cus-start cus-load cl-print help-fns radix-tree
dabbrev calc-alg calc-ext calc-menu calc calc-loaddefs rect
calc-macs erc-list erc-menu erc-join erc-ring erc-pcomplete
erc-track erc-match erc-button erc-fill erc-stamp
erc-netsplit tabify t-mouse term/linux mhtml-mode css-mode
eww xdg url-queue mm-url js cc-mode cc-fonts cc-guess
cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars
cc-defs sgml-mode facemenu jka-compr ispell y-mh-alias
mh-identity quail mh-letter mh-comp sendmail tex-mode
compile latexenc dired-aux conf-mode sort gnus-async
gnus-bcklg gnus-ml disp-table nndraft nnmh gnutls
network-stream nsm gnus-agent gnus-srvr gnus-score
score-mode nnvirtual gnus-msg nntp gnus-cache ibuffer
ibuffer-loaddefs mh-search mh-alias crm mule-util mh-thread
epa-file mh-funcs sh-script smie executable misearch
multi-isearch shr-color color term/xterm xterm qp flow-fill
mm-archive mail-extr mh-mime mh-gnus mh-show goto-addr
gnus-cite gnus-art mm-uu mml2015 mm-view mml-smime smime dig
gnus-sum shr kinsoku svg dom gnus-group gnus-undo gnus-start
gnus-dbus dbus xml gnus-cloud nnimap nnmail mail-source utf7
netrc nnoo parse-time gnus-spec gnus-int gnus-win gnus-range
gnus nnheader wid-edit mh-seq mh-inc hl-line mh-tool-bar
mh-xface mh-utils mh-folder which-func imenu mh-scan shell
pcomplete pcase flycheck find-func dash init server comp
comp-cstr warnings rx cl-extra help-mode time erc-services
erc-networks erc-goodies erc erc-backend iso8601 pp
format-spec erc-loaddefs man filladapt use-sql sql-indent
sql view thingatpt comint ansi-color ring message rmc puny
dired dired-loaddefs rfc822 mml mml-sec epa derived epg
rfc6068 epg-config gnus-util rmail rmail-loaddefs
text-property-search time-date mm-decode mm-bodies mm-encode
mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums
mail-prsvr mail-utils gmm-utils mailheader use-mh
mh-personality.el mh-e mh-compat mailabbrev mh-buffers
mh-loaddefs finder-inf info package browse-url url url-proxy
url-privacy url-expand url-methods url-history url-cookie
url-domsuf url-util mailcap url-handlers url-parse
auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs
password-cache json subr-x map url-vars seq byte-opt gv
bytecomp byte-compile cconv cl-loaddefs cl-lib iso-transl
tooltip eldoc paren electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt
fringe tabulated-list replace newcomment text-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch
easymenu timer select scroll-bar mouse jit-lock font-lock
syntax font-core term/tty-colors frame minibuffer cl-generic
cham georgian utf-8-lang misc-lang vietnamese tibetan thai
tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic
chinese composite emoji-zwj charscript charprop case-table
epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice button loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format
env code-pages mule custom widget hashtable-print-readable
backquote threads xwidget-internal dbusbind inotify
dynamic-setting system-font-setting font-render-setting
cairo move-toolbar gtk x-toolkit x multi-tty
make-network-process native-compile emacs)

Memory information:
((conses 16 755933 98080)
 (symbols 48 40261 22)
 (strings 32 187220 7150)
 (string-bytes 1 7520645)
 (vectors 16 77756)
 (vector-slots 8 2001590 101163)
 (floats 8 541 944)
 (intervals 56 12889 3793)
 (buffers 992 34))