Replacing a (sym-) link by its target
Kyle Jones <[email protected]>
| Newsgroups | gmane.emacs.xemacs.design |
|---|---|
| Message-ID | <[email protected]> |
David A. Cobb writes: > I've been using lndir with some success during make's -- leaving the > source tree alone and read-only, building in the link tree. > > When it comes time to change something, it seems the best way to do it > is make the working copy in the build tree. > If I just read the link, I get the original file -- but I also try to > replace the (read-only) original file. > > The sequence of operations otta be something like > (if (and (visited-file-is-a-link) (target-is-read-only)) > ((rename-the-link) ;; to get it out of the way > (write-the-buffer) > (delete-the-renamed-link)) > ; otherwise > (write-the-buffer)) > > Comment? Setting file-precious-flag gets you effect of replacing the link with a regular file. But what you describe woudl be a useful option for peopel who spend a lot of time working on RO mounted source trees.