Magit: Consider config option for magit-log-buffer-file to be non-sticky

Created on 12 Mar 2016  路  3Comments  路  Source: magit/magit

Continuing the discussion from https://github.com/syl20bnr/spacemacs/issues/5384...

As a new Magit user, I was surprised to discover that the command magit-log-buffer-file intentionally locks reporting to the current file for future log requests.

@tarsius has laid out a proposal for code changes in Magit to make this behavior configurable: https://github.com/syl20bnr/spacemacs/issues/5384#issuecomment-194966324

Thanks for any further input -- as well as all the work on a super helpful project!

feature request

Most helpful comment

magit-log-buffer-file (and the newly added magit-diff-buffer-file) now use a dedicated buffer by locking it to its value at the time it is created.

In addition to the Info nodes mentioned above, also see https://github.com/magit/magit/blob/master/Documentation/magit.org#minor-mode-for-buffers-visiting-files.

All 3 comments

Related to #2146.

The mechanism that (probably) should be used to use different log arguments for different kinds of log buffers is "locking a buffer to its value". See Modes and Buffers and Naming Buffers.

But some additional things are necessary to make this work.

  • The buffer has to start out in locked state. If the buffer starts out unlocked and is later locked, then it is to late and the regular log/diff buffer already has the file filter set. There probably should be an option which controls this behavior.
  • Currently only the revisions are considered to be part of the "buffer value". For logs and diffs the file filter (i.e. the value of the "-- " pseudo argument) should be part of the "value".

These things would have to be implemented in or near magit-mode-get-buffer, magit-generate-new-buffer, magit-generate-buffer-name-default-function. They probably should be taught to lock the buffer if this-command is one of the per-file commands. magit-generate-buffer-name-default-function would likely also have to be adjusted.

magit-log-buffer-file (and the newly added magit-diff-buffer-file) now use a dedicated buffer by locking it to its value at the time it is created.

In addition to the Info nodes mentioned above, also see https://github.com/magit/magit/blob/master/Documentation/magit.org#minor-mode-for-buffers-visiting-files.

Was this page helpful?
0 / 5 - 0 ratings