workflow/usecase for dired-do-redisplay in emacs? - emacs

What is the use case of dired-do-redisplay? I am reading the Emacs Dired documentation and trying to understand the usecases/workflow. See Dired Documentation

The doc string (C-h f) makes clear what the command is for, I think:
,----
| `dired-do-redisplay` is an interactive autoloaded compiled Lisp function
| in `dired-aux.el`.
|
| It is bound to l.
|
| `(dired-do-redisplay &optional ARG TEST-FOR-SUBDIR)`
|
| Redisplay all marked (or next `ARG`) files.
| If on a subdir line, redisplay that subdirectory. In that case,
| a prefix arg lets you edit the `ls' switches used for the new listing.
|
| Dired remembers switches specified with a prefix arg, so that reverting
| the buffer will not reset them. However, using `dired-undo` to re-insert
| or delete subdirectories can bypass this machinery. Hence, you sometimes
| may have to reset some subdirectory switches after a `dired-undo`.
| You can reset all subdirectory switches to the default using
| `M-x dired-reset-subdir-switches`.
| See Info node `(emacs)Subdir switches` for more details.
`----
Dired displays do not automatically update to reflect changes outside Emacs, for example (unless you set an option for automatic reverting). This command essentially reverts only the listings for certain files, or for a subdirectory listing. And for a subdir listing it lets you provide different ls switches, so you can relist with those specified switches.

Related

emacs rgrep in multiple sub directories

I want to grep in multiple sub directories, eg.
find subdir1 subdir2 -type f ( -name *.cc -o -name *.h ) -exec grep -e someString {} +
using emacs interactive rgrep. Is this possible? The rgrep in grep.el says:
but when I get to the "Base directory:" input, I can't figure out how to input more than 1 directory.
Is it possible to input more than 1 directory?
Thank you.
You can pass prefix arguments to rgrep to modify the command.
C-uM-x rgrep will take you through the normal prompts and then let you edit the result, at which point you can simply add the additional directories you wish to search to the initial find command.
C-uC-uM-x rgrep just gives you a bare template to edit immediately.
If all of the files are in sub-directories of a project, you might consider using the emacs projectile module. It handles multi-directory searching quickly and painlessly within a project.

Bash-style escape-underscore in Powershell

In bash I frequently use the escape underscore shortcut:
subl somedir/file.sh
./(escape underscore)
Which fills in the last item from the last line, eg:
./(escape underscore)
Becomes:
./somedir/file.sh
Is there a way I could set this up in powershell?
(I'm using Powershell 5.1, ConEmu, and PSReadLine and PCSX)
If you use Emacs mode with PSReadline, then Esc underscore does the right thing. Alt+. also does the same thing and is bound in both Emacs and Windows modes.
I don't know a similar function in Powershell (maybe just create one by yourself?), but you could go with an array. For example:
(Get-Childitem somedir)[-1]
It's not the same, but maybe a solution you could go with.
Another option is using Select-Object:
The Long version:
Get-ChildItem | Select-Object -Last 1
The short:
ls | select -l 1

etags auto generation

There were some people on stackoverflow having a problem like this but not exactly this and not exactly the solution I'm looking for. The problem is auto generating tag file by etags if the tag file didn't exist ( through emacs). I wanna log all the files and it is not limited to c or whatever and auto load it through emacs. I'm not interested in having any role in loading tag file.
Any idea?
For me I put the following line in my makefile file:
tags:
find -type f -name "*.[ch]" -print0 | xargs -0 etags -o TAGS -a -l c
I refresh the tags with M-! compile, then make tags.
Emacs auto-detects that the TAGS file was refreshed, and asks you if you need to re-load it.
Otherwise, you can type M-x tags-reset-tags-table, and when you search something with M-., Emacs auto-loads the new generated file.

Wild cards search in eclipse

The project in our company includes a variety of files. Many a times, it becomes necessary to search all but a few file types. Is there a way to exclude some extensions while doing a searching *.* file search.
One way I know of is to do it via resource filters, but then those exclusions become permanent. What I want is to search for *.*, while removing say *.jsp or *.sql or *.cpp files on the fly.
Thanks,
Ron
You do not mention how you are performing the searches. Personally, I am quite comfortable with the Unix command line, so I have found that having a couple of terminals open on the directory of my Eclipse workspace always comes handy.
On the shell command line, using find and sort to show all files under the current directory:
$ find -type f | sort
./a/a0.txt
./a/a1.doc
./b/b0.rtf
./b/b1.cpp
./b/b2.jsp
./c/c0.jsp
./c/c1.sql
./c/c2.cpp
To show all files except for those matching *.cpp:
$ find -type f ! -name '*.cpp' | sort
./a/a0.txt
./a/a1.doc
./b/b0.rtf
./b/b2.jsp
./c/c0.jsp
./c/c1.sql
To show all files except for those matching *.cpp or *.jsp:
$ find -type f ! -name '*.cpp' ! -name '*.jsp' | sort
./a/a0.txt
./a/a1.doc
./b/b0.rtf
./c/c1.sql
To show all files matching ?1.* except for those matching *.sql:
$ find -type f -name '?1.*' ! -name '*.sql' | sort
./a/a1.doc
./b/b1.cpp
find is the standard Unix command line utility for file searching. Unfortunately, while some of its options are standardized, others are different among the various Unix-like operating systems. You should probably have a look at its manual page (man find) to find out the options that your version of find accepts. The manual page I linked to is for GNU find, which is what most (all?) Linux distributions come with.
If you use Eclipse itself to perform the searches, you can do the following:
Click on Search in the menu bar
Select File
A File Search dialog will pop-up
Click on the Choose button next to the File name patterns textbox
Click on Select all - then remove the check-mark from those extensions you wish to exclude, making sure to exclude *.* as well
A pattern list will appear in the File name patterns textbox
Click Search and a new view with the search results will appear
Disclaimer: this is on Eclipse 3.7.1
This method does not seem to be as powerful as using find, but it offers better integration with Eclipse.

Handle multiple CVS repositories with emacs using PCL-CVS?

Is there a way to get PCL-CVS to operate on multiple CVS repositories at the same time? Each repository should get its own *cvs* buffer.
A prefix arg bigger than 8 is needed. e.g. C-u C-u M-x cvs-update
I found the answer in the Emacs manual.
cvs-examine is an interactive compiled Lisp function in `pcvs.el'.
Run a 'cvs -n update' in the specified DIRECTORY.
That is, check what needs to be done, but don't change the disc.
Feed the output to a cvs buffer and run `cvs-mode' on it.
With a prefix argument, prompt for a directory and cvs FLAGS to use.
A prefix arg >8 (ex: C-u C-u),
prevents reuse of an existing cvs buffer.
Optional argument NOSHOW if non-nil means not to display the buffer.