From 37b78790bdd917ce58ee6262d4122b96e12e928b Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sat, 12 Sep 2015 01:35:37 -0400 Subject: magit-shorten-hash-at-point: Don't ignore numeric prefix --- lisp/init-git.el | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'lisp/init-git.el') diff --git a/lisp/init-git.el b/lisp/init-git.el index 0514cfd..5d94c46 100644 --- a/lisp/init-git.el +++ b/lisp/init-git.el @@ -343,8 +343,8 @@ command will still offer the staged files)." (completing-read "Staged file: " files nil t))))) (insert (if no-directory (file-name-nondirectory file) file))))) -(defun km/magit-shorten-hash (hash) - (magit-rev-parse (format "--short=%s" (magit-abbrev-length)) hash)) +(defun km/magit-shorten-hash (hash &optional n) + (magit-rev-parse (format "--short=%s" (or n (magit-abbrev-length))) hash)) (defun km/magit-shorten-hash-at-point (&optional n) "Shorten hash at point to N characters. @@ -371,8 +371,7 @@ argument." (hash (match-string 0))) (when (< hash-len n) (user-error "Desired hash length is greater than current")) - (replace-match (or (km/magit-shorten-hash hash) - (substring hash 0 n)) + (replace-match (km/magit-shorten-hash hash n) 'fixedcase) (when (< offset n) (skip-chars-backward "A-z0-9") -- cgit v1.2.3