Skip to content

Commit 36f9475

Browse files
committed
[commit-patch-buffer.el] Only use local commit-patch executable if it exists.
Normally the exe goes in /usr/bin and the .el files go in /usr/share/site-lisp (or the /usr/local versions of those if you aren't installing a package). Fixes #11.
1 parent f11d10d commit 36f9475

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

commit-patch-buffer.el

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,11 @@
3030
(require 'vc)
3131
(require 'log-edit)
3232

33+
;; Prefer a locally installed commit patch over one installed in the PATH.
3334
(defvar commit-patch-program
34-
(let ((current (or load-file-name (buffer-file-name))))
35-
(expand-file-name "commit-patch" (file-name-directory current))))
35+
(let* ((this-path (or load-file-name (buffer-file-name)))
36+
(local-path (expand-file-name "commit-patch" (file-name-directory this-path))))
37+
(if (file-executable-p local-path) local-path "commit-patch")))
3638

3739
;; Based on vc-git-expanded-log-entry, but don't indent and only grab the full comment using --pretty
3840
(defun commit-patch-git-log-comment (revision)

0 commit comments

Comments
 (0)