From: Philip Kaludercic <philipk@posteo.net>
To: Christian <cnngimenez@disroot.org>
Cc: emacs-devel@gnu.org
Subject: Re: [ELPA] New package: SachaC-news
Date: Sat, 25 Nov 2023 22:50:23 +0000 [thread overview]
Message-ID: <87cyvxmor4.fsf@posteo.net> (raw)
In-Reply-To: <87fs0txzac.wl-cnngimenez@disroot.org> (Christian's message of "Sat, 25 Nov 2023 19:07:23 -0300")
Christian <cnngimenez@disroot.org> 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
prev parent reply other threads:[~2023-11-25 22:50 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-12 19:32 [ELPA] New package: SachaC-news Christian
2023-11-14 2:56 ` Richard Stallman
2023-11-15 23:56 ` Björn Bidar
2023-11-14 2:56 ` Richard Stallman
2023-11-18 20:26 ` Christian
2023-11-21 16:07 ` Sacha Chua
2023-11-25 22:40 ` Christian
2023-12-31 3:13 ` Richard Stallman
2023-12-31 18:13 ` Adam Porter
2023-12-31 19:32 ` Eli Zaretskii
2023-12-31 21:36 ` Adam Porter
2023-12-31 22:33 ` Christopher Dimech
2023-12-31 22:57 ` Emanuel Berg
2024-01-01 12:01 ` Eli Zaretskii
2024-01-02 3:19 ` Richard Stallman
2024-01-02 5:08 ` Emanuel Berg
2024-01-04 4:01 ` Richard Stallman
2024-01-02 18:05 ` Christian
2024-01-02 0:04 ` Stefan Kangas
2024-01-05 4:23 ` Richard Stallman
2024-01-02 17:40 ` Christian Gimenez
2023-11-17 7:28 ` Philip Kaludercic
2023-11-18 20:30 ` Christian
2023-11-18 21:10 ` Philip Kaludercic
2023-11-25 22:07 ` Christian
2023-11-25 22:50 ` Philip Kaludercic [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87cyvxmor4.fsf@posteo.net \
--to=philipk@posteo.net \
--cc=cnngimenez@disroot.org \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).