Artawower / blamer.el

A git blame plugin for emacs inspired by VS Code's GitLens plugin
GNU General Public License v3.0
426 stars 15 forks source link

blamer-max-lines not limiting lines #44

Closed LionyxML closed 1 year ago

LionyxML commented 1 year ago

Hello there.

I stumbled with this issue a few weeks back, and it is making me turn off blamer-mode :(

Whenever I select lines, I get the blamming, using this config:

image

It looks like it is ignoring (setq blamer-max-lines 5).

Heres all my configs for blamer-mode:

;; ---------------------------------  BLAMER-MODE Blamer for versioning view inside document
(setq blamer-view 'overlay)
(setq blamer-author-formatter " >> %s ")
(setq blamer-datetime-formatter "[%s]")
(setq blamer-commit-formatter " ● %s")
(setq blamer-idle-time 0.5)
(setq blamer-min-offset 40)
(setq blamer-prettify-time-p t)
(setq blamer-type 'selected) ;; selected, visual, both, overlay-popup, posframe-popup
(setq blamer-max-lines 5)
(setq blamer-uncommitted-changes-message "NO COMMITTED")
(setq blamer-max-commit-message-length 50)

(defun my-blamer-tooltip-func (commit-info)
  (let ((commit-date (plist-get commit-info :commit-date))
    (commit-time (plist-get commit-info :commit-time))
    (commit-message (plist-get commit-info :commit-message)))
    (message "%s" commit-info)
    (format "%s - %s - %s" commit-date commit-time commit-message)))

(setq blamer-tooltip-function 'my-blamer-tooltip-func)
;; (setq blamer-tooltip-function 'blamer-tooltip-keybindings)
;; (setq blamer-tooltip-function 'blamer-tooltip-commit-message)
;; (setq blamer-tooltip-function 'blamer-tooltip-author-info)

(defun blamer-callback-show-commit-diff (commit-info)
  (interactive)
  (let ((commit-hash (plist-get commit-info :commit-hash)))
    (when commit-hash
      (magit-show-commit commit-hash))))

(defun blamer-callback-open-remote (commit-info)
  (interactive)
  (let ((commit-hash (plist-get commit-info :commit-hash)))
    (when commit-hash
      (message commit-hash)
      (forge-browse-commit commit-hash))))

(setq blamer-bindings '(("<mouse-3>" . blamer-show-commit-info)
            ("<mouse-1>" . blamer-callback-show-commit-diff)))

Emacs version: GNU Emacs 29.0.60 (build 1, x86_64-apple-darwin22.1.0, NS appkit-2299.00 Version 13.0.1 (Build 22A400)) of 2022-12-08.

The packages status (using package-list-packages) is:

     Status: Installed in ‘blamer-20230304.2300/’ (unsigned). Delete
    Version: 20230304.2300
     Commit: 50cd50d4541be22091b11d3f6dcf4e9f1b9521af
    Summary: Show git blame info about current line
   Requires: emacs-27.1, posframe-1.1.7
    Website: https://github.com/artawower/blamer.el
 Maintainer: Artur Yaroshenko <artawower@protonmail.com>
     Author: Artur Yaroshenko <artawower@protonmail.com>
Other versions: 20230304.2300 (melpa).

Package for displaying git information about the current line or
about several selected lines.  Works with git only.

Am I breaking it somehow?

Artawower commented 1 year ago

Thanks for the bug report and detailed explanation! There was a bug with checking the range limit during an asynchronous operation. Should be fixed in the latest version

LionyxML commented 1 year ago

Thanks @Artawower, I just updated it. Everything works fine now.