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,41 +1,31 @@
;;; use-package-core.el --- A configuration macro for simplifying your .emacs -*- lexical-binding: t; -*-
;; Copyright (C) 2012-2017 John Wiegley
;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw@newartisans.com>
;; Maintainer: John Wiegley <johnw@newartisans.com>
;; Created: 17 Jun 2012
;; Modified: 29 Nov 2017
;; Version: 2.4.1
;; Package-Requires: ((emacs "24.3"))
;; Keywords: dotemacs startup speed config package
;; URL: https://github.com/jwiegley/use-package
;; This program 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 part of GNU Emacs.
;; This program 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.
;; GNU Emacs 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.
;; GNU Emacs 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 GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;; The `use-package' declaration macro allows you to isolate package
;; configuration in your ".emacs" in a way that is performance-oriented and,
;; well, just tidy. I created it because I have over 80 packages that I use
;; in Emacs, and things were getting difficult to manage. Yet with this
;; utility my total load time is just under 1 second, with no loss of
;; functionality!
;; This file contains the core implementation of the `use-package'
;; macro.
;;
;; Please see README.md from the same repository for documentation.
;; See the `use-package' info manual for more information.
;;; Code:
@@ -53,21 +43,30 @@
;; iterating over them to "disable all themes" won't disable it.
(setq custom-enabled-themes (remq 'use-package custom-enabled-themes))
(if (and (eq emacs-major-version 24) (eq emacs-minor-version 3))
(defsubst hash-table-keys (hash-table)
"Return a list of keys in HASH-TABLE."
(cl-loop for k being the hash-keys of hash-table collect k))
(eval-when-compile (require 'subr-x)))
(eval-when-compile
(if (and (eq emacs-major-version 24) (eq emacs-minor-version 3))
(progn
(defsubst hash-table-keys (hash-table)
"Return a list of keys in HASH-TABLE."
(cl-loop for k being the hash-keys of hash-table collect k))
(defsubst string-suffix-p (suffix string &optional ignore-case)
(let ((start-pos (- (length string) (length suffix))))
(and (>= start-pos 0)
(eq t (compare-strings suffix nil nil
string start-pos nil ignore-case))))))
(require 'subr-x)))
(eval-when-compile
(require 'regexp-opt))
(defgroup use-package nil
"A use-package declaration for simplifying your `.emacs'."
:group 'startup)
"A `use-package' declaration for simplifying your `.emacs'."
:group 'initialization
:link '(custom-manual "(use-package) Top")
:version "29.1")
(defconst use-package-version "2.4.1"
"This version of use-package.")
(defconst use-package-version "2.4.4"
"This version of `use-package'.")
(defcustom use-package-keywords
'(:disabled
@@ -94,6 +93,7 @@
;; Any other keyword that also declares commands to be autoloaded (such as
;; :bind) must appear before this keyword.
:commands
:autoload
:init
:defer
:demand
@@ -104,13 +104,13 @@
"The set of valid keywords, in the order they are processed in.
The order of this list is *very important*, so it is only
advisable to insert new keywords, never to delete or reorder
them. Further, attention should be paid to the NEWS.md if the
them. Further, attention should be paid to the NEWS.md if the
default order ever changes, as they may have subtle effects on
the semantics of use-package declarations and may necessitate
the semantics of `use-package' declarations and may necessitate
changing where you had inserted a new keyword earlier.
Note that `:disabled' is special in this list, as it causes
nothing at all to happen, even if the rest of the use-package
nothing at all to happen, even if the rest of the `use-package'
declaration is incorrect."
:type '(repeat symbol)
:group 'use-package)
@@ -118,7 +118,8 @@ declaration is incorrect."
(defcustom use-package-deferring-keywords
'(:bind-keymap
:bind-keymap*
:commands)
:commands
:autoload)
"Unless `:demand' is used, keywords in this list imply deferred loading.
The reason keywords like `:hook' are not in this list is that
they only imply deferred loading if they reference actual
@@ -129,9 +130,9 @@ otherwise requested."
:group 'use-package)
(defcustom use-package-ignore-unknown-keywords nil
"If non-nil, issue warning instead of error when unknown
keyword is encountered. The unknown keyword and its associated
arguments will be ignored in the `use-package' expansion."
"If non-nil, warn instead of signaling error for unknown keywords.
The unknown keyword and its associated arguments will be ignored
in the `use-package' expansion."
:type 'boolean
:group 'use-package)
@@ -146,7 +147,7 @@ call)."
"Whether to report about loading and configuration details.
If you customize this, then you should require the `use-package'
feature in files that use `use-package', even if these files only
contain compiled expansions of the macros. If you don't do so,
contain compiled expansions of the macros. If you don't do so,
then the expanded macros do their job silently."
:type '(choice (const :tag "Quiet, without catching errors" errors)
(const :tag "Quiet" nil)
@@ -193,9 +194,9 @@ Each entry in the alist is a list of three elements:
The first element is the `use-package' keyword.
The second is a form that can be evaluated to get the default
value. It can also be a function that will receive the name of
the use-package declaration and the keyword plist given to
`use-package', in normalized form. The value it returns should
value. It can also be a function that will receive the name of
the `use-package' declaration and the keyword plist given to
`use-package', in normalized form. The value it returns should
also be in normalized form (which is sometimes *not* what one
would normally write in a `use-package' declaration, so use
caution).
@@ -203,9 +204,9 @@ caution).
The third element is a form that can be evaluated to determine
whether or not to assign a default value; if it evaluates to nil,
then the default value is not assigned even if the keyword is not
present in the `use-package' form. This third element may also be
present in the `use-package' form. This third element may also be
a function, in which case it receives the name of the package (as
a symbol) and a list of keywords (in normalized form). It should
a symbol) and a list of keywords (in normalized form). It should
return nil or non-nil depending on whether defaulting should be
attempted."
:type `(repeat
@@ -290,7 +291,7 @@ This disables:
The main advantage to this variable is that, if you know your
configuration works, it will make the byte-compiled file as
minimal as possible. It can also help with reading macro-expanded
minimal as possible. It can also help with reading macro-expanded
definitions, to understand the main intent of what's happening."
:type 'boolean
:group 'use-package)
@@ -302,7 +303,7 @@ definitions, to understand the main intent of what's happening."
"\\s-+\\("))
(or (bound-and-true-p lisp-mode-symbol-regexp)
"\\(?:\\sw\\|\\s_\\|\\\\.\\)+") "\\)")
"Sexp providing regexp for finding use-package forms in user files.
"Sexp providing regexp for finding `use-package' forms in user files.
This is used by `use-package-jump-to-package-form' and
`use-package-enable-imenu-support'."
:type 'sexp
@@ -313,17 +314,18 @@ This is used by `use-package-jump-to-package-form' and
This is done by adjusting `lisp-imenu-generic-expression' to
include support for finding `use-package' and `require' forms.
Must be set before loading use-package."
Must be set before loading `use-package'."
:type 'boolean
:set
#'(lambda (_sym value)
#'(lambda (sym value)
(eval-after-load 'lisp-mode
(if value
`(add-to-list 'lisp-imenu-generic-expression
(list "Packages" ,use-package-form-regexp-eval 2))
`(setq lisp-imenu-generic-expression
(remove (list "Packages" ,use-package-form-regexp-eval 2)
lisp-imenu-generic-expression)))))
lisp-imenu-generic-expression))))
(set-default sym value))
:group 'use-package)
(defconst use-package-font-lock-keywords
@@ -334,8 +336,8 @@ Must be set before loading use-package."
(font-lock-add-keywords 'emacs-lisp-mode use-package-font-lock-keywords)
(defcustom use-package-compute-statistics nil
"If non-nil, compute statistics concerned use-package declarations.
View the statistical report using `use-package-report'. Note that
"If non-nil, compute statistics concerned `use-package' declarations.
View the statistical report using `use-package-report'. Note that
if this option is enabled, you must require `use-package' in your
user init file at loadup time, or you will see errors concerning
undefined variables."
@@ -361,14 +363,14 @@ undefined variables."
(and sym (symbolp sym)))
(defsubst use-package-as-symbol (string-or-symbol)
"If STRING-OR-SYMBOL is already a symbol, return it. Otherwise
convert it to a symbol and return that."
"If STRING-OR-SYMBOL is already a symbol, return it.
Otherwise convert it to a symbol and return that."
(if (symbolp string-or-symbol) string-or-symbol
(intern string-or-symbol)))
(defsubst use-package-as-string (string-or-symbol)
"If STRING-OR-SYMBOL is already a string, return it. Otherwise
convert it to a string and return that."
"If STRING-OR-SYMBOL is already a string, return it.
Otherwise convert it to a string and return that."
(if (stringp string-or-symbol) string-or-symbol
(symbol-name string-or-symbol)))
@@ -734,8 +736,8 @@ one.
If AFTER is non-nil, insert KEYWORD either at the end of the
keywords list, or after the ANCHOR if one has been provided.
If TEST is non-nil, it is the test used to compare ELEM to list
elements. The default is `eq'.
The modified list is returned. The original list is not modified."
elements. The default is `eq'.
The modified list is returned. The original list is not modified."
(let (result)
(dolist (k xs)
(if (funcall (or test #'eq) k anchor)
@@ -906,14 +908,14 @@ If RECURSED is non-nil, recurse into sublists."
"A predicate that recognizes functional constructions:
nil
sym
'sym
\\='sym
(quote sym)
#'sym
#\\='sym
(function sym)
(lambda () ...)
'(lambda () ...)
\\='(lambda () ...)
(quote (lambda () ...))
#'(lambda () ...)
#\\='(lambda () ...)
(function (lambda () ...))"
(or (if binding
(symbolp v)
@@ -928,7 +930,7 @@ If RECURSED is non-nil, recurse into sublists."
(defun use-package-normalize-function (v)
"Reduce functional constructions to one of two normal forms:
sym
#'(lambda () ...)"
#\\='(lambda () ...)"
(cond ((symbolp v) v)
((and (listp v)
(memq (car v) '(quote function))
@@ -985,6 +987,8 @@ If RECURSED is non-nil, recurse into sublists."
;;
(defun use-package-reset-statistics ()
"Reset statistics for `use-package'.
See also `use-package-statistics'."
(interactive)
(setq use-package-statistics (make-hash-table)))
@@ -998,11 +1002,10 @@ If RECURSED is non-nil, recurse into sublists."
(defun use-package-statistics-last-event (package)
"Return the date when PACKAGE's status last changed.
The date is returned as a string."
(format-time-string "%Y-%m-%d %a %H:%M"
(or (gethash :config package)
(gethash :init package)
(gethash :preface package)
(gethash :use-package package))))
(or (gethash :config package)
(gethash :init package)
(gethash :preface package)
(gethash :use-package package)))
(defun use-package-statistics-time (package)
"Return the time is took for PACKAGE to load."
@@ -1022,11 +1025,13 @@ The information is formatted in a way suitable for
(vector
(symbol-name package)
(use-package-statistics-status statistics)
(use-package-statistics-last-event statistics)
(format-time-string
"%H:%M:%S.%6N"
(use-package-statistics-last-event statistics))
(format "%.2f" (use-package-statistics-time statistics))))))
(defun use-package-report ()
"Show current statistics gathered about use-package declarations.
"Show current statistics gathered about `use-package' declarations.
In the table that's generated, the status field has the following
meaning:
Configured :config has been processed (the package is loaded!)
@@ -1042,15 +1047,43 @@ meaning:
(tabulated-list-print)
(display-buffer (current-buffer))))
(defvar use-package-statistics-status-order
'(("Declared" . 0)
("Prefaced" . 1)
("Initialized" . 2)
("Configured" . 3)))
(define-derived-mode use-package-statistics-mode tabulated-list-mode
"use-package statistics"
"Show current statistics gathered about use-package declarations."
"Show current statistics gathered about `use-package' declarations."
(setq tabulated-list-format
;; The sum of column width is 80 characters:
[("Package" 25 t)
("Status" 13 t)
("Last Event" 23 t)
("Time" 10 t)])
("Status" 13
(lambda (a b)
(< (assoc-default
(use-package-statistics-status
(gethash (car a) use-package-statistics))
use-package-statistics-status-order)
(assoc-default
(use-package-statistics-status
(gethash (car b) use-package-statistics))
use-package-statistics-status-order))))
("Last Event" 23
(lambda (a b)
(< (float-time
(use-package-statistics-last-event
(gethash (car a) use-package-statistics)))
(float-time
(use-package-statistics-last-event
(gethash (car b) use-package-statistics))))))
("Time" 10
(lambda (a b)
(< (use-package-statistics-time
(gethash (car a) use-package-statistics))
(use-package-statistics-time
(gethash (car b) use-package-statistics)))))])
(setq tabulated-list-sort-key '("Time" . t))
(tabulated-list-init-header))
(defun use-package-statistics-gather (keyword name after)
@@ -1264,7 +1297,10 @@ meaning:
(setq every nil)))
every))))
#'use-package-recognize-function
name label arg))))
(if (string-suffix-p "-mode" (symbol-name name))
name
(intern (concat (symbol-name name) "-mode")))
label arg))))
(defalias 'use-package-autoloads/:hook 'use-package-autoloads-mode)
@@ -1284,9 +1320,13 @@ meaning:
(concat (symbol-name sym)
use-package-hook-name-suffix)))
(function ,fun)))
(if (use-package-non-nil-symbolp syms) (list syms) syms)))))
(use-package-hook-handler-normalize-mode-symbols syms)))))
(use-package-normalize-commands args))))
(defun use-package-hook-handler-normalize-mode-symbols (syms)
"Ensure that `SYMS' turns into a list of modes."
(if (use-package-non-nil-symbolp syms) (list syms) syms))
;;;; :commands
(defalias 'use-package-normalize/:commands 'use-package-normalize-symlist)
@@ -1309,6 +1349,28 @@ meaning:
(delete-dups arg)))
(use-package-process-keywords name rest state)))
;;;; :autoload
(defalias 'use-package-normalize/:autoload 'use-package-normalize/:commands)
(defun use-package-handler/:autoload (name _keyword arg rest state)
(use-package-concat
;; Since we deferring load, establish any necessary autoloads, and also
;; keep the byte-compiler happy.
(let ((name-string (use-package-as-string name)))
(cl-mapcan
#'(lambda (command)
(when (symbolp command)
(append
(unless (plist-get state :demand)
`((unless (fboundp ',command)
(autoload #',command ,name-string))))
(when (bound-and-true-p byte-compile-current-file)
`((eval-when-compile
(declare-function ,command ,name-string)))))))
(delete-dups arg)))
(use-package-process-keywords name rest state)))
;;;; :defer
(defalias 'use-package-normalize/:defer 'use-package-normalize-predicate)
@@ -1439,7 +1501,7 @@ no keyword implies `:all'."
(defun use-package-normalize/:custom-face (name-symbol _keyword arg)
"Normalize use-package custom-face keyword."
(let ((error-msg
(format "%s wants a (<symbol> <face-spec>) or list of these"
(format "%s wants a (<symbol> <face-spec> [spec-type]) or list of these"
name-symbol)))
(unless (listp arg)
(use-package-error error-msg))
@@ -1450,13 +1512,13 @@ no keyword implies `:all'."
(spec (nth 1 def)))
(when (or (not face)
(not spec)
(> (length def) 2))
(> (length def) 3))
(use-package-error error-msg))))))
(defun use-package-handler/:custom-face (name _keyword args rest state)
"Generate use-package custom-face keyword code."
(use-package-concat
(mapcar #'(lambda (def) `(custom-set-faces (backquote ,def))) args)
(mapcar #'(lambda (def) `(apply #'face-spec-set (backquote ,def))) args)
(use-package-process-keywords name rest state)))
;;;; :init
@@ -1547,8 +1609,8 @@ no keyword implies `:all'."
(defmacro use-package (name &rest args)
"Declare an Emacs package by specifying a group of configuration options.
For full documentation, please see the README file that came with
this file. Usage:
For the full documentation, see Info node `(use-package) top'.
Usage:
(use-package package-name
[:keyword [option]]...)
@@ -1570,6 +1632,7 @@ this file. Usage:
package. This is useful if the package is being lazily
loaded, and you wish to conditionally call functions in your
`:init' block that are defined in the package.
:autoload Similar to :commands, but it for no-interactive one.
:hook Specify hook(s) to attach this package to.
:bind Bind keys, and define autoloads for the bound commands.
@@ -1584,12 +1647,15 @@ this file. Usage:
`:magic-fallback', or `:interpreter'. This can be an integer,
to force loading after N seconds of idle time, if the package
has not already been loaded.
:after Delay the use-package declaration until after the named modules
have loaded. Once load, it will be as though the use-package
declaration (without `:after') had been seen at that moment.
:demand Prevent the automatic deferred loading introduced by constructs
such as `:bind' (see `:defer' for the complete list).
:after Delay the effect of the use-package declaration
until after the named libraries have loaded.
Before they have been loaded, no other keyword
has any effect at all, and once they have been
loaded it is as if `:after' was not specified.
:if EXPR Initialize and load only if EXPR evaluates to a non-nil value.
:disabled The package is ignored completely if this keyword is present.
:defines Declare certain variables to silence the byte-compiler.
@@ -1597,13 +1663,13 @@ this file. Usage:
:load-path Add to the `load-path' before attempting to load the package.
:diminish Support for diminish.el (if installed).
:delight Support for delight.el (if installed).
:custom Call `custom-set' or `set-default' with each variable
:custom Call `Custom-set' or `set-default' with each variable
definition without modifying the Emacs `custom-file'.
(compare with `custom-set-variables').
:custom-face Call `customize-set-faces' with each face definition.
:custom-face Call `custom-set-faces' with each face definition.
:ensure Loads the package using package.el if necessary.
:pin Pin the package to an archive."
(declare (indent 1))
(declare (indent defun))
(unless (memq :disabled args)
(macroexp-progn
(use-package-concat
@@ -1622,12 +1688,6 @@ this file. Usage:
(when use-package-compute-statistics
`((use-package-statistics-gather :use-package ',name t)))))))
(put 'use-package 'lisp-indent-function 'defun)
(provide 'use-package-core)
;; Local Variables:
;; indent-tabs-mode: nil
;; End:
;;; use-package-core.el ends here