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: Thu, 15 Feb 2024 11:12:16 +0000 Message-ID: <87v86qnfqn.fsf@posteo.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="29110"; mail-complaints-to="usenet@ciao.gmane.io" To: 69141@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Feb 15 12:59:17 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 1raaOb-0007R1-DX for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 15 Feb 2024 12:59:17 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1raaO7-00025g-GB; Thu, 15 Feb 2024 06:58:47 -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 1raaO5-00024C-08 for bug-gnu-emacs@gnu.org; Thu, 15 Feb 2024 06:58:45 -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 1raaO4-0008AP-O9 for bug-gnu-emacs@gnu.org; Thu, 15 Feb 2024 06:58:44 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1raaON-0006Xo-9N for bug-gnu-emacs@gnu.org; Thu, 15 Feb 2024 06:59:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 15 Feb 2024 11:59:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 69141 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.170799829324976 (code B ref -1); Thu, 15 Feb 2024 11:59:03 +0000 Original-Received: (at submit) by debbugs.gnu.org; 15 Feb 2024 11:58:13 +0000 Original-Received: from localhost ([127.0.0.1]:54235 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1raaNY-0006Ug-QK for submit@debbugs.gnu.org; Thu, 15 Feb 2024 06:58:13 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:42358) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1raaNS-0006TL-TF for submit@debbugs.gnu.org; Thu, 15 Feb 2024 06:58:07 -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 1raZfC-0006cp-KH for bug-gnu-emacs@gnu.org; Thu, 15 Feb 2024 06:12:22 -0500 Original-Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1raZfA-00065L-Vs for bug-gnu-emacs@gnu.org; Thu, 15 Feb 2024 06:12:22 -0500 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 05E86240101 for ; Thu, 15 Feb 2024 12:12:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1707995538; bh=84iJZu0RPYjfe1igP10iKPlyuR8ufREqtGjRVKfjNIY=; h=From:To:Subject:OpenPGP:Date:Message-ID:MIME-Version:Content-Type: From; b=SRF3yO8OmkYF7EfM+iFC4aiw5Klxgni56hQvgALb9Bzp0jYNSeC/8pEHUP0mfpJKe 7ap7/R1uYl9MJannyaRt0GZXsNbOThzf21FlA2ylLcDHs2knf9T5pD9EmuhAlELRYP HSWv3H1GyuBk4Zuy9p9+3Ceio4wPawhd9KBBlrZh7s+8KWXFYMrYsliE80SVGvODm6 jC/RbihZJmIM4GOHQQZQfHANvyxRjQClE6zOQZ9UhNzjtjMWTJfiMGCZkbK95+TJ2a EBPiee4qUoZZ3cFBqGT30dyIoB8wxxA6v31IaT6vEQJIeiHUK3hdYGA3ccsed86geX 9z/EzhoApDzmg== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4TbC813jlkz6ty8 for ; Thu, 15 Feb 2024 12:12:17 +0100 (CET) OpenPGP: id=7126E1DE2F0CE35C770BED01F2C3CC513DB89F66; url="https://keys.openpgp.org/vks/v1/by-fingerprint/7126E1DE2F0CE35C770BED01F2C3CC513DB89F66"; preference=signencrypt Received-SPF: pass client-ip=185.67.36.66; envelope-from=philipk@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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:280054 Archived-At: --=-=-= Content-Type: text/plain 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: --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Allow-attaching-files-at-point-using-'gnus-dired-a.patch Content-Description: [PATCH] Allow attaching files at point using 'gnus-dired-attach' >From 9a5e9c51e74a278580eb670769b6093388a6109a 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. --- lisp/gnus/gnus-dired.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lisp/gnus/gnus-dired.el b/lisp/gnus/gnus-dired.el index 48c1aef968b..740caab349d 100644 --- a/lisp/gnus/gnus-dired.el +++ b/lisp/gnus/gnus-dired.el @@ -111,6 +111,11 @@ 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? + :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 +166,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 --=-=-=--