unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* use-package: Should we merge bind-chords.el / use-package-chords.el?
@ 2022-12-02 23:36 Stefan Kangas
  2022-12-08  0:19 ` Stefan Kangas
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Kangas @ 2022-12-02 23:36 UTC (permalink / raw)
  To: emacs-devel; +Cc: John Wiegley, Justin Talbott

I'm not so sure about merging bind-chord.el, use-package-chords.el, and
use-package-chords-tests.el into emacs.git, as part of the use-package
merge.

The most important reason is that they seem to depend on key-chord.el,
which is not in Emacs, nor on (Non-)GNU ELPA.[1]  But I'm also seeing that:

1. Two of the tests are failing.  Unless I'm missing something, they
   haven't been running as part of the use-package GitHub CI.[2]

2. They have seen minimal maintenance over the years, and have a
   relatively low number of downloads on MELPA.[3]

I'm sure they're very useful to some users, but the fact that they won't
work with Emacs OOTB makes it seem like the increased maintenance burden
might not be worth it.  They also risk confusing users that try to use
them, only to find that they don't work.

They currently reside on the features/use-package branch, but that would
be easy to reverse with a simple "git rm" on the branch.  Instead, we
could look into finding a new maintainer for them, in order to give them
an independent existence as GNU ELPA packages.

Footnotes:
[1]  https://github.com/emacsorphanage/key-chord

[2]  https://github.com/jwiegley/use-package/blob/master/Makefile#L103

[3]  See their git history here:
     https://github.com/jwiegley/use-package/commits/master/bind-chord.el
     https://github.com/jwiegley/use-package/commits/master/use-package-chords.el
     https://github.com/jwiegley/use-package/commits/master/use-package-chords-tests.el

     I see 13,567 downloads on MELPA, compared to 1,995,169 for
     use-package: https://melpa.org/#/?q=use-package



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: use-package: Should we merge bind-chords.el / use-package-chords.el?
  2022-12-02 23:36 use-package: Should we merge bind-chords.el / use-package-chords.el? Stefan Kangas
@ 2022-12-08  0:19 ` Stefan Kangas
  2022-12-08  0:58   ` John Wiegley
  2022-12-08  6:08   ` use-package: Problem with built-in packages? David Masterson
  0 siblings, 2 replies; 6+ messages in thread
From: Stefan Kangas @ 2022-12-08  0:19 UTC (permalink / raw)
  To: emacs-devel; +Cc: John Wiegley, Justin Talbott

