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: Adding new package hideshowvis to nongnu elpa Date: Wed, 29 May 2024 07:26:46 +0000 Message-ID: <87cyp55b9l.fsf@posteo.net> References: <807D0D50-1A4C-4A83-9807-DB7A50EC60AA@sheijk.net> 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="6942"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Jan Rehders Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed May 29 09:27:51 2024 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 1sCDiw-0001cH-VA for ged-emacs-devel@m.gmane-mx.org; Wed, 29 May 2024 09:27:51 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sCDi3-0003Sg-ED; Wed, 29 May 2024 03:26:55 -0400 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 1sCDi1-0003SX-KP for emacs-devel@gnu.org; Wed, 29 May 2024 03:26:53 -0400 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 1sCDhy-00064p-Jf for emacs-devel@gnu.org; Wed, 29 May 2024 03:26:53 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id EB5D4240104 for ; Wed, 29 May 2024 09:26:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1716967608; bh=xlVqGeVJJEulbaEUyPzSyV1EBmYOCIpnslNCG5YPTYQ=; h=From:To:Cc:Subject:OpenPGP:Date:Message-ID:MIME-Version: Content-Type:From; b=l19NRtdU/ebltn74qtcNIYaHR2GIhSYYV9su5NTB3pX8zBTfQZ37FY8tuORg9Al11 xjIi1XTTRG1OYpC0MuHAkz4PBKl4RAgFUCB09or4T+ePn99w0/yrRTST58Iorjce7+ a1W3r/MSExNIbpcNGywcKL5pIhyzlpl1w9BZjpgmXp16tYx9C7DfmDCdVFGxQOU5nP /Wy152+6HZlF2NtrLMIaUOo16VBjzHv6pVLbk2BXErkT2y0Pmd9YbpZ9WvEX1m0jLM i8yShcYuIRH7Hq0hmddc6oufCmchKCt33fF+dJV4LQXviB1XYXTZCxYj9DnC1xD5Kq JMyWWnknb3DGg== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Vq1Cq1XzQz9rxF; Wed, 29 May 2024 09:26:46 +0200 (CEST) In-Reply-To: <807D0D50-1A4C-4A83-9807-DB7A50EC60AA@sheijk.net> (Jan Rehders's message of "Tue, 28 May 2024 16:26:02 +0200") OpenPGP: id=7126E1DE2F0CE35C770BED01F2C3CC513DB89F66; url="https://keys.openpgp.org/vks/v1/by-fingerprint/7126E1DE2F0CE35C770BED01F2C3CC513DB89F66"; preference=signencrypt 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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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:319672 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Jan Rehders writes: > Hello, > > I=E2=80=99d like to offer my package hideshowvis to be included in nongnu > elpa.=20 Are you sure you don't want the package to be added to GNU ELPA? > It has a few users since many years and since Melpa removed > Emacs wiki packages years ago there has not been a trivial way to > install it Here are a few comments and suggestions from looking at the code: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable diff --git a/hideshowvis.el b/hideshowvis.el index 745afe8..fa4f863 100644 --- a/hideshowvis.el +++ b/hideshowvis.el @@ -1,12 +1,12 @@ ;;; hideshowvis.el --- Fringe markers for regions foldable by hideshow.el = -*- lexical-binding: t; -*- -;; + ;; Copyright 2008-2018 Jan Rehders -;; + ;; Author: Jan Rehders ;; URL: https://github.com/sheijk/hideshowvis ;; Version: 0.8 -;; Package-Requires: ((emacs "24")) -;; +;; Package-Requires: ((emacs "27.1")) + ;; Contributions and bug fixes by Bryan Waite, Michael Heerdegen, John Yat= es, ;; Matthew Fidler, and Eyal Soha. ;; @@ -24,18 +24,19 @@ ;; along with GNU Emacs; see the file COPYING. If not, write to ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. -;; -;; + ;;; Commentary: + +;; This minor mode will add little +/- displays to foldable regions in +;; the buffer and to folded regions. It is indented to be used in +;; conjunction with hideshow.el which is a part of GNU Emacs since +;; version 20. ;; -;; This minor mode will add little +/- displays to foldable regions in the -;; buffer and to folded regions. It is indented to be used in conjunction= with -;; hideshow.el which is a part of GNU Emacs since version 20. -;; -;; Currently it works for me but is not tested heavily. Please report any= bugs -;; to the above email address -;; +;; Currently it works for me but is not tested heavily. Please report +;; any bugs to the above email address + ;;; Installation: + ;; Add the following to your .emacs: ;; ;; (autoload 'hideshowvis-enable "hideshowvis" "Highlight foldable regions= ") @@ -63,16 +64,16 @@ ;; ;; It is not enabled by default because it might interfere with custom ;; hs-set-up-overlay functions -;; + ;;; TODO -;; + ;; - global-hideshowvis-minor-mode ;; - defcustom for hideshowvis-max-file-size needs to offer setting to nil ;; - add fringe icons lazily, only for visible region (check lazy font-loc= k to ;; see if it can help with this) -;; + ;;; Changelog -;; + ;; v0.8, 2024-05-28 ;; - Fixed interaction with auto-revert-mode and indent-region ;; - Fixed performance issue in some cases due to leaking overlays @@ -99,27 +100,29 @@ ;; v0.2, 2009-08-09 ;; - The '-' symbol in fringe is clickable. ;; - Don't show '-' in fringe if the foldable region ends on the same line. -;; + ;;; Code: =20 (require 'hideshow) =20 +(defgroup hideshowvis () + "Fringe markers for regions foldable by hideshow" + :group 'hideshow) + (define-fringe-bitmap 'hideshowvis-hideable-marker [0 0 0 126 126 0 0 0]) =20 (defconst hideshowvis-version "v0.7" "Version of hideshowvis minor mode.") =20 (defface hideshowvis-hidable-face '((t (:foreground "#ccc" :box t))) - "Face to highlight foldable regions." - :group 'hideshow) + "Face to highlight foldable regions.") =20 (defcustom hideshowvis-ignore-same-line t "No + for single line regions. Do not display foldable regions in the fringe if the matching closing parenthesis is on the same line. Set this to nil if enabling the minor mo= de is slow on your machine" - :group 'hideshow - :type 'bool) + :type 'boolean) =20 (defcustom hideshowvis-max-file-size (* 1024 100) "No highlighting in files larger than this number of bytes. @@ -127,8 +130,7 @@ slow on your machine" =E2=80=98hideshowvis-enable=E2=80=99 will not enable hideshowvis-mode if f= ile is larger than this value (in bytes). The minor mode can still be forced to be enabled u= sing `(hideshowvis-mode 1)'. Set this variable to nil to disable restriction." - :group 'hideshow - :type 'integer) + :type 'natnum) =20 (defun hideshowvis-highlight-hs-regions-in-fringe (&optional start end _ol= d-text-length) "Will update the fringe indicators for all foldable regions in the buffe= r. @@ -146,11 +148,9 @@ functions used with `after-change-functions'." (remove-overlays (point-min) (point-max) 'hideshowvis-hs t) (while (search-forward-regexp hs-block-start-regexp nil t) (when (if hideshowvis-ignore-same-line - (let (begin-line) - (setq begin-line - (save-excursion - (goto-char (match-beginning 0)) - (line-number-at-pos (point)))) + (let ((begin-line (save-excursion + (goto-char (match-beginning 0)) + (line-number-at-pos (point))))) (save-excursion (goto-char (match-beginning 0)) (ignore-errors @@ -158,16 +158,14 @@ functions used with `after-change-functions'." (funcall hs-forward-sexp-func 1) (> (line-number-at-pos (point)) begin-line))))) t) - (let* ((ovl (make-overlay (match-beginning 0) (match-end 0))) - (marker-string "*hideshowvis*")) - (put-text-property 0 - (length marker-string) - 'display - (list 'left-fringe - 'hideshowvis-hideable-marker - 'hideshowvis-hidable-face) - marker-string) - (overlay-put ovl 'before-string marker-string) + (let ((ovl (make-overlay (match-beginning 0) (match-end 0)))) + (overlay-put ovl 'before-string + (propertize + "*hideshowvis*" + 'display + (list 'left-fringe + 'hideshowvis-hideable-marker + 'hideshowvis-hidable-face))) (overlay-put ovl 'hideshowvis-hs t)))))))) =20 ;;;###autoload @@ -188,34 +186,32 @@ functions used with `after-change-functions'." (hs-hide-block) (beginning-of-line))) =20 -(defvar hideshowvis-mode-map +(define-obsolete-variable-alias 'hideshowvis-mode-map + 'hideshowvis-minor-mode-map + "0.9") + +(defvar hideshowvis-minor-mode-map (let ((hideshowvis-mode-map (make-sparse-keymap))) (define-key hideshowvis-mode-map [left-fringe mouse-1] 'hideshowvis-click-fringe) hideshowvis-mode-map) - "Keymap for hideshowvis mode.") + "Keymap for `hideshowvis-minor-mode'.") =20 ;;;###autoload -(define-minor-mode hideshowvis-minor-mode () - :doc "Will indicate regions foldable with hideshow in the fringe." - :init-value nil - :require 'hideshow - :group 'hideshow - :keymap hideshowvis-mode-map - (condition-case nil +(define-minor-mode hideshowvis-minor-mode + "Will indicate regions foldable with hideshow in the fringe." + :global nil + (condition-case err (if hideshowvis-minor-mode (progn (hs-minor-mode 1) (hideshowvis-highlight-hs-regions-in-fringe (point-min) (point= -max) 0) - (add-to-list 'after-change-functions - 'hideshowvis-highlight-hs-regions-in-fringe)) + (add-hook 'after-change-functions + #'hideshowvis-highlight-hs-regions-in-fringe)) (remove-overlays (point-min) (point-max) 'hideshowvis-hs t) - (setq after-change-functions - (remove 'hideshowvis-highlight-hs-regions-in-fringe - after-change-functions))) - (error - (message "Failed to toggle hideshowvis-minor-mode") - ))) + (remove-hook 'after-change-functions + #'hideshowvis-highlight-hs-regions-in-fringe)) + (error (message "Failed to toggle `hideshowvis-minor-mode': %S" err)))) =20 ;;;###autoload (defun hideshowvis-enable () @@ -229,37 +225,35 @@ functions used with `after-change-functions'." =20 (defcustom hideshowvis-hidden-fringe-face 'hideshowvis-hidden-fringe-face "*Specify face used to highlight the fringe on hidden regions." - :type 'face - :group 'hideshow) + :type 'face) =20 -(defface hideshowvis-hidden-fringe-face +(defface hideshowvis-hidden-fringe-face ;perhaps alias `mode-line-highligh= t' '((t (:foreground "#888" :box (:line-width 2 :color "grey75" :style rele= ased-button)))) - "Face used to highlight the fringe on folded regions." - :group 'hideshow) + "Face used to highlight the fringe on folded regions.") =20 (defcustom hideshowvis-hidden-region-face 'hideshowvis-hidden-region-face "*Specify the face to to use for the hidden region indicator." - :type 'face - :group 'hideshow) + :type 'face) =20 (defface hideshowvis-hidden-region-face '((t (:background "#ff8" :box t))) - "Face to hightlight the ... area of hidden regions." - :group 'hideshow) + "Face to hightlight the ... area of hidden regions.") =20 (defun hideshowvis-display-code-line-counts (ov) "Extend overlay OV to show number of lines hidden for `hideshowvis-symbo= ls'." (when (eq 'code (overlay-get ov 'hs)) - (let* ((marker-string "*fringe-dummy*") - (marker-length (length marker-string)) - (display-string (format "%d lines" (count-lines (overlay-start = ov) (overlay-end ov))))) - (overlay-put ov 'help-echo "Hidden text. C-c,=3D to show") - (put-text-property 0 marker-length 'display - (list 'left-fringe 'hideshowvis-hidden-marker 'hi= deshowvis-hidden-fringe-face) - marker-string) - (overlay-put ov 'before-string marker-string) - (put-text-property 0 (length display-string) 'face 'hideshowvis-hidd= en-region-face display-string) - (overlay-put ov 'after-string display-string)))) + (overlay-put ov 'help-echo "Hidden text. C-c,=3D to show") + (overlay-put ov 'before-string + (propertize + "*fringe-dummy*" + 'display + '(left-fringe + hideshowvis-hidden-marker + hideshowvis-hidden-fringe-face))) + (overlay-put ov 'after-string + (propertize + (format "%d lines" (count-lines (overlay-start ov) (overlay-end ov))) + 'face 'hideshowvis-hidden-region-face)))) =20 ;;;###autoload (defun hideshowvis-symbols () @@ -271,12 +265,12 @@ indicating the number of hidden lines at the end of t= he line for hidden regions. This will change the value of `hs-set-up-overlay' so it will overwrite anything you've set there." (interactive) - (setq hs-set-up-overlay 'hideshowvis-display-code-line-counts) + (setq hs-set-up-overlay #'hideshowvis-display-code-line-counts) ;; These won't get removed, again. Revert hooks are global and making th= em ;; buffer local might be risky. Instead checking whether showing symbols= is ;; turned on in the hook functions - (add-hook 'before-revert-hook 'hideshowvis-remove-overlays) - (add-hook 'after-revert-hook 'hideshowvis-update-all-overlays) + (add-hook 'before-revert-hook #'hideshowvis-remove-overlays) + (add-hook 'after-revert-hook #'hideshowvis-update-all-overlays) (hideshowvis-update-all-overlays)) =20 ;;;###autoload @@ -284,21 +278,21 @@ overwrite anything you've set there." "Disable enhanced highlighting of hidden regions." (interactive) (hideshowvis-remove-overlays) - (setq hs-set-up-overlay 'ignore)) + (setq hs-set-up-overlay #'ignore)) =20 (defun hideshowvis-remove-overlays () "Will remove all overlays added after calling `hideshowvis-symbols'." - (when (equal hs-set-up-overlay 'hideshowvis-display-code-line-counts) + (when (eq hs-set-up-overlay #'hideshowvis-display-code-line-counts) (dolist (ov (overlays-in (point-min) (point-max))) - (unless (null (overlay-get ov 'hs)) + (when (overlay-get ov 'hs) ;why are you returning a `hs' here? (overlay-put ov 'after-string nil))))) =20 (defun hideshowvis-update-all-overlays () "Will update all overlays added after calling `hideshowvis-symbols'." - (when (equal hs-set-up-overlay 'hideshowvis-display-code-line-counts) + (when (eq hs-set-up-overlay #'hideshowvis-display-code-line-counts) (dolist (ov (overlays-in (point-min) (point-max))) - (unless (null (overlay-get ov 'hs)) - (if (equal (overlay-start ov) (overlay-end ov)) + (when (overlay-get ov 'hs) + (if (=3D (overlay-start ov) (overlay-end ov)) (delete-overlay ov) (hideshowvis-display-code-line-counts ov)))))) =20 --=-=-= Content-Type: text/plain > Kind regards, > Jan > > From 9d2e52bf2e07e8b6a6f1049b4a74d34efdb58a4b Mon Sep 17 00:00:00 2001 > From: Jan Rehders > Date: Tue, 28 May 2024 16:18:56 +0200 > Subject: [PATCH] elpa-packages (hideshowvis): New package > > --- > elpa-packages | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/elpa-packages b/elpa-packages > index 82dc12718b..6bb7524f86 100644 > --- a/elpa-packages > +++ b/elpa-packages > @@ -371,6 +371,12 @@ > "helm-pkg.el" "helm-regexp.el" "helm-ring.el" "helm-semantic.el" "helm-shell.el" > "helm-sys.el" "helm-tags.el" "helm-types.el" "helm-utils.el" "helm-x-files.el")) > > + (hideshowvis > + :url "https://github.com/sheijk/hideshowvis/" > + :branch "main" > + :ignored-files ("screenshot.png") You can track files to ignore in a .elpaignore file as well. That might be better, in case you decide to replace, rename the file or add more. I can change that for you, you just have to add the file to the repository. > + :readme "README.md") > + > (highlight-parentheses :url "https://git.sr.ht/~tsdh/highlight-parentheses.el" > :branch "main" > :readme "README.md" -- Philip Kaludercic on peregrine --=-=-=--