all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* dired-mark-unmarked-files failed with exceptions
@ 2012-05-04 13:46 David Young
  2012-05-04 14:10 ` Drew Adams
  0 siblings, 1 reply; 2+ messages in thread
From: David Young @ 2012-05-04 13:46 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 1603 bytes --]

Hi! Folks

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.

Below is messages from the *Message* buffer.

For information about GNU Emacs and the GNU system, type C-h C-a.
Quit [2 times]
Making completion list...
Quit
Making completion list...
Loading dired-x...done
Marking matching files...
16 matching files marked.
call-interactively: 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

GNU Emacs 23.3.1 (i686-pc-linux-gnu, GTK+ Version 2.24.10) of 2012-03-26 on
roseapple, modified by Debian

I enabled debug by  (toggle-debug-on-error) and ran the command
`dired-mark-unmarked-files ' again. And the *Backtrace* buffer displayed
following messages.

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)
  call-interactively(dired-mark-unmarked-files t nil)
  execute-extended-command(nil)
  call-interactively(execute-extended-command nil nil)

It seems like that `dired-mark-unmarked-files ' would need some parameters
but it is not provided.  Will anyone help me? Thanks a lot.

-- 
M-x Thinks

[-- Attachment #2: Type: text/html, Size: 1850 bytes --]

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

* RE: dired-mark-unmarked-files failed with exceptions
  2012-05-04 13:46 dired-mark-unmarked-files failed with exceptions David Young
@ 2012-05-04 14:10 ` Drew Adams
  0 siblings, 0 replies; 2+ messages in thread
From: Drew Adams @ 2012-05-04 14:10 UTC (permalink / raw)
  To: 'David Young', help-gnu-emacs

> 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




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

end of thread, other threads:[~2012-05-04 14:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-04 13:46 dired-mark-unmarked-files failed with exceptions David Young
2012-05-04 14:10 ` Drew Adams

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.