unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* dired-mark
@ 2007-11-29  8:01 Andreas Röhler
  2007-11-29  8:34 ` dired-mark Tassilo Horn
  0 siblings, 1 reply; 9+ messages in thread
From: Andreas Röhler @ 2007-11-29  8:01 UTC (permalink / raw)
  To: emacs-devel


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?

Thanks

Andreas Röhler 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: dired-mark
  2007-11-29  8:01 dired-mark Andreas Röhler
@ 2007-11-29  8:34 ` Tassilo Horn
  2007-11-29  9:44   ` dired-mark Andreas Röhler
  0 siblings, 1 reply; 9+ messages in thread
From: Tassilo Horn @ 2007-11-29  8:34 UTC (permalink / raw)
  To: emacs-devel

Andreas Röhler <andreas.roehler@online.de> 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 ".."?

To mark all files and directories in the current directory I use `% m'
(`dired-mark-files-regexp') with the regexp ".*".  This will omit "."
and "..".

Bye,
Tassilo

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: dired-mark
  2007-11-29  8:34 ` dired-mark Tassilo Horn
@ 2007-11-29  9:44   ` Andreas Röhler
  2007-11-29 17:07     ` dired-mark Drew Adams
  0 siblings, 1 reply; 9+ messages in thread
From: Andreas Röhler @ 2007-11-29  9:44 UTC (permalink / raw)
  To: emacs-devel; +Cc: Tassilo Horn

Am Donnerstag, 29. November 2007 09:34 schrieb Tassilo Horn:
> Andreas Röhler <andreas.roehler@online.de> 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 a.roehler@web.de 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 a.roehler@web.de changed section end	
	(dired-repeat-over-lines
	 (prefix-numeric-value arg)
	 (function (lambda () (delete-char 1) (insert dired-marker-char))))))))

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: dired-mark
  2007-11-29  9:44   ` dired-mark Andreas Röhler
@ 2007-11-29 17:07     ` Drew Adams
  2007-11-29 20:15       ` dired-mark Andreas Röhler
  0 siblings, 1 reply; 9+ messages in thread
From: Drew Adams @ 2007-11-29 17:07 UTC (permalink / raw)
  To: Andreas Röhler, emacs-devel

> > But what if you really intend to mark "." or ".."?
>
> That's precisely the question.

Yes.

> I can't imagine any case I would need it. However, as
> experience tells our imagination runs short occasionally...

It doesn't matter if you can't imagine a case where you would need it.

As long as users can operate on marked files and directories, someone will
want to, well, mark `.' or `..' and then operate on it.

Madame Lambda or Mister X might define a command that prints each marked
file and all files in each marked directory. Or search them. Or do whatever
to/with them. And s?he might use that command on `.' or `..' as well as on
other marked directories.

There is no reason that users shouldn't be able to use `dired-mark' to mark
`.' and `..'. If you don't want to mark them, then don't. If you have code
that does something to all marked files and dirs, but you don't want to
treat `.' and `..', then exclude those in your special-purpose code.

Wrt subdirs, it is only when point is on a subdir header line that
`dired-mark' does not mark the subdir's `.' or `..' - in that case, it marks
all files and directories _contained_ in the subdir. `dired-mark' always
marks `.' and `..' whenever they are targeted (e.g. cursor on that line).

That's TRT, IMO. Acting on a directory is not (necessarily) the same thing
as acting on everything in it. It is useful to be able to mark and act on
any directory, including `.' and `..'.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: dired-mark
  2007-11-29 17:07     ` dired-mark Drew Adams
@ 2007-11-29 20:15       ` Andreas Röhler
  2007-11-30  2:06         ` dired-mark Stefan Monnier
  0 siblings, 1 reply; 9+ messages in thread
From: Andreas Röhler @ 2007-11-29 20:15 UTC (permalink / raw)
  To: emacs-devel; +Cc: Tassilo Horn, Drew Adams

Am Donnerstag, 29. November 2007 18:07 schrieb Drew Adams:
> > > But what if you really intend to mark "." or ".."?
> >
> > That's precisely the question.
>
> Yes.
>
> > I can't imagine any case I would need it. However, as
> > experience tells our imagination runs short occasionally...
>
> It doesn't matter if you can't imagine a case where you would need it.
>
> As long as users can operate on marked files and directories, someone will
> want to, well, mark `.' or `..' and then operate on it.
>
> Madame Lambda or Mister X might define a command that prints each marked
> file and all files in each marked directory. Or search them. Or do whatever
> to/with them. And s?he might use that command on `.' or `..' as well as on
> other marked directories.
>
> There is no reason that users shouldn't be able to use `dired-mark' to mark
> `.' and `..'. If you don't want to mark them, then don't. If you have code
> that does something to all marked files and dirs, but you don't want to
> treat `.' and `..', then exclude those in your special-purpose code.
>
> Wrt subdirs, it is only when point is on a subdir header line that
> `dired-mark' does not mark the subdir's `.' or `..' - in that case, it
> marks all files and directories _contained_ in the subdir. `dired-mark'
> always marks `.' and `..' whenever they are targeted (e.g. cursor on that
> line).
>
> That's TRT, IMO. Acting on a directory is not (necessarily) the same thing
> as acting on everything in it. It is useful to be able to mark and act on
> any directory, including `.' and `..'.
>

