From 1e37aa08e8ddecf62960f339dcd3914e21775fee Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sat, 4 Aug 2018 09:41:01 -0400 Subject: Add km/magit-log-occurrence command --- init.el | 1 + lisp/km-magit.el | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/init.el b/init.el index daec1bc..41ce4f8 100644 --- a/init.el +++ b/init.el @@ -1069,6 +1069,7 @@ ("f" . km/magit-reset-file) ("i" . km/magit-insert-staged-file) ("n" . km/magit-shorten-hash-at-point) + ("o" . km/magit-log-occurrence) ("p" . km/magit-pin-file) ("r" . km/magit-find-recently-changed-file) ("t" . km/magit-describe) diff --git a/lisp/km-magit.el b/lisp/km-magit.el index 4bad322..19cae74 100644 --- a/lisp/km-magit.el +++ b/lisp/km-magit.el @@ -654,6 +654,19 @@ argument. Interactively, this can be accessed using the command (magit-log (list range) args files) (call-interactively #'magit-log)))) +;;;###autoload +(defun km/magit-log-occurrence (beg end) + "Run `git log -S HEAD'." + (interactive "r") + (magit-mode-setup-internal + #'magit-log-mode + (list (list "HEAD") + (cons (format "-S%s" (buffer-substring-no-properties beg end)) + (cl-delete "-S" (car (magit-log-arguments)) + :test 'string-prefix-p)) + nil)) + (magit-log-goto-same-commit)) + (defun km/magit-cherry-dwim () (interactive) (-let [(head . upstream) -- cgit v1.2.3