From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Boruch Baum Newsgroups: gmane.emacs.bugs Subject: bug#48883: [External] : bug#48883: dired marking bugs Date: Sun, 6 Jun 2021 18:44:51 -0400 Message-ID: <20210606224451.32hmmhpsj3tqt5aj@E15-2016.optimum.net> References: <20210606203356.muhmgel5m2jwmzpj@E15-2016.optimum.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="a747dqbjpg3m6hrm" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20529"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: NeoMutt/20180716 Cc: "48883@debbugs.gnu.org" <48883@debbugs.gnu.org> To: Drew Adams Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jun 07 00:46:10 2021 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 1lq1X0-00056I-6o for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 07 Jun 2021 00:46:10 +0200 Original-Received: from localhost ([::1]:45022 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lq1Wy-0000Mn-R6 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 06 Jun 2021 18:46:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59342) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lq1Wr-0000MO-WE for bug-gnu-emacs@gnu.org; Sun, 06 Jun 2021 18:46:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42576) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lq1Wr-0006uU-Pj for bug-gnu-emacs@gnu.org; Sun, 06 Jun 2021 18:46:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lq1Wr-0004Sn-Lj for bug-gnu-emacs@gnu.org; Sun, 06 Jun 2021 18:46:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Boruch Baum Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 06 Jun 2021 22:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48883 X-GNU-PR-Package: emacs Original-Received: via spool by 48883-submit@debbugs.gnu.org id=B48883.162301950617091 (code B ref 48883); Sun, 06 Jun 2021 22:46:01 +0000 Original-Received: (at 48883) by debbugs.gnu.org; 6 Jun 2021 22:45:06 +0000 Original-Received: from localhost ([127.0.0.1]:54122 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lq1Vx-0004RZ-SR for submit@debbugs.gnu.org; Sun, 06 Jun 2021 18:45:06 -0400 Original-Received: from mout.gmx.net ([212.227.17.21]:34273) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lq1Vv-0004Qn-Js for 48883@debbugs.gnu.org; Sun, 06 Jun 2021 18:45:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1623019494; bh=NJ1x3QjsXiS2uYyOJ0MrV0XwHyrC97hBY0YuU3ai2Lg=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:References:In-Reply-To; b=l5GticvN87FYBKWazD1rFU0tKYrKZtEIGFvO2qQS6bmkMOniFRVHEVN90E7uv4H08 buB7SfBgV4FDJn5VNlBl9mPEcERUvGfUMPQFh9ZortejiPf/bxj1fvOXxx7Aagp+Zs Rzht32C0ZGRgYOeqinJwgDD+pvXM/61O2WT3kdXg= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from E15-2016.optimum.net ([96.224.230.212]) by mail.gmx.net (mrgmx105 [212.227.17.174]) with ESMTPSA (Nemesis) id 1Mn2WF-1l7Mgc2Jl9-00k7oT; Mon, 07 Jun 2021 00:44:53 +0200 Content-Disposition: inline In-Reply-To: X-Provags-ID: V03:K1:dAMNsLGLbCsBwk16X2ThdotRJgOt4Gx1NNUy4MITsLx82kg8SvJ 6/pk8yGvBReoes3NsgYsQi36m9zlyAqp4RLDUxFqJOtEZkbg0tWP5HsMe6IO6DaabAIl46O H0HoRbk3XUdmrCv6RZR6g9Q9J1w0n6yeJ8cTfX8O5qAq7PQvememv2bQWKelf6KZj9vlO0I jYxGBW8n0gMU3MQOl94gQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:lLLbxAX79LQ=:G0rVuvQrRi1sHVE5gZ9qns lUFE7aBhNTPHqK80Oq0JjnUwRszz6W9XzGsGQwDj6nhKtOpa/53bEdWo77VY+jbvG5uzqAk0W t/NIzr5pWq5XtErhkYUul9WTnJAjyWHo9++9HIIkR7YZcteM2QwD1mYiJeYpladKtU5VGQ3lh gQKUConQJwt9Pzb8faGgR/ubXU3lVdPcRbAIk4Rz4kpef17jbjujjI/COyJ3KpkpoNkqjpLBS urRwIpaNrqkV+vNG8ATqT3fF/iuEqzWavU/aU4RGyszGvJ5fNA52nW5P4eZJDbgRt9+NptxGA KyLpYJmteQXyTVSHUiBDoytHupNhGLCIyIwwtsJ8TtmCaDCizxrtdmUqr49otcqRbfa2ufBDk 8UotqkcHiQaFqcm8RjKsMGsKTvdmARmd+SHKLRV1CWIPRNycR3XYkRGTHLP5qxQq5l/w9QoS6 kFe9NVMW5DdVFt9OU1Qoy02ifcwzq/Dmq3XIkXaK0EdESnSceqF0HMg8i8+bH1wXK9QjNtD2f /hnawcGg1DwTzGJdShTz0VMq3AGALpO3NdJh9Vc8TLgMo5yCErlFDs4BJVL1Iiba7c0P4XczX cZYcAiEjpUyZnXQKx7524/HxLs02AdiEW/TDsrm9x6vyIt+n1PCuPfMSlnCoaCr1WfuSvloM+ kKF5RomKuhA3RXvVb9RnKtRoJRwIIRKDPd5X7kJ0fQAw1F+loiqxD0134lGzVXCSjQc/GKvse cXfrbGbz/8pcC28kk2Cp84tT5xnj+LZTaWrN1ZXXq6B8rb5B8Z9TwSvrr+pXdHAuYApvmR3N 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" Xref: news.gmane.io gmane.emacs.bugs:208166 Archived-At: --a747dqbjpg3m6hrm Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2021-06-06 22:12, Drew Adams wrote: > > 1.1) The correct and expected behavior of dired is that when one > > ... > > 1.2) Likewise, typing 'u' on that line unmarks all said lines. > > (You don't say so, but I think/hope you agree that > 1.1 and 1.2 are OK, not something improper.) Agreed. > > > 1.3) Now, advance one line, to the line typically presenting a > > summary, beginning with the word 'total', and press the sequen= ce > > 'C-u -1 m'. > > > > 1.4) Why is there now a mark on the prior line, the directory line? > > Note that the result differs from actually performing 'm' on > > that line also in that none of the "real" files in the directo= ry > > are marked. Note also that performing 'u' on the line does not > > remove the mark, but performing 'U' on the buffer does. > This change to `dired-repeat-over-lines' seems to > take care of that OK: > > In the second `while' (the one for negative movement), > change (save-excursion (funcall function)) to this: > (when (dired-get-filename nil t) ; <=3D=3D=3D=3D=3D=3D=3D > (save-excursion (funcall function))) I don't like that change because it allows operations on '.' and '..' which makes me uncomfortable. I have a patch in testing, but I want to do some more work before submitting it (and who knows, some emacs devel may insist none of this is a bug!). What I see as possibly the issue is function `dired-between-files'. I'm not equipped to perform a 'git blame', but the function's comment indicated a change at some point, and I suspect that's when the bug arose. > > 1.5) Attempting to perform an operation on the marked directory lin= e > > (eg. 'C' to copy it) returns the message "No files specified" > > IMO, that's not a problem. (I assume here you're > talking about point being on the dir heading line > and no (other) files being marked.) There _are_ > (should be) no files specified. Agreed. I should have made that clear. > IMO, there's nothing wrong with marking `.' or `..', > and nothing wrong with Dired having some operations > that work on them. I don't feel comfortable with that. Do you have any specific case in mind? > > 3) Improper advancing to (point-max) > > > > 3.1) Marking the final entry in a dired buffer advances POINT to a > > blank line, which is pretty much never desirable to a user. > > I don't see that as a problem. I agree that it isn't a *problem*, just that it's not friendly. OK. I've changed my mind, and am submitting my current patch. The reason I thought not to above is that I might want to propose changing function `dired-between-files'. However, from performing M-x rzgrep on the lisp directory, I see it referred to 9 times, and I haven't checked them yet: ./dired.el.gz:3498: (while (and (not (eobp)) (dired-between-files)) (= forward-line 1)) ./dired.el.gz:3509: (while (and (not (bobp)) (dired-between-files)) (= forward-line -1)) ./dired.el.gz:3515:(defun dired-between-files () ./dired.el.gz:3570: (while (and (< (point) end) (dired-between-files)= ) ./dired.el.gz:3652: (or (dired-between-files) ./files.el.gz:6944:;; dired-between-files, (shortcut for (not (dired-mov= e-to-filename))) ./net/ange-ftp.el.gz:5440:;;(or (assq 'vms ange-ftp-dired-between-files-al= ist) ./net/ange-ftp.el.gz:5441:;; (setq ange-ftp-dired-between-files-alist ./net/ange-ftp.el.gz:5443:;; ange-ftp-dired-between-files-alist))) Also, because dired is such an old feature of emacs, and since it is the subject of so many third-party[1] extensions, any *fix* to that function, even if correct, might have undesirable consequences downstream, so I want to careful about it. [1] I know I keep saying 'third-party' but I have no idea who is the secon= d-party. =2D- hkp://keys.gnupg.net CA45 09B5 5351 7C11 A9D1 7286 0036 9E45 1595 8BC0 --a747dqbjpg3m6hrm Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="dired.patch" (defun dired-repeat-over-lines (arg function) ;; This version skips non-file lines. (let ((pos (make-marker))) (beginning-of-line) (cond ((> arg 0) (while (and (> arg 0) (not (eobp))) (setq arg (1- arg)) (beginning-of-line) ;;(while (and (not (eobp)) (dired-between-files)) (forward-line 1)) (while (and (not (eobp)) (condition-case nil (not (dired-get-filename)) (error t))) (forward-line 1)) (save-excursion (forward-line 1) (move-marker pos (1+ (point)))) (save-excursion (funcall function)) ;; Advance to the next line--actually, to the line that *was* next. ;; (If FUNCTION inserted some new lines in between, skip them.) (goto-char pos)) (when (eobp) (forward-line -1) (dired-move-to-filename))) ((< arg 0) (while (and (< arg 0) (not (bobp))) (setq arg (1+ arg)) (forward-line -1) ;;(while (and (not (bobp)) (dired-between-files)) (forward-line -1)) (while (and (not (bobp)) (condition-case nil (not (dired-get-filename)) (error t))) (forward-line -1)) (beginning-of-line) (when (condition-case nil (dired-get-filename) (error nil)) (save-excursion (funcall function)))) (move-marker pos nil) (dired-move-to-filename))))) --a747dqbjpg3m6hrm--