unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#39380: 26.3: Opening files in vc-dir-mode with differing root and working dir fails
@ 2020-02-01  0:13 Wolfgang Scherer
  2020-02-01  7:20 ` Dmitry Gutov
  2020-02-01  7:20 ` Dmitry Gutov
  0 siblings, 2 replies; 17+ messages in thread
From: Wolfgang Scherer @ 2020-02-01  0:13 UTC (permalink / raw)
  To: 39380

Here is another per-tree/per-directory bug, I just found:

1. Prepare a Mercurial repository `check-hgs` with sub directories `sub1`
   and `sub2` and the files `sub1/a`, `sub2/x`,

   .. code-block:: sh

      mkdir -p check-hgs/sub1 check-hgs/sub2
      touch check-hgs/sub1/a check-hgs/sub2/x
      cd check-hgs && hg init

2. Find file `check-hgs/sub1/a`.

3. Press `C-x v d RET`, which will show a "Working dir" different from "Root":

   .. code-block:: text

      Working dir: check-hgs/sub1/
      Root       : check-hgs

                           ./
                           sub1/
      unregistered         sub1/a
                           sub2/
      unregistered         sub2/x

4. Go to line

   "unregistered         sub2/x"

   and press `f`.

5. Press `C-x d`.

   The default directory is "check-hgs/sub1/sub2/", which is wrong. It
   should be "check-hgs/sub2/".

The problem results from the call to `expand-file-name` in
`vc-dir-current-file`, which uses the default directory, but
`vc-dir-fileinfo->name` delivers a filename relative to the root
directory.

.. code-block:: elisp

   (defun vc-dir-current-file ()
     (let ((node (ewoc-locate vc-ewoc)))
       (unless node
     (error "No file available"))
       (expand-file-name (vc-dir-fileinfo->name (ewoc-data node)))))


However, modifying `vc-dir-current-file` does not solve the problem,
since all other invocations of `vc-dir-fileinfo->name` ultimately
suffer from the same deficiency.

It is IMHO better to remove the hybrid state of `vc-dir-mode`, where
the default directory is different from the root directory.
“

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

end of thread, other threads:[~2020-02-11 22:36 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-01  0:13 bug#39380: 26.3: Opening files in vc-dir-mode with differing root and working dir fails Wolfgang Scherer
2020-02-01  7:20 ` Dmitry Gutov
2020-02-02 22:35   ` Wolfgang Scherer
2020-02-03 13:11     ` Dmitry Gutov
2020-02-04 16:04       ` Wolfgang Scherer
2020-02-05 15:56         ` Dmitry Gutov
2020-02-06 13:25           ` Wolfgang Scherer
2020-02-06 13:38             ` Dmitry Gutov
2020-02-07  9:53               ` Eli Zaretskii
2020-02-07 11:03                 ` Dmitry Gutov
2020-02-07 14:00                   ` Eli Zaretskii
2020-02-08  1:20                     ` Dmitry Gutov
2020-02-08  8:04                       ` Eli Zaretskii
2020-02-08  9:36                         ` Dmitry Gutov
2020-02-08 10:11                           ` Eli Zaretskii
2020-02-11 22:36                             ` Dmitry Gutov
2020-02-01  7:20 ` Dmitry Gutov

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).