emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dired-mark


From: Andreas Röhler
Subject: Re: dired-mark
Date: Thu, 29 Nov 2007 10:44:52 +0100
User-agent: KMail/1.9.5

Am Donnerstag, 29. November 2007 09:34 schrieb Tassilo Horn:
> Andreas Röhler <address@hidden> writes:
> > dired-mark doku says:
> >
> > If on a subdir headerline, mark all its files except `.' and `..'.
> >
> > In the current directory however `.' and `..' are marked too. This may
> > cause errors later on, a need to search and unmark them.
> >
> > What about a change, which would skip or block marking of `.' and `..'
> > in current directory.
> >
> > Any opinions?
>
> But what if you really intend to mark "." or ".."?


That's precisely the question. For the moment I can't
imagine any case I would need it. However, as
experience tells our imagination runs short
occasionally...

Nonewithstanding I think `dired-mark' acts wisely in
subdirs. So why not let come in this behaviour into
current dir? 
>
> To mark all files and directories in the current directory I use `% m'
> (`dired-mark-files-regexp') with the regexp ".*".  This will omit "."
> and "..".


The task here is:

a temporary buffer is filled with results, sometimes
erroneously. 

As output is not always forseen and for other reason,
names are not easy to grasp with a regexp (this
would take time too).

Faster I get it with the time of output, have them
arranged at the bottom of dired-buffer. Then sometimes
the dirs are between...

Below the code as it runs successfully so far.

Thanks

Andreas Röhler

(defun dired-mark (arg)
  "Mark the current (or next ARG) files.
If on a subdir headerline, mark all its files except `.' and `..'.
Use \\[dired-unmark-all-files] to remove all marks
and \\[dired-unmark] on a subdir to remove the marks in
this subdir."
  (interactive "P")
  (if (dired-get-subdir)
      (save-excursion (dired-mark-subdir-files))
    ;; 2007-11-29 address@hidden changed section start    
    (let ((col (current-column)) buffer-read-only)
      (if
          (save-excursion
            (progn
              (move-to-column col)
              (or (looking-at "\\.")(looking-at "\\.\\."))))
          (progn (forward-line 1)
                 (move-to-column col))
        ;; 2007-11-29 address@hidden changed section end        
        (dired-repeat-over-lines
         (prefix-numeric-value arg)
         (function (lambda () (delete-char 1) (insert dired-marker-char))))))))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]