unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "'David Young'" <dove.young@gmail.com>, <help-gnu-emacs@gnu.org>
Subject: RE: dired-mark-unmarked-files failed with exceptions
Date: Fri, 4 May 2012 07:10:15 -0700	[thread overview]
Message-ID: <DE668394F4DA4C8B836D9490D5CFFB6F@us.oracle.com> (raw)
In-Reply-To: <CAK97FfM-VdPU5Zwr9Nh19aH9qrH0gioecQXFd_kQmAbYn+VGBA@mail.gmail.com>

> I am running Emacs 23.3.1 on Ubuntu 12.04 32bit.  I tried to
> run `dired' on my Emacs extension directory and marked some
> files by `dired-mark-extension', and then I want to revert
> the mark and remove in-interesting file lines from the dired
> buffer, so I ran `dired-mark-unmarked-files' command, it
> failed with exceptions.  
> 	
> Debugger entered--Lisp error: (wrong-number-of-arguments
>  #[(regexp msg &optional unflag-p localp)
>  ("/usr/share/emacs/23.3/lisp/dired-x.elc" . 18095) nil 9 
>  ("/usr/share/emacs/23.3/lisp/dired-x.elc" . 17750) "P"] 1)
>  dired-mark-unmarked-files(nil)
> 	
> It seems like that `dired-mark-unmarked-files ' would need some
> parameters but it is not provided.

Bravo! You found an Emacs bug that is at least as old as the Emacs 20 code.

Fortunately, it has been fixed in Emacs 24, so there is no need to report it.

If you want the fix, here is the Emacs 24 code - just put this in your init
file:

(defun dired-mark-unmarked-files (regexp msg &optional unflag-p localp)
  "Mark unmarked files matching REGEXP, displaying MSG.
REGEXP is matched against the entire file name.  When called
interactively, prompt for REGEXP.
With prefix argument, unflag all those files.
Optional fourth argument LOCALP is as in `dired-get-filename'."
  (interactive
   (list (dired-read-regexp
	  "Mark unmarked files matching regexp (default all): ")
	 nil current-prefix-arg nil))
  (let ((dired-marker-char (if unflag-p ?\s dired-marker-char)))
    (dired-mark-if
     (and
      ;; not already marked
      (looking-at " ")
      ;; uninteresting
      (let ((fn (dired-get-filename localp t)))
        (and fn (string-match regexp fn))))
     msg)))

That command never could have worked as coded prior to Emacs 24, for the reason
you give.  The `interative' spec was just "P", which passes only the raw prefix
arg to the function body.  But the function expects at least two required
arguments




      reply	other threads:[~2012-05-04 14:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-04 13:46 dired-mark-unmarked-files failed with exceptions David Young
2012-05-04 14:10 ` Drew Adams [this message]

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=DE668394F4DA4C8B836D9490D5CFFB6F@us.oracle.com \
    --to=drew.adams@oracle.com \
    --cc=dove.young@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /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.
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).