From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.bugs Subject: bug#69141: [PATCH] Allow attaching files at point using 'gnus-dired-attach' Date: Mon, 19 Feb 2024 15:54:22 +0000 Message-ID: <878r3gbgb5.fsf@posteo.net> References: <87v86qnfqn.fsf@posteo.net> <87bk8fq7w7.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23781"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 69141@debbugs.gnu.org To: Eric Abrahamsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Feb 19 16:55:12 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rc5z5-0005zC-Ve for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 19 Feb 2024 16:55:12 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rc5yf-0003Gj-0B; Mon, 19 Feb 2024 10:54:45 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rc5yb-0003Fq-KX for bug-gnu-emacs@gnu.org; Mon, 19 Feb 2024 10:54:41 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rc5yb-0002ND-CM for bug-gnu-emacs@gnu.org; Mon, 19 Feb 2024 10:54:41 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rc5yw-0007BF-Fa for bug-gnu-emacs@gnu.org; Mon, 19 Feb 2024 10:55:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 19 Feb 2024 15:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69141 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 69141-submit@debbugs.gnu.org id=B69141.170835809427568 (code B ref 69141); Mon, 19 Feb 2024 15:55:02 +0000 Original-Received: (at 69141) by debbugs.gnu.org; 19 Feb 2024 15:54:54 +0000 Original-Received: from localhost ([127.0.0.1]:43241 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rc5yn-0007AZ-L3 for submit@debbugs.gnu.org; Mon, 19 Feb 2024 10:54:54 -0500 Original-Received: from mout01.posteo.de ([185.67.36.65]:42351) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rc5yl-0007AG-4b for 69141@debbugs.gnu.org; Mon, 19 Feb 2024 10:54:52 -0500 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 93267240028 for <69141@debbugs.gnu.org>; Mon, 19 Feb 2024 16:54:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1708358063; bh=sA+9nL9f7a/vAxkq6VT6XG1N7j0ZqQR0Cg5nIXkCTXA=; h=From:To:Cc:Subject:OpenPGP:Date:Message-ID:MIME-Version: Content-Type:From; b=YFHg8xEQ5mtSSVyM51npQk7LALM97InooH413MACsJbQYa8qv1YEAIcBY9a1Pmk7w uSFrjU9Vcd5x0RyDtAVbcjml8Ew800+4Vlz9PEO+Y/0zbVjUGOszyQs87SzRBFEaDE lIvPiRC1wRa2S97OSaVh2wUpPykA5iYJRiy0NOCI64vTawjQg05/3BUkCzwhLMSPyR IYvla15Pk0znvY18GxH9kM0fYOXDlGHE9r/t2Lwrt7egqz4SAQi2R2dCAwBC/pDa4W +TDTSWirlZGpn/kDQInrvuy5eI6EiwGbTeMvsss9NQxMUF3t6n+qUlzmbKCj/3194Q r+QDtfnfXwt8Q== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4TdnCf71bpz9rxL; Mon, 19 Feb 2024 16:54:22 +0100 (CET) In-Reply-To: <87bk8fq7w7.fsf@ericabrahamsen.net> (Eric Abrahamsen's message of "Sat, 17 Feb 2024 10:10:16 -0800") OpenPGP: id=7126E1DE2F0CE35C770BED01F2C3CC513DB89F66; url="https://keys.openpgp.org/vks/v1/by-fingerprint/7126E1DE2F0CE35C770BED01F2C3CC513DB89F66"; preference=signencrypt X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:280275 Archived-At: --=-=-= Content-Type: text/plain Eric Abrahamsen writes: > Philip Kaludercic writes: > >> I use this command frequently, and am just as frequently mildly annoyed >> that attachments are always added at the bottom of the message buffer, >> instead of at point as is the case with 'mml-attach-file' (usually this >> is mild enough that I'd immediately forget about it). This patch allows >> disabling the behaviour: > > This looks fine to me, thank you. Would you add a :version to the > defcustom, and also a mention (with index entry) in the Gnus manual, > "Interaction with other modes -> Dired"? > > I guess 'mail is a fine group for the defcustom, kind of hard to say. How does this look like: --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Allow-attaching-files-at-point-using-gnus-dired-atta.patch >From a61cf2688bc952864a5c394a4f06b64c48a906e2 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Thu, 15 Feb 2024 12:10:12 +0100 Subject: [PATCH] Allow attaching files at point using 'gnus-dired-attach' * lisp/gnus/gnus-dired.el (gnus-dired-attach-at-end): Add option. (gnus-dired-attach): Respect it. * doc/misc/gnus.texi (Other modes): Document it. (Bug#69141) --- doc/misc/gnus.texi | 5 ++++- lisp/gnus/gnus-dired.el | 9 ++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index 2f8f97e5845..98196310b5c 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi @@ -26695,9 +26695,12 @@ Other modes @table @kbd @item C-c C-m C-a @findex gnus-dired-attach +@vindex gnus-dired-attach-at-end @cindex attachments, selection via dired Send dired's marked files as an attachment (@code{gnus-dired-attach}). -You will be prompted for a message buffer. +You will be prompted for a message buffer. By default it will attach +files to the end of the message buffer, but you can modify that +behaviour by customising @code{gnus-dired-attach-at-end}. @item C-c C-m C-l @findex gnus-dired-find-file-mailcap diff --git a/lisp/gnus/gnus-dired.el b/lisp/gnus/gnus-dired.el index 48c1aef968b..f33c5f7f2e5 100644 --- a/lisp/gnus/gnus-dired.el +++ b/lisp/gnus/gnus-dired.el @@ -111,6 +111,12 @@ gnus-dired-mail-buffers (autoload 'gnus-completing-read "gnus-util") +(defcustom gnus-dired-attach-at-end t + "Non-nil means that files should be attached at the end of a buffer." + :group 'mail ;; dired? + :version "30.1" + :type 'boolean) + ;; Method to attach files to a mail composition. (defun gnus-dired-attach (files-to-attach) "Attach dired's marked files to a gnus message composition. @@ -161,7 +167,8 @@ gnus-dired-attach ;; set buffer to destination buffer, and attach files (set-buffer destination) - (goto-char (point-max)) ;attach at end of buffer + (when gnus-dired-attach-at-end + (goto-char (point-max))) ;attach at end of buffer (while files-to-attach (mml-attach-file (car files-to-attach) (or (mm-default-file-type (car files-to-attach)) -- 2.43.0 --=-=-=--