From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Gabriel Newsgroups: gmane.emacs.devel Subject: Little improvements on pulse.el Date: Wed, 10 Mar 2021 02:39:56 -0300 Message-ID: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39850"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Mar 10 06:56:07 2021 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 1lJrpH-000AGC-6Q for ged-emacs-devel@m.gmane-mx.org; Wed, 10 Mar 2021 06:56:07 +0100 Original-Received: from localhost ([::1]:46040 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lJrpG-0000qA-7O for ged-emacs-devel@m.gmane-mx.org; Wed, 10 Mar 2021 00:56:06 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37220) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lJroN-0000GO-2a for emacs-devel@gnu.org; Wed, 10 Mar 2021 00:55:11 -0500 Original-Received: from mail-oln040092009052.outbound.protection.outlook.com ([40.92.9.52]:21059 helo=NAM04-BN3-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lJroJ-0001hU-S4 for emacs-devel@gnu.org; Wed, 10 Mar 2021 00:55:10 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dOaAZUsUFnhXRz1YpPCk8JU6n3I5HTh6WDUljS2x81IPeinuBG56yJlpVJHxH931ZEXykSL7Hf6VaemLvmQueFttTaCGWH8CMSzBLKZ4Icq2FfsyY1JqUEp48pvk8tHMzB9+88v9INwsnwdXgislXZ4eafGqO8fmNCBU1L+Fv170TJIiZQ5AmgyPbsIVoaHRbv93R+16gt4B5Fi+aThqJmFs0EdvUi2jJG1LcFjDzjD+v68eCu0yGIK1L2zRtAOB/h9p69I2QoP8egAi3jCWe1KP1rbcrYyS4q3EpUfZuRVhtISkhEoKUUPDvN5wQjsNtGj6qI0JOuxBITWuM0+f9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TeHQnRl+0XFoxPs3pPeL2/MIfPX4wkTkuViZZlF7kfw=; b=h26lAwDVZ/0lE93OmiTcd3iznGoR0WUoJq9iMxMR1SwRr96aP/8a9sne8UB95vokl42x39CDS5WlcSwmT3bnR1nGJgx3lvTsHv+H4vxtnun56UkIgUWCai9GGlmRSD6/VIBwWwCA//KvA8HgRqzHckkvRYkSDJhwvcUC/T+k+LNfNWlCcSf1YKy37WxIwHoqjEqiTjRskcMQcjRVjovf2bJ/Wq6YktUc8EAv8jKEpQBPGjimMUHhhmpGCjUFG30WR8uggLCHAx/pDAJFUslss5QmHu8IxXGCQcrTomP5j8uNdMtL7p7JdxujASPtxFklkTxdzfxL07IaXBMJ4ruvYQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TeHQnRl+0XFoxPs3pPeL2/MIfPX4wkTkuViZZlF7kfw=; b=bipWh5571YHKLqOyWHyPPOYZkgYXP6MdxMnBZt5yqRSqYhBDOUlipCT1OfwqV8715C/3ULnca64xg/MrzNnMykpNC51w3jUVfs02ZKgdVjZ13fCw2ujFueKVpAm0OrpIFr6Xy9isAj9Lelu6bHunM88bB2yrns+VPo5jIe7lu2SEYnmUbEO1CFn9tphfnRyeDjdCmt8ARBzB3gcKu401FMDTwDEfEyLpx1BXcWMoiL7yeLmRDFKxmoJcXu3IyTciOMUDtJwrL4DzzgNxa3EE8GNE4t3dY6AnLm/IH2dSE1GRyyClilObLT3SbQdo9GZXVQX3xeywUMMK1b4GAZZ0rA== Original-Received: from SN1NAM04FT036.eop-NAM04.prod.protection.outlook.com (10.152.88.60) by SN1NAM04HT195.eop-NAM04.prod.protection.outlook.com (10.152.89.163) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.20; Wed, 10 Mar 2021 05:40:02 +0000 Original-Received: from CH2PR01MB5879.prod.exchangelabs.com (2a01:111:e400:7e4c::49) by SN1NAM04FT036.mail.protection.outlook.com (2a01:111:e400:7e4c::405) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.25 via Frontend Transport; Wed, 10 Mar 2021 05:40:02 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:CEEA57A2E29F942B9D4D51F941347B9A023B816E017CE9503F83EE527D3C7445; UpperCasedChecksum:56201A347E9DE877ABED4E1F106A434EF41FE39F5525C058004D068FA6520628; SizeAsReceived:7239; Count:43 Original-Received: from CH2PR01MB5879.prod.exchangelabs.com ([fe80::592f:9a58:d8cd:d9c9]) by CH2PR01MB5879.prod.exchangelabs.com ([fe80::592f:9a58:d8cd:d9c9%7]) with mapi id 15.20.3912.028; Wed, 10 Mar 2021 05:40:02 +0000 X-TMN: [sJYyfVASykC0McrJnHQJxydTVYzr9LTylm/lqWTJic5GW1Wr9GDGT6k0QCTduczA] X-ClientProxiedBy: CP2PR80CA0010.lamprd80.prod.outlook.com (2603:10d6:101:3::20) To CH2PR01MB5879.prod.exchangelabs.com (2603:10b6:610:3c::12) X-Microsoft-Original-Message-ID: <87lfavr2hf.fsf@hotmail.com> X-MS-Exchange-MessageSentRepresentingType: 1 Original-Received: from precision5540 (2804:431:c7f2:d29a:da4a:9e76:c4c9:30c0) by CP2PR80CA0010.lamprd80.prod.outlook.com (2603:10d6:101:3::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17 via Frontend Transport; Wed, 10 Mar 2021 05:40:00 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 43 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: f793b881-90da-4122-efd6-08d8e386f295 X-MS-TrafficTypeDiagnostic: SN1NAM04HT195: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: J4+3vGhNX4heKw5sM7nCT9VftF87FC4cZKp5qlTMUHUI6jmMvu5nvg+jaQbQGsYiw4WUEaK9kbKdkY0j+gVAHGWPS9n1ej4mcdaW0hb/WSd73p9DVazBdvKgEZVUkO2kDeJ5KSbxa09kUImGrrMXJKKs4FbJEre11iDKIUyX2HPlnxUa3APjkMuO4JPR9s+30Rv9uQYcihxLAfBHesPtWrjsHNwNKTV0s1mYVY0vvtgTg/BQrXY652+mkJgZMMMTgpEKXaWmRQYZp/xVfkLn67mF/KPjkudNYujC5BYnG5ONv6Uojdw2Lqy33rX3TGnuNb8u4yLMNh3hdjnDe0K/Rx2BvxttvDPRInDkMgpPAbffEHU3FBUCJu5ubkWWIhPKM6WX4i3AVAaiURJYdoXsWw== X-MS-Exchange-AntiSpam-MessageData: oNCEP2m6Ox67JQexD1U5M1nk8GzeOQ1dZH5u7Y4dPPHGy/TzYCX3e66rvHctRQgp0x7ndTsRhz6RC+yABTWEhNMrQfZLdM0ZVi8HKs3v9/mdIxZTLF+fJVX5kQwqrRGotUUn2yXsjGwjwzsZiQ4D9P2rp9le4nOoKupVXN7b8EbXVHaJ3GFnD2yOv+PMBTXFOQGVdO9Lw6/n9iNy+z1EJg== X-OriginatorOrg: hotmail.com X-MS-Exchange-CrossTenant-Network-Message-Id: f793b881-90da-4122-efd6-08d8e386f295 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2021 05:40:02.3301 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: SN1NAM04FT036.eop-NAM04.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1NAM04HT195 Received-SPF: pass client-ip=40.92.9.52; envelope-from=gabriel376@hotmail.com; helo=NAM04-BN3-obe.outbound.protection.outlook.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-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.23 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" Xref: news.gmane.io gmane.emacs.devel:266266 Archived-At: I have been playing with pulse.el in the last few days and some ideas/questions come to my mind. This is the current source code of 'pulse-line-hook-function': (defun pulse-line-hook-function () "Function used in hooks to pulse the current line. Only pulses the line if `pulse-command-advice-flag' is non-nil." (when pulse-command-advice-flag (pulse-momentary-highlight-one-line (point)))) 1. It can be useful in some cases to pulse the current line by using an interactive command, for example, when doing a presentation, a pairing with other developer, or to easily find the cursor position. Since 'pulse-line-hook-function' is not a good name for an interactive function, we can create a new command for that. 2. The name and the docstring mention the use with hooks, but would be nice to use with advices as well. For example, to highlight the current line when the cursor, buffer or window changes: (dolist (symbol '(scroll-up-command scroll-down-command recenter-top-bottom other-window windmove-do-window-select kill-current-buffer delete-window)) (advice-add symbol :after #'pulse-line-hook-function)) The code above does not work, since 'pulse-line-hook-function' does not accept any argument (sent by the advice function). We can make it accept optional arguments, but again the name will not be the best one. 3. I could not find any documentation or usage in emacs source code for 'pulse-line-hook-function' and 'pulse-command-advice-flag'. Is the flag 'pulse-command-advice-flag' really needed ? The git history says the last modification of this code was 12+ years ago. 4. Would be nice to have support for 'pulse-highlight-start-face' in the themes provided by Emacs, especially on modus-themes. 5. The code on 'pulse-lighten-highlight' can be significantly improved by replacing 'pulse-int-to-hex' and 'pulse-color-values-to-hex' with 'color-gradient' from color.el. The idea is to build the list of color gradients beforehand and use a timer to set each color according to 'pulse-iterations' and 'pulse-delay'. A very basic example: (let* ((start (color-name-to-rgb (face-background 'pulse-highlight-start-face))) (end (color-name-to-rgb (face-background 'default))) (gradient-rgb (append (list start) (color-gradient start end pulse-iterations) (list end))) (gradient-hex (mapcar (apply-partially 'apply 'color-rgb-to-hex) gradient-rgb))) (seq-do-indexed (lambda (color index) (run-with-timer (* index pulse-delay) nil (apply-partially 'funcall (lambda (color) (set-face-background 'default color)) color))) gradient-hex)) Please share your comments and suggestions. I have FSF copyright assignment and can open patches for these (or other) improvements/bugs. Regards, Gabriel