From: Boruch Baum <boruch_baum@gmx.com>
To: Drew Adams <drew.adams@oracle.com>
Cc: "48883@debbugs.gnu.org" <48883@debbugs.gnu.org>
Subject: bug#48883: [External] : bug#48883: dired marking bugs
Date: Sun, 6 Jun 2021 20:50:00 -0400 [thread overview]
Message-ID: <20210607005000.cixkurympnxphbxm@E15-2016.optimum.net> (raw)
In-Reply-To: <SA2PR10MB4474162BFF0E14940945ED16F3399@SA2PR10MB4474.namprd10.prod.outlook.com>
[-- Attachment #1: Type: text/plain, Size: 672 bytes --]
Attached are two updated fix files.
file dired.2.patch is a slight modifcation of my first submission, to
cover a case of being in an empty directory.
file dired.3.patch is possibly a 'better' fix in that it addresses a
deficiency in function `dired-between-lines'. The emacs developers may
decide that method is undesirable and prefer the first patch.
Technically, neither file is a 'patch' file, but both are simple small
drop-in replacements for content of file dired.el @line ~3500. If for
this, you decide you need a real patch file, fine, just tell me for
which option.
--
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1 7286 0036 9E45 1595 8BC0
[-- Attachment #2: dired.2.patch --]
[-- Type: text/x-diff, Size: 1590 bytes --]
(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))))
(unless (eobp)
(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)))))
[-- Attachment #3: dired.3.patch --]
[-- Type: text/x-diff, Size: 1505 bytes --]
(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))
(save-excursion
(forward-line 1)
(move-marker pos (1+ (point))))
(unless (eobp)
(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))
(beginning-of-line)
(when (condition-case nil
(dired-get-filename)
(error nil))
(save-excursion (funcall function))))
(move-marker pos nil)
(dired-move-to-filename)))))
(defun dired-between-files ()
;; This used to be a regexp match of the `total ...' line output by
;; ls, which is slightly faster, but that is not very robust; notably,
;; it fails for non-english locales.
(not (condition-case nil
(dired-get-filename)
(error nil))))
next prev parent reply other threads:[~2021-06-07 0:50 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-06 20:33 bug#48883: dired marking bugs Boruch Baum
2021-06-06 22:12 ` bug#48883: [External] : " Drew Adams
2021-06-06 22:44 ` Boruch Baum
2021-06-07 15:24 ` Drew Adams
2021-06-07 0:08 ` Boruch Baum
2021-06-07 15:21 ` Drew Adams
2021-06-07 16:16 ` Drew Adams
2021-06-07 0:50 ` Boruch Baum [this message]
2021-06-07 18:53 ` Arthur Miller
2021-06-08 0:32 ` Filipp Gunbin
2021-06-08 4:15 ` Arthur Miller
2021-06-08 12:41 ` Filipp Gunbin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210607005000.cixkurympnxphbxm@E15-2016.optimum.net \
--to=boruch_baum@gmx.com \
--cc=48883@debbugs.gnu.org \
--cc=drew.adams@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).