From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 526B06DE104E for ; Wed, 20 Mar 2019 02:11:24 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.71 X-Spam-Level: X-Spam-Status: No, score=-0.71 tagged_above=-999 required=5 tests=[AWL=-0.010, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id t4rmbcUHQ7Wo for ; Wed, 20 Mar 2019 02:11:23 -0700 (PDT) Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by arlo.cworth.org (Postfix) with ESMTPS id 0A7366DE1037 for ; Wed, 20 Mar 2019 02:11:22 -0700 (PDT) X-Originating-IP: 90.92.41.33 Received: from bababa (lfbn-1-12225-33.w90-92.abo.wanadoo.fr [90.92.41.33]) (Authenticated sender: pierre@atlas.engineer) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 31E8720011 for ; Wed, 20 Mar 2019 09:11:20 +0000 (UTC) From: Pierre Neidhardt To: notmuch@notmuchmail.org Subject: Save multiple / all attachments without prompting (unless overwriting) Date: Wed, 20 Mar 2019 10:11:19 +0100 Message-ID: <87h8bxlxl4.fsf@bababa.i-did-not-set--mail-host-address--so-tickle-me> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Mar 2019 09:11:24 -0000 --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Is it possible to save all attachments at once to the default folder (mm-default-directory) without prompting? Better: only attachments in region? So far, I've hacked around mm-decode and came up with the following: =2D-8<---------------cut here---------------start------------->8--- (defun mm-save-part (handle &optional prompt) "Write HANDLE to a file. PROMPT overrides the default one used to ask user for a file name." (let ((filename (or (mail-content-type-get (mm-handle-disposition handle) 'filename) (mail-content-type-get (mm-handle-type handle) 'name))) file directory) (when filename (setq filename (gnus-map-function mm-file-name-rewrite-functions (file-name-nondirectory filename)))) (setq file mm-default-directory) ; <- ONLY CHANGE (if (file-directory-p file) (setq file (expand-file-name filename file)) (setq file (expand-file-name file (or mm-default-directory default-directory)))) (setq mm-default-directory (file-name-directory file)) (and (or (not (file-exists-p file)) (yes-or-no-p (format "File %s already exists; overwrite? " file))) (progn (mm-save-part-to-file handle file) file)))) =2D-8<---------------cut here---------------end--------------->8--- Thoughts? =2D-=20 Pierre Neidhardt https://ambrevar.xyz/ --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEUPM+LlsMPZAEJKvom9z0l6S7zH8FAlySA7cACgkQm9z0l6S7 zH8rdQf+IJJmwO24+TF3vbvFQn9kTszItlkosL92fZ8K5dIGmBkExGy06APkx6qt g271vhsA4GPhpUL1Sij/scFngXYVYYf7ucOpyMGj+4JvQI5I+9TL7ior89zvMb1p aCGi1nUxsHKZz1ZAaZxzVnM4JqdViUJHpTZAoer7TkkkblsynsCYed6YNR0M+chR +WcxXrX1X9r/eNfNAvG2J8VQwmkVaRD5CNzq9Sb0Zv/l5uSNOrnnwh4/Rhdw02YR E68QBSDRbl0Y8WREy5a1RtWTsyB6WXa/2ZL5nQdvW3bjYm3V+BrEO/XpsjxnUY1c HJ+rLE3KqroloxJD78Wle4hAo/iLVA== =m3nf -----END PGP SIGNATURE----- --=-=-=--