packages are now built-in
This commit is contained in:
@@ -1,14 +0,0 @@
|
||||
(define-package "bind-key" "20230203.2004" "A simple way to manage personal keybindings"
|
||||
'((emacs "24.3"))
|
||||
:commit "77945e002f11440eae72d8730d3de218163d551e" :authors
|
||||
'(("John Wiegley" . "johnw@newartisans.com"))
|
||||
:maintainers
|
||||
'(("John Wiegley" . "johnw@newartisans.com"))
|
||||
:maintainer
|
||||
'("John Wiegley" . "johnw@newartisans.com")
|
||||
:keywords
|
||||
'("keys" "keybinding" "config" "dotemacs" "extensions")
|
||||
:url "https://github.com/jwiegley/use-package")
|
||||
;; Local Variables:
|
||||
;; no-byte-compile: t
|
||||
;; End:
|
||||
@@ -1,565 +0,0 @@
|
||||
;;; bind-key.el --- A simple way to manage personal keybindings -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (c) 2012-2022 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: John Wiegley <johnw@newartisans.com>
|
||||
;; Maintainer: John Wiegley <johnw@newartisans.com>
|
||||
;; Created: 16 Jun 2012
|
||||
;; Version: 2.4.1
|
||||
;; Package-Requires: ((emacs "24.3"))
|
||||
;; Keywords: keys keybinding config dotemacs extensions
|
||||
;; URL: https://github.com/jwiegley/use-package
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; 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. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; If you have lots of keybindings set in your init file, it can be
|
||||
;; hard to know which ones you haven't set yet, and which may now be
|
||||
;; overriding some new default in a new Emacs version. This module
|
||||
;; aims to solve that problem.
|
||||
;;
|
||||
;; Bind keys as follows in your init file:
|
||||
;;
|
||||
;; (bind-key "C-c x" 'my-ctrl-c-x-command)
|
||||
;;
|
||||
;; If the keybinding argument is a vector, it is passed straight to
|
||||
;; `define-key', so remapping a key with `[remap COMMAND]' works as
|
||||
;; expected:
|
||||
;;
|
||||
;; (bind-key [remap original-ctrl-c-x-command] 'my-ctrl-c-x-command)
|
||||
;;
|
||||
;; If you want the keybinding to override all minor modes that may also bind
|
||||
;; the same key, use the `bind-key*' form:
|
||||
;;
|
||||
;; (bind-key* "<C-return>" 'other-window)
|
||||
;;
|
||||
;; If you want to rebind a key only in a particular keymap, use:
|
||||
;;
|
||||
;; (bind-key "C-c x" 'my-ctrl-c-x-command some-other-mode-map)
|
||||
;;
|
||||
;; To unbind a key within a keymap (for example, to stop your favorite major
|
||||
;; mode from changing a binding that you don't want to override everywhere),
|
||||
;; use `unbind-key':
|
||||
;;
|
||||
;; (unbind-key "C-c x" some-other-mode-map)
|
||||
;;
|
||||
;; To bind multiple keys at once, or set up a prefix map, a `bind-keys' macro
|
||||
;; is provided. It accepts keyword arguments, please see its documentation
|
||||
;; for a detailed description.
|
||||
;;
|
||||
;; To add keys into a specific map, use :map argument
|
||||
;;
|
||||
;; (bind-keys :map dired-mode-map
|
||||
;; ("o" . dired-omit-mode)
|
||||
;; ("a" . some-custom-dired-function))
|
||||
;;
|
||||
;; To set up a prefix map, use `:prefix-map' and `:prefix' arguments (both are
|
||||
;; required)
|
||||
;;
|
||||
;; (bind-keys :prefix-map my-customize-prefix-map
|
||||
;; :prefix "C-c c"
|
||||
;; ("f" . customize-face)
|
||||
;; ("v" . customize-variable))
|
||||
;;
|
||||
;; You can combine all the keywords together. Additionally,
|
||||
;; `:prefix-docstring' can be specified to set documentation of created
|
||||
;; `:prefix-map' variable.
|
||||
;;
|
||||
;; To bind multiple keys in a `bind-key*' way (to be sure that your bindings
|
||||
;; will not be overridden by other modes), you may use `bind-keys*' macro:
|
||||
;;
|
||||
;; (bind-keys*
|
||||
;; ("C-o" . other-window)
|
||||
;; ("C-M-n" . forward-page)
|
||||
;; ("C-M-p" . backward-page))
|
||||
;;
|
||||
;; After Emacs loads, you can see a summary of all your personal keybindings
|
||||
;; currently in effect with this command:
|
||||
;;
|
||||
;; M-x describe-personal-keybindings
|
||||
;;
|
||||
;; This display will tell you if you've overridden a default keybinding, and
|
||||
;; what the default was. Also, it will tell you if the key was rebound after
|
||||
;; your binding it with `bind-key', and what it was rebound it to.
|
||||
;;
|
||||
;; See the `use-package' info manual for more information.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'cl-lib)
|
||||
(require 'easy-mmode)
|
||||
|
||||
(defgroup bind-key nil
|
||||
"A simple way to manage personal keybindings."
|
||||
:group 'keyboard
|
||||
:group 'convenience
|
||||
:link '(emacs-commentary-link :tag "Commentary" "bind-key.el")
|
||||
:version "29.1")
|
||||
|
||||
(defcustom bind-key-column-widths '(18 . 40)
|
||||
"Width of columns in `describe-personal-keybindings'."
|
||||
:type '(cons integer integer)
|
||||
:group 'bind-key)
|
||||
|
||||
(defcustom bind-key-segregation-regexp
|
||||
"\\`\\(\\(C-[chx] \\|M-[gso] \\)\\([CM]-\\)?\\|.+-\\)"
|
||||
"Regexp used by \\[describe-personal-keybindings] to divide key sets."
|
||||
:type 'regexp
|
||||
:group 'bind-key)
|
||||
|
||||
(defcustom bind-key-describe-special-forms nil
|
||||
"If non-nil, extract docstrings from lambdas, closures and keymaps if possible."
|
||||
:type 'boolean
|
||||
:group 'bind-key)
|
||||
|
||||
;; Create override-global-mode to force key remappings
|
||||
|
||||
(defvar override-global-map (make-keymap)
|
||||
"Keymap for `override-global-mode'.")
|
||||
|
||||
(define-minor-mode override-global-mode
|
||||
"A minor mode for allowing keybindings to override other modes.
|
||||
The main purpose of this mode is to simplify bindings keys in
|
||||
such a way that they take precedence over other modes.
|
||||
|
||||
To achieve this, the keymap `override-global-map' is added to
|
||||
`emulation-mode-map-alists', which makes it take precedence over
|
||||
keymaps in `minor-mode-map-alist'. Thereby, key bindings get an
|
||||
even higher precedence than global key bindings defined with
|
||||
`keymap-global-set' (or, in Emacs 28 or older, `global-set-key').
|
||||
|
||||
The macro `bind-key*' (which see) provides a convenient way to
|
||||
add keys to that keymap."
|
||||
:init-value t
|
||||
:lighter "")
|
||||
|
||||
;; the keymaps in `emulation-mode-map-alists' take precedence over
|
||||
;; `minor-mode-map-alist'
|
||||
(add-to-list 'emulation-mode-map-alists
|
||||
`((override-global-mode . ,override-global-map)))
|
||||
|
||||
(defvar personal-keybindings nil
|
||||
"List of bindings performed by `bind-key'.
|
||||
|
||||
Elements have the form ((KEY . [MAP]) CMD ORIGINAL-CMD)")
|
||||
|
||||
;;;###autoload
|
||||
(defmacro bind-key (key-name command &optional keymap predicate)
|
||||
"Bind KEY-NAME to COMMAND in KEYMAP (`global-map' if not passed).
|
||||
|
||||
KEY-NAME may be a vector, in which case it is passed straight to
|
||||
`define-key'. Or it may be a string to be interpreted as
|
||||
spelled-out keystrokes, e.g., \"C-c C-z\". See the documentation
|
||||
of `edmacro-mode' for details.
|
||||
|
||||
COMMAND must be an interactive function, lambda form, or a cons
|
||||
`(STRING . DEFN)'.
|
||||
|
||||
KEYMAP, if present, should be a keymap variable or symbol.
|
||||
For example:
|
||||
|
||||
(bind-key \"M-h\" #\\='some-interactive-function my-mode-map)
|
||||
|
||||
(bind-key \"M-h\" #\\='some-interactive-function \\='my-mode-map)
|
||||
|
||||
If PREDICATE is non-nil, it is a form evaluated to determine when
|
||||
a key should be bound. It must return non-nil in such cases.
|
||||
Emacs can evaluate this form at any time that it does redisplay
|
||||
or operates on menu data structures, so you should write it so it
|
||||
can safely be called at any time."
|
||||
(let ((namevar (make-symbol "name"))
|
||||
(keyvar (make-symbol "key"))
|
||||
(kmapvar (make-symbol "kmap"))
|
||||
(kdescvar (make-symbol "kdesc"))
|
||||
(bindingvar (make-symbol "binding")))
|
||||
`(let* ((,namevar ,key-name)
|
||||
(,keyvar ,(if (stringp key-name) (read-kbd-macro key-name)
|
||||
`(if (vectorp ,namevar) ,namevar
|
||||
(read-kbd-macro ,namevar))))
|
||||
(,kmapvar (or (if (and ,keymap (symbolp ,keymap))
|
||||
(symbol-value ,keymap) ,keymap)
|
||||
global-map))
|
||||
(,kdescvar (cons (if (stringp ,namevar) ,namevar
|
||||
(key-description ,namevar))
|
||||
(if (symbolp ,keymap) ,keymap (quote ,keymap))))
|
||||
(,bindingvar (lookup-key ,kmapvar ,keyvar)))
|
||||
(let ((entry (assoc ,kdescvar personal-keybindings))
|
||||
(details (list ,command
|
||||
(unless (numberp ,bindingvar)
|
||||
,bindingvar))))
|
||||
(if entry
|
||||
(setcdr entry details)
|
||||
(add-to-list 'personal-keybindings (cons ,kdescvar details))))
|
||||
,(if predicate
|
||||
`(define-key ,kmapvar ,keyvar
|
||||
'(menu-item "" nil :filter (lambda (&optional _)
|
||||
(when ,predicate
|
||||
,command))))
|
||||
`(define-key ,kmapvar ,keyvar ,command)))))
|
||||
|
||||
;;;###autoload
|
||||
(defmacro unbind-key (key-name &optional keymap)
|
||||
"Unbind the given KEY-NAME, within the KEYMAP (if specified).
|
||||
See `bind-key' for more details."
|
||||
(let ((namevar (make-symbol "name"))
|
||||
(kdescvar (make-symbol "kdesc")))
|
||||
`(let* ((,namevar ,key-name)
|
||||
(,kdescvar (cons (if (stringp ,namevar) ,namevar
|
||||
(key-description ,namevar))
|
||||
(if (symbolp ,keymap) ,keymap (quote ,keymap)))))
|
||||
(bind-key--remove (if (vectorp ,namevar) ,namevar
|
||||
(read-kbd-macro ,namevar))
|
||||
(or (if (and ,keymap (symbolp ,keymap))
|
||||
(symbol-value ,keymap) ,keymap)
|
||||
global-map))
|
||||
(setq personal-keybindings
|
||||
(cl-delete-if (lambda (k) (equal (car k) ,kdescvar))
|
||||
personal-keybindings))
|
||||
nil)))
|
||||
|
||||
(defun bind-key--remove (key keymap)
|
||||
"Remove KEY from KEYMAP.
|
||||
|
||||
In contrast to `define-key', this function removes the binding from the keymap."
|
||||
(define-key keymap key nil)
|
||||
;; Split M-key in ESC key
|
||||
(setq key (cl-mapcan (lambda (k)
|
||||
(if (and (integerp k) (/= (logand k ?\M-\0) 0))
|
||||
(list ?\e (logxor k ?\M-\0))
|
||||
(list k)))
|
||||
key))
|
||||
;; Delete single keys directly
|
||||
(if (= (length key) 1)
|
||||
(delete key keymap)
|
||||
;; Lookup submap and delete key from there
|
||||
(let* ((prefix (vconcat (butlast key)))
|
||||
(submap (lookup-key keymap prefix)))
|
||||
(unless (keymapp submap)
|
||||
(error "Not a keymap for %s" key))
|
||||
(when (symbolp submap)
|
||||
(setq submap (symbol-function submap)))
|
||||
(delete (last key) submap)
|
||||
;; Delete submap if it is empty
|
||||
(when (= 1 (length submap))
|
||||
(bind-key--remove prefix keymap)))))
|
||||
|
||||
;;;###autoload
|
||||
(defmacro bind-key* (key-name command &optional predicate)
|
||||
"Similar to `bind-key', but overrides any mode-specific bindings."
|
||||
`(bind-key ,key-name ,command override-global-map ,predicate))
|
||||
|
||||
(defun bind-keys-form (args keymap)
|
||||
"Bind multiple keys at once.
|
||||
|
||||
Accepts keyword arguments:
|
||||
:map MAP - a keymap into which the keybindings should be
|
||||
added
|
||||
:prefix KEY - prefix key for these bindings
|
||||
:prefix-map MAP - name of the prefix map that should be created
|
||||
for these bindings
|
||||
:prefix-docstring STR - docstring for the prefix-map variable
|
||||
:menu-name NAME - optional menu string for prefix map
|
||||
:repeat-docstring STR - docstring for the repeat-map variable
|
||||
:repeat-map MAP - name of the repeat map that should be created
|
||||
for these bindings. If specified, the
|
||||
`repeat-map' property of each command bound
|
||||
(within the scope of the `:repeat-map' keyword)
|
||||
is set to this map.
|
||||
:exit BINDINGS - Within the scope of `:repeat-map' will bind the
|
||||
key in the repeat map, but will not set the
|
||||
`repeat-map' property of the bound command.
|
||||
:continue BINDINGS - Within the scope of `:repeat-map' forces the
|
||||
same behaviour as if no special keyword had
|
||||
been used (that is, the command is bound, and
|
||||
it's `repeat-map' property set)
|
||||
:filter FORM - optional form to determine when bindings apply
|
||||
|
||||
The rest of the arguments are conses of keybinding string and a
|
||||
function symbol (unquoted)."
|
||||
(let (map
|
||||
prefix-doc
|
||||
prefix-map
|
||||
prefix
|
||||
repeat-map
|
||||
repeat-doc
|
||||
repeat-type ;; Only used internally
|
||||
filter
|
||||
menu-name
|
||||
pkg)
|
||||
|
||||
;; Process any initial keyword arguments
|
||||
(let ((cont t)
|
||||
(arg-change-func 'cddr))
|
||||
(while (and cont args)
|
||||
(if (cond ((and (eq :map (car args))
|
||||
(not prefix-map))
|
||||
(setq map (cadr args)))
|
||||
((eq :prefix-docstring (car args))
|
||||
(setq prefix-doc (cadr args)))
|
||||
((and (eq :prefix-map (car args))
|
||||
(not (memq map '(global-map
|
||||
override-global-map))))
|
||||
(setq prefix-map (cadr args)))
|
||||
((eq :repeat-docstring (car args))
|
||||
(setq repeat-doc (cadr args)))
|
||||
((and (eq :repeat-map (car args))
|
||||
(not (memq map '(global-map
|
||||
override-global-map))))
|
||||
(setq repeat-map (cadr args))
|
||||
(setq map repeat-map))
|
||||
((eq :continue (car args))
|
||||
(setq repeat-type :continue
|
||||
arg-change-func 'cdr))
|
||||
((eq :exit (car args))
|
||||
(setq repeat-type :exit
|
||||
arg-change-func 'cdr))
|
||||
((eq :prefix (car args))
|
||||
(setq prefix (cadr args)))
|
||||
((eq :filter (car args))
|
||||
(setq filter (cadr args)) t)
|
||||
((eq :menu-name (car args))
|
||||
(setq menu-name (cadr args)))
|
||||
((eq :package (car args))
|
||||
(setq pkg (cadr args))))
|
||||
(setq args (funcall arg-change-func args))
|
||||
(setq cont nil))))
|
||||
|
||||
(when (or (and prefix-map (not prefix))
|
||||
(and prefix (not prefix-map)))
|
||||
(error "Both :prefix-map and :prefix must be supplied"))
|
||||
|
||||
(when repeat-type
|
||||
(unless repeat-map
|
||||
(error ":continue and :exit require specifying :repeat-map")))
|
||||
|
||||
(when (and menu-name (not prefix))
|
||||
(error "If :menu-name is supplied, :prefix must be too"))
|
||||
|
||||
(unless map (setq map keymap))
|
||||
|
||||
;; Process key binding arguments
|
||||
(let (first next)
|
||||
(while args
|
||||
(if (keywordp (car args))
|
||||
(progn
|
||||
(setq next args)
|
||||
(setq args nil))
|
||||
(if first
|
||||
(nconc first (list (car args)))
|
||||
(setq first (list (car args))))
|
||||
(setq args (cdr args))))
|
||||
|
||||
(cl-flet
|
||||
((wrap (map bindings)
|
||||
(if (and map pkg (not (memq map '(global-map
|
||||
override-global-map))))
|
||||
`((if (boundp ',map)
|
||||
,(macroexp-progn bindings)
|
||||
(eval-after-load
|
||||
,(if (symbolp pkg) `',pkg pkg)
|
||||
',(macroexp-progn bindings))))
|
||||
bindings)))
|
||||
|
||||
(append
|
||||
(when prefix-map
|
||||
`((defvar ,prefix-map)
|
||||
,@(when prefix-doc `((put ',prefix-map 'variable-documentation ,prefix-doc)))
|
||||
,@(if menu-name
|
||||
`((define-prefix-command ',prefix-map nil ,menu-name))
|
||||
`((define-prefix-command ',prefix-map)))
|
||||
,@(if (and map (not (eq map 'global-map)))
|
||||
(wrap map `((bind-key ,prefix ',prefix-map ,map ,filter)))
|
||||
`((bind-key ,prefix ',prefix-map nil ,filter)))))
|
||||
(when repeat-map
|
||||
`((defvar ,repeat-map (make-sparse-keymap)
|
||||
,@(when repeat-doc `(,repeat-doc)))))
|
||||
(wrap map
|
||||
(cl-mapcan
|
||||
(lambda (form)
|
||||
(let ((fun (and (cdr form) (list 'function (cdr form)))))
|
||||
(if prefix-map
|
||||
`((bind-key ,(car form) ,fun ,prefix-map ,filter))
|
||||
(if (and map (not (eq map 'global-map)))
|
||||
;; Only needed in this branch, since when
|
||||
;; repeat-map is non-nil, map is always
|
||||
;; non-nil
|
||||
`(,@(when (and repeat-map (not (eq repeat-type :exit)))
|
||||
`((put ,fun 'repeat-map ',repeat-map)))
|
||||
(bind-key ,(car form) ,fun ,map ,filter))
|
||||
`((bind-key ,(car form) ,fun nil ,filter))))))
|
||||
first))
|
||||
(when next
|
||||
(bind-keys-form `(,@(when repeat-map `(:repeat-map ,repeat-map))
|
||||
,@(if pkg
|
||||
(cons :package (cons pkg next))
|
||||
next)) map)))))))
|
||||
|
||||
;;;###autoload
|
||||
(defmacro bind-keys (&rest args)
|
||||
"Bind multiple keys at once.
|
||||
|
||||
Accepts keyword arguments:
|
||||
:map MAP - a keymap into which the keybindings should be
|
||||
added
|
||||
:prefix KEY - prefix key for these bindings
|
||||
:prefix-map MAP - name of the prefix map that should be created
|
||||
for these bindings
|
||||
:prefix-docstring STR - docstring for the prefix-map variable
|
||||
:menu-name NAME - optional menu string for prefix map
|
||||
:repeat-docstring STR - docstring for the repeat-map variable
|
||||
:repeat-map MAP - name of the repeat map that should be created
|
||||
for these bindings. If specified, the
|
||||
`repeat-map' property of each command bound
|
||||
(within the scope of the `:repeat-map' keyword)
|
||||
is set to this map.
|
||||
:exit BINDINGS - Within the scope of `:repeat-map' will bind the
|
||||
key in the repeat map, but will not set the
|
||||
`repeat-map' property of the bound command.
|
||||
:continue BINDINGS - Within the scope of `:repeat-map' forces the
|
||||
same behaviour as if no special keyword had
|
||||
been used (that is, the command is bound, and
|
||||
it's `repeat-map' property set)
|
||||
:filter FORM - optional form to determine when bindings apply
|
||||
|
||||
The rest of the arguments are conses of keybinding string and a
|
||||
function symbol (unquoted)."
|
||||
(macroexp-progn (bind-keys-form args nil)))
|
||||
|
||||
;;;###autoload
|
||||
(defmacro bind-keys* (&rest args)
|
||||
"Bind multiple keys at once, in `override-global-map'.
|
||||
Accepts the same keyword arguments as `bind-keys' (which see).
|
||||
|
||||
This binds keys in such a way that bindings are not overridden by
|
||||
other modes. See `override-global-mode'."
|
||||
(macroexp-progn (bind-keys-form args 'override-global-map)))
|
||||
|
||||
(defun get-binding-description (elem)
|
||||
(cond
|
||||
((listp elem)
|
||||
(cond
|
||||
((memq (car elem) '(lambda function))
|
||||
(if (and bind-key-describe-special-forms
|
||||
(stringp (nth 2 elem)))
|
||||
(nth 2 elem)
|
||||
"#<lambda>"))
|
||||
((eq 'closure (car elem))
|
||||
(if (and bind-key-describe-special-forms
|
||||
(stringp (nth 3 elem)))
|
||||
(nth 3 elem)
|
||||
"#<closure>"))
|
||||
((eq 'keymap (car elem))
|
||||
"#<keymap>")
|
||||
(t
|
||||
elem)))
|
||||
;; must be a symbol, non-symbol keymap case covered above
|
||||
((and bind-key-describe-special-forms (keymapp elem))
|
||||
(let ((doc (get elem 'variable-documentation)))
|
||||
(if (stringp doc) doc elem)))
|
||||
((symbolp elem)
|
||||
elem)
|
||||
(t
|
||||
"#<byte-compiled lambda>")))
|
||||
|
||||
(defun compare-keybindings (l r)
|
||||
(let* ((regex bind-key-segregation-regexp)
|
||||
(lgroup (and (string-match regex (caar l))
|
||||
(match-string 0 (caar l))))
|
||||
(rgroup (and (string-match regex (caar r))
|
||||
(match-string 0 (caar r))))
|
||||
(lkeymap (cdar l))
|
||||
(rkeymap (cdar r)))
|
||||
(cond
|
||||
((and (null lkeymap) rkeymap)
|
||||
(cons t t))
|
||||
((and lkeymap (null rkeymap))
|
||||
(cons nil t))
|
||||
((and lkeymap rkeymap
|
||||
(not (string= (symbol-name lkeymap) (symbol-name rkeymap))))
|
||||
(cons (string< (symbol-name lkeymap) (symbol-name rkeymap)) t))
|
||||
((and (null lgroup) rgroup)
|
||||
(cons t t))
|
||||
((and lgroup (null rgroup))
|
||||
(cons nil t))
|
||||
((and lgroup rgroup)
|
||||
(if (string= lgroup rgroup)
|
||||
(cons (string< (caar l) (caar r)) nil)
|
||||
(cons (string< lgroup rgroup) t)))
|
||||
(t
|
||||
(cons (string< (caar l) (caar r)) nil)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun describe-personal-keybindings ()
|
||||
"Display all the personal keybindings defined by `bind-key'."
|
||||
(interactive)
|
||||
(with-output-to-temp-buffer "*Personal Keybindings*"
|
||||
(princ (format (concat "Key name%s Command%s Comments\n%s %s "
|
||||
"---------------------\n")
|
||||
(make-string (- (car bind-key-column-widths) 9) ? )
|
||||
(make-string (- (cdr bind-key-column-widths) 8) ? )
|
||||
(make-string (1- (car bind-key-column-widths)) ?-)
|
||||
(make-string (1- (cdr bind-key-column-widths)) ?-)))
|
||||
(let (last-binding)
|
||||
(dolist (binding
|
||||
(setq personal-keybindings
|
||||
(sort personal-keybindings
|
||||
(lambda (l r)
|
||||
(car (compare-keybindings l r))))))
|
||||
|
||||
(if (not (eq (cdar last-binding) (cdar binding)))
|
||||
(princ (format "\n\n%s: %s\n%s\n\n"
|
||||
(cdar binding) (caar binding)
|
||||
(make-string (+ 21 (car bind-key-column-widths)
|
||||
(cdr bind-key-column-widths)) ?-)))
|
||||
(if (and last-binding
|
||||
(cdr (compare-keybindings last-binding binding)))
|
||||
(princ "\n")))
|
||||
|
||||
(let* ((key-name (caar binding))
|
||||
(at-present (lookup-key (or (symbol-value (cdar binding))
|
||||
(current-global-map))
|
||||
(read-kbd-macro key-name)))
|
||||
(command (nth 1 binding))
|
||||
(was-command (nth 2 binding))
|
||||
(command-desc (get-binding-description command))
|
||||
(was-command-desc (and was-command
|
||||
(get-binding-description was-command)))
|
||||
(at-present-desc (get-binding-description at-present)))
|
||||
(let ((line
|
||||
(format
|
||||
(format "%%-%ds%%-%ds%%s\n" (car bind-key-column-widths)
|
||||
(cdr bind-key-column-widths))
|
||||
key-name (format "`%s\'" command-desc)
|
||||
(if (string= command-desc at-present-desc)
|
||||
(if (or (null was-command)
|
||||
(string= command-desc was-command-desc))
|
||||
""
|
||||
(format "was `%s\'" was-command-desc))
|
||||
(format "[now: `%s\']" at-present)))))
|
||||
(princ (if (string-match "[ \t]+\n" line)
|
||||
(replace-match "\n" t t line)
|
||||
line))))
|
||||
|
||||
(setq last-binding binding)))))
|
||||
|
||||
(provide 'bind-key)
|
||||
|
||||
;; Local Variables:
|
||||
;; outline-regexp: ";;;\\(;* [^\s\t\n]\\|###autoload\\)\\|("
|
||||
;; End:
|
||||
|
||||
;;; bind-key.el ends here
|
||||
@@ -1,18 +0,0 @@
|
||||
This is the file .../info/dir, which contains the
|
||||
topmost node of the Info hierarchy, called (dir)Top.
|
||||
The first time you invoke Info you start off looking at this node.
|
||||
|
||||
File: dir, Node: Top This is the top of the INFO tree
|
||||
|
||||
This (the Directory node) gives a menu of major topics.
|
||||
Typing "q" exits, "H" lists all Info commands, "d" returns here,
|
||||
"h" gives a primer for first-timers,
|
||||
"mEmacs<Return>" visits the Emacs manual, etc.
|
||||
|
||||
In Emacs, you can click mouse button 2 on a menu item or cross reference
|
||||
to select it.
|
||||
|
||||
* Menu:
|
||||
|
||||
Emacs misc features
|
||||
* use-package: (use-package). Declarative package configuration for Emacs.
|
||||
@@ -1,489 +0,0 @@
|
||||
This is doclicense.info, produced by makeinfo version 7.1.1 from
|
||||
doclicense.texi.
|
||||
|
||||
Version 1.3, 3 November 2008
|
||||
|
||||
Copyright © 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
|
||||
<https://fsf.org/>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
0. PREAMBLE
|
||||
|
||||
The purpose of this License is to make a manual, textbook, or other
|
||||
functional and useful document “free” in the sense of freedom: to
|
||||
assure everyone the effective freedom to copy and redistribute it,
|
||||
with or without modifying it, either commercially or
|
||||
noncommercially. Secondarily, this License preserves for the
|
||||
author and publisher a way to get credit for their work, while not
|
||||
being considered responsible for modifications made by others.
|
||||
|
||||
This License is a kind of "copyleft", which means that derivative
|
||||
works of the document must themselves be free in the same sense.
|
||||
It complements the GNU General Public License, which is a copyleft
|
||||
license designed for free software.
|
||||
|
||||
We have designed this License in order to use it for manuals for
|
||||
free software, because free software needs free documentation: a
|
||||
free program should come with manuals providing the same freedoms
|
||||
that the software does. But this License is not limited to
|
||||
software manuals; it can be used for any textual work, regardless
|
||||
of subject matter or whether it is published as a printed book. We
|
||||
recommend this License principally for works whose purpose is
|
||||
instruction or reference.
|
||||
|
||||
1. APPLICABILITY AND DEFINITIONS
|
||||
|
||||
This License applies to any manual or other work, in any medium,
|
||||
that contains a notice placed by the copyright holder saying it can
|
||||
be distributed under the terms of this License. Such a notice
|
||||
grants a world-wide, royalty-free license, unlimited in duration,
|
||||
to use that work under the conditions stated herein. The
|
||||
"Document", below, refers to any such manual or work. Any member
|
||||
of the public is a licensee, and is addressed as "you". You accept
|
||||
the license if you copy, modify or distribute the work in a way
|
||||
requiring permission under copyright law.
|
||||
|
||||
A "Modified Version" of the Document means any work containing the
|
||||
Document or a portion of it, either copied verbatim, or with
|
||||
modifications and/or translated into another language.
|
||||
|
||||
A "Secondary Section" is a named appendix or a front-matter section
|
||||
of the Document that deals exclusively with the relationship of the
|
||||
publishers or authors of the Document to the Document's overall
|
||||
subject (or to related matters) and contains nothing that could
|
||||
fall directly within that overall subject. (Thus, if the Document
|
||||
is in part a textbook of mathematics, a Secondary Section may not
|
||||
explain any mathematics.) The relationship could be a matter of
|
||||
historical connection with the subject or with related matters, or
|
||||
of legal, commercial, philosophical, ethical or political position
|
||||
regarding them.
|
||||
|
||||
The "Invariant Sections" are certain Secondary Sections whose
|
||||
titles are designated, as being those of Invariant Sections, in the
|
||||
notice that says that the Document is released under this License.
|
||||
If a section does not fit the above definition of Secondary then it
|
||||
is not allowed to be designated as Invariant. The Document may
|
||||
contain zero Invariant Sections. If the Document does not identify
|
||||
any Invariant Sections then there are none.
|
||||
|
||||
The "Cover Texts" are certain short passages of text that are
|
||||
listed, as Front-Cover Texts or Back-Cover Texts, in the notice
|
||||
that says that the Document is released under this License. A
|
||||
Front-Cover Text may be at most 5 words, and a Back-Cover Text may
|
||||
be at most 25 words.
|
||||
|
||||
A "Transparent" copy of the Document means a machine-readable copy,
|
||||
represented in a format whose specification is available to the
|
||||
general public, that is suitable for revising the document
|
||||
straightforwardly with generic text editors or (for images composed
|
||||
of pixels) generic paint programs or (for drawings) some widely
|
||||
available drawing editor, and that is suitable for input to text
|
||||
formatters or for automatic translation to a variety of formats
|
||||
suitable for input to text formatters. A copy made in an otherwise
|
||||
Transparent file format whose markup, or absence of markup, has
|
||||
been arranged to thwart or discourage subsequent modification by
|
||||
readers is not Transparent. An image format is not Transparent if
|
||||
used for any substantial amount of text. A copy that is not
|
||||
"Transparent" is called "Opaque".
|
||||
|
||||
Examples of suitable formats for Transparent copies include plain
|
||||
ASCII without markup, Texinfo input format, LaTeX input format,
|
||||
SGML or XML using a publicly available DTD, and standard-conforming
|
||||
simple HTML, PostScript or PDF designed for human modification.
|
||||
Examples of transparent image formats include PNG, XCF and JPG.
|
||||
Opaque formats include proprietary formats that can be read and
|
||||
edited only by proprietary word processors, SGML or XML for which
|
||||
the DTD and/or processing tools are not generally available, and
|
||||
the machine-generated HTML, PostScript or PDF produced by some word
|
||||
processors for output purposes only.
|
||||
|
||||
The "Title Page" means, for a printed book, the title page itself,
|
||||
plus such following pages as are needed to hold, legibly, the
|
||||
material this License requires to appear in the title page. For
|
||||
works in formats which do not have any title page as such, "Title
|
||||
Page" means the text near the most prominent appearance of the
|
||||
work's title, preceding the beginning of the body of the text.
|
||||
|
||||
The "publisher" means any person or entity that distributes copies
|
||||
of the Document to the public.
|
||||
|
||||
A section "Entitled XYZ" means a named subunit of the Document
|
||||
whose title either is precisely XYZ or contains XYZ in parentheses
|
||||
following text that translates XYZ in another language. (Here XYZ
|
||||
stands for a specific section name mentioned below, such as
|
||||
"Acknowledgements", "Dedications", "Endorsements", or "History".)
|
||||
To "Preserve the Title" of such a section when you modify the
|
||||
Document means that it remains a section "Entitled XYZ" according
|
||||
to this definition.
|
||||
|
||||
The Document may include Warranty Disclaimers next to the notice
|
||||
which states that this License applies to the Document. These
|
||||
Warranty Disclaimers are considered to be included by reference in
|
||||
this License, but only as regards disclaiming warranties: any other
|
||||
implication that these Warranty Disclaimers may have is void and
|
||||
has no effect on the meaning of this License.
|
||||
|
||||
2. VERBATIM COPYING
|
||||
|
||||
You may copy and distribute the Document in any medium, either
|
||||
commercially or noncommercially, provided that this License, the
|
||||
copyright notices, and the license notice saying this License
|
||||
applies to the Document are reproduced in all copies, and that you
|
||||
add no other conditions whatsoever to those of this License. You
|
||||
may not use technical measures to obstruct or control the reading
|
||||
or further copying of the copies you make or distribute. However,
|
||||
you may accept compensation in exchange for copies. If you
|
||||
distribute a large enough number of copies you must also follow the
|
||||
conditions in section 3.
|
||||
|
||||
You may also lend copies, under the same conditions stated above,
|
||||
and you may publicly display copies.
|
||||
|
||||
3. COPYING IN QUANTITY
|
||||
|
||||
If you publish printed copies (or copies in media that commonly
|
||||
have printed covers) of the Document, numbering more than 100, and
|
||||
the Document's license notice requires Cover Texts, you must
|
||||
enclose the copies in covers that carry, clearly and legibly, all
|
||||
these Cover Texts: Front-Cover Texts on the front cover, and
|
||||
Back-Cover Texts on the back cover. Both covers must also clearly
|
||||
and legibly identify you as the publisher of these copies. The
|
||||
front cover must present the full title with all words of the title
|
||||
equally prominent and visible. You may add other material on the
|
||||
covers in addition. Copying with changes limited to the covers, as
|
||||
long as they preserve the title of the Document and satisfy these
|
||||
conditions, can be treated as verbatim copying in other respects.
|
||||
|
||||
If the required texts for either cover are too voluminous to fit
|
||||
legibly, you should put the first ones listed (as many as fit
|
||||
reasonably) on the actual cover, and continue the rest onto
|
||||
adjacent pages.
|
||||
|
||||
If you publish or distribute Opaque copies of the Document
|
||||
numbering more than 100, you must either include a machine-readable
|
||||
Transparent copy along with each Opaque copy, or state in or with
|
||||
each Opaque copy a computer-network location from which the general
|
||||
network-using public has access to download using public-standard
|
||||
network protocols a complete Transparent copy of the Document, free
|
||||
of added material. If you use the latter option, you must take
|
||||
reasonably prudent steps, when you begin distribution of Opaque
|
||||
copies in quantity, to ensure that this Transparent copy will
|
||||
remain thus accessible at the stated location until at least one
|
||||
year after the last time you distribute an Opaque copy (directly or
|
||||
through your agents or retailers) of that edition to the public.
|
||||
|
||||
It is requested, but not required, that you contact the authors of
|
||||
the Document well before redistributing any large number of copies,
|
||||
to give them a chance to provide you with an updated version of the
|
||||
Document.
|
||||
|
||||
4. MODIFICATIONS
|
||||
|
||||
You may copy and distribute a Modified Version of the Document
|
||||
under the conditions of sections 2 and 3 above, provided that you
|
||||
release the Modified Version under precisely this License, with the
|
||||
Modified Version filling the role of the Document, thus licensing
|
||||
distribution and modification of the Modified Version to whoever
|
||||
possesses a copy of it. In addition, you must do these things in
|
||||
the Modified Version:
|
||||
|
||||
A. Use in the Title Page (and on the covers, if any) a title
|
||||
distinct from that of the Document, and from those of previous
|
||||
versions (which should, if there were any, be listed in the
|
||||
History section of the Document). You may use the same title
|
||||
as a previous version if the original publisher of that
|
||||
version gives permission.
|
||||
|
||||
B. List on the Title Page, as authors, one or more persons or
|
||||
entities responsible for authorship of the modifications in
|
||||
the Modified Version, together with at least five of the
|
||||
principal authors of the Document (all of its principal
|
||||
authors, if it has fewer than five), unless they release you
|
||||
from this requirement.
|
||||
|
||||
C. State on the Title page the name of the publisher of the
|
||||
Modified Version, as the publisher.
|
||||
|
||||
D. Preserve all the copyright notices of the Document.
|
||||
|
||||
E. Add an appropriate copyright notice for your modifications
|
||||
adjacent to the other copyright notices.
|
||||
|
||||
F. Include, immediately after the copyright notices, a license
|
||||
notice giving the public permission to use the Modified
|
||||
Version under the terms of this License, in the form shown in
|
||||
the Addendum below.
|
||||
|
||||
G. Preserve in that license notice the full lists of Invariant
|
||||
Sections and required Cover Texts given in the Document's
|
||||
license notice.
|
||||
|
||||
H. Include an unaltered copy of this License.
|
||||
|
||||
I. Preserve the section Entitled "History", Preserve its Title,
|
||||
and add to it an item stating at least the title, year, new
|
||||
authors, and publisher of the Modified Version as given on the
|
||||
Title Page. If there is no section Entitled "History" in the
|
||||
Document, create one stating the title, year, authors, and
|
||||
publisher of the Document as given on its Title Page, then add
|
||||
an item describing the Modified Version as stated in the
|
||||
previous sentence.
|
||||
|
||||
J. Preserve the network location, if any, given in the Document
|
||||
for public access to a Transparent copy of the Document, and
|
||||
likewise the network locations given in the Document for
|
||||
previous versions it was based on. These may be placed in the
|
||||
"History" section. You may omit a network location for a work
|
||||
that was published at least four years before the Document
|
||||
itself, or if the original publisher of the version it refers
|
||||
to gives permission.
|
||||
|
||||
K. For any section Entitled "Acknowledgements" or "Dedications",
|
||||
Preserve the Title of the section, and preserve in the section
|
||||
all the substance and tone of each of the contributor
|
||||
acknowledgements and/or dedications given therein.
|
||||
|
||||
L. Preserve all the Invariant Sections of the Document, unaltered
|
||||
in their text and in their titles. Section numbers or the
|
||||
equivalent are not considered part of the section titles.
|
||||
|
||||
M. Delete any section Entitled "Endorsements". Such a section
|
||||
may not be included in the Modified Version.
|
||||
|
||||
N. Do not retitle any existing section to be Entitled
|
||||
"Endorsements" or to conflict in title with any Invariant
|
||||
Section.
|
||||
|
||||
O. Preserve any Warranty Disclaimers.
|
||||
|
||||
If the Modified Version includes new front-matter sections or
|
||||
appendices that qualify as Secondary Sections and contain no
|
||||
material copied from the Document, you may at your option designate
|
||||
some or all of these sections as invariant. To do this, add their
|
||||
titles to the list of Invariant Sections in the Modified Version's
|
||||
license notice. These titles must be distinct from any other
|
||||
section titles.
|
||||
|
||||
You may add a section Entitled "Endorsements", provided it contains
|
||||
nothing but endorsements of your Modified Version by various
|
||||
parties--for example, statements of peer review or that the text
|
||||
has been approved by an organization as the authoritative
|
||||
definition of a standard.
|
||||
|
||||
You may add a passage of up to five words as a Front-Cover Text,
|
||||
and a passage of up to 25 words as a Back-Cover Text, to the end of
|
||||
the list of Cover Texts in the Modified Version. Only one passage
|
||||
of Front-Cover Text and one of Back-Cover Text may be added by (or
|
||||
through arrangements made by) any one entity. If the Document
|
||||
already includes a cover text for the same cover, previously added
|
||||
by you or by arrangement made by the same entity you are acting on
|
||||
behalf of, you may not add another; but you may replace the old
|
||||
one, on explicit permission from the previous publisher that added
|
||||
the old one.
|
||||
|
||||
The author(s) and publisher(s) of the Document do not by this
|
||||
License give permission to use their names for publicity for or to
|
||||
assert or imply endorsement of any Modified Version.
|
||||
|
||||
5. COMBINING DOCUMENTS
|
||||
|
||||
You may combine the Document with other documents released under
|
||||
this License, under the terms defined in section 4 above for
|
||||
modified versions, provided that you include in the combination all
|
||||
of the Invariant Sections of all of the original documents,
|
||||
unmodified, and list them all as Invariant Sections of your
|
||||
combined work in its license notice, and that you preserve all
|
||||
their Warranty Disclaimers.
|
||||
|
||||
The combined work need only contain one copy of this License, and
|
||||
multiple identical Invariant Sections may be replaced with a single
|
||||
copy. If there are multiple Invariant Sections with the same name
|
||||
but different contents, make the title of each such section unique
|
||||
by adding at the end of it, in parentheses, the name of the
|
||||
original author or publisher of that section if known, or else a
|
||||
unique number. Make the same adjustment to the section titles in
|
||||
the list of Invariant Sections in the license notice of the
|
||||
combined work.
|
||||
|
||||
In the combination, you must combine any sections Entitled
|
||||
"History" in the various original documents, forming one section
|
||||
Entitled "History"; likewise combine any sections Entitled
|
||||
"Acknowledgements", and any sections Entitled "Dedications". You
|
||||
must delete all sections Entitled "Endorsements."
|
||||
|
||||
6. COLLECTIONS OF DOCUMENTS
|
||||
|
||||
You may make a collection consisting of the Document and other
|
||||
documents released under this License, and replace the individual
|
||||
copies of this License in the various documents with a single copy
|
||||
that is included in the collection, provided that you follow the
|
||||
rules of this License for verbatim copying of each of the documents
|
||||
in all other respects.
|
||||
|
||||
You may extract a single document from such a collection, and
|
||||
distribute it individually under this License, provided you insert
|
||||
a copy of this License into the extracted document, and follow this
|
||||
License in all other respects regarding verbatim copying of that
|
||||
document.
|
||||
|
||||
7. AGGREGATION WITH INDEPENDENT WORKS
|
||||
|
||||
A compilation of the Document or its derivatives with other
|
||||
separate and independent documents or works, in or on a volume of a
|
||||
storage or distribution medium, is called an "aggregate" if the
|
||||
copyright resulting from the compilation is not used to limit the
|
||||
legal rights of the compilation's users beyond what the individual
|
||||
works permit. When the Document is included in an aggregate, this
|
||||
License does not apply to the other works in the aggregate which
|
||||
are not themselves derivative works of the Document.
|
||||
|
||||
If the Cover Text requirement of section 3 is applicable to these
|
||||
copies of the Document, then if the Document is less than one half
|
||||
of the entire aggregate, the Document's Cover Texts may be placed
|
||||
on covers that bracket the Document within the aggregate, or the
|
||||
electronic equivalent of covers if the Document is in electronic
|
||||
form. Otherwise they must appear on printed covers that bracket
|
||||
the whole aggregate.
|
||||
|
||||
8. TRANSLATION
|
||||
|
||||
Translation is considered a kind of modification, so you may
|
||||
distribute translations of the Document under the terms of section
|
||||
4. Replacing Invariant Sections with translations requires special
|
||||
permission from their copyright holders, but you may include
|
||||
translations of some or all Invariant Sections in addition to the
|
||||
original versions of these Invariant Sections. You may include a
|
||||
translation of this License, and all the license notices in the
|
||||
Document, and any Warranty Disclaimers, provided that you also
|
||||
include the original English version of this License and the
|
||||
original versions of those notices and disclaimers. In case of a
|
||||
disagreement between the translation and the original version of
|
||||
this License or a notice or disclaimer, the original version will
|
||||
prevail.
|
||||
|
||||
If a section in the Document is Entitled "Acknowledgements",
|
||||
"Dedications", or "History", the requirement (section 4) to
|
||||
Preserve its Title (section 1) will typically require changing the
|
||||
actual title.
|
||||
|
||||
9. TERMINATION
|
||||
|
||||
You may not copy, modify, sublicense, or distribute the Document
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense, or distribute it is void,
|
||||
and will automatically terminate your rights under this License.
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the
|
||||
copyright holder fails to notify you of the violation by some
|
||||
reasonable means prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from
|
||||
that copyright holder, and you cure the violation prior to 30 days
|
||||
after your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate
|
||||
the licenses of parties who have received copies or rights from you
|
||||
under this License. If your rights have been terminated and not
|
||||
permanently reinstated, receipt of a copy of some or all of the
|
||||
same material does not give you any rights to use it.
|
||||
|
||||
10. FUTURE REVISIONS OF THIS LICENSE
|
||||
|
||||
The Free Software Foundation may publish new, revised versions of
|
||||
the GNU Free Documentation License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns. See
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
Each version of the License is given a distinguishing version
|
||||
number. If the Document specifies that a particular numbered
|
||||
version of this License "or any later version" applies to it, you
|
||||
have the option of following the terms and conditions either of
|
||||
that specified version or of any later version that has been
|
||||
published (not as a draft) by the Free Software Foundation. If the
|
||||
Document does not specify a version number of this License, you may
|
||||
choose any version ever published (not as a draft) by the Free
|
||||
Software Foundation. If the Document specifies that a proxy can
|
||||
decide which future versions of this License can be used, that
|
||||
proxy's public statement of acceptance of a version permanently
|
||||
authorizes you to choose that version for the Document.
|
||||
|
||||
11. RELICENSING
|
||||
|
||||
"Massive Multiauthor Collaboration Site" (or "MMC Site") means any
|
||||
World Wide Web server that publishes copyrightable works and also
|
||||
provides prominent facilities for anybody to edit those works. A
|
||||
public wiki that anybody can edit is an example of such a server.
|
||||
A "Massive Multiauthor Collaboration" (or "MMC") contained in the
|
||||
site means any set of copyrightable works thus published on the MMC
|
||||
site.
|
||||
|
||||
"CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
|
||||
license published by Creative Commons Corporation, a not-for-profit
|
||||
corporation with a principal place of business in San Francisco,
|
||||
California, as well as future copyleft versions of that license
|
||||
published by that same organization.
|
||||
|
||||
"Incorporate" means to publish or republish a Document, in whole or
|
||||
in part, as part of another Document.
|
||||
|
||||
An MMC is "eligible for relicensing" if it is licensed under this
|
||||
License, and if all works that were first published under this
|
||||
License somewhere other than this MMC, and subsequently
|
||||
incorporated in whole or in part into the MMC, (1) had no cover
|
||||
texts or invariant sections, and (2) were thus incorporated prior
|
||||
to November 1, 2008.
|
||||
|
||||
The operator of an MMC Site may republish an MMC contained in the
|
||||
site under CC-BY-SA on the same site at any time before August 1,
|
||||
2009, provided the MMC is eligible for relicensing.
|
||||
|
||||
ADDENDUM: How to use this License for your documents
|
||||
====================================================
|
||||
|
||||
To use this License in a document you have written, include a copy of
|
||||
the License in the document and put the following copyright and license
|
||||
notices just after the title page:
|
||||
|
||||
Copyright (C) YEAR YOUR NAME.
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
|
||||
Texts. A copy of the license is included in the section entitled ``GNU
|
||||
Free Documentation License''.
|
||||
|
||||
If you have Invariant Sections, Front-Cover Texts and Back-Cover
|
||||
Texts, replace the "with...Texts." line with this:
|
||||
|
||||
with the Invariant Sections being LIST THEIR TITLES, with
|
||||
the Front-Cover Texts being LIST, and with the Back-Cover Texts
|
||||
being LIST.
|
||||
|
||||
If you have Invariant Sections without Cover Texts, or some other
|
||||
combination of the three, merge those two alternatives to suit the
|
||||
situation.
|
||||
|
||||
If your document contains nontrivial examples of program code, we
|
||||
recommend releasing these examples in parallel under your choice of free
|
||||
software license, such as the GNU General Public License, to permit
|
||||
their use in free software.
|
||||
|
||||
|
||||
|
||||
Tag Table:
|
||||
|
||||
End Tag Table
|
||||
|
||||
|
||||
Local Variables:
|
||||
coding: utf-8
|
||||
End:
|
||||
@@ -1,13 +0,0 @@
|
||||
This is docstyle.info, produced by makeinfo version 7.1.1 from
|
||||
docstyle.texi.
|
||||
|
||||
|
||||
|
||||
Tag Table:
|
||||
|
||||
End Tag Table
|
||||
|
||||
|
||||
Local Variables:
|
||||
coding: utf-8
|
||||
End:
|
||||
@@ -1,185 +0,0 @@
|
||||
;;; use-package-bind-key.el --- Support for the :bind/:bind-keymap keywords -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: John Wiegley <johnw@newartisans.com>
|
||||
;; Maintainer: John Wiegley <johnw@newartisans.com>
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; 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. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; Provides support for the :bind, :bind*, :bind-keymap and :bind-keymap*
|
||||
;; keywords. Note that these are currently still baked into
|
||||
;; `use-package-keywords' and `use-package-deferring-keywords', although this
|
||||
;; is harmless if they are never used.
|
||||
;;
|
||||
;; These keywords are made available by default by requiring `use-package'.
|
||||
;;
|
||||
;; See the `use-package' info manual for more information.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'use-package-core)
|
||||
(require 'bind-key)
|
||||
|
||||
;;;###autoload
|
||||
(defun use-package-autoload-keymap (keymap-symbol package override)
|
||||
"Load PACKAGE and bind key sequence invoking this function to KEYMAP-SYMBOL.
|
||||
Then simulate pressing the same key sequence a again, so that the
|
||||
next key pressed is routed to the newly loaded keymap.
|
||||
|
||||
This function supports use-package's :bind-keymap keyword. It
|
||||
works by binding the given key sequence to an invocation of this
|
||||
function for a particular keymap. The keymap is expected to be
|
||||
defined by the package. In this way, loading the package is
|
||||
deferred until the prefix key sequence is pressed."
|
||||
(if (not (require package nil t))
|
||||
(use-package-error (format "Cannot load package.el: %s" package))
|
||||
(if (and (boundp keymap-symbol)
|
||||
(keymapp (symbol-value keymap-symbol)))
|
||||
(let* ((kv (this-command-keys-vector))
|
||||
(key (key-description kv))
|
||||
(keymap (symbol-value keymap-symbol)))
|
||||
(if override
|
||||
(bind-key* key keymap)
|
||||
(bind-key key keymap))
|
||||
(setq unread-command-events
|
||||
(mapcar (lambda (ev) (cons t ev))
|
||||
(listify-key-sequence kv))))
|
||||
(use-package-error
|
||||
(format "package.el %s failed to define keymap %s"
|
||||
package keymap-symbol)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun use-package-normalize-binder (name keyword args)
|
||||
(let ((arg args)
|
||||
args*)
|
||||
(while arg
|
||||
(let ((x (car arg))
|
||||
(y (cadr arg)))
|
||||
(cond
|
||||
;; (KEY DESC . COMMAND), i.e. (KEY . (DESC . COMMAND))
|
||||
((and (or (stringp x)
|
||||
(vectorp x))
|
||||
(consp y)
|
||||
(stringp (car y))
|
||||
(or (use-package-recognize-function (cdr y) t #'stringp)))
|
||||
(setq args* (nconc args* (list (cons x y))))
|
||||
(setq arg (cddr arg)))
|
||||
;; (KEY . COMMAND)
|
||||
((and (consp x)
|
||||
(or (stringp (car x))
|
||||
(vectorp (car x)))
|
||||
(or (use-package-recognize-function (cdr x) t #'stringp)))
|
||||
(setq args* (nconc args* (list x)))
|
||||
(setq arg (cdr arg)))
|
||||
;; KEYWORD
|
||||
;; :map KEYMAP
|
||||
;; :prefix-docstring STRING
|
||||
;; :prefix-map SYMBOL
|
||||
;; :prefix STRING
|
||||
;; :repeat-docstring STRING
|
||||
;; :repeat-map SYMBOL
|
||||
;; :filter SEXP
|
||||
;; :menu-name STRING
|
||||
;; :package SYMBOL
|
||||
;; :continue and :exit are used within :repeat-map
|
||||
((or (and (eq x :map) (symbolp (cadr arg)))
|
||||
(and (eq x :prefix) (stringp (cadr arg)))
|
||||
(and (eq x :prefix-map) (symbolp (cadr arg)))
|
||||
(and (eq x :prefix-docstring) (stringp (cadr arg)))
|
||||
(and (eq x :repeat-map) (symbolp (cadr arg)))
|
||||
(eq x :continue)
|
||||
(eq x :exit)
|
||||
(and (eq x :repeat-docstring) (stringp (cadr arg)))
|
||||
(eq x :filter)
|
||||
(and (eq x :menu-name) (stringp (cadr arg)))
|
||||
(and (eq x :package) (symbolp (cadr arg))))
|
||||
(setq args* (nconc args* (list x (cadr arg))))
|
||||
(setq arg (cddr arg)))
|
||||
((listp x)
|
||||
(setq args*
|
||||
(nconc args* (use-package-normalize-binder name keyword x)))
|
||||
(setq arg (cdr arg)))
|
||||
(t
|
||||
;; Error!
|
||||
(use-package-error
|
||||
(concat (symbol-name name)
|
||||
" wants arguments acceptable to the `bind-keys' macro,"
|
||||
" or a list of such values"))))))
|
||||
args*))
|
||||
|
||||
;;;; :bind, :bind*
|
||||
|
||||
;;;###autoload
|
||||
(defalias 'use-package-normalize/:bind 'use-package-normalize-binder)
|
||||
;;;###autoload
|
||||
(defalias 'use-package-normalize/:bind* 'use-package-normalize-binder)
|
||||
|
||||
;; jww (2017-12-07): This is too simplistic. It will fail to determine
|
||||
;; autoloads in this situation:
|
||||
;; (use-package foo
|
||||
;; :bind (:map foo-map (("C-a" . func))))
|
||||
;;;###autoload
|
||||
(defalias 'use-package-autoloads/:bind 'use-package-autoloads-mode)
|
||||
;;;###autoload
|
||||
(defalias 'use-package-autoloads/:bind* 'use-package-autoloads-mode)
|
||||
|
||||
;;;###autoload
|
||||
(defun use-package-handler/:bind
|
||||
(name _keyword args rest state &optional bind-macro)
|
||||
(use-package-concat
|
||||
(use-package-process-keywords name rest state)
|
||||
`(,@(mapcar
|
||||
#'(lambda (xs)
|
||||
`(,(if bind-macro bind-macro 'bind-keys)
|
||||
:package ,name ,@(use-package-normalize-commands xs)))
|
||||
(use-package-split-list-at-keys :break args)))))
|
||||
|
||||
(defun use-package-handler/:bind* (name keyword arg rest state)
|
||||
(use-package-handler/:bind name keyword arg rest state 'bind-keys*))
|
||||
|
||||
;;;; :bind-keymap, :bind-keymap*
|
||||
|
||||
;;;###autoload
|
||||
(defalias 'use-package-normalize/:bind-keymap 'use-package-normalize-binder)
|
||||
;;;###autoload
|
||||
(defalias 'use-package-normalize/:bind-keymap* 'use-package-normalize-binder)
|
||||
|
||||
;;;###autoload
|
||||
(defun use-package-handler/:bind-keymap
|
||||
(name _keyword args rest state &optional override)
|
||||
(use-package-concat
|
||||
(use-package-process-keywords name rest state)
|
||||
(mapcar
|
||||
#'(lambda (binding)
|
||||
`(,(if override 'bind-key* 'bind-key)
|
||||
,(car binding)
|
||||
#'(lambda ()
|
||||
(interactive)
|
||||
(use-package-autoload-keymap
|
||||
',(cdr binding) ',(use-package-as-symbol name)
|
||||
,override))))
|
||||
args)))
|
||||
|
||||
;;;###autoload
|
||||
(defun use-package-handler/:bind-keymap* (name keyword arg rest state)
|
||||
(use-package-handler/:bind-keymap name keyword arg rest state t))
|
||||
|
||||
(provide 'use-package-bind-key)
|
||||
|
||||
;;; use-package-bind-key.el ends here
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,88 +0,0 @@
|
||||
;;; use-package-delight.el --- Support for the :delight keyword -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: John Wiegley <johnw@newartisans.com>
|
||||
;; Maintainer: John Wiegley <johnw@newartisans.com>
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; 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. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; Provides support for the :delight keyword, which is made available
|
||||
;; by default by requiring `use-package'. Using it requires the
|
||||
;; `delight' package to be installed (available on GNU ELPA).
|
||||
;;
|
||||
;; See the `use-package' info manual for more information.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'use-package-core)
|
||||
|
||||
(defun use-package-normalize-delight (name args)
|
||||
"Normalize ARGS for a single call to `delight'."
|
||||
(when (eq :eval (car args))
|
||||
;; Handle likely common mistake.
|
||||
(use-package-error ":delight mode line constructs must be quoted"))
|
||||
(cond ((and (= (length args) 1)
|
||||
(use-package-non-nil-symbolp (car args)))
|
||||
`(,(nth 0 args) nil ,name))
|
||||
((= (length args) 2)
|
||||
`(,(nth 0 args) ,(nth 1 args) ,name))
|
||||
((= (length args) 3)
|
||||
args)
|
||||
(t
|
||||
(use-package-error
|
||||
":delight expects `delight' arguments or a list of them"))))
|
||||
|
||||
;;;###autoload
|
||||
(defun use-package-normalize/:delight (name _keyword args)
|
||||
"Normalize arguments to delight."
|
||||
(cond ((null args)
|
||||
`((,(use-package-as-mode name) nil ,name)))
|
||||
((and (= (length args) 1)
|
||||
(use-package-non-nil-symbolp (car args)))
|
||||
`((,(car args) nil ,name)))
|
||||
((and (= (length args) 1)
|
||||
(stringp (car args)))
|
||||
`((,(use-package-as-mode name) ,(car args) ,name)))
|
||||
((and (= (length args) 1)
|
||||
(listp (car args))
|
||||
(eq 'quote (caar args)))
|
||||
`((,(use-package-as-mode name) ,@(cdar args) ,name)))
|
||||
((and (= (length args) 2)
|
||||
(listp (nth 1 args))
|
||||
(eq 'quote (car (nth 1 args))))
|
||||
`((,(car args) ,@(cdr (nth 1 args)) ,name)))
|
||||
(t (mapcar
|
||||
(apply-partially #'use-package-normalize-delight name)
|
||||
(if (use-package-non-nil-symbolp (car args))
|
||||
(list args)
|
||||
args)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun use-package-handler/:delight (name _keyword args rest state)
|
||||
(let ((body (use-package-process-keywords name rest state)))
|
||||
(use-package-concat
|
||||
body
|
||||
`((if (fboundp 'delight)
|
||||
(delight '(,@args)))))))
|
||||
|
||||
(add-to-list 'use-package-keywords :delight t)
|
||||
|
||||
(provide 'use-package-delight)
|
||||
|
||||
;;; use-package-delight.el ends here
|
||||
@@ -1,77 +0,0 @@
|
||||
;;; use-package-diminish.el --- Support for the :diminish keyword -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: John Wiegley <johnw@newartisans.com>
|
||||
;; Maintainer: John Wiegley <johnw@newartisans.com>
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; 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. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; Provides support for the :diminish keyword, which is made available
|
||||
;; by default by requiring `use-package'. Using it requires the
|
||||
;; `diminish' package to be installed (available on GNU ELPA).
|
||||
;;
|
||||
;; See the `use-package' info manual for more information.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'use-package-core)
|
||||
|
||||
(defun use-package-normalize-diminish (name label arg &optional recursed)
|
||||
"Normalize the arguments to diminish down to a list of one of two forms:
|
||||
SYMBOL
|
||||
(SYMBOL . STRING)"
|
||||
(cond
|
||||
((not arg)
|
||||
(list (use-package-as-mode name)))
|
||||
((use-package-non-nil-symbolp arg)
|
||||
(list arg))
|
||||
((stringp arg)
|
||||
(list (cons (use-package-as-mode name) arg)))
|
||||
((and (consp arg) (stringp (cdr arg)))
|
||||
(list arg))
|
||||
((and (not recursed) (listp arg) (listp (cdr arg)))
|
||||
(mapcar #'(lambda (x) (car (use-package-normalize-diminish
|
||||
name label x t))) arg))
|
||||
(t
|
||||
(use-package-error
|
||||
(concat label " wants a string, symbol, "
|
||||
"(symbol . string) or list of these")))))
|
||||
|
||||
;;;###autoload
|
||||
(defun use-package-normalize/:diminish (name keyword args)
|
||||
(use-package-as-one (symbol-name keyword) args
|
||||
(apply-partially #'use-package-normalize-diminish name) t))
|
||||
|
||||
;;;###autoload
|
||||
(defun use-package-handler/:diminish (name _keyword arg rest state)
|
||||
(let ((body (use-package-process-keywords name rest state)))
|
||||
(use-package-concat
|
||||
(mapcar #'(lambda (var)
|
||||
`(if (fboundp 'diminish)
|
||||
,(if (consp var)
|
||||
`(diminish ',(car var) ,(cdr var))
|
||||
`(diminish ',var))))
|
||||
arg)
|
||||
body)))
|
||||
|
||||
(add-to-list 'use-package-keywords :diminish t)
|
||||
|
||||
(provide 'use-package-diminish)
|
||||
|
||||
;;; use-package-diminish.el ends here
|
||||
@@ -1,212 +0,0 @@
|
||||
;;; use-package-ensure.el --- Support for the :ensure and :pin keywords -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: John Wiegley <johnw@newartisans.com>
|
||||
;; Maintainer: John Wiegley <johnw@newartisans.com>
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; 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. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; Provides support for the :ensure and :pin keywords, which are made
|
||||
;; available by default by requiring `use-package'.
|
||||
;;
|
||||
;; See the `use-package' info manual for more information.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'cl-lib)
|
||||
(require 'use-package-core)
|
||||
|
||||
(defgroup use-package-ensure nil
|
||||
"Support for :ensure and :pin keywords in `use-package' declarations."
|
||||
:group 'use-package
|
||||
:link '(custom-manual "(use-package) Installing packages")
|
||||
:version "29.1")
|
||||
|
||||
(eval-when-compile
|
||||
(declare-function package-installed-p "package")
|
||||
(declare-function package-read-all-archive-contents "package" ()))
|
||||
|
||||
(defcustom use-package-always-ensure nil
|
||||
"Treat every package as though it had specified using `:ensure SEXP'.
|
||||
See also `use-package-defaults', which uses this value."
|
||||
:type 'sexp
|
||||
:group 'use-package-ensure)
|
||||
|
||||
(defcustom use-package-always-pin nil
|
||||
"Treat every package as though it had specified using `:pin SYM'.
|
||||
See also `use-package-defaults', which uses this value."
|
||||
:type 'symbol
|
||||
:group 'use-package-ensure)
|
||||
|
||||
(defcustom use-package-ensure-function 'use-package-ensure-elpa
|
||||
"Function that ensures a package is installed.
|
||||
This function is called with three arguments: the name of the
|
||||
package declared in the `use-package' form; the arguments passed
|
||||
to all `:ensure' keywords (always a list, even if only one); and
|
||||
the current `state' plist created by previous handlers.
|
||||
|
||||
Note that this function is called whenever `:ensure' is provided,
|
||||
even if it is nil. It is up to the function to decide on the
|
||||
semantics of the various values for `:ensure'.
|
||||
|
||||
This function should return non-nil if the package is installed.
|
||||
|
||||
The default value uses package.el to install the package."
|
||||
:type '(choice (const :tag "package.el" use-package-ensure-elpa)
|
||||
(function :tag "Custom"))
|
||||
:group 'use-package-ensure)
|
||||
|
||||
;;;; :pin
|
||||
|
||||
(defun use-package-normalize/:pin (_name keyword args)
|
||||
(use-package-only-one (symbol-name keyword) args
|
||||
#'(lambda (_label arg)
|
||||
(cond
|
||||
((stringp arg) arg)
|
||||
((use-package-non-nil-symbolp arg) (symbol-name arg))
|
||||
(t
|
||||
(use-package-error
|
||||
":pin wants an archive name (a string)"))))))
|
||||
|
||||
(eval-when-compile
|
||||
(defvar package-pinned-packages)
|
||||
(defvar package-archives))
|
||||
|
||||
(defun use-package-archive-exists-p (archive)
|
||||
"Check if a given ARCHIVE is enabled.
|
||||
|
||||
ARCHIVE can be a string or a symbol or `manual' to indicate a
|
||||
manually updated package."
|
||||
(if (member archive '(manual "manual"))
|
||||
't
|
||||
(let ((valid nil))
|
||||
(dolist (pa package-archives)
|
||||
(when (member archive (list (car pa) (intern (car pa))))
|
||||
(setq valid 't)))
|
||||
valid)))
|
||||
|
||||
(defun use-package-pin-package (package archive)
|
||||
"Pin PACKAGE to ARCHIVE."
|
||||
(unless (boundp 'package-pinned-packages)
|
||||
(setq package-pinned-packages ()))
|
||||
(let ((archive-symbol (if (symbolp archive) archive (intern archive)))
|
||||
(archive-name (if (stringp archive) archive (symbol-name archive))))
|
||||
(if (use-package-archive-exists-p archive-symbol)
|
||||
(add-to-list 'package-pinned-packages (cons package archive-name))
|
||||
(error "Archive '%s' requested for package '%s' is not available"
|
||||
archive-name package))
|
||||
(unless (bound-and-true-p package--initialized)
|
||||
(package-initialize t))))
|
||||
|
||||
(defun use-package-handler/:pin (name _keyword archive-name rest state)
|
||||
(let ((body (use-package-process-keywords name rest state))
|
||||
(pin-form (if archive-name
|
||||
`(use-package-pin-package ',(use-package-as-symbol name)
|
||||
,archive-name))))
|
||||
;; Pinning should occur just before ensuring
|
||||
;; See `use-package-handler/:ensure'.
|
||||
(if (bound-and-true-p byte-compile-current-file)
|
||||
(eval pin-form) ; Eval when byte-compiling,
|
||||
(push pin-form body)) ; or else wait until runtime.
|
||||
body))
|
||||
|
||||
;;;; :ensure
|
||||
|
||||
(defvar package-archive-contents)
|
||||
|
||||
;;;###autoload
|
||||
(defun use-package-normalize/:ensure (_name keyword args)
|
||||
(if (null args)
|
||||
(list t)
|
||||
(use-package-only-one (symbol-name keyword) args
|
||||
#'(lambda (_label arg)
|
||||
(cond
|
||||
((symbolp arg)
|
||||
(list arg))
|
||||
((and (listp arg) (= 3 (length arg))
|
||||
(symbolp (nth 0 arg))
|
||||
(eq :pin (nth 1 arg))
|
||||
(or (stringp (nth 2 arg))
|
||||
(symbolp (nth 2 arg))))
|
||||
(list (cons (nth 0 arg) (nth 2 arg))))
|
||||
(t
|
||||
(use-package-error
|
||||
(concat ":ensure wants an optional package name "
|
||||
"(an unquoted symbol name), or (<symbol> :pin <string>)"))))))))
|
||||
|
||||
(defun use-package-ensure-elpa (name args _state &optional _no-refresh)
|
||||
(dolist (ensure args)
|
||||
(let ((package
|
||||
(or (and (eq ensure t) (use-package-as-symbol name))
|
||||
ensure)))
|
||||
(when package
|
||||
(require 'package)
|
||||
(when (consp package)
|
||||
(use-package-pin-package (car package) (cdr package))
|
||||
(setq package (car package)))
|
||||
(unless (package-installed-p package)
|
||||
(condition-case-unless-debug err
|
||||
(progn
|
||||
(when (assoc package (bound-and-true-p
|
||||
package-pinned-packages))
|
||||
(package-read-all-archive-contents))
|
||||
(if (assoc package package-archive-contents)
|
||||
(package-install package)
|
||||
(package-refresh-contents)
|
||||
(when (assoc package (bound-and-true-p
|
||||
package-pinned-packages))
|
||||
(package-read-all-archive-contents))
|
||||
(package-install package))
|
||||
t)
|
||||
(error
|
||||
(display-warning 'use-package
|
||||
(format "Failed to install %s: %s"
|
||||
name (error-message-string err))
|
||||
:error))))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun use-package-handler/:ensure (name _keyword ensure rest state)
|
||||
(let* ((body (use-package-process-keywords name rest state)))
|
||||
;; We want to avoid installing packages when the `use-package' macro is
|
||||
;; being macro-expanded by elisp completion (see `lisp--local-variables'),
|
||||
;; but still install packages when byte-compiling, to avoid requiring
|
||||
;; `package' at runtime.
|
||||
(if (bound-and-true-p byte-compile-current-file)
|
||||
;; Eval when byte-compiling,
|
||||
(funcall use-package-ensure-function name ensure state)
|
||||
;; or else wait until runtime.
|
||||
(push `(,use-package-ensure-function ',name ',ensure ',state)
|
||||
body))
|
||||
body))
|
||||
|
||||
(add-to-list 'use-package-defaults
|
||||
'(:ensure (list use-package-always-ensure)
|
||||
(lambda (name args)
|
||||
(and use-package-always-ensure
|
||||
(not (plist-member args :load-path))))) t)
|
||||
|
||||
(add-to-list 'use-package-defaults
|
||||
'(:pin use-package-always-pin use-package-always-pin) t)
|
||||
|
||||
(add-to-list 'use-package-keywords :ensure)
|
||||
(add-to-list 'use-package-keywords :pin)
|
||||
|
||||
(provide 'use-package-ensure)
|
||||
|
||||
;;; use-package-ensure.el ends here
|
||||
@@ -1,74 +0,0 @@
|
||||
;;; use-package-jump.el --- Attempt to jump to a use-package declaration -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: John Wiegley <johnw@newartisans.com>
|
||||
;; Maintainer: John Wiegley <johnw@newartisans.com>
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; 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. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; Provides the command `M-x use-package-jump-to-package-form'. However, it
|
||||
;; only works if the package being jumped to was required during
|
||||
;; initialization. If it was autoloaded, it will not work.
|
||||
;; Improvements are needed.
|
||||
;;
|
||||
;; See the `use-package' info manual for more information.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'use-package-core)
|
||||
|
||||
(defun use-package-find-require (package)
|
||||
"Find file that required PACKAGE by searching `load-history'.
|
||||
Returns an absolute file path or nil if none is found."
|
||||
(catch 'suspect
|
||||
(dolist (filespec load-history)
|
||||
(dolist (entry (cdr filespec))
|
||||
(when (equal entry (cons 'require package))
|
||||
(throw 'suspect (car filespec)))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun use-package-jump-to-package-form (package)
|
||||
"Attempt to find and jump to the `use-package' form that loaded PACKAGE.
|
||||
This will only find the form if that form actually required
|
||||
PACKAGE. If PACKAGE was previously required then this function
|
||||
will jump to the file that originally required PACKAGE instead."
|
||||
(interactive (list (completing-read "Package: " features)))
|
||||
(let* ((package (if (stringp package) (intern package) package))
|
||||
(requiring-file (use-package-find-require package))
|
||||
file location)
|
||||
(if (null requiring-file)
|
||||
(user-error "Can't find file requiring file; may have been autoloaded")
|
||||
(setq file (if (string= (file-name-extension requiring-file) "elc")
|
||||
(concat (file-name-sans-extension requiring-file) ".el")
|
||||
requiring-file))
|
||||
(when (file-exists-p file)
|
||||
(find-file-other-window file)
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(setq location
|
||||
(re-search-forward
|
||||
(format (eval use-package-form-regexp-eval) package) nil t)))
|
||||
(if (null location)
|
||||
(message "No use-package form found.")
|
||||
(goto-char location)
|
||||
(beginning-of-line))))))
|
||||
|
||||
(provide 'use-package-jump)
|
||||
|
||||
;;; use-package-jump.el ends here
|
||||
@@ -1,80 +0,0 @@
|
||||
;;; use-package-lint.el --- Attempt to find errors in use-package declarations -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: John Wiegley <johnw@newartisans.com>
|
||||
;; Maintainer: John Wiegley <johnw@newartisans.com>
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; 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. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; Provides the command `M-x use-package-lint'.
|
||||
;;
|
||||
;; See the `use-package' info manual for more information.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'cl-lib)
|
||||
(require 'use-package-core)
|
||||
|
||||
(defun use-package-lint-declaration (name plist)
|
||||
(dolist (path (plist-get plist :load-path))
|
||||
(unless (file-exists-p path)
|
||||
(display-warning
|
||||
'use-package
|
||||
(format "%s :load-path does not exist: %s"
|
||||
name path) :error)))
|
||||
|
||||
(unless (or (plist-member plist :disabled)
|
||||
(plist-get plist :no-require)
|
||||
(locate-library (use-package-as-string name) nil
|
||||
(plist-get plist :load-path)))
|
||||
(display-warning
|
||||
'use-package
|
||||
(format "%s module cannot be located" name) :error))
|
||||
|
||||
;; (dolist (command (plist-get plist :commands))
|
||||
;; (unless (string= (find-lisp-object-file-name command nil)
|
||||
;; (locate-library (use-package-as-string name) nil
|
||||
;; (plist-get plist :load-path)))
|
||||
;; (display-warning
|
||||
;; 'use-package
|
||||
;; (format "%s :command is from different path: %s"
|
||||
;; name (symbol-name command)) :error)))
|
||||
)
|
||||
|
||||
;;;###autoload
|
||||
(defun use-package-lint ()
|
||||
"Check for errors in `use-package' declarations.
|
||||
For example, if the module's `:if' condition is met, but even
|
||||
with the specified `:load-path' the module cannot be found."
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(let ((re (eval use-package-form-regexp-eval)))
|
||||
(while (re-search-forward re nil t)
|
||||
(goto-char (match-beginning 0))
|
||||
(let ((decl (read (current-buffer))))
|
||||
(when (eq (car decl) 'use-package)
|
||||
(use-package-lint-declaration
|
||||
(use-package-as-string (cadr decl))
|
||||
(use-package-normalize-keywords
|
||||
(cadr decl) (cddr decl)))))))))
|
||||
|
||||
(provide 'use-package-lint)
|
||||
|
||||
;;; use-package-lint.el ends here
|
||||
@@ -1,15 +0,0 @@
|
||||
(define-package "use-package" "20230426.2324" "A configuration macro for simplifying your .emacs"
|
||||
'((emacs "24.3")
|
||||
(bind-key "2.4"))
|
||||
:commit "b59b4dc2361c7b351238990d0c34eece8d79ecf0" :authors
|
||||
'(("John Wiegley" . "johnw@newartisans.com"))
|
||||
:maintainers
|
||||
'(("John Wiegley" . "johnw@newartisans.com"))
|
||||
:maintainer
|
||||
'("John Wiegley" . "johnw@newartisans.com")
|
||||
:keywords
|
||||
'("dotemacs" "startup" "speed" "config" "package" "extensions")
|
||||
:url "https://github.com/jwiegley/use-package")
|
||||
;; Local Variables:
|
||||
;; no-byte-compile: t
|
||||
;; End:
|
||||
@@ -1,53 +0,0 @@
|
||||
;;; use-package.el --- A configuration macro for simplifying your .emacs -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: John Wiegley <johnw@newartisans.com>
|
||||
;; Maintainer: John Wiegley <johnw@newartisans.com>
|
||||
;; Created: 17 Jun 2012
|
||||
;; Version: 2.4.4
|
||||
;; Package-Requires: ((emacs "24.3") (bind-key "2.4"))
|
||||
;; Keywords: dotemacs startup speed config package extensions
|
||||
;; URL: https://github.com/jwiegley/use-package
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; 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. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; The `use-package' declaration macro allows you to isolate package
|
||||
;; configuration in your init file 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!
|
||||
;;
|
||||
;; See the `use-package' info manual for more information.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'use-package-core)
|
||||
|
||||
(require 'use-package-bind-key)
|
||||
(require 'use-package-diminish)
|
||||
(require 'use-package-delight)
|
||||
(require 'use-package-ensure)
|
||||
|
||||
(declare-function use-package-jump-to-package-form "use-package-jump")
|
||||
(autoload #'use-package-jump-to-package-form "use-package-jump" nil t)
|
||||
|
||||
(provide 'use-package)
|
||||
|
||||
;;; use-package.el ends here
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user