From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.bugs Subject: bug#39902: 28.0.50; Marking in dired with active region Date: Wed, 4 Mar 2020 17:11:25 -0800 (PST) Message-ID: References: <87d09suras.fsf@web.de> <87tv33r8e2.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="85308"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 39902@debbugs.gnu.org To: Juri Linkov , Michael Heerdegen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Mar 05 02:14:13 2020 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 1j9f5Z-000M2U-I1 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 05 Mar 2020 02:14:13 +0100 Original-Received: from localhost ([::1]:42066 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9f5Y-00025l-3o for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 04 Mar 2020 20:14:12 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40709) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9f5R-00025P-0b for bug-gnu-emacs@gnu.org; Wed, 04 Mar 2020 20:14:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j9f5P-0003NO-St for bug-gnu-emacs@gnu.org; Wed, 04 Mar 2020 20:14:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:36068) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j9f5O-0003MP-Ag for bug-gnu-emacs@gnu.org; Wed, 04 Mar 2020 20:14:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1j9f5O-0000My-6J for bug-gnu-emacs@gnu.org; Wed, 04 Mar 2020 20:14:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 05 Mar 2020 01:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 39902 X-GNU-PR-Package: emacs Original-Received: via spool by 39902-submit@debbugs.gnu.org id=B39902.15833708191383 (code B ref 39902); Thu, 05 Mar 2020 01:14:02 +0000 Original-Received: (at 39902) by debbugs.gnu.org; 5 Mar 2020 01:13:39 +0000 Original-Received: from localhost ([127.0.0.1]:42041 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j9f50-0000MF-M5 for submit@debbugs.gnu.org; Wed, 04 Mar 2020 20:13:38 -0500 Original-Received: from userp2130.oracle.com ([156.151.31.86]:45232) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j9f4y-0000M1-9O for 39902@debbugs.gnu.org; Wed, 04 Mar 2020 20:13:36 -0500 Original-Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0250w9W1126837; Thu, 5 Mar 2020 01:13:29 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=mime-version : message-id : date : from : sender : to : cc : subject : references : in-reply-to : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=i8tbVhT1i/hlJT3+BZ3XRC41hEJ9U53uTMwmYKtYIuA=; b=z8gZSTMw/eIDGOztVCt4ujlzfTzmBDQJolt05t8dxpyTCTcCl34xPRKbnuKfaXGJzFhU LpLReMexE7+0+JFfLLLVkbxa3klwdv+F3IY4C8iCHj79lq6VJ7BDMcKt3S4Wu+zkNFte zdCgh3PoW+s3pWapJfMZlHI3Jpn3sr7IFcY7TTDfvz5fPlbsntfzR96ieTmW+R7sXJqH bAPhfKO9Md5+RaG5c6lWTG52snIUdklcf9rgVsmiJIf6KU8h3BMJGHNAio19HYOPz0eK YDv7oTnJD1hhOLNoyK6IEc0ioERy90/S4n3jglyTCNzR9LJG16kDyxbQ1d8z1hkVGSpM Vw== Original-Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2130.oracle.com with ESMTP id 2yffcut335-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 05 Mar 2020 01:13:29 +0000 Original-Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0250wZcm110911; Thu, 5 Mar 2020 01:11:29 GMT Original-Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userp3020.oracle.com with ESMTP id 2yg1p90n32-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 05 Mar 2020 01:11:29 +0000 Original-Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 0251BQ44025151; Thu, 5 Mar 2020 01:11:27 GMT In-Reply-To: <87tv33r8e2.fsf@mail.linkov.net> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 16.0.4966.0 (x86)] X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9550 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 malwarescore=0 mlxlogscore=999 mlxscore=0 spamscore=0 adultscore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2003050003 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9550 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxscore=0 bulkscore=0 adultscore=0 suspectscore=0 spamscore=0 malwarescore=0 impostorscore=0 priorityscore=1501 mlxlogscore=999 lowpriorityscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2003050003 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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" Xref: news.gmane.io gmane.emacs.bugs:176879 Archived-At: > The peculiarity of dired mode is that it puts point in front of file name= . > So when the region doesn't cover the file name visually, it should not ta= ke > the file name outside the region into consideration for marking. That's what I said. It's the navigation keys, which didn't select complete lines, which led to the impression that not all files "in" the region got marked. It's about creation of the region. You can select complete lines, in which case `dired-mark' does what is expected: marks all of the files whose (full) lines are selected. But it's also possible to have `dired-mark' instead mark all of the files with ANY part of their line (not ALL of their line) in the region. > Exactly like kill-region should not kill text outside of the active regio= n, > dired-mark should not mark files outside of the active region. Bad analogy. Especially for purposes of marking or acting on files "in the region", what's important is that the region capture _some part_ of a file's line, not necessarily all of it. Marking is not, like `kill-region', an action on the characters of text in the region. It uses the region only to indicate a sequence of files to act on. This, or similar, is the behavior needed, as Stephen Berman pointed out: (defun diredp-mark-region-files (&optional unmark-p) "Mark all of the files in the current region (if it is active). With non-nil prefix arg, unmark them instead." (interactive "P") (let ((beg (min (point) (mark))) (end (max (point) (mark))) (inhibit-field-text-motion t)) ; Just in case. (setq beg (save-excursion (goto-char beg) (line-beginning-position)) end (save-excursion (goto-char end) (line-end-position))) (let ((dired-marker-char (if unmark-p ?\040 dired-marker-char))) (diredp-mark-if (and (<=3D (point) end) (>=3D (point) beg) (diredp-this-file-unmarked-p)) "region file")))) > Especially more dangerous command dired-flag-file-deletion > should not delete files outside of the active region. Not at all. The command simply marks; it does not delete. Subsequently using `x', to delete, prompts you for confirmation, specifying the files to be deleted. I don't see any danger. > > (2) Most of the time I rather want `dired-mark-files-regexp' to respect > > an active region - but that isn't implemented (though it would not be > > hard to do). I think that would be useful. >=20 > The problem is that this feature should be implemented in the macro > dired-mark-if, but then it will affect many other commands: >=20 > dired-mark-files-containing-regexp > dired-mark-symlinks > dired-mark-directories > dired-mark-executables > dired-flag-auto-save-files > dired-flag-backup-files > dired-compare-directories > dired-mark-unmarked-files > dired-mark-sexp > ... Those are all marking commands, so there's no problem. That said, I'm not sure it would be a great idea to have them (or have even just `dired-mark-files-regexp') act on only the files in the active region. Maybe, maybe not. It's certainly not hard, as a user, to narrow first and then use such commands (but yes, in that case you'll want to be sure to get the full lines in the narrowing).