diff options
-rw-r--r-- | init.el | 3 | ||||
-rw-r--r-- | lisp/km-magit.el | 34 |
2 files changed, 0 insertions, 37 deletions
@@ -1036,9 +1036,6 @@ (define-key magit-hunk-section-map [remap magit-visit-thing] #'km/magit-diff-visit-file) - (define-key magit-refs-mode-map (kbd "C-c C-f") - #'km/magit-refs-filter-recent) - (define-key magit-revision-mode-map (kbd "C-c C-r") #'km/magit-revision-insert-related-refs) diff --git a/lisp/km-magit.el b/lisp/km-magit.el index d4af9d3..cba378d 100644 --- a/lisp/km-magit.el +++ b/lisp/km-magit.el @@ -211,40 +211,6 @@ date." (magit-completing-read "Ref" (km/magit-list-recent-refs n 'remote)))) -(defun km/magit-refs-filter-recent (n) - "Limit branch list to N most recent. -Warning: I find this useful, but it's a hack that breaks -magit-section-backward and probably other things. Hit `g` to -refresh the buffer, and all should be right again." - (interactive (list (or (and current-prefix-arg - (prefix-numeric-value current-prefix-arg)) - 5))) - (unless (derived-mode-p 'magit-refs-mode) - (user-error "Not in Magit Refs mode")) - (let ((sec (magit-current-section)) - remote refs line-sec) - (when (eq (magit-section-type sec) 'branch) - (setq sec (magit-section-parent sec))) - (when (eq (magit-section-type sec) 'remote) - (setq remote (magit-section-value sec))) - (setq refs - (magit-git-lines - "for-each-ref" "--sort=-committerdate" "--format=%(refname:short)" - (format "--count=%s" n) - (if remote (format "refs/remotes/%s" remote) "refs/heads"))) - (save-excursion - (save-restriction - (narrow-to-region (magit-section-content sec) (magit-section-end sec)) - (goto-char (point-min)) - (while (and (not (eobp)) - (setq line-sec (magit-current-section)) - (eq (magit-section-type line-sec) 'branch)) - (if (member (magit-section-value line-sec) refs) - (forward-line 1) - (let ((inhibit-read-only t)) - (delete-region (magit-section-start line-sec) - (magit-section-end line-sec))))))))) - (defun km/magit-checkout-master () "Checkout master branch. \n(git checkout master)" |