[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/orgit 14a4c8a245 44/76: orgit-store-reference: New option
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/orgit 14a4c8a245 44/76: orgit-store-reference: New option |
Date: |
Thu, 13 Jan 2022 13:58:46 -0500 (EST) |
branch: elpa/orgit
commit 14a4c8a245a36bed267a5228adf5b7b99d4891a6
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
orgit-store-reference: New option
Closes #26.
---
orgit.el | 36 +++++++++++++++++++++++++-----------
1 file changed, 25 insertions(+), 11 deletions(-)
diff --git a/orgit.el b/orgit.el
index f0dd65c521..92c0459da9 100644
--- a/orgit.el
+++ b/orgit.el
@@ -177,8 +177,15 @@ If all of the above fails then `orgit-export' raises an
error."
:group 'orgit
:type 'boolean)
-(defcustom orgit-abbreviate-hashes t
- "Whether to abbreviate revision hashes."
+(defcustom orgit-store-reference nil
+ "Whether `orgit-rev-store' attemts to store link to a reference.
+
+If nil, then store a link to the commit itself, using its full
+hash.
+
+If t, then attempt to store a link to a tag or branch. If that
+is not possible because no such reference points at the commit,
+then store a link to the commit itself."
:package-version '(orgit . "1.6.0")
:group 'orgit
:type 'boolean)
@@ -310,8 +317,11 @@ In that case `orgit-rev-store' stores one or more links
instead."
;;;###autoload
(defun orgit-rev-store ()
"Store a link to a Magit-Revision mode buffer.
-With a prefix argument instead store the name of the branch that
-points at the revision, if any.
+With a prefix argument instead store the name of a tag or branch
+that points at the revision, if any.
+
+If `orgit-store-reference' is non-nil, then the meaning of the
+prefix argument is reversed.
When the region selects one or more commits, e.g. in a log, then
store links to the Magit-Revision mode buffers for these commits."
@@ -322,15 +332,19 @@ store links to the Magit-Revision mode buffers for these
commits."
(orgit-rev-store-1 (oref (magit-current-section) value)))))
(defun orgit-rev-store-1 (rev)
- (let ((repo (abbreviate-file-name default-directory)))
- (unless (magit-ref-p rev)
- (setq rev (cond (current-prefix-arg (magit-get-shortname rev))
- (orgit-abbreviate-hashes (magit-rev-abbrev rev))
- (t (magit-rev-parse rev)))))
+ (let ((repo (abbreviate-file-name default-directory))
+ (ref (and (if orgit-store-reference
+ (not current-prefix-arg)
+ current-prefix-arg)
+ (or (and (magit-ref-p rev) rev)
+ (magit-name-tag rev)
+ (magit-name-branch rev)))))
(org-store-link-props
:type "orgit-rev"
- :link (format "orgit-rev:%s::%s" repo rev)
- :description (format "%s (magit-rev %s)" repo rev))))
+ :link (format "orgit-rev:%s::%s" repo
+ (or ref (magit-rev-parse rev)))
+ :description (format "%s (magit-rev %s)" repo
+ (or ref (magit-rev-abbrev rev))))))
;;;###autoload
(defun orgit-rev-open (path)
- [nongnu] elpa/orgit 229a2ae37a 65/76: orgit-export-alist: Add git.sr.ht entry, (continued)
- [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
- [nongnu] elpa/orgit 718343d40d 22/76: orgit-{log, rev}-open: use -let, ELPA Syncer, 2022/01/13
- [nongnu] elpa/orgit adcfef22dc 28/76: add README.md, ELPA Syncer, 2022/01/13
- [nongnu] elpa/orgit d91d16903d 27/76: support relative paths when opening and exporting links, ELPA Syncer, 2022/01/13
- [nongnu] elpa/orgit c91e662ace 30/76: Add completion functions, ELPA Syncer, 2022/01/13
- [nongnu] elpa/orgit 022687eb02 31/76: Move note about org-magit.el to help elx-license, ELPA Syncer, 2022/01/13
- [nongnu] elpa/orgit 14a4c8a245 44/76: orgit-store-reference: New option,
ELPA Syncer <=
- [nongnu] elpa/orgit 158438c540 54/76: Fix typos, ELPA Syncer, 2022/01/13
- [nongnu] elpa/orgit 0bec3ea912 03/76: orgit-log-{store, open}: kludge to support version 2.1.0 of Magit, ELPA Syncer, 2022/01/13
- [nongnu] elpa/orgit 0881cf9633 05/76: complete Package-Requires list, add Homepage keyword, ELPA Syncer, 2022/01/13
- [nongnu] elpa/orgit 55292d377c 13/76: replace term commit with revision, ELPA Syncer, 2022/01/13
- [nongnu] elpa/orgit 190aa8e3ad 17/76: bump dependencies and copyright, ELPA Syncer, 2022/01/13
- [nongnu] elpa/orgit 731c5cb4f1 16/76: orgit-status-open: adapt to change to magit-status-internal, ELPA Syncer, 2022/01/13
- [nongnu] elpa/orgit 44a05c55d5 07/76: orgit-rev-store: Always use commit SHA-1 hash, ELPA Syncer, 2022/01/13
- [nongnu] elpa/orgit e0859c3c71 08/76: autoload functions where necessary, ELPA Syncer, 2022/01/13
- [nongnu] elpa/orgit faf8a24c87 18/76: orgit-rev-store: preserve refs and abbreviate hashes, ELPA Syncer, 2022/01/13
- [nongnu] elpa/orgit 6b2eba9c48 34/76: Changing heading of library footer section, ELPA Syncer, 2022/01/13