[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org df9b509 28/41: lisp/org-attach-git.el: New option `
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org df9b509 28/41: lisp/org-attach-git.el: New option `org-attach-git-dir' |
Date: |
Sun, 16 May 2021 04:57:21 -0400 (EDT) |
branch: externals/org
commit df9b509a6c9d40ecca691775c2dd3c92c2025185
Author: Juan Manuel MacĂas <maciaschain@posteo.net>
Commit: Bastien <bzg@gnu.org>
lisp/org-attach-git.el: New option `org-attach-git-dir'
* lisp/org-attach-git.el (org-attach-git-dir): New option to allow
using the attachment directory of the current node as a Git
repository, if correctly initialized.
(org-attach-git-use-annex, org-attach-git-annex-get-maybe)
(org-attach-git-commit): Use the new option.
* etc/ORG-NEWS: Announce the new option.
Link: https://orgmode.org/list/87y2g8rj7s.fsf@posteo.net/
---
etc/ORG-NEWS | 6 ++++++
lisp/org-attach-git.el | 33 ++++++++++++++++++++++++++++-----
2 files changed, 34 insertions(+), 5 deletions(-)
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index d9000de..0baf93a 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -169,6 +169,12 @@ step that runs inkscape text-to-path replacement over the
output file.
~org-html-scripts~ and ~org-html-style-default~ used to be constants,
you can now configure them.
+*** New option ~org-attach-git-dir~
+
+~org-attach-git-dir~ will decide whether to use ~org-attach-git-dir~
+(the default) or use the attachment directory of the current node, if
+it is correctly configured as a Git repository.
+
*** Some faces now use fixed-pitch
See [[msg:875z8njaol.fsf@protesilaos.com][this thread]].
diff --git a/lisp/org-attach-git.el b/lisp/org-attach-git.el
index 2091cbc..4c6bdc9 100644
--- a/lisp/org-attach-git.el
+++ b/lisp/org-attach-git.el
@@ -24,7 +24,7 @@
;;; Commentary:
;; An extension to org-attach. If `org-attach-id-dir' is initialized
-;; as a Git repository, then org-attach-git will automatically commit
+;; as a Git repository, then `org-attach-git' will automatically commit
;; changes when it sees them. Requires git-annex.
;;; Code:
@@ -52,9 +52,25 @@ If \\='ask, prompt using `y-or-n-p'. If t, always get. If
nil, never get."
(const :tag "always get from annex if necessary" t)
(const :tag "never get from annex" nil)))
+(defcustom org-attach-git-dir 'default
+ "Attachment directory with the Git repository to use.
+The default value is to use `org-attach-id-dir'. When set to
+`individual-repository', then the directory attached to the
+current node, if correctly initialized as a Git repository, will
+be used instead."
+ :group 'org-attach
+ :package-version '(Org . "9.5")
+ :type '(choice
+ (const :tag "Default" default)
+ (const :tag "Individual repository" individual-repository)))
+
(defun org-attach-git-use-annex ()
"Return non-nil if git annex can be used."
- (let ((git-dir (vc-git-root (expand-file-name org-attach-id-dir))))
+ (let ((git-dir (vc-git-root
+ (cond ((eq org-attach-git-dir 'default)
+ (expand-file-name org-attach-id-dir))
+ ((eq org-attach-git-dir 'individual-repository)
+ (org-attach-dir))))))
(and org-attach-git-annex-cutoff
(or (file-exists-p (expand-file-name "annex" git-dir))
(file-exists-p (expand-file-name ".git/annex" git-dir))))))
@@ -62,7 +78,11 @@ If \\='ask, prompt using `y-or-n-p'. If t, always get. If
nil, never get."
(defun org-attach-git-annex-get-maybe (path)
"Call git annex get PATH (via shell) if using git annex.
Signals an error if the file content is not available and it was not
retrieved."
- (let* ((default-directory (expand-file-name org-attach-id-dir))
+ (let* ((default-directory
+ (cond ((eq org-attach-git-dir 'default)
+ (expand-file-name org-attach-id-dir))
+ ((eq org-attach-git-dir 'individual-repository)
+ (org-attach-dir))))
(path-relative (file-relative-name path)))
(when (and (org-attach-git-use-annex)
(not
@@ -86,7 +106,10 @@ This checks for the existence of a \".git\" directory in
that directory.
Takes an unused optional argument for the sake of being compatible
with hook `org-attach-after-change-hook'."
- (let* ((dir (expand-file-name org-attach-id-dir))
+ (let* ((dir (cond ((eq org-attach-git-dir 'default)
+ (expand-file-name org-attach-id-dir))
+ ((eq org-attach-git-dir 'individual-repository)
+ (org-attach-dir))))
(git-dir (vc-git-root dir))
(use-annex (org-attach-git-use-annex))
(changes 0))
@@ -102,7 +125,7 @@ with hook `org-attach-after-change-hook'."
org-attach-git-annex-cutoff))
(call-process "git" nil nil nil "annex" "add" new-or-modified)
(call-process "git" nil nil nil "add" new-or-modified))
- (cl-incf changes))
+ (cl-incf changes))
(dolist (deleted
(split-string
(shell-command-to-string "git ls-files -z --deleted") "\0" t))
- [elpa] externals/org 81c7a2d 23/41: lisp/org-agenda.el: Use "09:00" instead of " 9:00", (continued)
- [elpa] externals/org 81c7a2d 23/41: lisp/org-agenda.el: Use "09:00" instead of " 9:00", ELPA Syncer, 2021/05/16
- [elpa] externals/org 72894cd 24/41: Allow moving inlinetasks using org-metaup/down, ELPA Syncer, 2021/05/16
- [elpa] externals/org c77066d 32/41: etc/ORG-NEWS: Add a news entry about ditaa.jar not being bundled, ELPA Syncer, 2021/05/16
- [elpa] externals/org f63cbd3 34/41: lisp/org.el: Fix bug in `org-sort-remove-invisible', ELPA Syncer, 2021/05/16
- [elpa] externals/org 8f39743 16/41: Use cache in org-up-heading-safe, ELPA Syncer, 2021/05/16
- [elpa] externals/org 83ab852 27/41: etc/ORG-NEWS: Various enhancements, ELPA Syncer, 2021/05/16
- [elpa] externals/org ee40458 25/41: lisp/ox-latex.el: Allow arbitrary float environments, ELPA Syncer, 2021/05/16
- [elpa] externals/org 336efd6 37/41: lisp/*: Use version number when obsoleting, ELPA Syncer, 2021/05/16
- [elpa] externals/org fdd7072 38/41: Merge branch 'master' of code.orgmode.org:bzg/org-mode, ELPA Syncer, 2021/05/16
- [elpa] externals/org 70d98b5 41/41: Merge branch 'master' of code.orgmode.org:bzg/org-mode, ELPA Syncer, 2021/05/16
- [elpa] externals/org df9b509 28/41: lisp/org-attach-git.el: New option `org-attach-git-dir',
ELPA Syncer <=
- [elpa] externals/org c7be27d 29/41: Merge remote-tracking branch 'savannah/bugfix', ELPA Syncer, 2021/05/16
- [elpa] externals/org 91373e1 26/41: ox-latex.el: Support specific attributes for verse block, ELPA Syncer, 2021/05/16
- [elpa] externals/org ef495b7 30/41: ox-html: Fix typography in a docstring, ELPA Syncer, 2021/05/16
- [elpa] externals/org 53b5af2 39/41: Merge branch 'maint', ELPA Syncer, 2021/05/16
- [elpa] externals/org b413355 36/41: lisp/ol.el: Enhance message when the link has already been stored, ELPA Syncer, 2021/05/16
- [elpa] externals/org b91e934 33/41: lisp/org.el: Minor enhancement to `org-priority', ELPA Syncer, 2021/05/16
- [elpa] externals/org f4b881e 35/41: lisp/org.el: Explicit the docstrings of org-priority-highest/lowest, ELPA Syncer, 2021/05/16
- [elpa] externals/org 4362b93 40/41: Merge branch 'maint', ELPA Syncer, 2021/05/16