[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/orgit 8a65bd2750 42/76: Favor pcase and subr-x over dash
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/orgit 8a65bd2750 42/76: Favor pcase and subr-x over dash |
Date: |
Thu, 13 Jan 2022 13:58:45 -0500 (EST) |
branch: elpa/orgit
commit 8a65bd2750d8a5f9d6d9485da4fd7eaa0e1d10e7
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
Favor pcase and subr-x over dash
---
orgit.el | 51 +++++++++++++++++++++++++++------------------------
1 file changed, 27 insertions(+), 24 deletions(-)
diff --git a/orgit.el b/orgit.el
index 3661f1bdd7..f0dd65c521 100644
--- a/orgit.el
+++ b/orgit.el
@@ -94,6 +94,9 @@
(require 'magit)
(require 'org)
+(eval-when-compile
+ (require 'subr-x))
+
;;;###autoload
(defun orgit-link-set-parameters (type &rest parameters)
(if (fboundp 'org-link-set-parameters) ; since v9.0
@@ -190,7 +193,7 @@ If all of the above fails then `orgit-export' raises an
error."
(defun orgit-store-link (arg)
"Like `org-store-link' but store links to all selected commits, if any."
(interactive "P")
- (-if-let (sections (magit-region-sections 'commit))
+ (if-let ((sections (magit-region-sections 'commit)))
(save-excursion
(dolist (section sections)
(goto-char (oref section start))
@@ -272,9 +275,9 @@ In that case `orgit-rev-store' stores one or more links
instead."
;;;###autoload
(defun orgit-log-open (path)
- (-let* (((dir args)
- (split-string path "::"))
- (default-directory (file-name-as-directory (expand-file-name dir))))
+ (pcase-let*
+ ((`(,dir ,args) (split-string path "::"))
+ (default-directory (file-name-as-directory (expand-file-name dir))))
(apply #'magit-log-other
(cond ((string-prefix-p "((" args)
(read args))
@@ -331,9 +334,9 @@ store links to the Magit-Revision mode buffers for these
commits."
;;;###autoload
(defun orgit-rev-open (path)
- (-let* (((dir rev)
- (split-string path "::"))
- (default-directory (file-name-as-directory (expand-file-name dir))))
+ (pcase-let*
+ ((`(,dir ,rev) (split-string path "::"))
+ (default-directory (file-name-as-directory (expand-file-name dir))))
(apply #'magit-show-commit
(cons rev (magit-diff-arguments)))))
@@ -351,24 +354,24 @@ store links to the Magit-Revision mode buffers for these
commits."
;;; Export
(defun orgit-export (path desc format gitvar idx)
- (-let* (((dir rev)
- (split-string path "::"))
- (default-directory (file-name-as-directory (expand-file-name dir)))
- (remotes (magit-git-lines "remote"))
- (remote (magit-get "orgit.remote"))
- (remote (cond ((= (length remotes) 1) (car remotes))
- ((member remote remotes) remote)
- ((member orgit-remote remotes) orgit-remote))))
+ (pcase-let*
+ ((`(,dir ,rev) (split-string path "::"))
+ (default-directory (file-name-as-directory (expand-file-name dir)))
+ (remotes (magit-git-lines "remote"))
+ (remote (magit-get "orgit.remote"))
+ (remote (cond ((= (length remotes) 1) (car remotes))
+ ((member remote remotes) remote)
+ ((member orgit-remote remotes) orgit-remote))))
(if remote
- (-if-let
- (link (or (-when-let (url (magit-get "orgit" gitvar))
- (format-spec url `((?r . ,rev))))
- (-when-let (url (magit-get "remote" remote "url"))
- (--when-let (--first (string-match (car it) url)
- orgit-export-alist)
- (format-spec (nth idx it)
- `((?n . ,(match-string 1 url))
- (?r . ,rev)))))))
+ (if-let ((link (or (when-let ((url (magit-get "orgit" gitvar)))
+ (format-spec url `((?r . ,rev))))
+ (when-let ((url (magit-get "remote" remote "url"))
+ (format (--first
+ (string-match (car it) url)
+ orgit-export-alist)))
+ (format-spec (nth idx format)
+ `((?n . ,(match-string 1 url))
+ (?r . ,rev)))))))
(pcase format
(`html (format "<a href=\"%s\">%s</a>" link desc))
(`latex (format "\\href{%s}{%s}" link desc))
- [nongnu] elpa/orgit 3747e49964 24/76: orgit-rev-store: only resolve rev with prefix argument, (continued)
- [nongnu] elpa/orgit 3747e49964 24/76: orgit-rev-store: only resolve rev with prefix argument, ELPA Syncer, 2022/01/13
- [nongnu] elpa/orgit a9d0c74659 14/76: bump dependencies, ELPA Syncer, 2022/01/13
- [nongnu] elpa/orgit aa193c045b 21/76: orgit-export: use -let*, ELPA Syncer, 2022/01/13
- [nongnu] elpa/orgit ca93e9ec56 25/76: orgit-export: ensure default-directory ends with a slash, ELPA Syncer, 2022/01/13
- [nongnu] elpa/orgit cbce5871fe 29/76: Store all revisions and optionally all arguments in log links, ELPA Syncer, 2022/01/13
- [nongnu] elpa/orgit 976f3c7d25 32/76: Support storing link(s) to selected commit(s), ELPA Syncer, 2022/01/13
- [nongnu] elpa/orgit 692256bac9 33/76: Add Makefile, ELPA Syncer, 2022/01/13
- [nongnu] elpa/orgit d909f92d3b 35/76: Bump copyright years, ELPA Syncer, 2022/01/13
- [nongnu] elpa/orgit ea79e0567a 39/76: orgit-export-alist: Update kernel.org entry, ELPA Syncer, 2022/01/13
- [nongnu] elpa/orgit ddb830c38c 43/76: make: Add new indirect dependencies, ELPA Syncer, 2022/01/13
- [nongnu] elpa/orgit 8a65bd2750 42/76: Favor pcase and subr-x over dash,
ELPA Syncer <=
- [nongnu] elpa/orgit a2d3937040 49/76: Adapt to changes in Magit, ELPA Syncer, 2022/01/13
- [nongnu] elpa/orgit e23c7a6776 46/76: orgit--repository-directory: Error on non-existent directory, ELPA Syncer, 2022/01/13
- [nongnu] elpa/orgit 9598d71682 55/76: Revert "Add .github/FUNDING.yml", ELPA Syncer, 2022/01/13
- [nongnu] elpa/orgit c110371202 57/76: orgit--repository-directory: Support relative paths again, ELPA Syncer, 2022/01/13
- [nongnu] elpa/orgit e147f05577 61/76: eval-after-load: replace string feature w/ symbol, ELPA Syncer, 2022/01/13
- [nongnu] elpa/orgit 229a2ae37a 65/76: orgit-export-alist: Add git.sr.ht entry, ELPA Syncer, 2022/01/13
- [nongnu] elpa/orgit 6a22c2e459 06/76: orgit-log-store: use branch name, not HEAD, ELPA Syncer, 2022/01/13
- [nongnu] elpa/orgit efde657483 10/76: magit-log-export: use correct variable, ELPA Syncer, 2022/01/13
- [nongnu] elpa/orgit 455dac3422 15/76: orgit-export-alist: add gitlab and remove gitorious, ELPA Syncer, 2022/01/13
- [nongnu] elpa/orgit 2330a8cdb5 20/76: orgit-log-store: remove old kludges and todos, ELPA Syncer, 2022/01/13