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: [ELPA] New package: SachaC-news Date: Sat, 25 Nov 2023 22:50:23 +0000 Message-ID: <87cyvxmor4.fsf@posteo.net> References: <87o7fyix8e.wl-cnngimenez@disroot.org> <87leawq1ng.fsf@posteo.net> <875y1yrehf.wl-cnngimenez@disroot.org> <87zfzazs1r.fsf@posteo.net> <87fs0txzac.wl-cnngimenez@disroot.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18139"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Christian Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Nov 25 23:51:21 2023 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 1r71Ue-0004Wa-HZ for ged-emacs-devel@m.gmane-mx.org; Sat, 25 Nov 2023 23:51:20 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r71Tx-0002mc-4Z; Sat, 25 Nov 2023 17:50:37 -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 1r71Tu-0002lH-5e for emacs-devel@gnu.org; Sat, 25 Nov 2023 17:50:34 -0500 Original-Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r71Tr-0000g2-MH for emacs-devel@gnu.org; Sat, 25 Nov 2023 17:50:33 -0500 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 0484F240027 for ; Sat, 25 Nov 2023 23:50:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1700952626; bh=wmV3fWIBCn8hLbjSTEr6TLbF7oxzHjXyBuFvGt0LLYs=; h=From:To:Cc:Subject:Autocrypt:Date:Message-ID:MIME-Version:From; b=f1G0qW2IJnmsef19q69f1/N84xAbEAdizIAGzXZld5Aw94Edmnu0mFZG78KHTQf3f rZsGoqk9DKw1SwxnNWs2UWPoCboUQm4A2wlYZzwlf96jDl4c4ijWMMH1+zt37FBYOA /E7OlxE6Y++hoOKb0ub5YzRt3u4OWtg8uVdjXxvJom/QkEXUL80/5cdKI0PAVmnMXU qPbTYibg7PTOppewlldNaYASPThrnQNLtWE25idOAi5KxQCg3nx0qJlxtyLRdZakYw RNhdDHCselF96zUy4LQ95YW8Naxw50ipyi1XoKjwF5v6+zmlE2XMTJEFqMxnW9RvO2 oAKFWRrCTgdLw== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Sd6WP2MB2z6txZ; Sat, 25 Nov 2023 23:50:25 +0100 (CET) In-Reply-To: <87fs0txzac.wl-cnngimenez@disroot.org> (Christian's message of "Sat, 25 Nov 2023 19:07:23 -0300") X-Hashcash: 1:20:231125:emacs-devel@gnu.org::kBRyopfyXu7Hh5jH:1mfQ X-Hashcash: 1:20:231125:cnngimenez@disroot.org::7ru7Hd22zzUIOCnO:3utD Autocrypt: addr=philipk@posteo.net; keydata= mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof z4oM Received-SPF: pass client-ip=185.67.36.65; envelope-from=philipk@posteo.net; helo=mout01.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_H5=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:313227 Archived-At: Christian writes: > Hi Philip! > > Sorry, I misunderstood your idea. What would you like to > discuss specifically? > > I will try to pinpoint some things you suggested that is nice > to talk about. The diff has many modifications, and I find it > difficult to see the exact places you want to discuss. In > fact, most of them are changes that I think are better in the > way you wrote. > > Below are extracts from the diff and my comments. Tell me if > this method is a good idea to talk about them. It is entirely fine; I'll just be responding to the parts of the message where I have something constructive to add. > 4) >> (defun sachac-news--show-last-new-internal () >> "Show the last news. >> This is used after the update sentinel is executed. >> See `sachac-news-show-last-new'." >> - (let ((str (sachac-news-take-last-new t))) >> + (let ((str (sachac-news-take-last-new t))) ;unused! >> (with-current-buffer (get-buffer-create "*last-news*") >> (org-mode) > >> - (delete-region (point-min) (point-max)) >> - (insert str) >> + (erase-buffer) >> + (insert "foo") > > The str variable was used to insert the last new string. The > portion of the Org-mode text with the last title. No, that was my bad, I must have replaced the variable with a constant while testing and forgot to change it back. > But now I changed this function to support diferent formats (txt, > html, org, etc.). This code changed in the current version. Would it be worth checking out the code again? > 5) >> @@ -313,20 +303,17 @@ These variables can be loaded again with `sachac-news-load-data'." >> (with-temp-buffer >> (let ((data (list (cons 'last-update sachac-news-last-update) >> (cons 'last-saved-title sachac-news-last-saved-title)))) >> - (insert (prin1-to-string data)) >> - (write-file (sachac-news-dir-datafile)) >> - data)) ) >> + (prin1 data (current-buffer)) >> + (write-region nil nil (sachac-news-dir-datafile) nil 'silent) >> + data))) > >> (defun sachac-news-load-data-if-needed () >> "If the data has not been loaded yet, load it." > > Mmm... to my eyes it seems that it does the same but it may be > something I do not know... or maybe I am missing something? > Can I ask you why did you change it? Is the new code a > more convenient or accepted way to do what is intended? > > I wonder if perhaps is a parameter or something I do not know > what it does... > Maybe is efficiency: the data is directly printed to the buffer > without transforming into a string? Yes; The point of these two changes is to avoid generating a string, that is immediately discarded (less GC), and to avoid generating a message when writing the buffer contents to disk. > 6) >> @@ -335,6 +322,7 @@ These variables can be loaded again with `sachac-news-load-data'." > >> (defun sachac-news-update-time-str () >> "Return a string with the last time and the amount of time left." >> + ;; Perhaps format this in a temporary buffer, then return the buffer string? >> (format "Waiting time: %s hours >> -- Update -- >> Last time updated: %s > Yes, that could be a good idea... However, it should not be a > large string, because it will be displayed on the > minibuffer. Mmm... maybe it is already large... > > What do you think? should the string be formatted in a > temporary buffer? It just seemed like it would be more readable, than having a multi-line format-string. > This string is shown when using M-x > sachac-news-show-update-time when an update has been executed > before. Perhaps `display-message-or-buffer' could be of interest? -- Philip Kaludercic