I have no definite opinion in that point, just
raised the question from my scenario.

Should you know a precise case where marking the "."
and ".." in the dired-buffer are useful, I would like
to read about that.

Andreas Röhler

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: dired-mark
  2007-11-29 20:15       ` dired-mark Andreas Röhler
@ 2007-11-30  2:06         ` Stefan Monnier
  2007-11-30  9:30           ` dired-mark Andreas Schwab
  0 siblings, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2007-11-30  2:06 UTC (permalink / raw)
  To: Andreas Röhler; +Cc: Tassilo Horn, Drew Adams, emacs-devel

> Should you know a precise case where marking the "."
> and ".." in the dired-buffer are useful, I would like
> to read about that.

E.g. when you want to change the permissions?


        Stefan

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: dired-mark
  2007-11-30  2:06         ` dired-mark Stefan Monnier
@ 2007-11-30  9:30           ` Andreas Schwab
  2007-11-30 15:11             ` dired-mark Stefan Monnier
  0 siblings, 1 reply; 9+ messages in thread
From: Andreas Schwab @ 2007-11-30  9:30 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Tassilo Horn, Andreas Röhler, Drew Adams, emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> Should you know a precise case where marking the "."
>> and ".." in the dired-buffer are useful, I would like
>> to read about that.
>
> E.g. when you want to change the permissions?

Incidentally, dired-do-chmod refuses to operate on "." and "..".

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: dired-mark
  2007-11-30  9:30           ` dired-mark Andreas Schwab
@ 2007-11-30 15:11             ` Stefan Monnier
  2007-11-30 16:42               ` dired-mark Andreas Röhler
  0 siblings, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2007-11-30 15:11 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Horn, Andreas Röhler, Drew Adams, emacs-devel

>>> Should you know a precise case where marking the "."
>>> and ".." in the dired-buffer are useful, I would like
>>> to read about that.
>> 
>> E.g. when you want to change the permissions?

> Incidentally, dired-do-chmod refuses to operate on "." and "..".

Sounds like a bug to me,


        Stefan "who admits to using zsh rather than dired"

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: dired-mark
  2007-11-30 15:11             ` dired-mark Stefan Monnier
@ 2007-11-30 16:42               ` Andreas Röhler
  0 siblings, 0 replies; 9+ messages in thread
From: Andreas Röhler @ 2007-11-30 16:42 UTC (permalink / raw)
  To: emacs-devel; +Cc: Andreas Schwab, Tassilo Horn, Stefan Monnier, Drew Adams

Am Freitag, 30. November 2007 16:11 schrieb Stefan Monnier:
> >>> Should you know a precise case where marking the "."
> >>> and ".." in the dired-buffer are useful, I would like
> >>> to read about that.
> >>
> >> E.g. when you want to change the permissions?
> >
> > Incidentally, dired-do-chmod refuses to operate on "." and "..".
>
> Sounds like a bug to me,
>
>
>         Stefan "who admits to using zsh rather than dired"
>

For ".." I think it's ok to have it disabled.

For "." enabling them might be useful.

From the marking question this would constat a special
case, as it addresses remaining files at once.

So to operate on them, should be not need to mark it before,
because it's no alternative selection then.

Andreas Röhler

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2007-11-30 16:42 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-29  8:01 dired-mark Andreas Röhler
2007-11-29  8:34 ` dired-mark Tassilo Horn
2007-11-29  9:44   ` dired-mark Andreas Röhler
2007-11-29 17:07     ` dired-mark Drew Adams
2007-11-29 20:15       ` dired-mark Andreas Röhler
2007-11-30  2:06         ` dired-mark Stefan Monnier
2007-11-30  9:30           ` dired-mark Andreas Schwab
2007-11-30 15:11             ` dired-mark Stefan Monnier
2007-11-30 16:42               ` dired-mark Andreas Röhler

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).