[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/why-this d47f547250 39/59: Allow customization of executab
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/why-this d47f547250 39/59: Allow customization of executable paths |
Date: |
Sun, 27 Nov 2022 16:02:52 -0500 (EST) |
branch: elpa/why-this
commit d47f547250f8dfab6fea6cfd05eb6fa16274930e
Author: Akib Azmain Turja <akib@disroot.org>
Commit: Akib Azmain Turja <akib@disroot.org>
Allow customization of executable paths
---
why-this.el | 50 ++++++++++++++++++++++++++++++++++++--------------
1 file changed, 36 insertions(+), 14 deletions(-)
diff --git a/why-this.el b/why-this.el
index e389670a5d..aa1602d466 100644
--- a/why-this.el
+++ b/why-this.el
@@ -239,9 +239,21 @@ and return a string."
:package-version '(why-this "1.0")
:group 'why-this)
-(defvar why-this--git-author-name (string-trim
- (shell-command-to-string
- "git config --get user.name"))
+(defcustom why-this-git-program "git"
+ "Path to or name of `git' executable."
+ :type '(choice (string :tag "Name")
+ (file :tag "Path"))
+ :package-version '(why-this "1.0")
+ :group 'why-this)
+
+(defcustom why-this-hg-program "hg"
+ "Path to or name of `hg' executable."
+ :type '(choice (string :tag "Name")
+ (file :tag "Path"))
+ :package-version '(why-this "1.0")
+ :group 'why-this)
+
+(defvar why-this--git-author-name nil
"Name of author.")
(defvar why-this--overlays nil
@@ -702,24 +714,32 @@ Do CMD with ARGS."
('supported-p
(and (buffer-file-name)
(string= "true\n" (shell-command-to-string
- "git rev-parse --is-inside-work-tree"))))
+ (format "%s rev-parse --is-inside-work-tree"
+ (shell-quote-argument
+ why-this-git-program))))))
('line-data
+ (unless why-this--git-author-name
+ (setq why-this--git-author-name
+ (string-trim (shell-command-to-string
+ (format "%s config --get user.name"
+ (shell-quote-argument
+ why-this-git-program))))))
(when (> (- (nth 1 args) (nth 0 args)) 0)
- (let* ((blame (let ((temp-file
- (let ((file (make-temp-file "why-this-git-"))
- (text (buffer-substring-no-properties
- (point-min) (point-max))))
- (with-temp-file file
- (insert text))
- file)))
+ (let* ((blame (let ((temp-file (make-temp-file "why-this-git-")))
+ (let ((text (buffer-substring-no-properties
+ (point-min) (point-max))))
+ (with-temp-file temp-file
+ (insert text)))
(unwind-protect
(butlast
(split-string
(shell-command-to-string
(format (concat
- "git blame -L %i,%i \"%s\""
+ "%s blame -L %i,%i \"%s\""
" --porcelain --contents \"%s\""
" ; echo $?")
+ (shell-quote-argument
+ why-this-git-program)
(nth 0 args) (1- (nth 1 args))
(buffer-file-name) temp-file))
"\n"))
@@ -786,7 +806,8 @@ Do CMD with ARGS."
('supported-p
(and (buffer-file-name)
(string= "t" (shell-command-to-string
- (format "hg annotate \"%s\" --template \"t\""
+ (format "%s annotate \"%s\" --template \"t\""
+ (shell-quote-argument why-this-hg-program)
(buffer-file-name))))))
('line-data
(when (> (- (nth 1 args) (nth 0 args)) 0)
@@ -796,11 +817,12 @@ Do CMD with ARGS."
(shell-command-to-string
(format
(concat
- "hg annotate \"%s\" --template \"({lines %% '(:id"
+ "%s annotate \"%s\" --template \"({lines %% '(:id"
" {rev} :author \\\"{person(user)}\\\" :time"
" ({hgdate(date)}) :desc \\\"{sub(\\\"\\\\\\\"\\\","
" \\\"\\\\\\\\\\\\\\\"\\\", sub(\\\"\\n.*\\\","
" \\\"\\\", desc))}\\\") '})\"")
+ (shell-quote-argument why-this-hg-program)
(buffer-file-name))))))
data)
(dolist (i (number-sequence (1- (nth 1 args)) (nth 0 args) -1))
- [nongnu] elpa/why-this e89aabc765 02/59: (provide 'why-this), (continued)
- [nongnu] elpa/why-this e89aabc765 02/59: (provide 'why-this), ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 961f84afc6 08/59: Fixed typo in the value of why-this-echo-format, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 2f714a9820 05/59: Add Git backend, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 82397f6a45 03/59: Add support for nick names, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 3c252a6621 07/59: Allow showing last change manually, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this f62dccdd90 10/59: Add annonation support, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 340194b6d2 24/59: Calculate background for message, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 167397e7ad 25/59: Fix copyright year, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 9c0daa799c 28/59: Rename a variable, change backend API and update docs, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 53b2b803f0 22/59: Update commentary, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this d47f547250 39/59: Allow customization of executable paths,
ELPA Syncer <=
- [nongnu] elpa/why-this 7f1ae28159 36/59: Fix Git backend, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 9f656b59dd 33/59: Change package summary, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 3497115c2b 35/59: Don't store unnecessary data, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 7a2e4af450 19/59: Rewrite Git backend, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 41fe21da73 15/59: Fontify before annotate, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 006ea3864a 13/59: Fix Git backend 'supported-p command, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 0c1686d8d3 12/59: Fix misspelled word "annonate", ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 73398fb7cb 04/59: Don't interfere with writing, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 2093cadb03 06/59: Add relative time support and fix Git backend, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this c2a21ca13d 01/59: Core implementation without any backends, ELPA Syncer, 2022/11/27