help-gnu-emacs
[Top][All Lists]
Advanced

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

RE: dired-mark-unmarked-files failed with exceptions


From: Drew Adams
Subject: RE: dired-mark-unmarked-files failed with exceptions
Date: Fri, 4 May 2012 07:10:15 -0700

> 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 via email to

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