On Friday, 17 July 2015 20:33:09 UTC+1, Kyle Meyer wrote: > Daniel Dehennin <[email protected]> wrote: > [...] > > My problem is that I can not find a quick way to open the files from > > magit-rev buffer or after viewing a file with magit-diff-visit-file. > > > > Is there a way to make “C-u magit-diff-visit-file” open the file at > > current HEAD? > > Just to be clear: from the buffer visiting a file for a particular > revision, you want to visit the working tree version (which may or may > not be HEAD's version), right?
What about from a magit-rev special buffer, which was the other thing he asked about? The answer you gave below doesn't work for a magit-rev buffer. > If so, you can use a command like this: > > (defun magit-find-current-file-from-rev () > (interactive) > (find-file (or magit-buffer-file-name > (user-error "Not in a revision buffer")))) > > This doesn't attempt to restore point but will get you to the file of > the same name in the working tree. I use something similar as part of a > larger command and find it useful. > > (If you really want to visit HEAD's version, magit-find-file will give > good defaults from the revision file buffer. I think HEAD will usually > be the second choice for a revision and the default file name should > correspond to the one you're visiting.) > > > Should I submit an issue? > > I think it's nice to be able to jump from a revision file to the working > tree version, so I'd say yes, but perhaps I missing some other obvious > way to do this or am overestimating its usefulness to other people. The > command above could try to put point in a similar position (and its > docstring could give the same warning as > magit-diff-visit-file-worktree's that point is more likely to be a badly > placed the older the version is). -- You received this message because you are subscribed to the Google Groups "magit" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