[-- Attachment #1: Type: text/plain, Size: 617 bytes --]

Stefan Kangas <stefankangas@gmail.com> writes:

> I'm not so sure about merging bind-chord.el, use-package-chords.el, and
> use-package-chords-tests.el into emacs.git, as part of the use-package
> merge.
[...]
> They currently reside on the features/use-package branch, but that would
> be easy to reverse with a simple "git rm" on the branch.  Instead, we
> could look into finding a new maintainer for them, in order to give them
> an independent existence as GNU ELPA packages.

Since there have been no comments, I intend to install the attached
patch before the merge.  Please speak up promptly if you disagree.

[-- Attachment #2: 0001-Drop-key-chord.el-support-from-use-package.patch --]
[-- Type: text/x-diff, Size: 14288 bytes --]

From 4723b9cafb113fc422794d54106df09c36fada57 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefankangas@gmail.com>
Date: Thu, 8 Dec 2022 01:12:02 +0100
Subject: [PATCH] Drop key-chord.el support from use-package

* lisp/use-package/bind-chord.el:
* lisp/use-package/use-package-chords.el:
* test/lisp/use-package/use-package-chords-tests.el: Delete files.
* doc/misc/use-package.texi (use-package-chords): Delete section.
Ref: https://lists.gnu.org/r/emacs-devel/2022-12/msg00052.html
---
 doc/misc/use-package.texi                     |  27 ---
 lisp/use-package/bind-chord.el                | 113 ------------
 lisp/use-package/use-package-chords.el        |  54 ------
 .../use-package/use-package-chords-tests.el   | 169 ------------------
 4 files changed, 363 deletions(-)
 delete mode 100644 lisp/use-package/bind-chord.el
 delete mode 100644 lisp/use-package/use-package-chords.el
 delete mode 100644 test/lisp/use-package/use-package-chords-tests.el

diff --git a/doc/misc/use-package.texi b/doc/misc/use-package.texi
index d39125c455..b5a8417ae3 100644
--- a/doc/misc/use-package.texi
+++ b/doc/misc/use-package.texi
@@ -1569,7 +1569,6 @@ Keyword extensions
 
 @menu
 * use-package-ensure-system-package::
-* use-package-chords::
 * Creating an extension::
 @end menu
 
@@ -1675,32 +1674,6 @@ use-package-ensure-system-package
 commands.  Custom commands should include the call to sudo in the
 command if needed.
 
-@node use-package-chords
-@section @code{(use-package-chords)}
-
-The @code{:chords} keyword allows you to define
-@uref{https://www.emacswiki.org/emacs/key-chord.el,@code{key-chord}}
-bindings for @code{use-package} declarations in the same manner as the
-@code{:bind} keyword.
-
-To enable the extension:
-
-@lisp
-(use-package use-package-chords
-  :ensure t
-  :config (key-chord-mode 1))
-@end lisp
-
-Then you can define your chord bindings in the same manner as
-@code{:bind} using a cons or a list of conses:
-
-@lisp
-(use-package ace-jump-mode
-  :chords (("jj" . ace-jump-char-mode)
-           ("jk" . ace-jump-word-mode)
-           ("jl" . ace-jump-line-mode)))
-@end lisp
-
 @node Creating an extension
 @section How to create an extension keyword
 
diff --git a/lisp/use-package/bind-chord.el b/lisp/use-package/bind-chord.el
deleted file mode 100644
index ed736a4b96..0000000000
--- a/lisp/use-package/bind-chord.el
+++ /dev/null
@@ -1,113 +0,0 @@
-;;; bind-chord.el --- key-chord binding helper for use-package-chords  -*- lexical-binding: t; -*-
-
-;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
-
-;; Author: Justin Talbott <justin@waymondo.com>
-;; Keywords: convenience, tools, extensions
-;; URL: https://github.com/jwiegley/use-package
-;; Version: 0.2.1
-;; Package-Requires: ((emacs "24.3") (bind-key "1.0") (key-chord "0.6"))
-;; Filename: bind-chord.el
-
-;; 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 of the License, or
-;; (at your option) any later version.
-
-;; 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.
-
-;; You should have received a copy of the GNU General Public License
-;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
-
-;;; Commentary:
-
-;;; Code:
-
-(require 'bind-key)
-(require 'key-chord nil t)
-
-;;;###autoload
-(defmacro bind-chord (chord command &optional keymap)
-  "Bind CHORD to COMMAND in KEYMAP (`global-map' if not passed)."
-  (let ((key1 (logand 255 (aref chord 0)))
-        (key2 (logand 255 (aref chord 1))))
-    (if (eq key1 key2)
-        `(bind-key (vector 'key-chord ,key1 ,key2) ,command ,keymap)
-      `(progn
-         (bind-key (vector 'key-chord ,key1 ,key2) ,command ,keymap)
-         (bind-key (vector 'key-chord ,key2 ,key1) ,command ,keymap)))))
-
-(defun bind-chords-form (args keymap)
-  "Bind multiple chords at once.
-
-Accepts keyword arguments:
-:map MAP               - a keymap into which the keybindings should be
-                         added
-
-The rest of the arguments are conses of keybinding string and a
-function symbol (unquoted)."
-  (let (map pkg)
-    (let ((cont t))
-      (while (and cont args)
-        (if (cond ((eq :map (car args))
-                   (setq map (cadr args)))
-                  ((eq :package (car args))
-                   (setq pkg (cadr args))))
-            (setq args (cddr args))
-          (setq cont nil))))
-
-    (unless map (setq map keymap))
-
-    (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
-         (wrap map
-               (cl-mapcan
-                (lambda (form)
-                  (let ((fun (and (cdr form) (list 'function (cdr form)))))
-                    (if (and map (not (eq map 'global-map)))
-                        `((bind-chord ,(car form) ,fun ,map))
-                      `((bind-chord ,(car form) ,fun nil)))))
-                first))
-         (when next
-           (bind-chords-form (if pkg
-                            (cons :package (cons pkg next))
-                          next) map)))))))
-
-;;;###autoload
-(defmacro bind-chords (&rest args)
-  "Bind multiple chords at once.
-
-Accepts keyword argument:
-:map - a keymap into which the keybindings should be added
-
-The rest of the arguments are conses of keybinding string and a
-function symbol (unquoted)."
-  (macroexp-progn (bind-chords-form args nil)))
-
-(provide 'bind-chord)
-
-;;; bind-chord.el ends here
diff --git a/lisp/use-package/use-package-chords.el b/lisp/use-package/use-package-chords.el
deleted file mode 100644
index 479083b929..0000000000
--- a/lisp/use-package/use-package-chords.el
+++ /dev/null
@@ -1,54 +0,0 @@
-;;; use-package-chords.el --- key-chord keyword for use-package  -*- lexical-binding: t; -*-
-
-;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
-
-;; Author: Justin Talbott <justin@waymondo.com>
-;; Keywords: convenience, tools, extensions
-;; URL: https://github.com/jwiegley/use-package
-;; Version: 0.2.1
-;; Package-Requires: ((use-package "2.1") (bind-key "1.0") (bind-chord "0.2") (key-chord "0.6"))
-;; Filename: use-package-chords.el
-
-;; 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 of the License, or
-;; (at your option) any later version.
-
-;; 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.
-
-;; You should have received a copy of the GNU General Public License
-;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
-
-;;; Commentary:
-
-;; The `:chords' keyword allows you to define `key-chord' bindings for
-;; `use-package' declarations in the same manner as the `:bind'
-;; keyword.
-
-;;; Code:
-
-(require 'use-package)
-(require 'bind-chord)
-
-;;;###autoload
-(defalias 'use-package-autoloads/:chords 'use-package-autoloads-mode)
-
-;;;###autoload
-(defalias 'use-package-normalize/:chords 'use-package-normalize-binder)
-
-;;;###autoload
-(defun use-package-handler/:chords (name _keyword arg rest state)
-  "Handler for `:chords' keyword in `use-package'."
-  (use-package-concat
-   (use-package-process-keywords name rest state)
-   `(,(macroexpand
-       `(bind-chords :package ,name ,@arg)))))
-
-(add-to-list 'use-package-keywords :chords)
-
-(provide 'use-package-chords)
-
-;;; use-package-chords.el ends here
diff --git a/test/lisp/use-package/use-package-chords-tests.el b/test/lisp/use-package/use-package-chords-tests.el
deleted file mode 100644
index 665784eaf4..0000000000
--- a/test/lisp/use-package/use-package-chords-tests.el
+++ /dev/null
@@ -1,169 +0,0 @@
-;;; use-package-chords-tests.el --- Tests for use-package-chords.el  -*- lexical-binding: t; -*-
-
-;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
-
-;; 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 of the License, or
-;; (at your option) any later version.
-
-;; 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.
-
-;; You should have received a copy of the GNU General Public License
-;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
-
-;;; Code:
-
-(require 'ert)
-(require 'use-package)
-(require 'use-package-chords)
-
-(setq use-package-always-ensure nil
-      use-package-verbose 'errors
-      use-package-expand-minimally t)
-
-(defmacro match-expansion (form &rest value)
-  `(should (pcase (expand-minimally ,form)
-             ,@(mapcar #'(lambda (x) (list x t)) value))))
-
-;; Copied from use-package-tests.el.
-(defmacro expand-minimally (form)
-  `(let ((use-package-verbose 'errors)
-         (use-package-expand-minimally t))
-     (macroexpand-1 ',form)))
-
-(defun use-package-test-normalize-chord (&rest args)
-  (apply #'use-package-normalize-binder 'foo :chords args))
-
-(ert-deftest use-package-test-normalize/:chords-1 ()
-  (should (equal (use-package-test-normalize-chord
-                  '(("C-a" . alpha)))
-                 '(("C-a" . alpha)))))
-
-(ert-deftest use-package-test-normalize/:chords-2 ()
-  (should (equal (use-package-test-normalize-chord
-                  '(("C-a" . alpha)
-                    :map foo-map
-                    ("C-b" . beta)))
-                 '(("C-a" . alpha)
-                   :map foo-map
-                   ("C-b" . beta)))))
-
-(ert-deftest use-package-test-normalize/:chords-3 ()
-  (should (equal (use-package-test-normalize-chord
-                  '(:map foo-map
-                         ("C-a" . alpha)
-                         ("C-b" . beta)))
-                 '(:map foo-map
-                        ("C-a" . alpha)
-                        ("C-b" . beta)))))
-
-(ert-deftest use-package-test/:chords-1 ()
-  ;; FIXME:
-  :tags '(:unstable)
-  (match-expansion
-   (use-package foo :chords ("C-k" . key1) ("C-u" . key2))
-   `(progn
-      (unless
-          (fboundp 'key1)
-        (autoload #'key1 "foo" nil t))
-      (unless
-          (fboundp 'key2)
-        (autoload #'key2 "foo" nil t))
-      (bind-chord "C-k" #'key1 nil)
-      (bind-chord "C-u" #'key2 nil))))
-
-(ert-deftest use-package-test/:chords-2 ()
-  ;; FIXME:
-  :tags '(:unstable)
-  (match-expansion
-   (use-package foo :chords (("C-k" . key1) ("C-u" . key2)))
-   `(progn
-      (unless (fboundp 'key1)
-        (autoload #'key1 "foo" nil t))
-      (unless (fboundp 'key2)
-        (autoload #'key2 "foo" nil t))
-      (bind-chord "C-k" #'key1 nil)
-      (bind-chord "C-u" #'key2 nil))))
-
-(ert-deftest use-package-test/:chords-3 ()
-  (match-expansion
-   (use-package foo :chords (:map my-map ("C-k" . key1) ("C-u" . key2)))
-   `(progn
-      (unless
-          (fboundp 'key1)
-        (autoload #'key1 "foo" nil t))
-      (unless
-          (fboundp 'key2)
-        (autoload #'key2 "foo" nil t))
-      (if
-          (boundp 'my-map)
-          (progn
-            (bind-chord "C-k" #'key1 my-map)
-            (bind-chord "C-u" #'key2 my-map))
-        (eval-after-load 'foo
-          '(progn
-             (bind-chord "C-k" #'key1 my-map)
-             (bind-chord "C-u" #'key2 my-map)))))))
-
-(ert-deftest use-package-test/:chords-4 ()
-  (should-error
-   (match-expansion
-    (use-package foo :chords :map my-map ("C-k" . key1) ("C-u" . key2))
-    `(bind-chords :package foo))))
-
-(ert-deftest use-package-test/:chords-5 ()
-  (match-expansion
-   (use-package foo :chords ("C-k" . key1) (:map my-map ("C-u" . key2)))
-   `(progn
-      (unless (fboundp 'key1)
-        (autoload #'key1 "foo" nil t))
-      (unless (fboundp 'key2)
-        (autoload #'key2 "foo" nil t))
-      (progn
-        (bind-chord "C-k" #'key1 nil)
-        (if
-            (boundp 'my-map)
-            (bind-chord "C-u" #'key2 my-map)
-          (eval-after-load 'foo
-            '(bind-chord "C-u" #'key2 my-map)))))))
-
-(ert-deftest use-package-test/:chords-6 ()
-  (match-expansion
-   (use-package foo
-     :chords
-     ("C-k" . key1)
-     (:map my-map ("C-u" . key2))
-     (:map my-map2 ("C-u" . key3)))
-   `(progn
-      (unless
-          (fboundp 'key1)
-        (autoload #'key1 "foo" nil t))
-      (unless
-          (fboundp 'key2)
-        (autoload #'key2 "foo" nil t))
-      (unless
-          (fboundp 'key3)
-        (autoload #'key3 "foo" nil t))
-      (progn
-        (bind-chord "C-k" #'key1 nil)
-        (if
-            (boundp 'my-map)
-            (bind-chord "C-u" #'key2 my-map)
-          (eval-after-load 'foo
-            '(bind-chord "C-u" #'key2 my-map)))
-        (if
-            (boundp 'my-map2)
-            (bind-chord "C-u" #'key3 my-map2)
-          (eval-after-load 'foo
-            '(bind-chord "C-u" #'key3 my-map2)))))))
-
-;; Local Variables:
-;; no-byte-compile: t
-;; no-update-autoloads: t
-;; End:
-
-;;; use-package-chords-tests.el ends here
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: use-package: Should we merge bind-chords.el / use-package-chords.el?
  2022-12-08  0:19 ` Stefan Kangas
@ 2022-12-08  0:58   ` John Wiegley
  2022-12-08  6:08   ` use-package: Problem with built-in packages? David Masterson
  1 sibling, 0 replies; 6+ messages in thread
From: John Wiegley @ 2022-12-08  0:58 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: emacs-devel, Justin Talbott

>>>>> Stefan Kangas <stefankangas@gmail.com> writes:

> Since there have been no comments, I intend to install the attached patch
> before the merge. Please speak up promptly if you disagree.

I have no real opinion either way, so whatever you want to do, Stefan.

-- 
John Wiegley                  GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com                          60E1 46C4 BD1A 7AC1 4BA2



^ permalink raw reply	[flat|nested] 6+ messages in thread

* use-package: Problem with built-in packages?
  2022-12-08  0:19 ` Stefan Kangas
  2022-12-08  0:58   ` John Wiegley
@ 2022-12-08  6:08   ` David Masterson
  2022-12-08 16:37     ` Stefan Kangas
  1 sibling, 1 reply; 6+ messages in thread
From: David Masterson @ 2022-12-08  6:08 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: emacs-devel, John Wiegley, Justin Talbott

I've run into a problem with installing Org-9.6 with use-package that I
wonder if it might be a general problem with use-package.

Org-9.6 (IIRC) introduced org-assert-version that everything in Org now
depends on.  I load many (all?) packages with use-package.  The problem
I get (once I fixed up my ":after" setting in the other packages) is a
:catch when loading Org-9.6:

Error (use-package): org/:catch: Invalid function: org-assert-version

The problem is that I'm using a pre-built Emacs v2.7 which has Org-9.3
built-in.  Testing says that Org is not loaded before the use-package
for Org.  Therefore, something is happening in the use-package for Org
that is causing Org to be loaded before the load-path is properly set
(thus, causing the :catch).

Does this make sense?  Hmm, I guess I should try adding Org-9.6to the
load-path before the use-package for Org.  If I'm right, everything
should start working.

What do you think?
-- 
David Masterson



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: use-package: Problem with built-in packages?
  2022-12-08  6:08   ` use-package: Problem with built-in packages? David Masterson
@ 2022-12-08 16:37     ` Stefan Kangas
  2022-12-08 18:25       ` David Masterson
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Kangas @ 2022-12-08 16:37 UTC (permalink / raw)
  To: David Masterson; +Cc: emacs-devel, John Wiegley, Justin Talbott

David Masterson <dsmasterson@gmail.com> writes:

> I've run into a problem with installing Org-9.6 with use-package that I
> wonder if it might be a general problem with use-package.
[...]
> Error (use-package): org/:catch: Invalid function: org-assert-version

I think this is a problem in org-mode, see:

    https://debbugs.gnu.org/cgi/bugreport.cgi?bug=59882

Please add any new observations you may have to that bug report.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: use-package: Problem with built-in packages?
  2022-12-08 16:37     ` Stefan Kangas
@ 2022-12-08 18:25       ` David Masterson
  0 siblings, 0 replies; 6+ messages in thread
From: David Masterson @ 2022-12-08 18:25 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: emacs-devel, John Wiegley, Justin Talbott

Stefan Kangas <stefankangas@gmail.com> writes:

> David Masterson <dsmasterson@gmail.com> writes:
>
>> I've run into a problem with installing Org-9.6 with use-package that I
>> wonder if it might be a general problem with use-package.
> [...]
>> Error (use-package): org/:catch: Invalid function: org-assert-version
>
> I think this is a problem in org-mode, see:
>
>     https://debbugs.gnu.org/cgi/bugreport.cgi?bug=59882
>
> Please add any new observations you may have to that bug report.

Okay

-- 
David Masterson



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-12-08 18:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-02 23:36 use-package: Should we merge bind-chords.el / use-package-chords.el? Stefan Kangas
2022-12-08  0:19 ` Stefan Kangas
2022-12-08  0:58   ` John Wiegley
2022-12-08  6:08   ` use-package: Problem with built-in packages? David Masterson
2022-12-08 16:37     ` Stefan Kangas
2022-12-08 18:25       ` David Masterson

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).