From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Akib Azmain Turja Newsgroups: gmane.emacs.devel Subject: Re: [NonGNU ELPA] 11 new packages! Date: Mon, 28 Nov 2022 01:55:29 +0600 Message-ID: <87a64cmatq.fsf@disroot.org> 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> <87v8n2zwc6.fsf@posteo.net> <87cz9arw7t.fsf@disroot.org> <8735a46cls.fsf@posteo.net> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33993"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Emacs Developer List To: Philip Kaludercic Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Nov 27 21:01:51 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 1ozNqY-0008bZ-8f for ged-emacs-devel@m.gmane-mx.org; Sun, 27 Nov 2022 21:01:50 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ozNpm-0008DL-Oc; Sun, 27 Nov 2022 15:01:02 -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 1ozNpg-0008CO-Q2 for emacs-devel@gnu.org; Sun, 27 Nov 2022 15:00:58 -0500 Original-Received: from knopi.disroot.org ([178.21.23.139]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ozNpe-0006ed-NJ for emacs-devel@gnu.org; Sun, 27 Nov 2022 15:00:56 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id 7B0CE41393; Sun, 27 Nov 2022 21:00:53 +0100 (CET) X-Virus-Scanned: SPAM Filter at disroot.org Original-Received: from knopi.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id iJqmCMBEYDTj; Sun, 27 Nov 2022 21:00:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1669579251; bh=HOHxzwEQ4/MrUDN235x2aVo6V51ep4Ttkd6Zj1CNAJI=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=W9OcyUFUiqQ/HpqiGaYMhiA98O90Af46wgcWWLoAUyDy5rqw89uAS5bVYOFlKfy9V 1kkPLkEBWZ8uXcSo/I8BtZl4wlEb1dMb8QMoyXtYspPBsf3dm0izKAI4G9tuTKwtrX 7T0C+5r+zsefuk1gUzejpPUCBHD+ddsPRIB0mDIG7y4PsPdTnh8XI/q6B2lUlyfp07 kLN9HxTVh8s2g652uZQ5uOSi7mEIGqNM3OK1PJ6SymIJ0V9zkz2SEsqArrNLLRuQ3R LLfoy5EWncDGlLmsH1K42xnBARxow/ENidAHY3pWLR0R2CwiCIDHn6Oewe8l++RoDI uzTkNh3ph48ow== In-Reply-To: <8735a46cls.fsf@posteo.net> (Philip Kaludercic's message of "Sun, 27 Nov 2022 08:11:27 +0000") Received-SPF: pass client-ip=178.21.23.139; envelope-from=akib@disroot.org; helo=knopi.disroot.org X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, 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:300644 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Philip Kaludercic writes: > Akib Azmain Turja writes: > >>> ;;;###autoload >>> (defun gnu-indent-region (beg end) >>> @@ -88,14 +87,15 @@ When called non-interactively, indent text between = BEG and END." >>> (send-region process beg end) >>> (process-send-eof process) >>> (redisplay) >>> - (while (process-live-p process) >>> - (sleep-for 0.01)) >>> + (while (accept-process-output process nil 10)) >> >> MILLISEC argument is obsolete, I used SECONDS instead. > > Actually, this change might have been pointless. I misremembed the > warning from (elisp) Accepting Output, that said you shouldn't combine > `accept-process-output' and `process-live-p', but what you were doing > was probably harmless. > > I guess the real question is why you don't use a synchronous process? > indent usually isn't that slow. > I don't like synchronous processes, they block Emacs completely. >>> (error "GNU Indent exited with non-zero status")) >>> (save-restriction >>> (let ((inhibit-read-only t)) >>> (narrow-to-region beg end) >>> + ;; Perhaps something should be done to try an preserve >>> + ;; the point after indentation? >>> (insert-file-contents temp-file nil nil nil >>> t)))) >> >> On my computer, the point doesn't move relative to text, because the >> fifth argument to insert-file-contents is t. > > My bad then. > >>> (delete-file temp-file))) >>> @@ -108,11 +108,24 @@ When called non-interactively, indent text betwee= n BEG and END." >>> (interactive) >>> (gnu-indent-region (point-min) (point-max))) >>> >>> +;; A little suggestion >>> +;;;###autoload >>> +(defun gnu-indent-defun-or-fill (arg) >>> + "Indent current function with GNU Indent. >>> +If point is in a comment, call `fill-paragraph' instead. A >>> +prefix argument ARG is passed to `fill-paragraph'." >>> + (interactive "P") >>> + (if (nth 8 (syntax-ppss)) ;if in a comment >>> + (fill-paragraph arg) >>> + (let ((bounds (bounds-of-thing-at-point 'defun))) >>> + (if (consp bounds) >>> + (gnu-indent-region (car bounds) (cdr bounds)) >>> + (user-error "No defun at point"))))) >>> + >> >> Great idea. But would it cause problem to assign copyright if I take >> your change? (AFAIK you've completed paperwork, but in this case you're >> not contributing to FSF-copyrighted code, so is this change covered by >> your paperwork? Right now, no, you're the copyright holder. (According >> to Section 2 of copyright assignment agreement sent to me.)) > > I don't think there should be an issue, as we want to add the package to > NonGNU ELPA. If the package is later moved to GNU ELPA, then my CA > should cover it. > >>> devhelp: >>> >>> diff --git a/devhelp.el b/devhelp.el >>> index 6b3d9a1ce9..05aeb1e18e 100644 >>> --- a/devhelp.el >>> +++ b/devhelp.el >>> @@ -48,6 +48,10 @@ >>> ;; "~/.guix-profile/share/doc/" >>> ;; "~/.guix-profile/share/gtk-doc/html/")) >>> >>> +;; Do you think it makes sense to automatically detect this (if the >>> +;; user has a ~/.guix-profile directory) and make the changes to the >>> +;; default value? >>> + >> >> Yes, it makes sense. But I didn't find any way to detected the >> directories, except heuristics. > > What would the problem be with checking the existence of these specific > (or other well known directories)? > > (append [default value] > (and (file-exists-p "~/.guix-profile/share/doc/" > (list "~/.guix-profile/share/doc/"))) > (and (file-exists-p "~/.guix-profile/share/gtk-doc/html/") > (list "~/.guix-profile/share/gtk-doc/html/")))) > I like this approach. Thanks. >>> @@ -219,6 +224,7 @@ If a single file was opened, only show that book's = table of contents." >>> See `devhelp-toc' for more details." >>> (let ((inhibit-read-only t)) >>> (erase-buffer) >>> + ;; Why not prepare the document in SXML and then use `dom-print'? >>> (insert >>> "Table of contents
    " >>> (let ((book-tocs >> >> Hmm, that would be a cleaner approach. Now I need to research the >> format of SXML. > > This gives a brief demonstration: > > (dom-print '(tag ((key . "value")) (sub-tag () "body"))) > ;; Output: body > >>> (defgroup why-this nil >>> "Show why the current line contains this." >>> :group 'tools >>> @@ -64,6 +68,7 @@ the first argument is the command (which is a symbol): >>> `:author' Name of the author. >>> `:time' Time of change (local). >>> `:desc' Single line description of change." >>> + ;; Would it make sense to use a `cl-defstruct'? >>> :type 'hook >>> :options (list #'why-this-git >>> #'why-this-hg) >> >> Maybe. But I think the plist approach is simpler and good enough. > > My fear is that it is less robust, but my fear is probably unreasonable. > >>> @@ -364,6 +370,7 @@ TIME-FORMAT is used to format data." >>> 'solaire-region-face >>> 'region)) >>> ('line >>> + ;; Looks like a `cond' to me >>> (if (bound-and-true-p hl-line-mode) >>> (if (bound-and-true-p solaire-mode) >>> 'solaire-hl-line-face >> >> Yes, but I think its more efficient. (IIUC cond would test hl-line-mode >> before returning why-this-face.) > > I don't think there would be a big difference. The transformation I had > in mind was something along these lines: > > (if foo (if bar (if baz 0 1) 2) 3) > =E2=87=9D > (cond ((not foo) 3) > ((not bar) 2) > ((not baz) 1) > (t 0)) > At the first glance, I though your code is simply wrong. But after reading more attentively, it tells me you're actually a genius. >>> @@ -537,6 +544,11 @@ Actually the supported backend is returned." >>> (* (- (nth i b-color) >>> (nth i a-color)) >>> ratio))))) >>> + ;; Note that RGB interpolation doesn't always behave the way you >>> + ;; think it does. You'd have to convert it into some other color >>> + ;; space like CIELAB to get perceptual mixing right (but even that >>> + ;; is trying because it requires some kind of a white-reference >>> + ;; point). >>> (color-rgb-to-hex (funcall mix 0) >>> (funcall mix 1) >>> (funcall mix 2) >> >> Any edge case of my code? > > Not an edge-case, just a mathematical/physical problem. Maybe > https://www.alanzucconi.com/2016/01/06/colour-interpolation/ can help > explain what I had in mind (it also indicates that interpolation in the > HSV color space might be good enough of a fix). =2D-=20 Akib Azmain Turja, GPG key: 70018CE5819F17A3BBA666AFE74F0EFA922AE7F5 Fediverse: akib@hostux.social Codeberg: akib emailselfdefense.fsf.org | "Nothing can be secure without encryption." --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEyVTKmrtL6kNBe3FRVTX89U2IYWsFAmODwLIACgkQVTX89U2I YWuH7RAAkY3N017nwsPyi6IOqu266YQkkExLgYH5//5ZQNrFwp9j8kDDFIXKz4DY NXh7uAJfIc6hEHDanlgmzV0YGAfeS35PHur/0Ww8LrdsAIpzig/52BWKkjNNNf9s KIyXDH3y6xyCTgU9bZUDwJu0+xr9d/u7vG7m4xHeRPBiaAEB7EtcXg+NWgRQn6z2 8b2HfCWcTTv+G8VAHi1wy3NE8gSpFBMGLUoiAAb09P2DLmlPelFkA9ooxv6rREin RUpqKq89DW1RYhAtKhZxzVvEuRQvdGeiazBDJOMQ+8WY8MI6hBCmqTkfSONTfBq+ EfgwMq60xbMoMBYhYQHmeVBwPvsclP5aarcWuh4vZjlbQklomWyl/6bFxhyn7sXi z3S4N4AVEgJ9PCctnhTtJCmlUqNXQICH4mQpaR9x0owToR2gY8OVun6uKIDzhyUT UtAC3zD+VU8fGEmnGSr8k3RigMZVnxse5ZBI1nX1Q7StLqPX5vJxYt6hkMiqUIjC EPc5Am1bGIXB0moXeziFzW5+26d70k8hvnKK3mwnqrOoZvYBfq7pcRc49mSnDgsA TVLNb6T4zx05CfiWl2UEbN0ZwfT01GtxHBpxlnnWmmgKtE1INgZ/8nC/PQrbZqKx TbSStSflw8Ii7BrRmyvhG5z8qs1A3/FqJWUF9/8NCvQisDCS+vU= =nhl7 -----END PGP SIGNATURE----- --=-=-=--