* [ELPA] New package: SachaC-news @ 2023-11-12 19:32 Christian 2023-11-14 2:56 ` Richard Stallman ` (2 more replies) 0 siblings, 3 replies; 26+ messages in thread From: Christian @ 2023-11-12 19:32 UTC (permalink / raw) To: emacs-devel Hi! I want to propose SachaC-news (or sachac-news.el if you like) package to be included in ELPA. Its objective is to check for Sacha Chua's news repository periodically, and to show the Org file if there is a new commit with a new post in it. It has some customizations too, such as folding specific sections automatically, and desktop notifications via "notify-send". The requirement is the git program to be installed on your system. This information and its usage is at the README.org file at the package repository: https://github.com/cnngimenez/sachac-news The code has been checked with byte-compile-file, and flycheck configured with checkdoc and flycheck-package [1]. They do not display any warnings up to commit d00e629, but tell me if you find something to fix or any suggestions. According to http://elpa.gnu.org/, and the README.org [2] file linked there, it says to notify to this mail address as first step. Also, it mentions other steps regarding pushing the code and adding an entry on elpa-packages file. But, there is a marker above indicating "OUTDATED" [3]. Please, could you tell me if these steps are needed? If they are not, how should I proceed? Cheers! Christian Gimenez [1] https://github.com/purcell/flycheck-package [2] https://git.savannah.gnu.org/cgit/emacs/elpa.git/plain/README [3] The section states: "Text below this marker is OUTDATED and still needs to be reviewed/rewritten!!" ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [ELPA] New package: SachaC-news 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-17 7:28 ` Philip Kaludercic 2 siblings, 1 reply; 26+ messages in thread From: Richard Stallman @ 2023-11-14 2:56 UTC (permalink / raw) To: Christian; +Cc: emacs-devel [[[ To any NSA and FBI agents reading my email: please consider ]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > I want to propose SachaC-news (or sachac-news.el if you like) > package to be included in ELPA. Its objective is to check for > Sacha Chua's news repository periodically, and to show the Org > file if there is a new commit with a new post in it. What other formats does this repository store postings in? If it has -- or can generate -- plain text, that should be preferred. There are users who like Org fornat, but it is not Emacs's preferred way of showing information, -- Dr Richard Stallman (https://stallman.org) Chief GNUisance of the GNU Project (https://gnu.org) Founder, Free Software Foundation (https://fsf.org) Internet Hall-of-Famer (https://internethalloffame.org) ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [ELPA] New package: SachaC-news 2023-11-14 2:56 ` Richard Stallman @ 2023-11-15 23:56 ` Björn Bidar 0 siblings, 0 replies; 26+ messages in thread From: Björn Bidar @ 2023-11-15 23:56 UTC (permalink / raw) To: Richard Stallman; +Cc: Christian, emacs-devel Richard Stallman <rms@gnu.org> writes: > [[[ To any NSA and FBI agents reading my email: please consider ]]] > [[[ whether defending the US Constitution against all enemies, ]]] > [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > > > I want to propose SachaC-news (or sachac-news.el if you like) > > package to be included in ELPA. Its objective is to check for > > Sacha Chua's news repository periodically, and to show the Org > > file if there is a new commit with a new post in it. > > What other formats does this repository store postings in? If it has > -- or can generate -- plain text, that should be preferred. > There are users who like Org fornat, but it is not Emacs's preferred > way of showing information, The base text file might be in org-mode but org-mode can export to plain text e.g. ANSI or UTF-8. Despite that I consider org-mode text quite easy to read even for those that don't understand org, especially inside Emacs. ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [ELPA] New package: SachaC-news 2023-11-12 19:32 [ELPA] New package: SachaC-news Christian 2023-11-14 2:56 ` Richard Stallman @ 2023-11-14 2:56 ` Richard Stallman 2023-11-18 20:26 ` Christian 2023-11-17 7:28 ` Philip Kaludercic 2 siblings, 1 reply; 26+ messages in thread From: Richard Stallman @ 2023-11-14 2:56 UTC (permalink / raw) To: Christian; +Cc: emacs-devel [[[ To any NSA and FBI agents reading my email: please consider ]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > I want to propose SachaC-news (or sachac-news.el if you like) > package to be included in ELPA. Are you the developer of the SachaC-news program? I would guess so, but I'd like to be sure rather than guess. Its objective is to check for > Sacha Chua's news repository periodically, and to show the Org > file if there is a new commit with a new post in it. What other formats does this repository store postings in? If it has -- or can generate -- plain text, that should be preferred. There are users who like Org fornat, but it is not Emacs's preferred way of showing information. > The > requirement is the git program to be installed on your system. Could you say what task it does using git? Is Sacha's news repository a git repository? That might be ok, but where is it? I hope not github! Where is that archive stored? Can you please tell us its URL? We deprecate use of github, so if we are going to have Emacs use a specific git repo for particular purposes, we should put it on a repo site that we recommend. The name SachaC-News suggests that Sacha Chua maintains that archive. Is that correct? What formats does it store articles in? Is Org format the only one? Org format is NOT the Emacs standard or preferred format, and not everyone uses it. Therefore, if we add a command to display some useful information, it should not use Org format. The best format to use is plain text. -- Dr Richard Stallman (https://stallman.org) Chief GNUisance of the GNU Project (https://gnu.org) Founder, Free Software Foundation (https://fsf.org) Internet Hall-of-Famer (https://internethalloffame.org) ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [ELPA] New package: SachaC-news 2023-11-14 2:56 ` Richard Stallman @ 2023-11-18 20:26 ` Christian 2023-11-21 16:07 ` Sacha Chua 2023-12-31 3:13 ` Richard Stallman 0 siblings, 2 replies; 26+ messages in thread From: Christian @ 2023-11-18 20:26 UTC (permalink / raw) To: rms; +Cc: Christian, emacs-devel [-- Attachment #1: Type: text/plain, Size: 5194 bytes --] Hi! On Mon, 13 Nov 2023 23:56:15 -0300, Richard Stallman wrote: > > [[[ To any NSA and FBI agents reading my email: please consider ]]] > [[[ whether defending the US Constitution against all enemies, ]]] > [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > > > I want to propose SachaC-news (or sachac-news.el if you like) > > package to be included in ELPA. > > Are you the developer of the SachaC-news program? > I would guess so, but I'd like to be sure rather than guess. Yes, I am the developer... Well, now, Philip Kaluderci is too a developer of SachaC-news :) > > Its objective is to check for > > Sacha Chua's news repository periodically, and to show the Org > > file if there is a new commit with a new post in it. > > What other formats does this repository store postings in? If it has > -- or can generate -- plain text, that should be preferred. > There are users who like Org fornat, but it is not Emacs's preferred > way of showing information. Sacha Chua creates her blog posts using this file written in Org-mode. This mode is installed by default on Emacs 29 [1] and can export to other formats: LaTeX, HTML, plain text, TeXInfo and info (by installing ox-texinfo), etc. Mmm... I suppose... I can add a customization to show an exported buffer instead the Org-mode buffer. For example, if sachac-news-show-plain-text is set to t, it will do the overall process, but add an extra step to export the Org file into plain text... or even generalize this idea to use any export dispatch function... I believe it can be implemented... what do you think? > > > The > > requirement is the git program to be installed on your system. > > Could you say what task it does using git? Is Sacha's news repository > a git repository? That might be ok, but where is it? I hope not > github! Where is that archive stored? Can you please tell us its > URL? Sure, it uses "git clone URL" to clone the repository if it does not exists; or it updates the current local repository by executing "git pull" [2]. Recently, I have just added a customization variable to set the URL to Sacha's Emacs News repository (see [3]). By default, its value is [4] which is a clone of the original. This repository will be automatically updated once a day, if there is a new blog post. However, you can change it to any other repository URL with an index.org file if you like. > > We deprecate use of github, so if we are going to have Emacs use a > specific git repo for particular purposes, we should put it on a repo > site that we recommend. Oh! I found the article "GNU Ethical Repository Criteria Evaluations" [5] which eases me to search for a new repository service to move the project (thanks for writing it!). According to the table in it, I decided to move sachac-news repository to sr.ht, which is grade B ("Good enough to recommend"). I have an account on savannah.gnu.org. If it is needed, I can request a new repository there. But it will require some time to be approved. > > The name SachaC-News suggests that Sacha Chua maintains that archive. > Is that correct? Sacha Chua maintains her emacs-news blog posts [6], and creates them by using the index.org file in that archive (or so it seems as far as I can understand the code in it, I have not asked her yet!). > > What formats does it store articles in? Is Org > format the only one? Her repository has only the index.org file. But, it can be exported to other formats too. > > Org format is NOT the Emacs standard or preferred format, and not > everyone uses it. Therefore, if we add a command to display some > useful information, it should not use Org format. > > The best format to use is plain text. Maybe, the name "Org" is not correct? I mean Org-mode [7] (I call it "Org" casually, sorry for that)... I thought it is considered as a plain text format. I love it and use it for... well... almost everything. If I am wrong in any way, please tell me. > > -- > Dr Richard Stallman (https://stallman.org) > Chief GNUisance of the GNU Project (https://gnu.org) > Founder, Free Software Foundation (https://fsf.org) > Internet Hall-of-Famer (https://internethalloffame.org) > > Cheers! Christian. [1] This is the Org-mode at the latest commit in Emacs 29 repository: https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/org?h=emacs-29&id=da946ca6924b5ba1a1c785284406cf894aef12b5 [2] This line implements the git clone and git update: https://git.sr.ht/~cngimenez/sachac-news/tree/6798169e06f12543346753602406476e7af288f1/item/sachac-news.el#L460 [3] sachac-news-sacha-repository-url at this line: https://git.sr.ht/~cngimenez/sachac-news/tree/6798169e06f12543346753602406476e7af288f1/item/sachac-news.el#L114 [4] https://git.sr.ht/~cngimenez/sachac-emacs-news [5] https://www.gnu.org/software/repo-criteria-evaluation.html [6] https://sachachua.com/blog/category/emacs-news/ [7] https://orgmode.org/ -- - Mastodon: @cnngimenez@mastodon.social ,= ,-_-. =. Utilice GPG: ((_/)o o(\_)) * https://emailselfdefense.fsf.org/ `-'(. .)`-' * Usando la terminal GNU/Linux: \_/ $ gpg2 --search-keys 77A56F0DA5DD9E05 [-- Attachment #2: OpenPGP Digital Signature --] [-- Type: application/pgp-signature, Size: 228 bytes --] ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [ELPA] New package: SachaC-news 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 1 sibling, 1 reply; 26+ messages in thread From: Sacha Chua @ 2023-11-21 16:07 UTC (permalink / raw) To: Christian; +Cc: rms, emacs-devel Christian <cnngimenez@disroot.org> writes: Hello, Christian, all! Christian: Neat idea, thanks for making it! =) >> What other formats does this repository store postings in? If it has >> -- or can generate -- plain text, that should be preferred. >> There are users who like Org fornat, but it is not Emacs's preferred >> way of showing information. > Sacha Chua creates her blog posts using this file written in > Org-mode. This mode is installed by default on Emacs 29 [1] and > can export to other formats: LaTeX, HTML, plain text, TeXInfo > and info (by installing ox-texinfo), etc. I could take another couple of minutes during the export process and export them as text and HTML as well. Here are both in my fork of your Sourcehut: https://git.sr.ht/~sachac/sachac-emacs-news . The Org version seems easier to parse, though. > Mmm... I suppose... I can add a customization to show an > exported buffer instead the Org-mode buffer. For example, if > sachac-news-show-plain-text is set to t, it will do the > overall process, but add an extra step to export the Org file > into plain text... or even generalize this idea to use any > export dispatch function... I believe it can be > implemented... what do you think? Yeah, it's probably better to do it on-the-fly, so people can get different versions of whatever they like. Making the backend selectable sounds like a possibly useful thing, in case maybe someone wants to use one of the Emacs News categories as a starting point for, say, their Markdown-based blog post... > Recently, I have just added a customization variable to set the > URL to Sacha's Emacs News repository (see [3]). By default, its > value is [4] which is a clone of the original. This repository > will be automatically updated once a day, if there is a new > blog post. However, you can change it to any other repository > URL with an index.org file if you like. Sure, we could use your repo (or my fork of your repo) if you like. Or if you add me as a collaborator on your repo, I can add it to the list of repos to push to... <laugh> > I have an account on savannah.gnu.org. If it is needed, I can > request a new repository there. But it will require some time > to be approved. I wasn't sure if Emacs News is eligible for Savannah hosting, since I link to lots of YouTube videos and the occasional commercial workshop being advertised by people. (Goodness knows emacs-devel has seen lots of discussions about MELPA, even...) Happy to set up another repo there if people feel it's all right. Decentralized source control for the win! > Sacha Chua maintains her emacs-news blog posts [6], and creates them > by using the index.org file in that archive (or so it seems as far as > I can understand the code in it, I have not asked her yet!). Yup, that's pretty much it. >> Org format is NOT the Emacs standard or preferred format, and not >> everyone uses it. Therefore, if we add a command to display some >> useful information, it should not use Org format. >> The best format to use is plain text. > Maybe, the name "Org" is not correct? I mean Org-mode [7] (I call it > "Org" casually, sorry for that)... I thought it is considered as a > plain text format. I love it and use it for... well... almost > everything. If I am wrong in any way, please tell me. I use Org because that makes it easy to export to different formats with hyperlinks. I like the conciseness of working with the titles for the most part while easily being able to access the URLs as needed. I also like having custom package links that open up package descriptions on my computer and export to regular HTML or ASCII links when I'm publishing. It's easy to rearrange bulleted lists, too. If people open the Org files, they can mostly follow the hyperlinks without loading any custom configuration. I'm going to keep Org as my source data format instead of using something like Hyperbole and/or Markdown. If we want the source data available in different formats, I can add that to my publishing process and keep that in the repo. It takes me a few minutes to export the whole file, so it's not a big deal. I'm guessing when people want to see the data, they'll usually want to see hyperlinked titles instead of titles + URLs (as in the ASCII export) while still being able to access the URLs if needed. I think taking advantage of Org's existing functionality makes sense here. Of course, the package can display things in different formats for people who prefer those. For people's convenience, I post HTML/Org/TXT to the emacs-tangents mailing list, so the information is available there in multiple formats. Fetching the index.org without git could work if you grab the whole file using the raw URL, like https://git.sr.ht/~sachac/sachac-emacs-news/blob/master/index.org ? It's 3.8MB (sorry server operators). I keep everything in one file to make it easier to check for duplicates. Would it help if I wrote the last post as a separate file, as in https://git.sr.ht/~sachac/sachac-emacs-news/tree/master/item/most-recent.org (or .txt or .html)? Sacha ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [ELPA] New package: SachaC-news 2023-11-21 16:07 ` Sacha Chua @ 2023-11-25 22:40 ` Christian 0 siblings, 0 replies; 26+ messages in thread From: Christian @ 2023-11-25 22:40 UTC (permalink / raw) To: Sacha Chua; +Cc: Christian, rms, emacs-devel [-- Attachment #1: Type: text/plain, Size: 7137 bytes --] Hi Sacha and all! I know that EmacsConf is so near, and you are working a lot for it... sorry for bringing more work to you! On Tue, 21 Nov 2023 13:07:19 -0300, Sacha Chua wrote: > > Christian <cnngimenez@disroot.org> writes: > > Hello, Christian, all! > > Christian: Neat idea, thanks for making it! =) Well, I read Emacs News frequently, and used many things from your posts... Thanks for making it! :) > > >> What other formats does this repository store postings in? If it has > >> -- or can generate -- plain text, that should be preferred. > >> There are users who like Org fornat, but it is not Emacs's preferred > >> way of showing information. > > Sacha Chua creates her blog posts using this file written in > > Org-mode. This mode is installed by default on Emacs 29 [1] and > > can export to other formats: LaTeX, HTML, plain text, TeXInfo > > and info (by installing ox-texinfo), etc. > > I could take another couple of minutes during the export process and > export them as text and HTML as well. Here are both in my fork of your > Sourcehut: https://git.sr.ht/~sachac/sachac-emacs-news . The Org version > seems easier to parse, though. I added a new customization variable "sachac-news-use-git-file" [1] to select which file to open. For example, if you want plain text, you can change its value to "most-recent.txt". By default, it uses "most-recent.org". > > > Mmm... I suppose... I can add a customization to show an > > exported buffer instead the Org-mode buffer. For example, if > > sachac-news-show-plain-text is set to t, it will do the > > overall process, but add an extra step to export the Org file > > into plain text... or even generalize this idea to use any > > export dispatch function... I believe it can be > > implemented... what do you think? > > Yeah, it's probably better to do it on-the-fly, so people can get > different versions of whatever they like. Making the backend selectable > sounds like a possibly useful thing, in case maybe someone wants to use > one of the Emacs News categories as a starting point for, say, their > Markdown-based blog post... Done! if you set "sachac-news-after-download-function" [2] to, for example, org-md-export-to-markdown, it will generate a markdown file and display it. It was a little tricky to implement, it uses the file specified on "sachac-news-use-git-file" as the base to export. Maybe, someone want to use another tool or elisp function... > > > Recently, I have just added a customization variable to set the > > URL to Sacha's Emacs News repository (see [3]). By default, its > > value is [4] which is a clone of the original. This repository > > will be automatically updated once a day, if there is a new > > blog post. However, you can change it to any other repository > > URL with an index.org file if you like. > > Sure, we could use your repo (or my fork of your repo) if you like. Or > if you add me as a collaborator on your repo, I can add it to the list > of repos to push to... <laugh> Good idea! I have just added your account to my fork, so you can collaborate too, and then pull or push to... XD XD Well, I changed the default URL to yours: https://git.sr.ht/~sachac/sachac-emacs-news I think is better that way. Just in case, I really added you as collaborator with Read+Write access to both repos. > > > I have an account on savannah.gnu.org. If it is needed, I can > > request a new repository there. But it will require some time > > to be approved. > > I wasn't sure if Emacs News is eligible for Savannah hosting, since I > link to lots of YouTube videos and the occasional commercial workshop > being advertised by people. (Goodness knows emacs-devel has seen lots of > discussions about MELPA, even...) Happy to set up another repo there if > people feel it's all right. Decentralized source control for the win! > > > Sacha Chua maintains her emacs-news blog posts [6], and creates them > > by using the index.org file in that archive (or so it seems as far as > > I can understand the code in it, I have not asked her yet!). > > Yup, that's pretty much it. > > >> Org format is NOT the Emacs standard or preferred format, and not > >> everyone uses it. Therefore, if we add a command to display some > >> useful information, it should not use Org format. > >> The best format to use is plain text. > > Maybe, the name "Org" is not correct? I mean Org-mode [7] (I call it > > "Org" casually, sorry for that)... I thought it is considered as a > > plain text format. I love it and use it for... well... almost > > everything. If I am wrong in any way, please tell me. > > I use Org because that makes it easy to export to different formats with > hyperlinks. I like the conciseness of working with the titles for the > most part while easily being able to access the URLs as needed. I also > like having custom package links that open up package descriptions on my > computer and export to regular HTML or ASCII links when I'm publishing. > It's easy to rearrange bulleted lists, too. If people open the Org > files, they can mostly follow the hyperlinks without loading any custom > configuration. I'm going to keep Org as my source data format instead > of using something like Hyperbole and/or Markdown. > > If we want the source data available in different formats, I can add > that to my publishing process and keep that in the repo. It takes me a > few minutes to export the whole file, so it's not a big deal. > > I'm guessing when people want to see the data, they'll usually want to > see hyperlinked titles instead of titles + URLs (as in the ASCII export) > while still being able to access the URLs if needed. I think taking > advantage of Org's existing functionality makes sense here. Of course, > the package can display things in different formats for people who > prefer those. > > For people's convenience, I post HTML/Org/TXT to the emacs-tangents > mailing list, so the information is available there in multiple formats. > > Fetching the index.org without git could work if you grab the whole file > using the raw URL, like > https://git.sr.ht/~sachac/sachac-emacs-news/blob/master/index.org ? It's > 3.8MB (sorry server operators). I keep everything in one file to make it > easier to check for duplicates. > > Would it help if I wrote the last post as a separate file, as in > https://git.sr.ht/~sachac/sachac-emacs-news/tree/master/item/most-recent.org > (or .txt or .html)? I see in the repo that you have already done it! Awesome! Thanks a lot! Now sachac-news uses most-recent.org by default! > > Sacha [1] The sachac-news-use-git-file variable is defined here: https://git.sr.ht/~cngimenez/sachac-news/tree/ba3ba95ba8fe74df000161e0933ac89cad583cf3/item/sachac-news.el#L120 [2] The sachac-news-after-download-function is defined here: https://git.sr.ht/~cngimenez/sachac-news/tree/ba3ba95ba8fe74df000161e0933ac89cad583cf3/item/sachac-news.el#L133 -- - Mastodon: @cnngimenez@mastodon.social ,= ,-_-. =. Utilice GPG: ((_/)o o(\_)) * https://emailselfdefense.fsf.org/ `-'(. .)`-' * Usando la terminal GNU/Linux: \_/ $ gpg2 --search-keys 77A56F0DA5DD9E05 [-- Attachment #2: OpenPGP Digital Signature --] [-- Type: application/pgp-signature, Size: 228 bytes --] ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [ELPA] New package: SachaC-news 2023-11-18 20:26 ` Christian 2023-11-21 16:07 ` Sacha Chua @ 2023-12-31 3:13 ` Richard Stallman 2023-12-31 18:13 ` Adam Porter ` (2 more replies) 1 sibling, 3 replies; 26+ messages in thread From: Richard Stallman @ 2023-12-31 3:13 UTC (permalink / raw) To: Christian; +Cc: emacs-devel [[[ To any NSA and FBI agents reading my email: please consider ]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] Please forgive me for taking so long to see your reply. > Mmm... I suppose... I can add a customization to show an > exported buffer instead the Org-mode buffer. For example, if > sachac-news-show-plain-text is set to t, it will do the > overall process, but add an extra step to export the Org file > into plain text... or even generalize this idea to use any > export dispatch function... I believe it can be > implemented... what do you think? That is a good approach, but one detail should be different. The variable should be sachac-news-show-org, and default to nil. Org format is text with its own kind of markup -- it is not plain text. The point is that, in designing other parts of Emacs, we should not treat Org format as if it were a standard. Org is an extension package in Emacs; some people use it, and some don't. -- Dr Richard Stallman (https://stallman.org) Chief GNUisance of the GNU Project (https://gnu.org) Founder, Free Software Foundation (https://fsf.org) Internet Hall-of-Famer (https://internethalloffame.org) ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [ELPA] New package: SachaC-news 2023-12-31 3:13 ` Richard Stallman @ 2023-12-31 18:13 ` Adam Porter 2023-12-31 19:32 ` Eli Zaretskii ` (2 more replies) 2024-01-02 0:04 ` Stefan Kangas 2024-01-02 17:40 ` Christian Gimenez 2 siblings, 3 replies; 26+ messages in thread From: Adam Porter @ 2023-12-31 18:13 UTC (permalink / raw) To: rms; +Cc: cnngimenez, emacs-devel > Org format is text with its own kind of markup -- it is not plain text. Many users would disagree. If you look up promotional and educational content about Org, you'll find that cited as one of its chief benefits: that it's essentially plain text. Indeed, Org's own web site uses the slogan, "Your life in plain text." One of Org's design points is that its syntax is intended to be readable as plain text. > That is a good approach, but one detail should be different. > The variable should be sachac-news-show-org, and default to nil. That begs the question: If the same content were displayed in a non-Org, "plain text" format, what would the difference be? And if someone were to write a major mode to syntax-highlight and navigate such text, would it still be "plain text"? What makes a document "plain text" as opposed to Org, Markdown, or any of the numerous readable-as-plain-text formats out there? ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [ELPA] New package: SachaC-news 2023-12-31 18:13 ` Adam Porter @ 2023-12-31 19:32 ` Eli Zaretskii 2023-12-31 21:36 ` Adam Porter 2024-01-02 3:19 ` Richard Stallman 2024-01-02 18:05 ` Christian 2 siblings, 1 reply; 26+ messages in thread From: Eli Zaretskii @ 2023-12-31 19:32 UTC (permalink / raw) To: Adam Porter; +Cc: rms, cnngimenez, emacs-devel > Date: Sun, 31 Dec 2023 12:13:24 -0600 > Cc: cnngimenez@disroot.org, emacs-devel@gnu.org > From: Adam Porter <adam@alphapapa.net> > > > Org format is text with its own kind of markup -- it is not plain text. > > Many users would disagree. How can users disagree with something that is a plain fact? > If you look up promotional and educational > content about Org, you'll find that cited as one of its chief benefits: > that it's essentially plain text. "Essentially plain text" means it's not plain text. Do you deny that Org files have their own specialized markup? Because that's all that Richard said above. If you do agree that Org has its own markup, then where are you going with your objections and arguments? ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [ELPA] New package: SachaC-news 2023-12-31 19:32 ` Eli Zaretskii @ 2023-12-31 21:36 ` Adam Porter 2023-12-31 22:33 ` Christopher Dimech ` (2 more replies) 0 siblings, 3 replies; 26+ messages in thread From: Adam Porter @ 2023-12-31 21:36 UTC (permalink / raw) To: Eli Zaretskii; +Cc: rms, cnngimenez, emacs-devel On 12/31/23 13:32, Eli Zaretskii wrote: >> Date: Sun, 31 Dec 2023 12:13:24 -0600 >> Cc: cnngimenez@disroot.org, emacs-devel@gnu.org >> From: Adam Porter <adam@alphapapa.net> >> >>> Org format is text with its own kind of markup -- it is not plain text. >> >> Many users would disagree. > > How can users disagree with something that is a plain fact? A fact? Org's own web site, as I said, proclaims, "Your life in plain text." It would seem there is at least room for interpretation. >> If you look up promotional and educational >> content about Org, you'll find that cited as one of its chief benefits: >> that it's essentially plain text. > > "Essentially plain text" means it's not plain text. What is "plain text"? Is the following block "plain text"? To-do list: - Walk dog - Feed cat - Reply to email I would say so, as I've written many such lists in ".txt" files before I discovered Org mode, yet it has Org syntax that would cause it to be parsed as a paragraph followed by a bulleted list. If it is not "plain text," then what would make it so? Shall we remove the hyphens? To-do list: Walk dog Feed cat Reply to email Is that now "plain text"? Does that now qualify it for inclusion in an Emacs package since it technically lacks Org syntax? (Or does it? Org will parse that block as two paragraphs of Org-formatted text.) Is it now easier to read outside of org-mode's font-locking? > Do you deny that Org files have their own specialized markup? Because > that's all that Richard said above. If you do agree that Org has its > own markup, then where are you going with your objections and > arguments? He said that the package in question should have the output of one of its commands changed to not output Org syntax. With Org being "essentially" plain text, and intended to be readable as plain-text in any software, without any special fontification, that raises the question of what would be changed to qualify the command's output as non-Org "plain text", and what the benefit would be to the user. ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [ELPA] New package: SachaC-news 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 2 siblings, 0 replies; 26+ messages in thread From: Christopher Dimech @ 2023-12-31 22:33 UTC (permalink / raw) To: Adam Porter; +Cc: Eli Zaretskii, rms, cnngimenez, emacs-devel > Sent: Monday, January 01, 2024 at 9:36 AM > From: "Adam Porter" <adam@alphapapa.net> > To: "Eli Zaretskii" <eliz@gnu.org> > Cc: rms@gnu.org, cnngimenez@disroot.org, emacs-devel@gnu.org > Subject: Re: [ELPA] New package: SachaC-news > > On 12/31/23 13:32, Eli Zaretskii wrote: > >> Date: Sun, 31 Dec 2023 12:13:24 -0600 > >> Cc: cnngimenez@disroot.org, emacs-devel@gnu.org > >> From: Adam Porter <adam@alphapapa.net> > >> > >>> Org format is text with its own kind of markup -- it is not plain text. > >> > >> Many users would disagree. > > > > How can users disagree with something that is a plain fact? > > A fact? Org's own web site, as I said, proclaims, "Your life in plain > text." It would seem there is at least room for interpretation. > > >> If you look up promotional and educational > >> content about Org, you'll find that cited as one of its chief benefits: > >> that it's essentially plain text. > > > > "Essentially plain text" means it's not plain text. > > What is "plain text"? Is the following block "plain text"? > > To-do list: > > - Walk dog > - Feed cat > - Reply to email > > I would say so, as I've written many such lists in ".txt" files before I > discovered Org mode, yet it has Org syntax that would cause it to be > parsed as a paragraph followed by a bulleted list. If it is not "plain > text," then what would make it so? Shall we remove the hyphens? > > To-do list: > > Walk dog > Feed cat > Reply to email > > Is that now "plain text"? Does that now qualify it for inclusion in an > Emacs package since it technically lacks Org syntax? (Or does it? Org > will parse that block as two paragraphs of Org-formatted text.) Is it > now easier to read outside of org-mode's font-locking? > > > Do you deny that Org files have their own specialized markup? Because > > that's all that Richard said above. If you do agree that Org has its > > own markup, then where are you going with your objections and > > arguments? > > He said that the package in question should have the output of one of > its commands changed to not output Org syntax. With Org being > "essentially" plain text, and intended to be readable as plain-text in > any software, without any special fontification, that raises the > question of what would be changed to qualify the command's output as > non-Org "plain text", and what the benefit would be to the user. Here we are discussing plain text in the context of Modern English. Consider the case of French, with four diacritics, two ligatures and the cedilla. Should a document written in french be considered as plain text ? The answer is yes. We should start considering plain text as text in the normal language, including diacritics, ligatures and other marks that go beyond the basic Latin Alphabet. I do not see any problem with having non-plain text. Org has evolved, and can see good reasons for org-files to include - for instance - arrow marks. If the textual information written in the user's normal language shows up intact, the corresponding org file should be considered plain-text. ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [ELPA] New package: SachaC-news 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 2 siblings, 0 replies; 26+ messages in thread From: Emanuel Berg @ 2023-12-31 22:57 UTC (permalink / raw) To: emacs-devel Adam Porter wrote: >> How can users disagree with something that is a plain fact? > > A fact? Org's own web site, as I said, proclaims, "Your life > in plain text." It is plain text with markup elements according to its own definition and rules. But those elements are also in plain text so the whole thing is still plain text. -- underground experts united https://dataswamp.org/~incal ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [ELPA] New package: SachaC-news 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 2 siblings, 0 replies; 26+ messages in thread From: Eli Zaretskii @ 2024-01-01 12:01 UTC (permalink / raw) To: Adam Porter; +Cc: rms, cnngimenez, emacs-devel > Date: Sun, 31 Dec 2023 15:36:40 -0600 > Cc: rms@gnu.org, cnngimenez@disroot.org, emacs-devel@gnu.org > From: Adam Porter <adam@alphapapa.net> > > On 12/31/23 13:32, Eli Zaretskii wrote: > >> Date: Sun, 31 Dec 2023 12:13:24 -0600 > >> Cc: cnngimenez@disroot.org, emacs-devel@gnu.org > >> From: Adam Porter <adam@alphapapa.net> > >> > >>> Org format is text with its own kind of markup -- it is not plain text. > >> > >> Many users would disagree. > > > > How can users disagree with something that is a plain fact? > > A fact? Org's own web site, as I said, proclaims, "Your life in plain > text." It would seem there is at least room for interpretation. If there's room for interpretation, why do you object to Richard's (and mine)? > > Do you deny that Org files have their own specialized markup? Because > > that's all that Richard said above. If you do agree that Org has its > > own markup, then where are you going with your objections and > > arguments? > > He said that the package in question should have the output of one of > its commands changed to not output Org syntax. With Org being > "essentially" plain text, and intended to be readable as plain-text in > any software, without any special fontification, that raises the > question of what would be changed to qualify the command's output as > non-Org "plain text", and what the benefit would be to the user. I think you are splitting hair, because it's crystal clear what Richard asked for: produce output without Org's markup. Saying that the request is already satisfied based on the differences in interpreting what is and isn't "plain text' is not useful here, since, given the reference to Org markup, it should be clear what Richard meant when he said "plain text" in this case. ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [ELPA] New package: SachaC-news 2023-12-31 18:13 ` Adam Porter 2023-12-31 19:32 ` Eli Zaretskii @ 2024-01-02 3:19 ` Richard Stallman 2024-01-02 5:08 ` Emanuel Berg 2024-01-02 18:05 ` Christian 2 siblings, 1 reply; 26+ messages in thread From: Richard Stallman @ 2024-01-02 3:19 UTC (permalink / raw) To: Adam Porter; +Cc: cnngimenez, emacs-devel [[[ To any NSA and FBI agents reading my email: please consider ]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > Indeed, Org's own web site uses the > slogan, "Your life in plain text." The presence of that statement in a web site means someone said so. To what extent it is true is another question. It might be entirely true, or partly true, or an exaggeration. It could appear true if you stretch the meaning somewhat. > What is "plain text"? Is the following block "plain text"? > To-do list: > - Walk dog > - Feed cat > - Reply to email I would call that an example of plain text with intuitive informal markup. You've stated it is also an example of Org format. Ok. But Org format is not the same thing as plain text with intuitive informal markup. They overlap, but they are not the same. In intuitive informal markup, you can represent a bulleted list in many ways. Using a single hypheh for the bullet is not the only way. It could be just space, "--", "---", "*", "#", ".", and other things. (What I normally use is askerisk.) In Org format, I suppose those have different meanings and are not equivalent. Does Org treat all of them as bulleted lists? I don't use Org mode, so I don't know. Can someone confirm? ISTR that, when I read the Org documentation, I saw constructs that were not so intuitive. Perhaps you are citing the subset that is most intuitive, and other constructs are less so -- but I am not sure. The difference between Org format and intuitive informal markup goes the other way, too. You can't write intuitive informal markup and assune the result will be valid Org format and mean the same thing. There is room in Emacs for Org format to be used. There is also room for intuitive informal markup. There should also be room for another markup format which would have specified definitions (as Org does) but a lot more constructs, so that it can represent whatever Texinfo can. Therefore, other Emacs fearures should not assume that text is written in Org mode, unless the user asks for that. -- Dr Richard Stallman (https://stallman.org) Chief GNUisance of the GNU Project (https://gnu.org) Founder, Free Software Foundation (https://fsf.org) Internet Hall-of-Famer (https://internethalloffame.org) ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [ELPA] New package: SachaC-news 2024-01-02 3:19 ` Richard Stallman @ 2024-01-02 5:08 ` Emanuel Berg 2024-01-04 4:01 ` Richard Stallman 0 siblings, 1 reply; 26+ messages in thread From: Emanuel Berg @ 2024-01-02 5:08 UTC (permalink / raw) To: emacs-devel Richard Stallman wrote: >> What is "plain text"? Is the following block "plain text"? >> >> To-do list: >> >> - Walk dog >> - Feed cat >> - Reply to email > > I would call that an example of plain text with intuitive > informal markup. You've stated it is also an example of Org > format. Ok. Org is formatted and structured with markup. It is intuitive, but formal. But it isn't binary and no further processing is required before it can be accessed to convey it's meaning. Note that this mail is formally structured (the attribution, citations, and signature) so if that's disallowed then this mail is also not plain text. C++ source is plain text. https://en.wikipedia.org/wiki/Plain_text -- underground experts united https://dataswamp.org/~incal ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [ELPA] New package: SachaC-news 2024-01-02 5:08 ` Emanuel Berg @ 2024-01-04 4:01 ` Richard Stallman 0 siblings, 0 replies; 26+ messages in thread From: Richard Stallman @ 2024-01-04 4:01 UTC (permalink / raw) To: Emanuel Berg; +Cc: emacs-devel [[[ To any NSA and FBI agents reading my email: please consider ]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > > I would call that an example of plain text with intuitive > > informal markup. You've stated it is also an example of Org > > format. Ok. > Org is formatted and structured with markup. It is intuitive, > but formal. You've used the same words I used, but used them to talk about a somthing else. It looks like a response to what I said, but it's actually changing the subject. -- Dr Richard Stallman (https://stallman.org) Chief GNUisance of the GNU Project (https://gnu.org) Founder, Free Software Foundation (https://fsf.org) Internet Hall-of-Famer (https://internethalloffame.org) ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [ELPA] New package: SachaC-news 2023-12-31 18:13 ` Adam Porter 2023-12-31 19:32 ` Eli Zaretskii 2024-01-02 3:19 ` Richard Stallman @ 2024-01-02 18:05 ` Christian 2 siblings, 0 replies; 26+ messages in thread From: Christian @ 2024-01-02 18:05 UTC (permalink / raw) To: Adam Porter; +Cc: rms, cnngimenez, emacs-devel [-- Attachment #1: Type: text/plain, Size: 1945 bytes --] Hi! Mmm... May I suggest to change the subject of the thread to a more specific to the debate? Or, if it is possible, to "move" the debate to another thread? The aim of the subject "New package: SachaC-news" is to share and propose this package to ELPA. And, to suggest modifications to allow its inclusion to this repository. Also, in my personal case, to learn more about the decisions, conventions, and requirements to include new packages. The results of the debate can be related to the package, because it affects the default format to display. But, it could also affect other packages. The subject used may be confusing, and may not be completely accurate to the debate topic. Cheers! Christian gimenez. On Sun, 31 Dec 2023 15:13:24 -0300, Adam Porter wrote: > > > Org format is text with its own kind of markup -- it is not plain text. > > Many users would disagree. If you look up promotional and educational > content about Org, you'll find that cited as one of its chief > benefits: that it's essentially plain text. Indeed, Org's own web > site uses the slogan, "Your life in plain text." One of Org's design > points is that its syntax is intended to be readable as plain text. > > > That is a good approach, but one detail should be different. > > The variable should be sachac-news-show-org, and default to nil. > > That begs the question: If the same content were displayed in a > non-Org, "plain text" format, what would the difference be? And if > someone were to write a major mode to syntax-highlight and navigate > such text, would it still be "plain text"? What makes a document > "plain text" as opposed to Org, Markdown, or any of the numerous > readable-as-plain-text formats out there? -- - Mastodon: @cnngimenez@mastodon.social ,= ,-_-. =. Utilice GPG: ((_/)o o(\_)) * https://emailselfdefense.fsf.org/ `-'(. .)`-' * Usando la terminal GNU/Linux: \_/ $ gpg2 --search-keys 77A56F0DA5DD9E05 [-- Attachment #2: OpenPGP Digital Signature --] [-- Type: application/pgp-signature, Size: 228 bytes --] ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [ELPA] New package: SachaC-news 2023-12-31 3:13 ` Richard Stallman 2023-12-31 18:13 ` Adam Porter @ 2024-01-02 0:04 ` Stefan Kangas 2024-01-05 4:23 ` Richard Stallman 2024-01-02 17:40 ` Christian Gimenez 2 siblings, 1 reply; 26+ messages in thread From: Stefan Kangas @ 2024-01-02 0:04 UTC (permalink / raw) To: rms, Christian; +Cc: emacs-devel Richard Stallman <rms@gnu.org> writes: > > Mmm... I suppose... I can add a customization to show an > > exported buffer instead the Org-mode buffer. For example, if > > sachac-news-show-plain-text is set to t, it will do the > > overall process, but add an extra step to export the Org file > > into plain text... or even generalize this idea to use any > > export dispatch function... I believe it can be > > implemented... what do you think? > > That is a good approach, but one detail should be different. > The variable should be sachac-news-show-org, and default to nil. > > Org format is text with its own kind of markup -- it is not plain text. This feature request is incomplete, I think: you didn't specify what alternative format you would like to see instead. In any case, I don't think this feature request sounds like a blocker for adding this package to GNU ELPA. ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [ELPA] New package: SachaC-news 2024-01-02 0:04 ` Stefan Kangas @ 2024-01-05 4:23 ` Richard Stallman 0 siblings, 0 replies; 26+ messages in thread From: Richard Stallman @ 2024-01-05 4:23 UTC (permalink / raw) To: Stefan Kangas; +Cc: cnngimenez, emacs-devel [[[ To any NSA and FBI agents reading my email: please consider ]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > This feature request is incomplete, I think: you didn't specify what > alternative format you would like to see instead. I hope that the message I sent a day or two ago precisely how specifying "plain text" is different from specifying "Org format" fills in the rest. Is there a feature in Org mode to format an Org format document and deliver it as "text"> That would serve. > In any case, I don't think this feature request sounds like a blocker > for adding this package to GNU ELPA. Conceptually, this is a major decision -- even though the change in code might be very little. So it should be made at the outset, not left for later. -- Dr Richard Stallman (https://stallman.org) Chief GNUisance of the GNU Project (https://gnu.org) Founder, Free Software Foundation (https://fsf.org) Internet Hall-of-Famer (https://internethalloffame.org) ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [ELPA] New package: SachaC-news 2023-12-31 3:13 ` Richard Stallman 2023-12-31 18:13 ` Adam Porter 2024-01-02 0:04 ` Stefan Kangas @ 2024-01-02 17:40 ` Christian Gimenez 2 siblings, 0 replies; 26+ messages in thread From: Christian Gimenez @ 2024-01-02 17:40 UTC (permalink / raw) To: rms; +Cc: Christian, emacs-devel [-- Attachment #1: Type: text/plain, Size: 3495 bytes --] Hi! Happy 2024!!! On Sun, 31 Dec 2023 00:13:34 -0300, Richard Stallman wrote: > > [[[ To any NSA and FBI agents reading my email: please > consider ]]] [[[ whether defending the US Constitution > against all enemies, ]]] [[[ foreign or domestic, requires > you to follow Snowden's example. ]]] > > Please forgive me for taking so long to see your reply. > > > Mmm... I suppose... I can add a customization to show an > > exported buffer instead the Org-mode buffer. For example, > > if sachac-news-show-plain-text is set to t, it will do > > the overall process, but add an extra step to export the > > Org file into plain text... or even generalize this idea > > to use any export dispatch function... I believe it can > > be implemented... what do you think? > > That is a good approach, but one detail should be different. > The variable should be sachac-news-show-org, and default to > nil. While implementing this feature around a month ago, I found some difficulties... it seemed to me a little counter-intuitive using a variable like this: should it store the format name? or a boolean? Also, Sacha is now exporting the last news in four files with its own formats: most-recent.md (Markdown), most-recent.org (Org-mode), most-recent.txt (Unicode plain text according to M-x org-export-dispatch), and most-recent.html (HTML). For these reasons, I decided to create a custom variable called sachac-news-use-git-file which stores the name of the file to open, instead of storing a boolean or symbol value. It is easier to understand because the user has to set the filename, even so, it can be any other file in the repository, for instance: the index.txt. And, as a side effect, the software may be used for other repositories and, possibly, other formats. Therefore, to implement your suggestion I have just changed its default value from "most-recent.org" to "most-recent.txt" (see the code at line 120: [1]). The user may change its value with M-x customize-option to "most-recent.md" if Markdown is what they prefer, or "most-recent.org" if Org-mode is best for them. This feature is explained at the README.org file (see [2]). I also exported this file into Unicode plain text. By the way, thanks Sacha for exporting into different formats!!! I am sorry it adds an extra work to you. It really makes the implementation easier! > > Org format is text with its own kind of markup -- it is not > plain text. > > The point is that, in designing other parts of Emacs, we > should not treat Org format as if it were a standard. Org is > an extension package in Emacs; some people use it, and some > don't. > > -- > Dr Richard Stallman (https://stallman.org) Chief GNUisance of > the GNU Project (https://gnu.org) Founder, Free Software > Foundation (https://fsf.org) Internet Hall-of-Famer > (https://internethalloffame.org) > > Cheers! Christian Gimenez. [1] https://git.sr.ht/~cngimenez/sachac-news/tree/0dd98c588a0f4752e17a02c2ecdc98ea214b068b/item/sachac-news.el#L120 [2] At README.org: https://git.sr.ht/~cngimenez/sachac-news/tree/0dd98c588a0f4752e17a02c2ecdc98ea214b068b/item/README.org#L38 Or, at README.txt: https://git.sr.ht/~cngimenez/sachac-news/tree/0dd98c588a0f4752e17a02c2ecdc98ea214b068b/item/README.txt#L97 -- - Mastodon: @cnngimenez@mastodon.social ,= ,-_-. =. Utilice GPG: ((_/)o o(\_)) * https://emailselfdefense.fsf.org/ `-'(. .)`-' * Usando la terminal GNU/Linux: \_/ $ gpg2 --search-keys 77A56F0DA5DD9E05 [-- Attachment #2: OpenPGP Digital Signature --] [-- Type: application/pgp-signature, Size: 228 bytes --] ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [ELPA] New package: SachaC-news 2023-11-12 19:32 [ELPA] New package: SachaC-news Christian 2023-11-14 2:56 ` Richard Stallman 2023-11-14 2:56 ` Richard Stallman @ 2023-11-17 7:28 ` Philip Kaludercic 2023-11-18 20:30 ` Christian 2 siblings, 1 reply; 26+ messages in thread From: Philip Kaludercic @ 2023-11-17 7:28 UTC (permalink / raw) To: Christian; +Cc: emacs-devel [-- Attachment #1: Type: text/plain, Size: 959 bytes --] Christian <cnngimenez@disroot.org> writes: > Hi! > > I want to propose SachaC-news (or sachac-news.el if you like) > package to be included in ELPA. Its objective is to check for > Sacha Chua's news repository periodically, and to show the Org > file if there is a new commit with a new post in it. It has > some customizations too, such as folding specific sections > automatically, and desktop notifications via "notify-send". The > requirement is the git program to be installed on your system. > This information and its usage is at the README.org file at the > package repository: > > https://github.com/cnngimenez/sachac-news > > The code has been checked with byte-compile-file, and > flycheck configured with checkdoc and flycheck-package [1]. > They do not display any warnings up to commit d00e629, but tell > me if you find something to fix or any suggestions. I found a few things, here is a diff with some comments and suggestions: [-- Attachment #2: Type: text/plain, Size: 17723 bytes --] diff --git a/sachac-news.el b/sachac-news.el index 8d67911..1f389b2 100644 --- a/sachac-news.el +++ b/sachac-news.el @@ -22,7 +22,6 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see <https://www.gnu.org/licenses/>. - ;;; Commentary: ;; Check periodically for new commits on Sacha Chua's news repository. @@ -58,29 +57,29 @@ ;;; Code: -(provide 'sachac-news) (require 'org-element) (require 'org-list) -(require 'cl-extra) +(require 'cl-lib) (defgroup sachac-news nil "Sacha Chua's Emacs news customizations." :group 'applications) -(defcustom sachac-news-git-command "git" +(defcustom sachac-news-git-command + (eval-when-compile + (require 'vc-git) + vc-git-program) "Path or git command name. Valid values are \"/usr/bin/git\" or \"git\" if it is in the current PATH." - :type 'string - :group 'sachac-news) ;; defcustom + :type 'string) ;; defcustom (defcustom sachac-news-fold-category-regexp-list '() "A list of regexp strings of the matching categories that should be folded. The function `sachac-news-fold-categories' use this variable to find categories that the user wants to hide." - :type '(repeat regexp) - :group 'sachac-news) ;; defcustom + :type '(repeat regexp)) ;; defcustom (defcustom sachac-news-alarm-sound-file "/usr/share/sounds/freedesktop/stereo/bell.oga" @@ -88,8 +87,7 @@ categories that the user wants to hide." If the value is nil or the file does not exists, the `ding' function is used. See `sachac-news-default-sound-alarm' function." - :type 'file - :group 'sachac-news) ;; defcustom + :type 'file) ;; defcustom (defcustom sachac-news-alarm-sound-programs '(("mpv" . "--really-quiet %s") @@ -100,22 +98,20 @@ programs is founded on the system, the `ding' function will be used. The first program founded is used. This variable is used by `sachac-news-default-sound-alarm' function." - :type '(alist :key-type string :value-type string) - :group 'sachac-news ) ;; defcustom + :type '(alist :key-type string :value-type string)) ;; defcustom (defcustom sachac-news-alarm-functions-hook '(sachac-news-default-notify-alarm sachac-news-default-sound-alarm) "The alarm functions. These functions are called when there are new news." - :type 'hook - :group 'sachac-news ) ;; defcustom + :type 'hook) ;; defcustom (defconst sachac-news-title-regexp "^\\*\\*[[:space:]]+[[:digit:]]+-[[:digit:]]+-[[:digit:]]+[[:space:]]+Emacs news" - "Regexp used to find news titles in the index.org file." ) ;; defconst + "Regexp used to find news titles in the index.org file.") ;; defconst -(defvar sachac-news-timer-setted-time 0 +(defvar sachac-news-timer-setted-time 0 ;perhaps mark these as internal: sachac-news--... "At what time the timer has been setted? See `sachac-news-set-timer'.") @@ -148,66 +144,67 @@ Else, this variable contains nil.") If USE-INDEX-ORG is t, then load the index.org file. Else, use the current buffer as if it is the index.org." - (if use-index-org (with-temp-buffer (insert-file-contents (sachac-news-git-index-org)) - (sachac-news-take-last-new nil) ) + (sachac-news-take-last-new nil)) (progn (goto-char (point-min)) (search-forward-regexp sachac-news-title-regexp) (let ((sachac-news-title (org-element-at-point))) (buffer-substring-no-properties (org-element-property :begin sachac-news-title) - (org-element-property :end sachac-news-title))))) ) + (org-element-property :end sachac-news-title)))))) -(defcustom sachac-news-data-directory (concat user-emacs-directory - "sachac/") +(defcustom sachac-news-data-directory + (locate-user-emacs-file "sachac") "Where is the data directory?" - :type 'directory - :group 'sachac-news) ;; defcustom + :type 'directory) ;; defcustom -(defcustom sachac-news-data-file "data.el" +(defcustom sachac-news-data-file "data.eld" "The configuration and data file. This is where the last updated date and other data is stored." - :type 'file - :group 'sachac-news) ;; defcustom + :type 'file) ;; defcustom (defcustom sachac-news-git-dirname "git" "The directory where the git repository should be cloned." - :type 'string - :group 'sachac-news) + :type 'string) +;; She publishes the news every week around the beginning, why check +;; every day? (defcustom sachac-news-update-hours-wait 24 "The amount of hours when the git clone/pull must wait before be called. Default is 24 hours. Only positive values should be used." - :type 'integer - :group 'sachac-news ) ;; defcustom + :type 'natnum + :group 'sachac-news) ;; defcustom (defun sachac-news-dir-git () "Return the complete git path." - (concat sachac-news-data-directory "/" sachac-news-git-dirname) ) + (expand-file-name sachac-news-git-dirname sachac-news-data-directory)) (defun sachac-news-dir-datafile () "Return the complete data file path." - (concat sachac-news-data-directory "/" sachac-news-data-file) ) - + (expand-file-name sachac-news-data-file sachac-news-data-directory)) (defun sachac-news-git-index-org () "Return the index.org path on the git directory." - (concat (sachac-news-dir-git) "/emacs-news/index.org") ) + (expand-file-name + "index.org" + (expand-file-name + "emacs-news" + (sachac-news-dir-git)))) (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") (goto-char (point-min)) @@ -217,7 +214,7 @@ See `sachac-news-show-last-new'." (sachac-news-update-last-saved-title) (sachac-news-fold-categories)) - (display-buffer (current-buffer)))) ) + (display-buffer (current-buffer))))) (defun sachac-news-show-last-new-if-new () "Show the last new if there is a new title. @@ -241,16 +238,12 @@ see `sachac-news-update-hours-wait' variable." #'sachac-news--show-last-new-internal #'sachac-news--show-last-new-internal)) -;; -;; -------------------- -;; Last saved title -;; +;;; Last saved title (defun sachac-news-update-last-saved-title () "Save the last title into the data file." - (setq sachac-news-last-saved-title (sachac-news-get-last-title)) - (sachac-news-save-data) ) + (sachac-news-save-data)) (defun sachac-news-get-last-title (&optional use-current-buffer) "Get the first title founded in the current buffer. @@ -264,7 +257,7 @@ the last title. Else, if t, use the current buffer, but remember to call nil t) (with-temp-buffer (insert (sachac-news-take-last-new t)) - (sachac-news-get-last-title t))) ) + (sachac-news-get-last-title t)))) (defun sachac-news-is-there-new-title-p (&optional use-current-buffer) "According to the last save, return t when a new post is found. @@ -284,12 +277,9 @@ last news buffer. Else, open the index.org and retrieve the last news." (or (null sachac-news-last-saved-title) (not (string-equal last-title - sachac-news-last-saved-title)))) ) + sachac-news-last-saved-title))))) -;; -;; -------------------- -;; Data or config. load/save -;; +;;; Data or config. load/save (defun sachac-news-load-data () "Update variables which values are in the configuration file. @@ -305,7 +295,7 @@ important variables." (setq sachac-news-last-saved-title (alist-get 'last-saved-title expr)) ;; Return the expression loaded - expr))) ) + expr)))) (defun sachac-news-save-data () "Save some important variables into the data file. @@ -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." (unless sachac-news-data-loaded (sachac-news-load-data) - (setq sachac-news-data-loaded t)) ) + (setq sachac-news-data-loaded t))) -;; -;; -------------------- -;; Git clone/update -;; +;;; Git clone/update (defun sachac-news-update-last-update () "Update the `sachac-news-last-update' date with the current date." @@ -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 @@ -361,19 +349,19 @@ Time left for automatic forced update: %s %s" (* sachac-news-update-hours-wait 60 60))) "No timer setted") (number-to-string (/ (sachac-news-get-update-time-left) 60)) - "minutes") ) + "minutes")) (defun sachac-news-get-update-wait-seconds () "Get the `sachac-news-update-hours-wait' in seconds." - (* sachac-news-update-hours-wait 60 60) ) + (* sachac-news-update-hours-wait 60 60)) (defun sachac-news-show-update-time () "Display the time left for the next update." (interactive) (sachac-news-load-data-if-needed) (if sachac-news-last-update - (message (sachac-news-update-time-str)) - (message "Git has not been called before.")) ) + (message "%s" (sachac-news-update-time-str)) + (message "Git has not been called before."))) (defun sachac-news-get-update-time-left () "Return the seconds left for the next scheduled update. @@ -384,7 +372,7 @@ been setted)." (if sachac-news-timer-setted-time (- (+ sachac-news-timer-setted-time (sachac-news-get-update-wait-seconds)) (time-convert (current-time) 'integer)) - 0) ) + 0)) (defun sachac-news-get-update-enable-time-left () "Return the seconds left for the next enabled update. @@ -398,7 +386,7 @@ loaded)." (if sachac-news-last-update (- (+ sachac-news-last-update (sachac-news-get-update-wait-seconds)) (time-convert (current-time) 'integer)) - 0) ) + 0)) (defun sachac-news-get-update-time-elapsed () "Return the seconds elapsed since the last update. @@ -408,19 +396,19 @@ Return the numbre of seconds after the maximum wait + 1 if (if sachac-news-last-update (- (time-convert (current-time) 'integer) sachac-news-last-update) - (+ (sachac-news-get-update-wait-seconds) 1)) ) + (+ (sachac-news-get-update-wait-seconds) 1))) (defun sachac-news-is-time-for-update-p () "Check if a day has passed since the last update." (if sachac-news-last-update (>= (sachac-news-get-update-time-elapsed) - (sachac-news-get-update-wait-seconds) ) - t) ) + (sachac-news-get-update-wait-seconds)) + t)) (defun sachac-news-create-dirs () "Create the needed directories to save data and the repository." (make-directory sachac-news-data-directory t) - (make-directory (sachac-news-dir-git) t) ) + (make-directory (sachac-news-dir-git) t)) (defun sachac-news--git-sentinel (_process event) "Git sentinel. @@ -454,19 +442,19 @@ FUNC-CALL-AFTER is a function called after the git process endend successfully." (when func-call-after (add-hook 'sachac-news--git-hook func-call-after)) (setq sachac-news--git-process - (if (file-exists-p (sachac-news-git-index-org)) - (start-process-shell-command "sachac-news-git-pull" + (let ((default-directory (expand-file-name "emacs-news" (sachac-news-dir-git)))) + ;; I am not sure what the point is there, but I suspect + ;; there should be a better way to do this using timers + ;; and vc-git. + (if (file-exists-p (sachac-news-git-index-org)) + (start-process-shell-command "sachac-news-git-pull" + "*sachac-news-git*" + (concat "sleep 60 ; " git-program " pull")) + (start-process-shell-command "sachac-news-git-clone" "*sachac-news-git*" - (concat - "cd " (sachac-news-dir-git) "/emacs-news ; sleep 60 ; " - git-program - " pull")) - (start-process-shell-command "sachac-news-git-clone" - "*sachac-news-git*" - (concat - "cd " (sachac-news-dir-git) "; sleep 60 ; " - git-program " clone https://github.com/sachac/emacs-news.git")))) - (set-process-sentinel sachac-news--git-process #'sachac-news--git-sentinel)) ) + (concat "sleep 60 ; " git-program " clone \ +https://github.com/sachac/emacs-news.git"))))) + (set-process-sentinel sachac-news--git-process #'sachac-news--git-sentinel))) (defun sachac-news-update-git (&optional force-update @@ -501,11 +489,11 @@ pull/clone." (when callback-if-no-update (funcall callback-if-no-update)))) ;; Git program not founded - (message "%s %s\n%s\n%s" - "The Git program has not been founded!" - "SachaC-news cannot download news without it!" - "Please install it in our system or customize the variable:" - "M-x customize-option sachac-news-git-command"))) ) + (message (substitute-command-keys + "The Git program has not been founded! \ +SachaC-news cannot download news without it! +Please install it in our system or customize the variable: ) +\\[customize-option] sachac-news-git-command"))))) (defun sachac-news-open-index-file () "Open the index.org file from the local repository. @@ -519,15 +507,10 @@ how the update is done." (sachac-news-update-git) (if (file-exists-p (sachac-news-git-index-org)) (find-file (sachac-news-git-index-org)) - (message "%s\n%s" - "Index file not found! Did something wrong happen?" - "See `sachac-news-update-git'.")) ) + (message "Index file not found! Did something wrong happen? +See `sachac-news-update-git'."))) - -;; -;; -------------------- -;; Folding categories -;; +;;; Folding categories (defun sachac-news-find-all-categories (category-regexps &optional org-element) "Match paragraph with the CATEGORY-REGEXPS regexp. @@ -554,7 +537,7 @@ Returns a list of org-element of type \\'item found in the index.org." (string-match-p category element)) category-regexps)) - parent)))) ) + parent))))) (defun sachac-news-fold-all-items (item-list) @@ -582,12 +565,9 @@ This function works on any Org file, even at the Emacs news' index.org." (let ((category-list (if category-regexp-list category-regexp-list sachac-news-fold-category-regexp-list))) (sachac-news-fold-all-items - (sachac-news-find-all-categories category-list))) ) + (sachac-news-find-all-categories category-list)))) -;; -;; -------------------- -;; Alarm -;; +;;; Alarm (defun sachac-news-default-notify-alarm () "The default alarm. @@ -596,7 +576,7 @@ Use the notify-send to send the alarm." (when program (shell-command (concat program " --app-name=\"Emacs: SachaC-news\"" - " \"Check the News!\"")))) ) + " \"Check the News!\""))))) (defun sachac-news-default-sound-alarm () "The default sound alarm. @@ -619,17 +599,14 @@ as fallback." (car program-data) (split-string (format (cadr program-data) sachac-news-alarm-sound-file))) - (ding t))) ) + (ding t)))) (defun sachac-news-run-alarm-if-needed () "Run the alarm hook functions if there is a new post ." (when (sachac-news-is-there-new-title-p) - (run-hooks 'sachac-news-alarm-functions-hook)) ) + (run-hooks 'sachac-news-alarm-functions-hook))) -;; -;; -------------------- -;; Timer -;; +;;; Timer (defun sachac-news-timer-function () "The function used by the timer." @@ -638,7 +615,7 @@ as fallback." (sachac-news-update-git t #'sachac-news-show-last-new-if-new) (sachac-news-run-alarm-if-needed) - (sachac-news-activate-timer) ) + (sachac-news-activate-timer)) (defun sachac-news-activate-timer () @@ -650,9 +627,9 @@ Set the timer for executing on `sachac-news-update-hours-wait' hours." (setq sachac-news-timer-setted-time (time-convert (current-time) 'integer)) (setq sachac-news-timer (run-at-time - (concat (number-to-string sachac-news-update-hours-wait) "hours") - nil - #'sachac-news-timer-function)) ) + (format "%d hours" sachac-news-update-hours-wait) + nil + #'sachac-news-timer-function))) (defun sachac-news-deactivate-timer () "Stop and cancel the timer." @@ -660,7 +637,7 @@ Set the timer for executing on `sachac-news-update-hours-wait' hours." (when (timerp sachac-news-timer) (cancel-timer sachac-news-timer) (setq sachac-news-timer nil)) - (setq sachac-news-timer-setted-time nil) ) + (setq sachac-news-timer-setted-time nil)) (defun sachac-news-timer-status () "Is the timer setted or not? @@ -668,8 +645,13 @@ Report the user about the timer status." (interactive) (if (timerp sachac-news-timer) (message "Timer is setted and running.") - (message "Timer is deactivated")) ) + (message "Timer is deactivated"))) + +;; Don't activate side effects while loading your package! Instruct +;; the users to add this to their init.el, so that one knows what is +;; going on. -(sachac-news-activate-timer) +;; (sachac-news-activate-timer) +(provide 'sachac-news) ;;; sachac-news.el ends here [-- Attachment #3: Type: text/plain, Size: 774 bytes --] > According to http://elpa.gnu.org/, and the README.org [2] file > linked there, it says to notify to this mail address as > first step. Also, it mentions other steps regarding pushing the > code and adding an entry on elpa-packages file. But, there is a > marker above indicating "OUTDATED" [3]. That should be addressed ^^ > Please, could you tell me if these steps are needed? > If they are not, how should I proceed? As soon as we sort out the above comments, I can take care of adding the package for you. > Cheers! > Christian Gimenez > > [1] https://github.com/purcell/flycheck-package > [2] https://git.savannah.gnu.org/cgit/emacs/elpa.git/plain/README > [3] The section states: "Text below this marker is OUTDATED and > still needs to be reviewed/rewritten!!" ^ permalink raw reply related [flat|nested] 26+ messages in thread
* Re: [ELPA] New package: SachaC-news 2023-11-17 7:28 ` Philip Kaludercic @ 2023-11-18 20:30 ` Christian 2023-11-18 21:10 ` Philip Kaludercic 0 siblings, 1 reply; 26+ messages in thread From: Christian @ 2023-11-18 20:30 UTC (permalink / raw) To: Philip Kaludercic; +Cc: Christian, emacs-devel [-- Attachment #1: Type: text/plain, Size: 20911 bytes --] Thanks Philip! I applied the diff to this commit: https://git.sr.ht/~cngimenez/sachac-news/commit/8263dbc7982f543f673172c4a60d4bb68a48c6f6 Cheers! Christian. On Fri, 17 Nov 2023 04:28:35 -0300, Kaludercic wrote: > > [1 <text/plain (7bit)>] > Christian <cnngimenez@disroot.org> writes: > > > Hi! > > > > I want to propose SachaC-news (or sachac-news.el if you like) > > package to be included in ELPA. Its objective is to check for > > Sacha Chua's news repository periodically, and to show the Org > > file if there is a new commit with a new post in it. It has > > some customizations too, such as folding specific sections > > automatically, and desktop notifications via "notify-send". The > > requirement is the git program to be installed on your system. > > This information and its usage is at the README.org file at the > > package repository: > > > > https://github.com/cnngimenez/sachac-news > > > > The code has been checked with byte-compile-file, and > > flycheck configured with checkdoc and flycheck-package [1]. > > > They do not display any warnings up to commit d00e629, but tell > > me if you find something to fix or any suggestions. > > I found a few things, here is a diff with some comments and suggestions: > > [2 <text/plain (7bit)>] > diff --git a/sachac-news.el b/sachac-news.el > index 8d67911..1f389b2 100644 > --- a/sachac-news.el > +++ b/sachac-news.el > @@ -22,7 +22,6 @@ > ;; You should have received a copy of the GNU General Public License > ;; along with this program. If not, see <https://www.gnu.org/licenses/>. > > - > ;;; Commentary: > > ;; Check periodically for new commits on Sacha Chua's news repository. > @@ -58,29 +57,29 @@ > > ;;; Code: > > -(provide 'sachac-news) > (require 'org-element) > (require 'org-list) > -(require 'cl-extra) > +(require 'cl-lib) > > (defgroup sachac-news nil > "Sacha Chua's Emacs news customizations." > :group 'applications) > > -(defcustom sachac-news-git-command "git" > +(defcustom sachac-news-git-command > + (eval-when-compile > + (require 'vc-git) > + vc-git-program) > "Path or git command name. > > Valid values are \"/usr/bin/git\" or \"git\" if it is in the current PATH." > - :type 'string > - :group 'sachac-news) ;; defcustom > + :type 'string) ;; defcustom > > (defcustom sachac-news-fold-category-regexp-list '() > "A list of regexp strings of the matching categories that should be folded. > > The function `sachac-news-fold-categories' use this variable to find > categories that the user wants to hide." > - :type '(repeat regexp) > - :group 'sachac-news) ;; defcustom > + :type '(repeat regexp)) ;; defcustom > > (defcustom sachac-news-alarm-sound-file > "/usr/share/sounds/freedesktop/stereo/bell.oga" > @@ -88,8 +87,7 @@ categories that the user wants to hide." > If the value is nil or the file does not exists, the `ding' function is used. > > See `sachac-news-default-sound-alarm' function." > - :type 'file > - :group 'sachac-news) ;; defcustom > + :type 'file) ;; defcustom > > (defcustom sachac-news-alarm-sound-programs > '(("mpv" . "--really-quiet %s") > @@ -100,22 +98,20 @@ programs is founded on the system, the `ding' function will be used. The > first program founded is used. > > This variable is used by `sachac-news-default-sound-alarm' function." > - :type '(alist :key-type string :value-type string) > - :group 'sachac-news ) ;; defcustom > + :type '(alist :key-type string :value-type string)) ;; defcustom > > (defcustom sachac-news-alarm-functions-hook > '(sachac-news-default-notify-alarm > sachac-news-default-sound-alarm) > "The alarm functions. > These functions are called when there are new news." > - :type 'hook > - :group 'sachac-news ) ;; defcustom > + :type 'hook) ;; defcustom > > (defconst sachac-news-title-regexp > "^\\*\\*[[:space:]]+[[:digit:]]+-[[:digit:]]+-[[:digit:]]+[[:space:]]+Emacs news" > - "Regexp used to find news titles in the index.org file." ) ;; defconst > + "Regexp used to find news titles in the index.org file.") ;; defconst > > -(defvar sachac-news-timer-setted-time 0 > +(defvar sachac-news-timer-setted-time 0 ;perhaps mark these as internal: sachac-news--... > "At what time the timer has been setted? > See `sachac-news-set-timer'.") > > @@ -148,66 +144,67 @@ Else, this variable contains nil.") > > If USE-INDEX-ORG is t, then load the index.org file. Else, use the current > buffer as if it is the index.org." > - > (if use-index-org > (with-temp-buffer > (insert-file-contents (sachac-news-git-index-org)) > - (sachac-news-take-last-new nil) ) > + (sachac-news-take-last-new nil)) > (progn > (goto-char (point-min)) > (search-forward-regexp sachac-news-title-regexp) > (let ((sachac-news-title (org-element-at-point))) > (buffer-substring-no-properties > (org-element-property :begin sachac-news-title) > - (org-element-property :end sachac-news-title))))) ) > + (org-element-property :end sachac-news-title)))))) > > -(defcustom sachac-news-data-directory (concat user-emacs-directory > - "sachac/") > +(defcustom sachac-news-data-directory > + (locate-user-emacs-file "sachac") > "Where is the data directory?" > - :type 'directory > - :group 'sachac-news) ;; defcustom > + :type 'directory) ;; defcustom > > -(defcustom sachac-news-data-file "data.el" > +(defcustom sachac-news-data-file "data.eld" > "The configuration and data file. > This is where the last updated date and other data is stored." > - :type 'file > - :group 'sachac-news) ;; defcustom > + :type 'file) ;; defcustom > > (defcustom sachac-news-git-dirname "git" > "The directory where the git repository should be cloned." > - :type 'string > - :group 'sachac-news) > + :type 'string) > > +;; She publishes the news every week around the beginning, why check > +;; every day? > (defcustom sachac-news-update-hours-wait 24 > "The amount of hours when the git clone/pull must wait before be called. > > Default is 24 hours. Only positive values should be used." > - :type 'integer > - :group 'sachac-news ) ;; defcustom > + :type 'natnum > + :group 'sachac-news) ;; defcustom > > (defun sachac-news-dir-git () > "Return the complete git path." > - (concat sachac-news-data-directory "/" sachac-news-git-dirname) ) > + (expand-file-name sachac-news-git-dirname sachac-news-data-directory)) > > (defun sachac-news-dir-datafile () > "Return the complete data file path." > - (concat sachac-news-data-directory "/" sachac-news-data-file) ) > - > + (expand-file-name sachac-news-data-file sachac-news-data-directory)) > > (defun sachac-news-git-index-org () > "Return the index.org path on the git directory." > - (concat (sachac-news-dir-git) "/emacs-news/index.org") ) > + (expand-file-name > + "index.org" > + (expand-file-name > + "emacs-news" > + (sachac-news-dir-git)))) > > (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") > > (goto-char (point-min)) > > @@ -217,7 +214,7 @@ See `sachac-news-show-last-new'." > (sachac-news-update-last-saved-title) > (sachac-news-fold-categories)) > > - (display-buffer (current-buffer)))) ) > + (display-buffer (current-buffer))))) > > (defun sachac-news-show-last-new-if-new () > "Show the last new if there is a new title. > @@ -241,16 +238,12 @@ see `sachac-news-update-hours-wait' variable." > #'sachac-news--show-last-new-internal > #'sachac-news--show-last-new-internal)) > > -;; > -;; -------------------- > -;; Last saved title > -;; > +;;; Last saved title > > (defun sachac-news-update-last-saved-title () > "Save the last title into the data file." > - > (setq sachac-news-last-saved-title (sachac-news-get-last-title)) > - (sachac-news-save-data) ) > + (sachac-news-save-data)) > > (defun sachac-news-get-last-title (&optional use-current-buffer) > "Get the first title founded in the current buffer. > @@ -264,7 +257,7 @@ the last title. Else, if t, use the current buffer, but remember to call > nil t) > (with-temp-buffer > (insert (sachac-news-take-last-new t)) > - (sachac-news-get-last-title t))) ) > + (sachac-news-get-last-title t)))) > > (defun sachac-news-is-there-new-title-p (&optional use-current-buffer) > "According to the last save, return t when a new post is found. > @@ -284,12 +277,9 @@ last news buffer. Else, open the index.org and retrieve the last news." > > (or (null sachac-news-last-saved-title) > (not (string-equal last-title > - sachac-news-last-saved-title)))) ) > + sachac-news-last-saved-title))))) > > -;; > -;; -------------------- > -;; Data or config. load/save > -;; > +;;; Data or config. load/save > > (defun sachac-news-load-data () > "Update variables which values are in the configuration file. > @@ -305,7 +295,7 @@ important variables." > (setq sachac-news-last-saved-title > (alist-get 'last-saved-title expr)) > ;; Return the expression loaded > - expr))) ) > + expr)))) > > (defun sachac-news-save-data () > "Save some important variables into the data file. > @@ -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." > (unless sachac-news-data-loaded > (sachac-news-load-data) > - (setq sachac-news-data-loaded t)) ) > + (setq sachac-news-data-loaded t))) > > -;; > -;; -------------------- > -;; Git clone/update > -;; > +;;; Git clone/update > > (defun sachac-news-update-last-update () > "Update the `sachac-news-last-update' date with the current date." > @@ -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 > @@ -361,19 +349,19 @@ Time left for automatic forced update: %s %s" > (* sachac-news-update-hours-wait 60 60))) > "No timer setted") > (number-to-string (/ (sachac-news-get-update-time-left) 60)) > - "minutes") ) > + "minutes")) > > (defun sachac-news-get-update-wait-seconds () > "Get the `sachac-news-update-hours-wait' in seconds." > - (* sachac-news-update-hours-wait 60 60) ) > + (* sachac-news-update-hours-wait 60 60)) > > (defun sachac-news-show-update-time () > "Display the time left for the next update." > (interactive) > (sachac-news-load-data-if-needed) > (if sachac-news-last-update > - (message (sachac-news-update-time-str)) > - (message "Git has not been called before.")) ) > + (message "%s" (sachac-news-update-time-str)) > + (message "Git has not been called before."))) > > (defun sachac-news-get-update-time-left () > "Return the seconds left for the next scheduled update. > @@ -384,7 +372,7 @@ been setted)." > (if sachac-news-timer-setted-time > (- (+ sachac-news-timer-setted-time (sachac-news-get-update-wait-seconds)) > (time-convert (current-time) 'integer)) > - 0) ) > + 0)) > > (defun sachac-news-get-update-enable-time-left () > "Return the seconds left for the next enabled update. > @@ -398,7 +386,7 @@ loaded)." > (if sachac-news-last-update > (- (+ sachac-news-last-update (sachac-news-get-update-wait-seconds)) > (time-convert (current-time) 'integer)) > - 0) ) > + 0)) > > (defun sachac-news-get-update-time-elapsed () > "Return the seconds elapsed since the last update. > @@ -408,19 +396,19 @@ Return the numbre of seconds after the maximum wait + 1 if > (if sachac-news-last-update > (- (time-convert (current-time) 'integer) > sachac-news-last-update) > - (+ (sachac-news-get-update-wait-seconds) 1)) ) > + (+ (sachac-news-get-update-wait-seconds) 1))) > > (defun sachac-news-is-time-for-update-p () > "Check if a day has passed since the last update." > (if sachac-news-last-update > (>= (sachac-news-get-update-time-elapsed) > - (sachac-news-get-update-wait-seconds) ) > - t) ) > + (sachac-news-get-update-wait-seconds)) > + t)) > > (defun sachac-news-create-dirs () > "Create the needed directories to save data and the repository." > (make-directory sachac-news-data-directory t) > - (make-directory (sachac-news-dir-git) t) ) > + (make-directory (sachac-news-dir-git) t)) > > (defun sachac-news--git-sentinel (_process event) > "Git sentinel. > @@ -454,19 +442,19 @@ FUNC-CALL-AFTER is a function called after the git process endend successfully." > (when func-call-after > (add-hook 'sachac-news--git-hook func-call-after)) > (setq sachac-news--git-process > - (if (file-exists-p (sachac-news-git-index-org)) > - (start-process-shell-command "sachac-news-git-pull" > + (let ((default-directory (expand-file-name "emacs-news" (sachac-news-dir-git)))) > + ;; I am not sure what the point is there, but I suspect > + ;; there should be a better way to do this using timers > + ;; and vc-git. > + (if (file-exists-p (sachac-news-git-index-org)) > + (start-process-shell-command "sachac-news-git-pull" > + "*sachac-news-git*" > + (concat "sleep 60 ; " git-program " pull")) > + (start-process-shell-command "sachac-news-git-clone" > "*sachac-news-git*" > - (concat > - "cd " (sachac-news-dir-git) "/emacs-news ; sleep 60 ; " > - git-program > - " pull")) > - (start-process-shell-command "sachac-news-git-clone" > - "*sachac-news-git*" > - (concat > - "cd " (sachac-news-dir-git) "; sleep 60 ; " > - git-program " clone https://github.com/sachac/emacs-news.git")))) > - (set-process-sentinel sachac-news--git-process #'sachac-news--git-sentinel)) ) > + (concat "sleep 60 ; " git-program " clone \ > +https://github.com/sachac/emacs-news.git"))))) > + (set-process-sentinel sachac-news--git-process #'sachac-news--git-sentinel))) > > > (defun sachac-news-update-git (&optional force-update > @@ -501,11 +489,11 @@ pull/clone." > (when callback-if-no-update > (funcall callback-if-no-update)))) > ;; Git program not founded > - (message "%s %s\n%s\n%s" > - "The Git program has not been founded!" > - "SachaC-news cannot download news without it!" > - "Please install it in our system or customize the variable:" > - "M-x customize-option sachac-news-git-command"))) ) > + (message (substitute-command-keys > + "The Git program has not been founded! \ > +SachaC-news cannot download news without it! > +Please install it in our system or customize the variable: ) > +\\[customize-option] sachac-news-git-command"))))) > > (defun sachac-news-open-index-file () > "Open the index.org file from the local repository. > @@ -519,15 +507,10 @@ how the update is done." > (sachac-news-update-git) > (if (file-exists-p (sachac-news-git-index-org)) > (find-file (sachac-news-git-index-org)) > - (message "%s\n%s" > - "Index file not found! Did something wrong happen?" > - "See `sachac-news-update-git'.")) ) > + (message "Index file not found! Did something wrong happen? > +See `sachac-news-update-git'."))) > > - > -;; > -;; -------------------- > -;; Folding categories > -;; > +;;; Folding categories > > (defun sachac-news-find-all-categories (category-regexps &optional org-element) > "Match paragraph with the CATEGORY-REGEXPS regexp. > @@ -554,7 +537,7 @@ Returns a list of org-element of type \\'item found in the index.org." > (string-match-p category element)) > category-regexps)) > > - parent)))) ) > + parent))))) > > > (defun sachac-news-fold-all-items (item-list) > @@ -582,12 +565,9 @@ This function works on any Org file, even at the Emacs news' index.org." > (let ((category-list (if category-regexp-list category-regexp-list > sachac-news-fold-category-regexp-list))) > (sachac-news-fold-all-items > - (sachac-news-find-all-categories category-list))) ) > + (sachac-news-find-all-categories category-list)))) > > -;; > -;; -------------------- > -;; Alarm > -;; > +;;; Alarm > > (defun sachac-news-default-notify-alarm () > "The default alarm. > @@ -596,7 +576,7 @@ Use the notify-send to send the alarm." > (when program > (shell-command (concat program > " --app-name=\"Emacs: SachaC-news\"" > - " \"Check the News!\"")))) ) > + " \"Check the News!\""))))) > > (defun sachac-news-default-sound-alarm () > "The default sound alarm. > @@ -619,17 +599,14 @@ as fallback." > (car program-data) > (split-string > (format (cadr program-data) sachac-news-alarm-sound-file))) > - (ding t))) ) > + (ding t)))) > > (defun sachac-news-run-alarm-if-needed () > "Run the alarm hook functions if there is a new post ." > (when (sachac-news-is-there-new-title-p) > - (run-hooks 'sachac-news-alarm-functions-hook)) ) > + (run-hooks 'sachac-news-alarm-functions-hook))) > > -;; > -;; -------------------- > -;; Timer > -;; > +;;; Timer > > (defun sachac-news-timer-function () > "The function used by the timer." > @@ -638,7 +615,7 @@ as fallback." > (sachac-news-update-git t #'sachac-news-show-last-new-if-new) > (sachac-news-run-alarm-if-needed) > > - (sachac-news-activate-timer) ) > + (sachac-news-activate-timer)) > > > (defun sachac-news-activate-timer () > @@ -650,9 +627,9 @@ Set the timer for executing on `sachac-news-update-hours-wait' hours." > (setq sachac-news-timer-setted-time (time-convert (current-time) 'integer)) > (setq sachac-news-timer > (run-at-time > - (concat (number-to-string sachac-news-update-hours-wait) "hours") > - nil > - #'sachac-news-timer-function)) ) > + (format "%d hours" sachac-news-update-hours-wait) > + nil > + #'sachac-news-timer-function))) > > (defun sachac-news-deactivate-timer () > "Stop and cancel the timer." > @@ -660,7 +637,7 @@ Set the timer for executing on `sachac-news-update-hours-wait' hours." > (when (timerp sachac-news-timer) > (cancel-timer sachac-news-timer) > (setq sachac-news-timer nil)) > - (setq sachac-news-timer-setted-time nil) ) > + (setq sachac-news-timer-setted-time nil)) > > (defun sachac-news-timer-status () > "Is the timer setted or not? > @@ -668,8 +645,13 @@ Report the user about the timer status." > (interactive) > (if (timerp sachac-news-timer) > (message "Timer is setted and running.") > - (message "Timer is deactivated")) ) > + (message "Timer is deactivated"))) > + > +;; Don't activate side effects while loading your package! Instruct > +;; the users to add this to their init.el, so that one knows what is > +;; going on. > > -(sachac-news-activate-timer) > +;; (sachac-news-activate-timer) > > +(provide 'sachac-news) > ;;; sachac-news.el ends here > [3 <text/plain (7bit)>] > > > According to http://elpa.gnu.org/, and the README.org [2] file > > linked there, it says to notify to this mail address as > > first step. Also, it mentions other steps regarding pushing the > > code and adding an entry on elpa-packages file. But, there is a > > marker above indicating "OUTDATED" [3]. > > That should be addressed ^^ > > > Please, could you tell me if these steps are needed? > > If they are not, how should I proceed? > > As soon as we sort out the above comments, I can take care of adding the > package for you. > > > Cheers! > > Christian Gimenez > > > > [1] https://github.com/purcell/flycheck-package > > [2] https://git.savannah.gnu.org/cgit/emacs/elpa.git/plain/README > > [3] The section states: "Text below this marker is OUTDATED and > > still needs to be reviewed/rewritten!!" -- - Mastodon: @cnngimenez@mastodon.social ,= ,-_-. =. Utilice GPG: ((_/)o o(\_)) * https://emailselfdefense.fsf.org/ `-'(. .)`-' * Usando la terminal GNU/Linux: \_/ $ gpg2 --search-keys 77A56F0DA5DD9E05 [-- Attachment #2: OpenPGP Digital Signature --] [-- Type: application/pgp-signature, Size: 228 bytes --] ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [ELPA] New package: SachaC-news 2023-11-18 20:30 ` Christian @ 2023-11-18 21:10 ` Philip Kaludercic 2023-11-25 22:07 ` Christian 0 siblings, 1 reply; 26+ messages in thread From: Philip Kaludercic @ 2023-11-18 21:10 UTC (permalink / raw) To: Christian; +Cc: emacs-devel Christian <cnngimenez@disroot.org> writes: > Thanks Philip! > > I applied the diff to this commit: > > https://git.sr.ht/~cngimenez/sachac-news/commit/8263dbc7982f543f673172c4a60d4bb68a48c6f6 It appears you applied my comments as well? I should have made it clear, that my message just intended to propose some changes, demonstrate possible alternatives and raise some questions for us to discuss. > Cheers! > Christian. > > On Fri, 17 Nov 2023 04:28:35 -0300, Kaludercic wrote: >> >> [1 <text/plain (7bit)>] >> Christian <cnngimenez@disroot.org> writes: >> >> > Hi! >> > >> > I want to propose SachaC-news (or sachac-news.el if you like) >> > package to be included in ELPA. Its objective is to check for >> > Sacha Chua's news repository periodically, and to show the Org >> > file if there is a new commit with a new post in it. It has >> > some customizations too, such as folding specific sections >> > automatically, and desktop notifications via "notify-send". The >> > requirement is the git program to be installed on your system. >> > This information and its usage is at the README.org file at the >> > package repository: >> > >> > https://github.com/cnngimenez/sachac-news >> > >> > The code has been checked with byte-compile-file, and >> > flycheck configured with checkdoc and flycheck-package [1]. >> >> > They do not display any warnings up to commit d00e629, but tell >> > me if you find something to fix or any suggestions. >> >> I found a few things, here is a diff with some comments and suggestions: >> >> [2 <text/plain (7bit)>] >> diff --git a/sachac-news.el b/sachac-news.el >> index 8d67911..1f389b2 100644 >> --- a/sachac-news.el >> +++ b/sachac-news.el >> @@ -22,7 +22,6 @@ >> ;; You should have received a copy of the GNU General Public License >> ;; along with this program. If not, see <https://www.gnu.org/licenses/>. >> >> - >> ;;; Commentary: >> >> ;; Check periodically for new commits on Sacha Chua's news repository. >> @@ -58,29 +57,29 @@ >> >> ;;; Code: >> >> -(provide 'sachac-news) >> (require 'org-element) >> (require 'org-list) >> -(require 'cl-extra) >> +(require 'cl-lib) >> >> (defgroup sachac-news nil >> "Sacha Chua's Emacs news customizations." >> :group 'applications) >> >> -(defcustom sachac-news-git-command "git" >> +(defcustom sachac-news-git-command >> + (eval-when-compile >> + (require 'vc-git) >> + vc-git-program) >> "Path or git command name. >> >> Valid values are \"/usr/bin/git\" or \"git\" if it is in the current PATH." >> - :type 'string >> - :group 'sachac-news) ;; defcustom >> + :type 'string) ;; defcustom >> >> (defcustom sachac-news-fold-category-regexp-list '() >> "A list of regexp strings of the matching categories that should be folded. >> >> The function `sachac-news-fold-categories' use this variable to find >> categories that the user wants to hide." >> - :type '(repeat regexp) >> - :group 'sachac-news) ;; defcustom >> + :type '(repeat regexp)) ;; defcustom >> >> (defcustom sachac-news-alarm-sound-file >> "/usr/share/sounds/freedesktop/stereo/bell.oga" >> @@ -88,8 +87,7 @@ categories that the user wants to hide." >> If the value is nil or the file does not exists, the `ding' function is used. >> >> See `sachac-news-default-sound-alarm' function." >> - :type 'file >> - :group 'sachac-news) ;; defcustom >> + :type 'file) ;; defcustom >> >> (defcustom sachac-news-alarm-sound-programs >> '(("mpv" . "--really-quiet %s") >> @@ -100,22 +98,20 @@ programs is founded on the system, the `ding' function will be used. The >> first program founded is used. >> >> This variable is used by `sachac-news-default-sound-alarm' function." >> - :type '(alist :key-type string :value-type string) >> - :group 'sachac-news ) ;; defcustom >> + :type '(alist :key-type string :value-type string)) ;; defcustom >> >> (defcustom sachac-news-alarm-functions-hook >> '(sachac-news-default-notify-alarm >> sachac-news-default-sound-alarm) >> "The alarm functions. >> These functions are called when there are new news." >> - :type 'hook >> - :group 'sachac-news ) ;; defcustom >> + :type 'hook) ;; defcustom >> >> (defconst sachac-news-title-regexp >> "^\\*\\*[[:space:]]+[[:digit:]]+-[[:digit:]]+-[[:digit:]]+[[:space:]]+Emacs news" >> - "Regexp used to find news titles in the index.org file." ) ;; defconst >> + "Regexp used to find news titles in the index.org file.") ;; defconst >> >> -(defvar sachac-news-timer-setted-time 0 >> +(defvar sachac-news-timer-setted-time 0 ;perhaps mark these as internal: sachac-news--... >> "At what time the timer has been setted? >> See `sachac-news-set-timer'.") >> >> @@ -148,66 +144,67 @@ Else, this variable contains nil.") >> >> If USE-INDEX-ORG is t, then load the index.org file. Else, use the current >> buffer as if it is the index.org." >> - >> (if use-index-org >> (with-temp-buffer >> (insert-file-contents (sachac-news-git-index-org)) >> - (sachac-news-take-last-new nil) ) >> + (sachac-news-take-last-new nil)) >> (progn >> (goto-char (point-min)) >> (search-forward-regexp sachac-news-title-regexp) >> (let ((sachac-news-title (org-element-at-point))) >> (buffer-substring-no-properties >> (org-element-property :begin sachac-news-title) >> - (org-element-property :end sachac-news-title))))) ) >> + (org-element-property :end sachac-news-title)))))) >> >> -(defcustom sachac-news-data-directory (concat user-emacs-directory >> - "sachac/") >> +(defcustom sachac-news-data-directory >> + (locate-user-emacs-file "sachac") >> "Where is the data directory?" >> - :type 'directory >> - :group 'sachac-news) ;; defcustom >> + :type 'directory) ;; defcustom >> >> -(defcustom sachac-news-data-file "data.el" >> +(defcustom sachac-news-data-file "data.eld" >> "The configuration and data file. >> This is where the last updated date and other data is stored." >> - :type 'file >> - :group 'sachac-news) ;; defcustom >> + :type 'file) ;; defcustom >> >> (defcustom sachac-news-git-dirname "git" >> "The directory where the git repository should be cloned." >> - :type 'string >> - :group 'sachac-news) >> + :type 'string) >> >> +;; She publishes the news every week around the beginning, why check >> +;; every day? >> (defcustom sachac-news-update-hours-wait 24 >> "The amount of hours when the git clone/pull must wait before be called. >> >> Default is 24 hours. Only positive values should be used." >> - :type 'integer >> - :group 'sachac-news ) ;; defcustom >> + :type 'natnum >> + :group 'sachac-news) ;; defcustom >> >> (defun sachac-news-dir-git () >> "Return the complete git path." >> - (concat sachac-news-data-directory "/" sachac-news-git-dirname) ) >> + (expand-file-name sachac-news-git-dirname sachac-news-data-directory)) >> >> (defun sachac-news-dir-datafile () >> "Return the complete data file path." >> - (concat sachac-news-data-directory "/" sachac-news-data-file) ) >> - >> + (expand-file-name sachac-news-data-file sachac-news-data-directory)) >> >> (defun sachac-news-git-index-org () >> "Return the index.org path on the git directory." >> - (concat (sachac-news-dir-git) "/emacs-news/index.org") ) >> + (expand-file-name >> + "index.org" >> + (expand-file-name >> + "emacs-news" >> + (sachac-news-dir-git)))) >> >> (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") >> >> (goto-char (point-min)) >> >> @@ -217,7 +214,7 @@ See `sachac-news-show-last-new'." >> (sachac-news-update-last-saved-title) >> (sachac-news-fold-categories)) >> >> - (display-buffer (current-buffer)))) ) >> + (display-buffer (current-buffer))))) >> >> (defun sachac-news-show-last-new-if-new () >> "Show the last new if there is a new title. >> @@ -241,16 +238,12 @@ see `sachac-news-update-hours-wait' variable." >> #'sachac-news--show-last-new-internal >> #'sachac-news--show-last-new-internal)) >> >> -;; >> -;; -------------------- >> -;; Last saved title >> -;; >> +;;; Last saved title >> >> (defun sachac-news-update-last-saved-title () >> "Save the last title into the data file." >> - >> (setq sachac-news-last-saved-title (sachac-news-get-last-title)) >> - (sachac-news-save-data) ) >> + (sachac-news-save-data)) >> >> (defun sachac-news-get-last-title (&optional use-current-buffer) >> "Get the first title founded in the current buffer. >> @@ -264,7 +257,7 @@ the last title. Else, if t, use the current buffer, but remember to call >> nil t) >> (with-temp-buffer >> (insert (sachac-news-take-last-new t)) >> - (sachac-news-get-last-title t))) ) >> + (sachac-news-get-last-title t)))) >> >> (defun sachac-news-is-there-new-title-p (&optional use-current-buffer) >> "According to the last save, return t when a new post is found. >> @@ -284,12 +277,9 @@ last news buffer. Else, open the index.org and retrieve the last news." >> >> (or (null sachac-news-last-saved-title) >> (not (string-equal last-title >> - sachac-news-last-saved-title)))) ) >> + sachac-news-last-saved-title))))) >> >> -;; >> -;; -------------------- >> -;; Data or config. load/save >> -;; >> +;;; Data or config. load/save >> >> (defun sachac-news-load-data () >> "Update variables which values are in the configuration file. >> @@ -305,7 +295,7 @@ important variables." >> (setq sachac-news-last-saved-title >> (alist-get 'last-saved-title expr)) >> ;; Return the expression loaded >> - expr))) ) >> + expr)))) >> >> (defun sachac-news-save-data () >> "Save some important variables into the data file. >> @@ -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." >> (unless sachac-news-data-loaded >> (sachac-news-load-data) >> - (setq sachac-news-data-loaded t)) ) >> + (setq sachac-news-data-loaded t))) >> >> -;; >> -;; -------------------- >> -;; Git clone/update >> -;; >> +;;; Git clone/update >> >> (defun sachac-news-update-last-update () >> "Update the `sachac-news-last-update' date with the current date." >> @@ -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 >> @@ -361,19 +349,19 @@ Time left for automatic forced update: %s %s" >> (* sachac-news-update-hours-wait 60 60))) >> "No timer setted") >> (number-to-string (/ (sachac-news-get-update-time-left) 60)) >> - "minutes") ) >> + "minutes")) >> >> (defun sachac-news-get-update-wait-seconds () >> "Get the `sachac-news-update-hours-wait' in seconds." >> - (* sachac-news-update-hours-wait 60 60) ) >> + (* sachac-news-update-hours-wait 60 60)) >> >> (defun sachac-news-show-update-time () >> "Display the time left for the next update." >> (interactive) >> (sachac-news-load-data-if-needed) >> (if sachac-news-last-update >> - (message (sachac-news-update-time-str)) >> - (message "Git has not been called before.")) ) >> + (message "%s" (sachac-news-update-time-str)) >> + (message "Git has not been called before."))) >> >> (defun sachac-news-get-update-time-left () >> "Return the seconds left for the next scheduled update. >> @@ -384,7 +372,7 @@ been setted)." >> (if sachac-news-timer-setted-time >> (- (+ sachac-news-timer-setted-time (sachac-news-get-update-wait-seconds)) >> (time-convert (current-time) 'integer)) >> - 0) ) >> + 0)) >> >> (defun sachac-news-get-update-enable-time-left () >> "Return the seconds left for the next enabled update. >> @@ -398,7 +386,7 @@ loaded)." >> (if sachac-news-last-update >> (- (+ sachac-news-last-update (sachac-news-get-update-wait-seconds)) >> (time-convert (current-time) 'integer)) >> - 0) ) >> + 0)) >> >> (defun sachac-news-get-update-time-elapsed () >> "Return the seconds elapsed since the last update. >> @@ -408,19 +396,19 @@ Return the numbre of seconds after the maximum wait + 1 if >> (if sachac-news-last-update >> (- (time-convert (current-time) 'integer) >> sachac-news-last-update) >> - (+ (sachac-news-get-update-wait-seconds) 1)) ) >> + (+ (sachac-news-get-update-wait-seconds) 1))) >> >> (defun sachac-news-is-time-for-update-p () >> "Check if a day has passed since the last update." >> (if sachac-news-last-update >> (>= (sachac-news-get-update-time-elapsed) >> - (sachac-news-get-update-wait-seconds) ) >> - t) ) >> + (sachac-news-get-update-wait-seconds)) >> + t)) >> >> (defun sachac-news-create-dirs () >> "Create the needed directories to save data and the repository." >> (make-directory sachac-news-data-directory t) >> - (make-directory (sachac-news-dir-git) t) ) >> + (make-directory (sachac-news-dir-git) t)) >> >> (defun sachac-news--git-sentinel (_process event) >> "Git sentinel. >> @@ -454,19 +442,19 @@ FUNC-CALL-AFTER is a function called after the git process endend successfully." >> (when func-call-after >> (add-hook 'sachac-news--git-hook func-call-after)) >> (setq sachac-news--git-process >> - (if (file-exists-p (sachac-news-git-index-org)) >> - (start-process-shell-command "sachac-news-git-pull" >> + (let ((default-directory (expand-file-name "emacs-news" (sachac-news-dir-git)))) >> + ;; I am not sure what the point is there, but I suspect >> + ;; there should be a better way to do this using timers >> + ;; and vc-git. >> + (if (file-exists-p (sachac-news-git-index-org)) >> + (start-process-shell-command "sachac-news-git-pull" >> + "*sachac-news-git*" >> + (concat "sleep 60 ; " git-program " pull")) >> + (start-process-shell-command "sachac-news-git-clone" >> "*sachac-news-git*" >> - (concat >> - "cd " (sachac-news-dir-git) "/emacs-news ; sleep 60 ; " >> - git-program >> - " pull")) >> - (start-process-shell-command "sachac-news-git-clone" >> - "*sachac-news-git*" >> - (concat >> - "cd " (sachac-news-dir-git) "; sleep 60 ; " >> - git-program " clone https://github.com/sachac/emacs-news.git")))) >> - (set-process-sentinel sachac-news--git-process #'sachac-news--git-sentinel)) ) >> + (concat "sleep 60 ; " git-program " clone \ >> +https://github.com/sachac/emacs-news.git"))))) >> + (set-process-sentinel sachac-news--git-process #'sachac-news--git-sentinel))) >> >> >> (defun sachac-news-update-git (&optional force-update >> @@ -501,11 +489,11 @@ pull/clone." >> (when callback-if-no-update >> (funcall callback-if-no-update)))) >> ;; Git program not founded >> - (message "%s %s\n%s\n%s" >> - "The Git program has not been founded!" >> - "SachaC-news cannot download news without it!" >> - "Please install it in our system or customize the variable:" >> - "M-x customize-option sachac-news-git-command"))) ) >> + (message (substitute-command-keys >> + "The Git program has not been founded! \ >> +SachaC-news cannot download news without it! >> +Please install it in our system or customize the variable: ) >> +\\[customize-option] sachac-news-git-command"))))) >> >> (defun sachac-news-open-index-file () >> "Open the index.org file from the local repository. >> @@ -519,15 +507,10 @@ how the update is done." >> (sachac-news-update-git) >> (if (file-exists-p (sachac-news-git-index-org)) >> (find-file (sachac-news-git-index-org)) >> - (message "%s\n%s" >> - "Index file not found! Did something wrong happen?" >> - "See `sachac-news-update-git'.")) ) >> + (message "Index file not found! Did something wrong happen? >> +See `sachac-news-update-git'."))) >> >> - >> -;; >> -;; -------------------- >> -;; Folding categories >> -;; >> +;;; Folding categories >> >> (defun sachac-news-find-all-categories (category-regexps &optional org-element) >> "Match paragraph with the CATEGORY-REGEXPS regexp. >> @@ -554,7 +537,7 @@ Returns a list of org-element of type \\'item found in the index.org." >> (string-match-p category element)) >> category-regexps)) >> >> - parent)))) ) >> + parent))))) >> >> >> (defun sachac-news-fold-all-items (item-list) >> @@ -582,12 +565,9 @@ This function works on any Org file, even at the Emacs news' index.org." >> (let ((category-list (if category-regexp-list category-regexp-list >> sachac-news-fold-category-regexp-list))) >> (sachac-news-fold-all-items >> - (sachac-news-find-all-categories category-list))) ) >> + (sachac-news-find-all-categories category-list)))) >> >> -;; >> -;; -------------------- >> -;; Alarm >> -;; >> +;;; Alarm >> >> (defun sachac-news-default-notify-alarm () >> "The default alarm. >> @@ -596,7 +576,7 @@ Use the notify-send to send the alarm." >> (when program >> (shell-command (concat program >> " --app-name=\"Emacs: SachaC-news\"" >> - " \"Check the News!\"")))) ) >> + " \"Check the News!\""))))) >> >> (defun sachac-news-default-sound-alarm () >> "The default sound alarm. >> @@ -619,17 +599,14 @@ as fallback." >> (car program-data) >> (split-string >> (format (cadr program-data) sachac-news-alarm-sound-file))) >> - (ding t))) ) >> + (ding t)))) >> >> (defun sachac-news-run-alarm-if-needed () >> "Run the alarm hook functions if there is a new post ." >> (when (sachac-news-is-there-new-title-p) >> - (run-hooks 'sachac-news-alarm-functions-hook)) ) >> + (run-hooks 'sachac-news-alarm-functions-hook))) >> >> -;; >> -;; -------------------- >> -;; Timer >> -;; >> +;;; Timer >> >> (defun sachac-news-timer-function () >> "The function used by the timer." >> @@ -638,7 +615,7 @@ as fallback." >> (sachac-news-update-git t #'sachac-news-show-last-new-if-new) >> (sachac-news-run-alarm-if-needed) >> >> - (sachac-news-activate-timer) ) >> + (sachac-news-activate-timer)) >> >> >> (defun sachac-news-activate-timer () >> @@ -650,9 +627,9 @@ Set the timer for executing on `sachac-news-update-hours-wait' hours." >> (setq sachac-news-timer-setted-time (time-convert (current-time) 'integer)) >> (setq sachac-news-timer >> (run-at-time >> - (concat (number-to-string sachac-news-update-hours-wait) "hours") >> - nil >> - #'sachac-news-timer-function)) ) >> + (format "%d hours" sachac-news-update-hours-wait) >> + nil >> + #'sachac-news-timer-function))) >> >> (defun sachac-news-deactivate-timer () >> "Stop and cancel the timer." >> @@ -660,7 +637,7 @@ Set the timer for executing on `sachac-news-update-hours-wait' hours." >> (when (timerp sachac-news-timer) >> (cancel-timer sachac-news-timer) >> (setq sachac-news-timer nil)) >> - (setq sachac-news-timer-setted-time nil) ) >> + (setq sachac-news-timer-setted-time nil)) >> >> (defun sachac-news-timer-status () >> "Is the timer setted or not? >> @@ -668,8 +645,13 @@ Report the user about the timer status." >> (interactive) >> (if (timerp sachac-news-timer) >> (message "Timer is setted and running.") >> - (message "Timer is deactivated")) ) >> + (message "Timer is deactivated"))) >> + >> +;; Don't activate side effects while loading your package! Instruct >> +;; the users to add this to their init.el, so that one knows what is >> +;; going on. >> >> -(sachac-news-activate-timer) >> +;; (sachac-news-activate-timer) >> >> +(provide 'sachac-news) >> ;;; sachac-news.el ends here >> [3 <text/plain (7bit)>] >> >> > According to http://elpa.gnu.org/, and the README.org [2] file >> > linked there, it says to notify to this mail address as >> > first step. Also, it mentions other steps regarding pushing the >> > code and adding an entry on elpa-packages file. But, there is a >> > marker above indicating "OUTDATED" [3]. >> >> That should be addressed ^^ >> >> > Please, could you tell me if these steps are needed? >> > If they are not, how should I proceed? >> >> As soon as we sort out the above comments, I can take care of adding the >> package for you. >> >> > Cheers! >> > Christian Gimenez >> > >> > [1] https://github.com/purcell/flycheck-package >> > [2] https://git.savannah.gnu.org/cgit/emacs/elpa.git/plain/README >> > [3] The section states: "Text below this marker is OUTDATED and >> > still needs to be reviewed/rewritten!!" > > -- > > - Mastodon: @cnngimenez@mastodon.social > > ,= ,-_-. =. Utilice GPG: > ((_/)o o(\_)) * https://emailselfdefense.fsf.org/ > `-'(. .)`-' * Usando la terminal GNU/Linux: > \_/ $ gpg2 --search-keys 77A56F0DA5DD9E05 > -- Philip Kaludercic ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [ELPA] New package: SachaC-news 2023-11-18 21:10 ` Philip Kaludercic @ 2023-11-25 22:07 ` Christian 2023-11-25 22:50 ` Philip Kaludercic 0 siblings, 1 reply; 26+ messages in thread From: Christian @ 2023-11-25 22:07 UTC (permalink / raw) To: Philip Kaludercic; +Cc: Christian, emacs-devel [-- Attachment #1: Type: text/plain, Size: 8297 bytes --] 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. Thanks! Cheers! 1) > (defcustom sachac-news-alarm-functions-hook > '(sachac-news-default-notify-alarm > sachac-news-default-sound-alarm) > "The alarm functions. > These functions are called when there are new news." > - :type 'hook > - :group 'sachac-news ) ;; defcustom > + :type 'hook) ;; defcustom I think it is correct to remove the :group. I tend to specify it in case I create more than one customization group, but in this case, only one is defined. 2) > +(defvar sachac-news-timer-setted-time 0 ;perhaps mark these as internal: sachac-news--... > "At what time the timer has been setted? > See `sachac-news-set-timer'.") Yep, this variable should be internal. It is used to store the timestamp when the timer has been activated. And later, the variable is used to calculate how much time has been passed since the activation. Some of the rest of the variables, I believe they should be internal too. 3) > (defun sachac-news-dir-git () > "Return the complete git path." > - (concat sachac-news-data-directory "/" sachac-news-git-dirname) ) > + (expand-file-name sachac-news-git-dirname sachac-news-data-directory)) > (defun sachac-news-dir-datafile () > "Return the complete data file path." > - (concat sachac-news-data-directory "/" sachac-news-data-file) ) > - > + (expand-file-name sachac-news-data-file sachac-news-data-directory)) > (defun sachac-news-git-index-org () > "Return the index.org path on the git directory." > - (concat (sachac-news-dir-git) "/emacs-news/index.org") ) > + (expand-file-name > + "index.org" > + (expand-file-name > + "emacs-news" > + (sachac-news-dir-git)))) I prefer using the expand-file-name, they are more portable. Did not know that this function exists. 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. But now I changed this function to support diferent formats (txt, html, org, etc.). This code changed in the current version. 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? 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? This string is shown when using M-x sachac-news-show-update-time when an update has been executed before. 7) > @@ -454,19 +442,19 @@ FUNC-CALL-AFTER is a function called after the git process endend successfully." > (when func-call-after > (add-hook 'sachac-news--git-hook func-call-after)) > (setq sachac-news--git-process > - (if (file-exists-p (sachac-news-git-index-org)) > - (start-process-shell-command "sachac-news-git-pull" > + (let ((default-directory (expand-file-name "emacs-news" (sachac-news-dir-git)))) > + ;; I am not sure what the point is there, but I suspect > + ;; there should be a better way to do this using timers > + ;; and vc-git. > + (if (file-exists-p (sachac-news-git-index-org)) > + (start-process-shell-command "sachac-news-git-pull" > + "*sachac-news-git*" > + (concat "sleep 60 ; " git-program " pull")) > + (start-process-shell-command "sachac-news-git-clone" > "*sachac-news-git*" > - (concat > - "cd " (sachac-news-dir-git) "/emacs-news ; sleep 60 ; " > - git-program > - " pull")) > - (start-process-shell-command "sachac-news-git-clone" > - "*sachac-news-git*" > - (concat > - "cd " (sachac-news-dir-git) "; sleep 60 ; " > - git-program " clone https://github.com/sachac/emacs-news.git")))) > - (set-process-sentinel sachac-news--git-process #'sachac-news--git-sentinel)) ) > + (concat "sleep 60 ; " git-program " clone \ > +https://github.com/sachac/emacs-news.git"))))) > + (set-process-sentinel sachac-news--git-process #'sachac-news--git-sentinel))) This refers to the sachac-news--git-update internal function. The sachac-news.el is already using timers, in fact, it must be a timer the one that at some point calls this function. Also, there are interactive commands that can trigger a new git-update. I think it may be more complex to create another timer inside one to just do the git clone/pull. Using vc-git it's a good idea! I didn't thought about that! 8) > @@ -668,8 +645,13 @@ Report the user about the timer status." > (interactive) > (if (timerp sachac-news-timer) > (message "Timer is setted and running.") > - (message "Timer is deactivated")) ) > + (message "Timer is deactivated"))) > + > +;; Don't activate side effects while loading your package! Instruct > +;; the users to add this to their init.el, so that one knows what is > +;; going on. > -(sachac-news-activate-timer) > +;; (sachac-news-activate-timer) > +(provide 'sachac-news) > ;;; sachac-news.el ends here Oh! That's true! I wanted to activate the timer automatically. But it is better to add a comment on the README.org about this. Thanks! On Sat, 18 Nov 2023 18:10:24 -0300, Philip Kaludercic wrote: > > Christian <cnngimenez@disroot.org> writes: > > > Thanks Philip! > > > > I applied the diff to this commit: > > > > https://git.sr.ht/~cngimenez/sachac-news/commit/8263dbc7982f543f673172c4a60d4bb68a48c6f6 > > It appears you applied my comments as well? I should have made it > clear, that my message just intended to propose some changes, > demonstrate possible alternatives and raise some questions for us to > discuss. > > > Cheers! > > Christian. > > > > -- > > > > - Mastodon: @cnngimenez@mastodon.social > > > > ,= ,-_-. =. Utilice GPG: > > ((_/)o o(\_)) * https://emailselfdefense.fsf.org/ > > `-'(. .)`-' * Usando la terminal GNU/Linux: > > \_/ $ gpg2 --search-keys 77A56F0DA5DD9E05 > > > > -- > Philip Kaludercic -- - Mastodon: @cnngimenez@mastodon.social ,= ,-_-. =. Utilice GPG: ((_/)o o(\_)) * https://emailselfdefense.fsf.org/ `-'(. .)`-' * Usando la terminal GNU/Linux: \_/ $ gpg2 --search-keys 77A56F0DA5DD9E05 [-- Attachment #2: OpenPGP Digital Signature --] [-- Type: application/pgp-signature, Size: 228 bytes --] ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [ELPA] New package: SachaC-news 2023-11-25 22:07 ` Christian @ 2023-11-25 22:50 ` Philip Kaludercic 0 siblings, 0 replies; 26+ messages in thread From: Philip Kaludercic @ 2023-11-25 22:50 UTC (permalink / raw) To: Christian; +Cc: emacs-devel 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 ^ permalink raw reply [flat|nested] 26+ messages in thread
end of thread, other threads:[~2024-01-05 4:23 UTC | newest] Thread overview: 26+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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
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).