Dired invert selection - emacs

I want to mark all files currently unmarked and simultaneously unmark all marked files. How do I do it?
Let's say I have a directory with *.png and and other formats. I want to filter only PNGs. Say, I did: % d.png and now want to select the rest, but not the PNG?

If you used %d to select the files (dired-flag-file-deletion), they are considered
flagged, not marked. To mark files, you may use %m (dired-mark). The command t toggles the marked files (dired-toggle-marks); this was mentioned by event_jr's answer. To convert files from flagged to marked, use the command *cD* (dired-change-marks).
It seems the only command that operates on flagged files is x, which deletes them (dired-do-flagged-delete). The same can be achieved on marked files with D (dired-do-delete), and you can do much more on marked files, such as R (dired-do-rename). So apparently the only advantage of flagging are the convenient commands to flag "garbage" files, which you may use and then convert the flags to marks anyway.

t .................................... for toggle

Related

Using diff3 where filenames contain a dash (-)

I'm trying to use diff3 in this way
diff3 options... mine older yours
My problem is that I probably can't use it, since all my 3 files contain a "dash" within.
The manual mentions:
At most one of these three file names may be `-', which tells diff3 to read the standard input for that file.
so I probably have to rename filenames before running diff3.
If you know for a better solution or a workaround, please let me know about. Thank you!
At most one of these three file names may be `-', which tells diff3 to read the standard input for that file.
It does not state, that your filenames should not contain dash symbols. It simply says, that if you want to, you can put - instead of one of the names, in which case the standard input will be read instead of reading one of the files.
So, you can have as many dashes in your filenames as you like and diff3 should work just fine.
However, on Windows putting filenames in "" for escaping space characters does not work, and I failed to find a suitable workaround. However, you can automatize the process of renaming files (if the files are relatively small, this would not even be too inefficient):
#echo off
copy %1 tempfile_1.txt
copy %2 tempfile_2.txt
copy %3 tempfile_3.txt
"C:\Program Files (x86)\KDiff3\bin\diff3.exe" -E tempfile_1.txt tempfile_2.txt tempfile_3.txt
del tempfile_1.txt tempfile_2.txt tempfile_3.txt
Put this in a file like diff3.cmd, then run diff3.cmd "first file.txt" "second file.txt" "third file.txt".
P.S. Moving files would be more efficient (if they are on the same disk volume as the script, which they are not in your case), you could even move them back to where they were initially, but for some time they would not be present at their original folder.

Ignore ELPA files in recentf

I update from ELPA/MELPA regularly. Unfortunately, the files the Emacs package manager manipulates show up in my recentf list, basically making it useless since it's always full from whatever files were updated, and not files that I actually care about. How can I fix this?
See user options recentf-exclude, recentf-keep, recentf-auto-cleanup, and command recentf-cleanup.
The first two options let you exclude and include files that satisfy certain predicates or whose names match certain patterns, respectively.

diff ignore certain pattern in the file

I want to make diff between two files which contains lines beginning with "line_$NR". I want to make diff between the files making abstraction of the presence of "lines_$NR" but when the differences are printed I want lines_$NR to be displayed.
It is possible to do that?
Thanks.
I believe in this case, you have to preprocess your iput files to remove /^line_[0-9]*/, diff the resulting files, then recombine the diff output with the removed words according to line numbers in diff output.
Python's difflib should be very handy here, or same from perl. If you want to stick to shell, I suppose you could get by with awk.
If you don't need exact output, perhaps you can use diff's --line-format=... directive to inject actual line number in a diff, rather than the word you removed in preprocessing step.

Tell find-name-dired to only show filenames

Is there any way to make find-name-dired to only show filenames that I can move through and select? I have a lot of files that are buried in subdirectories, and I don't want it to print out the entire subdirectory every time it finds a file.
Two problems with this:
How would you distinguish between two files with the same file name in different directories?
Dired needs the full path in order to be able to do anything with that file.
You could deal with (2) by using text properties or overlays to hide the directories, but due to (1) I really couldn't recommend that.
Edit: to otherwise customise the output of dired to reduce unwanted noise you can use Dired Details (optionally with Dired Details Plus)
How do I hide number of links in dired?
Emacs dired: too much information

How do you use the diff command against two source trees

I tried running 'diff' against two source directories get a patch file with a 'diff' between the two directories.
diff -rupN flyingsaucer-R8pre2_b/ flyingsaucer-R8pre2/ > a.patch
The command above does not seem to work, it generates a diff of everything and I get a 13 MB file, when in reality, it should be a couple of changes.
Should work with any recent version of gnu diff (tested here with gnu diff 2.8.1.)
You might want to add -b (and perhaps -B) to ignore difference in white space which perhaps generate large patch files unnecessarily.
I don't see any reason why it wouldn't work. Try adding "wb" to the argument list to ignore whitespace changes. Are you sure you got the trailing slashes the same on both sides?