pkg update and first config fix

org-brain not working, add org-roam
This commit is contained in:
2022-12-19 23:02:34 +01:00
parent 02b3e07185
commit 82f05baffe
885 changed files with 356098 additions and 36993 deletions

View File

@@ -1,32 +1,34 @@
;;; orgit.el --- support for Org links to Magit buffers -*- lexical-binding: t; -*-
;;; orgit.el --- Support for Org links to Magit buffers -*- lexical-binding:t -*-
;; Copyright (C) 2014-2021 The Magit Project Contributors
;; Copyright (C) 2014-2022 The Magit Project Contributors
;; Author: Jonas Bernoulli <jonas@bernoul.li>
;; Maintainer: Jonas Bernoulli <jonas@bernoul.li>
;; Package-Requires: ((emacs "25.1") (magit "3.0") (org "9.4"))
;; Package-Version: 20210620.1943
;; Package-Commit: f956d802f19ea495efa95af6c673588afeb3adc5
;; Homepage: https://github.com/magit/orgit
;; Keywords: hypermedia vc
;; Package-Commit: ae5252fd47dd49a908d257fb59e9e8f53c5aad08
;; Package-Version: 20221127.2228
;; Package-X-Original-Version: 1.8.0.50-git
;; Package-Requires: (
;; (emacs "25.1")
;; (compat "28.1.1.0")
;; (magit "3.0")
;; (org "9.4"))
;; SPDX-License-Identifier: GPL-3.0-or-later
;; This library is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; This file is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published
;; by the Free Software Foundation, either version 3 of the License,
;; or (at your option) any later version.
;;
;; This library is distributed in the hope that it will be useful,
;; This file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this library. If not, see http://www.gnu.org/licenses.
;; This library was inspired by `org-magit.el' which was written by
;; Yann Hodique <yann.hodique@gmail.com> and is distributed under the
;; GNU General Public License version 2 or later.
;; along with this file. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
@@ -92,6 +94,7 @@
;;; Code:
(require 'cl-lib)
(require 'compat)
(require 'format-spec)
(require 'magit)
(require 'org)
@@ -99,19 +102,7 @@
(unless (fboundp 'org-link-store-props)
(defalias 'org-link-store-props 'org-store-link-props))
(eval-when-compile
(require 'subr-x))
;;;###autoload
(defun orgit-link-set-parameters (type &rest parameters)
(if (fboundp 'org-link-set-parameters) ; since v9.0
(apply #'org-link-set-parameters type parameters)
(with-no-warnings
(org-add-link-type type
(plist-get parameters :follow)
(plist-get parameters :export))
(add-hook 'org-store-link-functions
(plist-get parameters :store)))))
(eval-when-compile (require 'subr-x))
;;; Options
@@ -216,7 +207,10 @@ 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."
then store a link to the commit itself.
The prefix argument also affects how the revision is stored,
see `orgit-rev-store'."
:package-version '(orgit . "1.6.0")
:group 'orgit
:type 'boolean)
@@ -228,14 +222,13 @@ The format is used in two passes. The first pass consumes all
specs of the form `%C'; to preserve a spec for the second pass
it has to be quoted like `%%C'.
The first pass accepts the \"pretty formats\" documented in
the git-show(1) manpage. The second pass accepts these specs:
The first pass accepts the \"pretty format\" specs documented
in the git-show(1) manpage.
The second pass accepts these specs:
`%%N' The name or id of the repository.
`%%R' If `orgit-store-reference' is non-nil, then the tag or
branch that points at the commit, if any. Otherwise the
abbreviated commit hash. (A prefix argument reverses the
meaning of `orgit-store-reference'.)"
`%%R' Either a reference, abbreviated revision or revision of
the form \":/TEXT\". See `orgit-ref-store'."
:package-version '(orgit . "1.8.0")
:group 'orgit
:type 'string)
@@ -244,7 +237,7 @@ the git-show(1) manpage. The second pass accepts these specs:
;;;###autoload
(with-eval-after-load 'magit
(define-key magit-mode-map [remap org-store-link] 'orgit-store-link))
(define-key magit-mode-map [remap org-store-link] #'orgit-store-link))
;;;###autoload
(defun orgit-store-link (_arg)
@@ -256,19 +249,19 @@ the git-show(1) manpage. The second pass accepts these specs:
(goto-char (oref section start))
(set-mark (point))
(activate-mark)
(call-interactively 'org-store-link))
(call-interactively #'org-store-link))
(deactivate-mark))
(call-interactively 'org-store-link)))
(call-interactively #'org-store-link)))
;;; Status
;;;###autoload
(with-eval-after-load 'org
(orgit-link-set-parameters "orgit"
:store 'orgit-status-store
:follow 'orgit-status-open
:export 'orgit-status-export
:complete 'orgit-status-complete-link))
(org-link-set-parameters "orgit"
:store #'orgit-status-store
:follow #'orgit-status-open
:export #'orgit-status-export
:complete #'orgit-status-complete-link))
;;;###autoload
(defun orgit-status-store ()
@@ -300,11 +293,11 @@ In that case `orgit-rev-store' stores one or more links instead."
;;;###autoload
(with-eval-after-load 'org
(orgit-link-set-parameters "orgit-log"
:store 'orgit-log-store
:follow 'orgit-log-open
:export 'orgit-log-export
:complete 'orgit-log-complete-link))
(org-link-set-parameters "orgit-log"
:store #'orgit-log-store
:follow #'orgit-log-open
:export #'orgit-log-export
:complete #'orgit-log-complete-link))
;;;###autoload
(defun orgit-log-store ()
@@ -364,46 +357,64 @@ In that case `orgit-rev-store' stores one or more links instead."
;;;###autoload
(with-eval-after-load 'org
(orgit-link-set-parameters "orgit-rev"
:store 'orgit-rev-store
:follow 'orgit-rev-open
:export 'orgit-rev-export
:complete 'orgit-rev-complete-link))
(org-link-set-parameters "orgit-rev"
:store #'orgit-rev-store
:follow #'orgit-rev-open
:export #'orgit-rev-export
:complete #'orgit-rev-complete-link))
;;;###autoload
(defun orgit-rev-store ()
"Store a link to a Magit-Revision mode buffer.
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.
By default store an abbreviated revision hash.
\\<global-map>With a single \\[universal-argument] \
prefix argument instead store the name of a tag
or branch that points at the revision, if any. The meaning of this
prefix argument is reversed if `orgit-store-reference' is non-nil.
With a single \\[negative-argument] \
negative prefix argument store revision using the
form \":/TEXT\", which is described in the gitrevisions(7) manpage.
When more than one prefix argument is used, then `org-store-link'
stores a link itself, without calling this function.
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."
(cond ((eq major-mode 'magit-revision-mode)
(orgit-rev-store-1 magit-buffer-revision))
((derived-mode-p 'magit-mode)
(when-let ((revs (magit-region-values 'commit)))
(mapc 'orgit-rev-store-1 revs)
(when-let* ((revs (magit-region-values 'commit)))
;; Cannot use and-let* because of debbugs#31840.
(mapc #'orgit-rev-store-1 revs)
t))))
(defun orgit-rev-store-1 (rev)
(let ((repo (orgit--current-repository))
(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)))))
(pcase-let* ((repo (orgit--current-repository))
(`(,rev ,desc)
(pcase (list current-prefix-arg orgit-store-reference)
((or '((4) nil) '(nil t))
(if-let ((ref (or (and (magit-ref-p rev) rev)
(magit-name-tag rev)
(magit-name-branch rev))))
(list ref ref)
(list (magit-rev-parse rev)
(magit-rev-abbrev rev))))
(`(- ,_)
(let ((txt (concat ":/" (magit-rev-format "%s" rev))))
(list txt txt)))
(_
(list (magit-rev-parse rev)
(magit-rev-abbrev rev))))))
(org-link-store-props
:type "orgit-rev"
:link (format "orgit-rev:%s::%s" repo
(or ref (magit-rev-parse rev)))
:link (format "orgit-rev:%s::%s" repo rev)
:description (format-spec
(magit-rev-format orgit-rev-description-format rev)
`((?N . ,repo)
(?R . ,(or ref (magit-rev-abbrev rev))))))))
(?R . ,desc))))))
;;;###autoload
(defun orgit-rev-open (path)
@@ -432,14 +443,14 @@ store links to the Magit-Revision mode buffers for these commits."
(let* ((default-directory dir)
(remotes (magit-git-lines "remote"))
(remote (magit-get "orgit.remote"))
(remote (cond ((= (length remotes) 1) (car remotes))
(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)))
(or (and-let* ((url (magit-get "orgit" gitvar)))
(format-spec url `((?r . ,rev))))
(when-let ((url (magit-get "remote" remote "url"))
(and-let* ((url (magit-get "remote" remote "url"))
(format (cl-find-if
(lambda (elt)
(string-match (car elt) url))
@@ -460,9 +471,9 @@ store links to the Magit-Revision mode buffers for these commits."
(defun orgit--format-export (link desc format)
(pcase format
(`html (format "<a href=\"%s\">%s</a>" link desc))
(`latex (format "\\href{%s}{%s}" link desc))
(`ascii link)
('html (format "<a href=\"%s\">%s</a>" link desc))
('latex (format "\\href{%s}{%s}" link desc))
('ascii link)
(_ link)))
;;; Utilities