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,34 +1,40 @@
;;; git-commit.el --- Edit Git commit messages -*- lexical-binding: t; -*-
;;; git-commit.el --- Edit Git commit messages -*- lexical-binding:t; coding:utf-8 -*-
;; Copyright (C) 2010-2022 The Magit Project Contributors
;;
;; You should have received a copy of the AUTHORS.md file which
;; lists all contributors. If not, see http://magit.vc/authors.
;; Copyright (C) 2008-2022 The Magit Project Contributors
;; Author: Jonas Bernoulli <jonas@bernoul.li>
;; Sebastian Wiesner <lunaryorn@gmail.com>
;; Florian Ragwitz <rafl@debian.org>
;; Marius Vollmer <marius.vollmer@gmail.com>
;; Sebastian Wiesner <lunaryorn@gmail.com>
;; Florian Ragwitz <rafl@debian.org>
;; Marius Vollmer <marius.vollmer@gmail.com>
;; Maintainer: Jonas Bernoulli <jonas@bernoul.li>
;; Keywords: git tools vc
;; Homepage: https://github.com/magit/magit
;; Package-Requires: ((emacs "25.1") (transient "0.3.6") (with-editor "3.0.5"))
;; Package-Version: 3.3.0
;; Keywords: git tools vc
;; Package-Version: 3.3.0.50-git
;; Package-Requires: (
;; (emacs "25.1")
;; (compat "28.1.1.2")
;; (transient "0.3.6")
;; (with-editor "3.0.5"))
;; SPDX-License-Identifier: GPL-3.0-or-later
;; 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, or (at your option)
;; any later version.
;; Magit 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 file is distributed in the hope that it will be useful,
;; Magit 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 file. If not, see <http://www.gnu.org/licenses/>.
;; along with Magit. If not, see <https://www.gnu.org/licenses/>.
;; You should have received a copy of the AUTHORS.md file, which
;; lists all contributors. If not, see https://magit.vc/authors.
;;; Commentary:
@@ -110,15 +116,10 @@
;; M-x customize-group RET git-commit RET
;;; Code:
;;;; Dependencies
(require 'seq)
(require 'subr-x)
(require 'magit-git nil t)
(require 'magit-mode nil t)
(require 'magit-utils nil t)
(require 'log-edit)
(require 'ring)
(require 'rx)
@@ -126,23 +127,22 @@
(require 'transient)
(require 'with-editor)
(defvar recentf-exclude)
;;;; Declarations
;; For historic reasons Magit isn't a hard dependency.
(unless (and (require 'magit-base nil t)
(require 'magit-git nil t))
(declare-function magit-completing-read "magit-base"
( prompt collection &optional predicate require-match
initial-input hist def fallback))
(declare-function magit-expand-git-file-name "magit-git" (filename))
(declare-function magit-git-lines "magit-git" (&rest args))
(declare-function magit-hook-custom-get "magit-base" (symbol))
(declare-function magit-list-local-branch-names "magit-git" ()))
(defvar diff-default-read-only)
(defvar flyspell-generic-check-word-predicate)
(defvar font-lock-beg)
(defvar font-lock-end)
(declare-function magit-completing-read "magit-utils"
(prompt collection &optional predicate require-match
initial-input hist def fallback))
(declare-function magit-expand-git-file-name "magit-git" (filename))
(declare-function magit-git-lines "magit-git" (&rest args))
(declare-function magit-list-local-branch-names "magit-git" ())
(declare-function magit-list-remote-branch-names "magit-git"
(&optional remote relative))
(defvar recentf-exclude)
;;; Options
;;;; Variables
@@ -175,12 +175,12 @@ full loading."
:initialize (lambda (symbol exp)
(custom-initialize-default symbol exp)
(when global-git-commit-mode
(add-hook 'find-file-hook 'git-commit-setup-check-buffer)))
(add-hook 'find-file-hook #'git-commit-setup-check-buffer)))
(if global-git-commit-mode
(add-hook 'find-file-hook 'git-commit-setup-check-buffer)
(remove-hook 'find-file-hook 'git-commit-setup-check-buffer)))
(add-hook 'find-file-hook #'git-commit-setup-check-buffer)
(remove-hook 'find-file-hook #'git-commit-setup-check-buffer)))
(defcustom git-commit-major-mode 'text-mode
(defcustom git-commit-major-mode #'text-mode
"Major mode used to edit Git commit messages.
The major mode configured here is turned on by the minor mode
`git-commit-mode'."
@@ -210,7 +210,7 @@ The major mode configured here is turned on by the minor mode
"Hook run at the end of `git-commit-setup'."
:group 'git-commit
:type 'hook
:get (and (featurep 'magit-utils) 'magit-hook-custom-get)
:get (and (featurep 'magit-base) #'magit-hook-custom-get)
:options '(git-commit-save-message
git-commit-setup-changelog-support
magit-generate-changelog
@@ -240,7 +240,7 @@ This hook is only run if `magit' is available.
Also see `magit-post-commit-hook'."
:group 'git-commit
:type 'hook
:get (and (featurep 'magit-utils) 'magit-hook-custom-get))
:get (and (featurep 'magit-base) #'magit-hook-custom-get))
(defcustom git-commit-finish-query-functions
'(git-commit-check-style-conventions)
@@ -302,7 +302,7 @@ already using it, then you probably shouldn't start doing so."
(defcustom git-commit-known-pseudo-headers
'("Signed-off-by" "Acked-by" "Modified-by" "Cc"
"Suggested-by" "Reported-by" "Tested-by" "Reviewed-by"
"Co-authored-by")
"Co-authored-by" "Co-developed-by")
"A list of Git pseudo headers to be highlighted."
:group 'git-commit
:safe (lambda (val) (and (listp val) (seq-every-p #'stringp val)))
@@ -402,20 +402,20 @@ This is only used if Magit is available."
(defvar git-commit-mode-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "M-p") 'git-commit-prev-message)
(define-key map (kbd "M-n") 'git-commit-next-message)
(define-key map (kbd "C-c M-p") 'git-commit-search-message-backward)
(define-key map (kbd "C-c M-n") 'git-commit-search-message-forward)
(define-key map (kbd "C-c C-i") 'git-commit-insert-pseudo-header)
(define-key map (kbd "C-c C-a") 'git-commit-ack)
(define-key map (kbd "C-c M-i") 'git-commit-suggested)
(define-key map (kbd "C-c C-m") 'git-commit-modified)
(define-key map (kbd "C-c C-o") 'git-commit-cc)
(define-key map (kbd "C-c C-p") 'git-commit-reported)
(define-key map (kbd "C-c C-r") 'git-commit-review)
(define-key map (kbd "C-c C-s") 'git-commit-signoff)
(define-key map (kbd "C-c C-t") 'git-commit-test)
(define-key map (kbd "C-c M-s") 'git-commit-save-message)
(define-key map (kbd "M-p") #'git-commit-prev-message)
(define-key map (kbd "M-n") #'git-commit-next-message)
(define-key map (kbd "C-c M-p") #'git-commit-search-message-backward)
(define-key map (kbd "C-c M-n") #'git-commit-search-message-forward)
(define-key map (kbd "C-c C-i") #'git-commit-insert-pseudo-header)
(define-key map (kbd "C-c C-a") #'git-commit-ack)
(define-key map (kbd "C-c M-i") #'git-commit-suggested)
(define-key map (kbd "C-c C-m") #'git-commit-modified)
(define-key map (kbd "C-c C-o") #'git-commit-cc)
(define-key map (kbd "C-c C-p") #'git-commit-reported)
(define-key map (kbd "C-c C-r") #'git-commit-review)
(define-key map (kbd "C-c C-s") #'git-commit-signoff)
(define-key map (kbd "C-c C-t") #'git-commit-test)
(define-key map (kbd "C-c M-s") #'git-commit-save-message)
map)
"Key map used by `git-commit-mode'.")
@@ -446,6 +446,8 @@ This is only used if Magit is available."
:help "Insert a 'Suggested-by' header"]
["Co-authored-by" git-commit-co-authored t
:help "Insert a 'Co-authored-by' header"]
["Co-developed-by" git-commit-co-developed t
:help "Insert a 'Co-developed-by' header"]
"-"
["Save" git-commit-save-message t]
["Cancel" with-editor-cancel t]
@@ -467,7 +469,7 @@ This is only used if Magit is available."
(string-match-p git-commit-filename-regexp buffer-file-name)
(git-commit-setup-font-lock)))
(add-hook 'after-change-major-mode-hook 'git-commit-setup-font-lock-in-buffer)
(add-hook 'after-change-major-mode-hook #'git-commit-setup-font-lock-in-buffer)
(defun git-commit-setup-check-buffer ()
(and buffer-file-name
@@ -531,15 +533,15 @@ to recover older messages")
;; Pretend that git-commit-mode is a major-mode,
;; so that directory-local settings can be used.
(let ((default-directory
(or (and (not (file-exists-p ".dir-locals.el"))
;; When $GIT_DIR/.dir-locals.el doesn't exist,
;; fallback to $GIT_WORK_TREE/.dir-locals.el,
;; because the maintainer can use the latter
;; to enforce conventions, while s/he has no
;; control over the former.
(fboundp 'magit-toplevel) ; silence byte-compiler
(magit-toplevel))
default-directory)))
(or (and (not (file-exists-p ".dir-locals.el"))
;; When $GIT_DIR/.dir-locals.el doesn't exist,
;; fallback to $GIT_WORK_TREE/.dir-locals.el,
;; because the maintainer can use the latter
;; to enforce conventions, while s/he has no
;; control over the former.
(fboundp 'magit-toplevel) ; silence byte-compiler
(magit-toplevel))
default-directory)))
(let ((buffer-file-name nil) ; trick hack-dir-local-variables
(major-mode 'git-commit-mode)) ; trick dir-locals-collect-variables
(hack-dir-local-variables)
@@ -551,11 +553,14 @@ to recover older messages")
;; Maybe already enabled when using `shell-command' or an Emacs shell.
(with-editor-mode 1))
(add-hook 'with-editor-finish-query-functions
'git-commit-finish-query-functions nil t)
#'git-commit-finish-query-functions nil t)
(add-hook 'with-editor-pre-finish-hook
'git-commit-save-message nil t)
#'git-commit-save-message nil t)
(add-hook 'with-editor-pre-cancel-hook
'git-commit-save-message nil t)
#'git-commit-save-message nil t)
(when (fboundp 'magit-commit--reset-command)
(add-hook 'with-editor-post-finish-hook #'magit-commit--reset-command)
(add-hook 'with-editor-post-cancel-hook #'magit-commit--reset-command))
(when (and (fboundp 'magit-rev-parse)
(not (memq last-command
'(magit-sequencer-continue
@@ -565,13 +570,13 @@ to recover older messages")
magit-rebase-continue
magit-rebase-skip))))
(add-hook 'with-editor-post-finish-hook
(apply-partially 'git-commit-run-post-finish-hook
(apply-partially #'git-commit-run-post-finish-hook
(magit-rev-parse "HEAD"))
nil t)
(when (fboundp 'magit-wip-maybe-add-commit-hook)
(magit-wip-maybe-add-commit-hook)))
(setq with-editor-cancel-message
'git-commit-cancel-message)
#'git-commit-cancel-message)
(git-commit-mode 1)
(git-commit-setup-font-lock)
(git-commit-prepare-message-ring)
@@ -643,7 +648,7 @@ finally check current non-comment text."
(require 'flyspell)
(turn-on-flyspell)
(setq flyspell-generic-check-word-predicate
'git-commit-flyspell-verify)
#'git-commit-flyspell-verify)
(let ((end)
(comment-start-regex (format "^\\(%s\\|$\\)" comment-start)))
(save-excursion
@@ -781,7 +786,7 @@ Save current message first."
(insert str)
(goto-char (point-min))
(when (re-search-forward (concat flush " -+ >8 -+$") nil t)
(delete-region (point-at-bol) (point-max)))
(delete-region (line-beginning-position) (point-max)))
(goto-char (point-min))
(flush-lines flush)
(goto-char (point-max))
@@ -795,21 +800,29 @@ Save current message first."
(setq str (replace-match "\n" t t str)))
str)))
;;; Utilities
(defsubst git-commit-executable ()
(if (fboundp 'magit-git-executable)
(magit-git-executable)
"git"))
;;; Headers
(transient-define-prefix git-commit-insert-pseudo-header ()
"Insert a commit message pseudo header."
[["Insert ... by yourself"
("a" "Ack" git-commit-ack)
("m" "Modified" git-commit-modified)
("r" "Reviewed" git-commit-review)
("s" "Signed-off" git-commit-signoff)
("t" "Tested" git-commit-test)]
("a" "Ack" git-commit-ack)
("m" "Modified" git-commit-modified)
("r" "Reviewed" git-commit-review)
("s" "Signed-off" git-commit-signoff)
("t" "Tested" git-commit-test)]
["Insert ... by someone"
("C-c" "Cc" git-commit-cc)
("C-r" "Reported" git-commit-reported)
("C-i" "Suggested" git-commit-suggested)
("C-a" "Co-authored" git-commit-co-authored)]])
("C-c" "Cc" git-commit-cc)
("C-r" "Reported" git-commit-reported)
("C-i" "Suggested" git-commit-suggested)
("C-a" "Co-authored" git-commit-co-authored)
("C-d" "Co-developed" git-commit-co-developed)]])
(defun git-commit-ack (name mail)
"Insert a header acknowledging that you have looked at the commit."
@@ -856,16 +869,25 @@ Save current message first."
(interactive (git-commit-read-ident "Co-authored-by"))
(git-commit-insert-header "Co-authored-by" name mail))
(defun git-commit-co-developed (name mail)
"Insert a header mentioning the person who co-developed the commit."
(interactive (git-commit-read-ident "Co-developed-by"))
(git-commit-insert-header "Co-developed-by" name mail))
(defun git-commit-self-ident ()
(list (or (getenv "GIT_AUTHOR_NAME")
(getenv "GIT_COMMITTER_NAME")
(ignore-errors (car (process-lines "git" "config" "user.name")))
(with-demoted-errors "Error running 'git config user.name': %S"
(car (process-lines
(git-commit-executable) "config" "user.name")))
user-full-name
(read-string "Name: "))
(or (getenv "GIT_AUTHOR_EMAIL")
(getenv "GIT_COMMITTER_EMAIL")
(getenv "EMAIL")
(ignore-errors (car (process-lines "git" "config" "user.email")))
(with-demoted-errors "Error running 'git config user.email': %S"
(car (process-lines
(git-commit-executable) "config" "user.email")))
(read-string "Email: "))))
(defvar git-commit-read-ident-history nil)
@@ -876,7 +898,7 @@ Save current message first."
prompt
(sort (delete-dups
(magit-git-lines "log" "-n9999" "--format=%aN <%ae>"))
'string<)
#'string<)
nil nil nil 'git-commit-read-ident-history)))
(save-match-data
(if (string-match "\\`\\([^<]+\\) *<\\([^>]+\\)>\\'" str)
@@ -966,7 +988,7 @@ Added to `font-lock-extend-region-functions'."
(eval . `(,(git-commit-summary-regexp)
(1 'git-commit-summary)))
;; - Keyword [aka "text in brackets"] (overrides summary)
("\\[.+?\\]"
("\\[[^][]+?\\]"
(0 'git-commit-keyword t))
;; - Non-empty second line (overrides summary and note)
(eval . `(,(git-commit-summary-regexp)
@@ -1027,49 +1049,53 @@ Added to `font-lock-extend-region-functions'."
"Font-Lock keywords for Git-Commit mode.")
(defun git-commit-setup-font-lock ()
(let ((table (make-syntax-table (syntax-table))))
(when comment-start
(modify-syntax-entry (string-to-char comment-start) "." table))
(modify-syntax-entry ?# "." table)
(modify-syntax-entry ?\" "." table)
(modify-syntax-entry ?\' "." table)
(modify-syntax-entry ?` "." table)
(set-syntax-table table))
(setq-local comment-start
(or (with-temp-buffer
(call-process "git" nil (current-buffer) nil
"config" "core.commentchar")
(unless (bobp)
(goto-char (point-min))
(buffer-substring (point) (line-end-position))))
"#"))
(setq-local comment-start-skip (format "^%s+[\s\t]*" comment-start))
(setq-local comment-end-skip "\n")
(setq-local comment-use-syntax nil)
(setq-local git-commit--branch-name-regexp
(if (and (featurep 'magit-git)
;; When using cygwin git, we may end up in a
;; non-existing directory, which would cause
;; any git calls to signal an error.
(file-accessible-directory-p default-directory))
(progn
;; Make sure the below functions are available.
(require 'magit)
;; Font-Lock wants every submatch to succeed, so
;; also match the empty string. Avoid listing
;; remote branches and using `regexp-quote',
;; because in repositories have thousands of
;; branches that would be very slow. See #4353.
(format "\\(\\(?:%s\\)\\|\\)\\([^']+\\)"
(mapconcat #'identity
(magit-list-local-branch-names)
"\\|")))
"\\([^']*\\)"))
(setq-local font-lock-multiline t)
(add-hook 'font-lock-extend-region-functions
#'git-commit-extend-region-summary-line
t t)
(font-lock-add-keywords nil git-commit-font-lock-keywords))
(with-demoted-errors "Error running git-commit-setup-font-lock: %S"
(let ((table (make-syntax-table (syntax-table))))
(when comment-start
(modify-syntax-entry (string-to-char comment-start) "." table))
(modify-syntax-entry ?# "." table)
(modify-syntax-entry ?\" "." table)
(modify-syntax-entry ?\' "." table)
(modify-syntax-entry ?` "." table)
(set-syntax-table table))
(setq-local comment-start
(or (with-temp-buffer
(and (zerop
(call-process
(git-commit-executable) nil (list t nil) nil
"config" "core.commentchar"))
(not (bobp))
(progn
(goto-char (point-min))
(buffer-substring (point) (line-end-position)))))
"#"))
(setq-local comment-start-skip (format "^%s+[\s\t]*" comment-start))
(setq-local comment-end-skip "\n")
(setq-local comment-use-syntax nil)
(setq-local git-commit--branch-name-regexp
(if (and (featurep 'magit-git)
;; When using cygwin git, we may end up in a
;; non-existing directory, which would cause
;; any git calls to signal an error.
(file-accessible-directory-p default-directory))
(progn
;; Make sure the below functions are available.
(require 'magit)
;; Font-Lock wants every submatch to succeed, so
;; also match the empty string. Avoid listing
;; remote branches and using `regexp-quote',
;; because in repositories have thousands of
;; branches that would be very slow. See #4353.
(format "\\(\\(?:%s\\)\\|\\)\\([^']+\\)"
(mapconcat #'identity
(magit-list-local-branch-names)
"\\|")))
"\\([^']*\\)"))
(setq-local font-lock-multiline t)
(add-hook 'font-lock-extend-region-functions
#'git-commit-extend-region-summary-line
t t)
(font-lock-add-keywords nil git-commit-font-lock-keywords)))
(defun git-commit-propertize-diff ()
(require 'diff-mode)