From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.devel Subject: Re: [NonGNU ELPA] 11 new packages! Date: Fri, 25 Nov 2022 07:14:36 +0000 Message-ID: <87tu2n1p5v.fsf@posteo.net> References: <87r0y6ug9z.fsf@disroot.org> <87y1sct2hp.fsf@posteo.net> <87k03vf5m8.fsf@disroot.org> <87edu2narn.fsf@posteo.net> <8735aieqtr.fsf@disroot.org> <87cz9mlq3o.fsf@posteo.net> <875yfdd5ad.fsf@disroot.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33765"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Emacs Developer List To: Akib Azmain Turja Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Nov 25 08:15:21 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oySvh-0008WU-6M for ged-emacs-devel@m.gmane-mx.org; Fri, 25 Nov 2022 08:15:21 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oySv6-0004rk-40; Fri, 25 Nov 2022 02:14:44 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oySv2-0004qS-MV for emacs-devel@gnu.org; Fri, 25 Nov 2022 02:14:40 -0500 Original-Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oySv0-0001xg-FZ for emacs-devel@gnu.org; Fri, 25 Nov 2022 02:14:40 -0500 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 78611240103 for ; Fri, 25 Nov 2022 08:14:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1669360476; bh=yo+yJA4fFGWUegm5DgEo4k0Y3L5X4fjOsaU+AeoPN14=; h=From:To:Cc:Subject:Date:From; b=P5cHtsDHeuq2Pv54Jfoh7MVRLKgZ1MP3n6Vae5pvrYBIMc+o13250MQvZgxYHzSha fxgCWRJYlCmXZ9BZyo3uxUcGzBV+FvQMjwkpqzcxrRAdgKghUh3O3O2y/JOCDzQxps Ss8EJMltMz8WdzyWnKOGCA0ZivTiu8fq33ZaEn9o0t8kRbN5knvcCPgfXyckkcH5OS rl1tHC7YfT81cLIlaPFAtIQ9mbo9ADmOYlDPCBkzm97h2MTZiLsNNIBDqi/u0gLNJq qa+7WIkLICQrfm8PtJYWaRq568t1uE7W+xt9KW8ZBq0u899ue0FJQ0eNOArTq/J+WY Ill/bG3lp3Sfw== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4NJR226nKRz9rxK; Fri, 25 Nov 2022 08:14:34 +0100 (CET) In-Reply-To: <875yfdd5ad.fsf@disroot.org> (Akib Azmain Turja's message of "Thu, 17 Nov 2022 20:28:10 +0600") Received-SPF: pass client-ip=185.67.36.66; envelope-from=philipk@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:300464 Archived-At: --=-=-= Content-Type: text/plain Akib Azmain Turja writes: > Philip Kaludercic writes: > >>>> OK, then adding them to NonGNU ELPA seems like the safer bet. >>>> >>>> I'd like to add them, but I'll have to take the time to review them >>>> first, which might take a bit. >>> >>> What do you want to review? The patches, or the packages? >> >> The packages, unless you aren't interested in comments. > > Review if you wish, I welcome feedback. Sorry for the delay, here are a few more comments: iwindow: --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=comments.diff diff --git a/iwindow.el b/iwindow.el index c808bd26f9..eab2c3084b 100644 --- a/iwindow.el +++ b/iwindow.el @@ -46,6 +46,8 @@ ;;; Code: (require 'cl-lib) +;; By adding `seq' as a dependency you could lower the dependency on +;; the minimum version of Emacs. (defgroup iwindow nil "Interactively manipulate windows." @@ -54,7 +56,7 @@ :prefix "iwindow-") (defcustom iwindow-selection-keys - '(?0 ?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9) + (number-sequence ?0 ?9) "List of keys to use to select window. Each element should be a key that `read-key' can return." @@ -141,8 +143,7 @@ list of form (OPTION...), whose length of no more than the length of (walk tree nil)) (run-hook-wrapped 'iwindow-decoration-functions (lambda (fn) (ignore (push fn decorators)))) - (cl-labels ((call-decorators - (fns) + (cl-labels ((call-decorators (fns) (with-selected-window current-window (if fns (funcall (car fns) windows @@ -157,6 +158,7 @@ list of form (OPTION...), whose length of no more than the length of Return the window chosen." (if (windowp tree) (prog1 + ;; Is there really a point to using `prog1' here? tree (redraw-display)) (let ((option nil) @@ -192,7 +194,7 @@ WINDOW and ignore WINDOW when PREDICATE returns nil." (seq-filter predicate windows) windows))) (when candidates - (if (cdr candidates) ; (> (length candidates) 1) + (if (cdr candidates) ;(length> candidates 1) (iwindow--ask (iwindow--make-decision-tree (vconcat windows) 0 (length windows) predicate)) @@ -215,7 +217,7 @@ WINDOWS and CALLBACK is described in the docstring of (alist-get (selected-window) ',windows))) (mapconcat - (apply-partially #'string ? ) + (apply-partially #'string ?\s) keys "") ',(alist-get (current-buffer) original-mode-lines))))) @@ -261,6 +263,7 @@ WINDOWS and CALLBACK is described in the docstring of WINDOWS and CALLBACK is described in the docstring of `iwindow-decoration-functions', which see." + ;; Again, recommending Compat you could make use of `named-let' here (cl-labels ((setup-windows (window-list) (with-selected-window (caar window-list) (let ((ov nil)) --=-=-= Content-Type: text/plain blow: --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=blow.el Content-Transfer-Encoding: quoted-printable ;;; blow.el --- Blow away mode lighters -*- lexical-binding: t; -*- ;; Copyright (C) 2022 Akib Azmain Turja. ;; Author: Akib Azmain Turja ;; Created: 2022-06-08 ;; Version: 0.1 ;; Package-Requires: ((emacs "24.1")) ;; Keywords: convenience ;; URL: https://codeberg.org/akib/emacs-blow ;; This file is not part of GNU Emacs. ;; This file is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 3, or (at your option) ;; any later version. ;; 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. ;; For a full copy of the GNU General Public License ;; see . ;;; Commentary: ;; Mode lighters are indicator that make us aware that a mode is ;; enabled. This is helpful, but when there are too many of them, it ;; becomes a problem, because often lighters with the important ;; information gets truncated due to the non-important lighters. So ;; we blow them, and they are usually the lighters of the important, ;; perhaps indispensible, modes for you, so that you can see and focus ;; on what matters. ;; ;; Using this package is simple: ;; ;; =E2=94=8C=E2=94=80=E2=94=80=E2=94=80=E2=94=80 ;; =E2=94=82 ;; Enable `blow-mode'. ;; =E2=94=82 (blow-mode +1) ;; =E2=94=82 ;; =E2=94=82 ;; Blow the lighter of `gcmh-mode'. ;; =E2=94=82 (blow 'gcmh-mode) ;; =E2=94=82 ;; =E2=94=82 ;; Change the lighter of `eldoc-mode' to `ELispDoc' (with a pr= eceding ;; =E2=94=82 ;; space to differentiate from other lighters. ;; =E2=94=82 (blow 'eldoc-mode " ElispDoc") ;; =E2=94=82 ;; =E2=94=82 ;; Show the lighter of `paredit-mode' unless the major mode is ;; =E2=94=82 ;; `emacs-lisp-mode'. ;; =E2=94=82 (blow 'paredit-mode '(:eval (unless (eq major-mode 'emacs-lisp= -mode) ;; =E2=94=82 (blow-original-lighter 'paredit-= mode)))) ;; =E2=94=82 ;; =E2=94=82 ;; Revert `eldoc-mode' lighter. ;; =E2=94=82 (blow-revert 'eldoc-mode) ;; =E2=94=94=E2=94=80=E2=94=80=E2=94=80=E2=94=80 ;; ;; Or, if you prefer customizing variable, set `blow-mode-list' from ;; custom, or customize it from your init file like the following: ;; ;; =E2=94=8C=E2=94=80=E2=94=80=E2=94=80=E2=94=80 ;; =E2=94=82 ;; You can also use `setq', but you would need to reenable `bl= ow-mode' ;; =E2=94=82 ;; for changes to effect. ;; =E2=94=82 (customize-set-variable ;; =E2=94=82 blow-mode-list ;; =E2=94=82 ;; =E2=94=82 ;; Blow the lighter of `gcmh-mode'. ;; =E2=94=82 '((gcmh-mode nil) ;; =E2=94=82 ;; =E2=94=82 ;; Change the lighter of `eldoc-mode' to `ELispDoc' (with a ;; =E2=94=82 ;; preceding space to differentiate from other lighters. ;; =E2=94=82 (eldoc-mode " ElispDoc") ;; =E2=94=82 ;; =E2=94=82 ;; Show the lighter of `paredit-mode' unless the major mode= is ;; =E2=94=82 ;; `emacs-lisp-mode'. ;; =E2=94=82 (paredit-mode (:eval (unless (eq major-mode 'emacs-lisp-mod= e) ;; =E2=94=82 (blow-original-lighter 'paredit-mode= )))))) ;; =E2=94=82 ;; =E2=94=82 ;; Enable mode to take effect. ;; =E2=94=82 (blow-mode +1) ;; =E2=94=94=E2=94=80=E2=94=80=E2=94=80=E2=94=80 ;;; Code: (defgroup blow nil "Blow away mode lighters." :group 'convenience :link '(url-link "https://codeberg.org/akib/emacs-blow") :prefix "blow-") (defvar blow-mode) (defun blow--set-mode-list (symbol value) "Set SYMBOL's default value to VALUE, SYMBOL should be `blow-mode-list'." (set-default symbol value) ;perhaps `custom-set-default' would be better? (when blow-mode (blow--setup-all-buffers))) (defcustom blow-mode-list nil "Mode lighters to blow. Each element is a list cell of form (MODE REPLACEMENT), where mode is the mode name and REPLACEMENT is a mode line template (see `mode-line-format') to use instead of the mode's own lighter. If a mode appears more than once, the first one takes effect. Don't modify this variable from Lisp programs, use `blow' instead." :type '(repeat (list (symbol :tag "Mode") (sexp :tag "Mode line template"))) :set #'blow--set-mode-list) (defvar blow--original-lighters nil ;why isn't the value initialised? "Hash table of modes and their original lighters or nil.") (defun blow--hash-exists-p (key table) "Return t if KEY is in hash table TABLE." (let ((default (make-symbol "blow--nonexistant"))) ;the prefix is not nec= essary, the symbol isn't interned anyway (not (eq (gethash key table default) default)))) (defun blow--puthash-unless-exists (key value table) "Put KEY and VALUE in TABLE unless KEY already exists." (unless (blow--hash-exists-p key table) (puthash key value table))) (defun blow--replace-lighters-on-all-buffer (replacement-lighters) "Replace lighters on all buffers with REPLACEMENT-LIGHTERS." (let ((major-mode-replacement-lighters (make-hash-table :test 'eq :size (length blow-mode-list)))) (maphash (lambda (mode replacement) (let ((pair (assq mode minor-mode-alist))) (if (not pair) (puthash mode replacement major-mode-replacement-lighters) (blow--puthash-unless-exists mode (cadr pair) blow--original-lighters) (setf (cadr pair) replacement)))) replacement-lighters) (dolist (buffer (buffer-list)) (with-current-buffer buffer (let* ((default (make-symbol "blow--nonexistant")) (replacement (gethash major-mode major-mode-replacement-lighters default))) (unless (eq replacement default) (blow--puthash-unless-exists major-mode mode-name blow--original-lighters) (setq mode-name replacement))))))) (defun blow--setup-all-buffers () "Blow mode lighters on all buffers." (unless blow--original-lighters (setq blow--original-lighters (make-hash-table))) (let ((changed-lighters (make-hash-table :test 'eq :size (length blow-mode-list)))) (dolist (entry blow-mode-list) (unless (and (blow--hash-exists-p (car entry) blow--original-lighters) (eq (gethash (car entry) blow--original-lighters) (cadr entry))) (blow--puthash-unless-exists (car entry) (cadr entry) changed-lighters))) (maphash (lambda (key value) (blow--puthash-unless-exists key value changed-lighters)) blow--original-lighters) (blow--replace-lighters-on-all-buffer changed-lighters))) (defun blow--after-major-mode-change () "Set `mode-name' after major-mode change." (let ((entry (assq major-mode blow-mode-list))) (when entry (setq mode-name (cadr entry))))) ;;;###autoload (defun blow (mode &optional replacement) "Blow mode lighter of MODE and use REPLACEMENT as it's lighter." (let ((entry (assq mode blow-mode-list))) (when entry (setq blow-mode-list (delq entry blow-mode-list))) (push (list mode replacement) blow-mode-list)) (when blow-mode (blow--setup-all-buffers))) (defun blow-revert (mode) "Revert the blown mode lighter of MODE." (let ((entry (assq mode blow-mode-list))) (when entry (setq blow-mode-list (delq entry blow-mode-list)))) (when blow-mode (blow--setup-all-buffers))) ;;;###autoload (define-minor-mode blow-mode "Minor mode to blow away mode lighters." :global t :lighter " Blow" (if blow-mode (progn (blow--setup-all-buffers) (add-hook 'after-change-major-mode-hook #'blow--after-major-mode-change)) (let ((blow-mode-list nil)) (blow--setup-all-buffers) (setq blow--original-lighters nil) (remove-hook 'after-change-major-mode-hook #'blow--after-major-mode-change)))) (defun blow-original-lighter (mode) "Return the original lighter of mode MODE. This only works for minor modes and blown major modes." (if (and blow-mode (blow--hash-exists-p mode blow--original-lighters)) (gethash mode blow--original-lighters) (cadr (assq mode minor-mode-alist)))) (provide 'blow) ;;; blow.el ends here --=-=-=--