unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: stardiviner <numbchild@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Emacs developers <emacs-devel@gnu.org>
Subject: Re: How to contribute new package to GNU ELPA?
Date: Sun, 20 Dec 2020 10:12:43 +0800	[thread overview]
Message-ID: <CAL1eYuLDX8cVOe_k4ASK-p5N2foqO1e6ezg85VYFdDPvg-VTsQ@mail.gmail.com> (raw)
In-Reply-To: <jwvblepq1qr.fsf-monnier+emacs@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 6143 bytes --]

Thanks for your detailed answering. @Stefan Monnier
<monnier@iro.umontreal.ca>  It's really helpful! I tried to give up after
first email. :smile:

[stardiviner]           <Hack this world!>      GPG key ID: 47C32433
IRC(freeenode): stardiviner                     Twitter:  @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/


On Sat, Dec 19, 2020 at 11:35 PM Stefan Monnier <monnier@iro.umontreal.ca>
wrote:

> Hi
>
> >> -;; Package-Requires: ((emacs "24.4") (cl-lib "0.5") (request "0.3.0"))
> >> +;; Package-Requires: ((emacs "24.4") (request "0.3.0"))
> >
> > cl-lib should be required for `cl-function`.
>
> cl-lib comes bundles with Emacs>=24.3, so your Emacs-24.4 dependency
> already ensures cl-lib is available.
>
Applied.

>
> >>     ;; This file is part of GNU Emacs.
> >>   @@ -28,13 +28,13 @@
> >>     ;;; Commentary:
> >>   -;;; This currently only works for Linux, not tested for Mac OS
> >> X and Windows.
> >> +;; This currently only works for Linux, not tested for Mac OS X and
> Windows.
> >>   -;;; Kiwix installation
> >> +;;;; Kiwix installation
> >>   ;;
> >>   ;; http://www.kiwix.org
> >>   -;;; Config:
> >> +;;;; Config:
> >>   ;;
> >>   ;; (use-package kiwix
> >>   ;;   :ensure t
> >> @@ -45,7 +45,7 @@
> >>   ;;               kiwix-server-port 8080
> >>   ;;               kiwix-default-library
> "wikipedia_zh_all_2015-11.zim"))
> >>   -;;; Usage:
> >> +;;;; Usage:
> >
> > Why use four `;` instead of three `;`? I search many packages, they all
> use
> > three `;`. I don't know which one is the standard.
>
Applied.

>
> Because it's a sub-heading of "Commentary:" (e.g. we'd use five
> semi-colons for subsubheadings).
>
> >> +(if (featurep 'ivy) (require 'ivy))     ;FIXME: That's a no-op!
> > What does the "no-op" mean? Because some user might have not installed
> ivy,
> > so I added one condition to detect it here.
>
> If (featurep 'ivy) is non-nil, then (require 'ivy) won't do anything.
> I think your (featurep 'ivy) intended to test is Ivy is installed,
> whereas it tests if Ivy is already loaded.  But in any case you don't
> need any of that: if Ivy is installed, then `ivy-read` will be
> auto-loaded, so the rest of your code will "just work" regardless if Ivy
> is already loaded or not.
>
> You might want to use something like:
>
>     (defcustom kiwix-default-completing-read
>       (cond ((fboundp 'ivy-read) 'ivy)
>             ((fboundp 'helm) 'helm))
>
> OTOH.
>
> Applied.

> > Why deleted all `:group 'kiwix-mode`? If think correct, the :group is
> used
> > by `customize-group`. So It should be necessary.
>
> These are redundant because by default vars are placed in the group that
> was last `defgroup`d.
>
> >>   (defun kiwix-dir-detect ()
> >>     "Detect Kiwix profile directory exist."
> >> -  (let ((kiwix-dir (concat (getenv "HOME") "/.www.kiwix.org/kiwix")))
> >> -    (if (file-accessible-directory-p kiwix-dir)
> >> +  (let ((kiwix-dir "~/.www.kiwix.org/kiwix"))
> >> +    (if (file-directory-p kiwix-dir)
> > Use `file-accessible-directory-p` because also can detect folder
> > permission. If user can't read folder, that's a problem too.
>
> Then use something better (e.g. (and (file-directory-p kiwix-dir)
> (file-readable-p kiwix-dir))), but (file-accessible-directory-p kiwix-dir)
> returns non-nil when the directory is absent, in which case the user
> can't read the directory either, so it's not testing what you want.
>
> > I prefer to use `$HOME` environment variable, it should be more
> > cross-platformed.
>
> Fine by me.  I just thought it was an "obvious simplification".
>
> Actually, it's the other way around: HOME is just an env-var and its
> meaning is defined by the platform (it just happens to work fine with the
> currently supported platforms), whereas "~/" is defined by Emacs so
> we (Emacs maintainers) have to make sure it works on all platforms.  ;-)
>
Applied.

>
> >>         :success (cl-function
> >> -                (lambda (&key data &allow-other-keys)
> >> +                (lambda (&key _data &allow-other-keys) ;FIXME: Why not
> `&rest _'?
> > For later success message output.
>
> But that's another function, so it's unrelated, AFAICT.
> So, I guess what you mean is that you put it for documentation purposes,
> to remind the reader what args are passed to the success function (and
> ignored in this particular success function).
> FWIW, I find this to be a perfectly good reason (even thought it costs
> a bit extra because the `cl-lib` will actually "work" to extract the `data`
> argument even though it's not used).
>
Hmm, let's keep this. I just applied "_data" to hint it's not used.

>
> >> -(defun kiwix-at-point (&optional interactively)
> >> +(defun kiwix-at-point ()
> >>     "Search for the symbol at point with `kiwix-query'.
> >>     Or When prefix argument `INTERACTIVELY' specified, then prompt
> >>   for query string and library interactively."
> >> -  (interactive "P")
> >> +  (interactive)
> > This is necessary for later command definition
> `kiwix-at-point-interactive`.
>
> No it's not.  What this did is add an `interactively` argument and pass
> it the value of `current-prefix-arg`.  Since you don't use the variable
> `interactively`, you don't need that: the variable `current-prefix-arg`
> is not affected by the above changes.
>
> This said, maybe I'm missing something: I don't see any place where you
> implement the "When prefix argument `INTERACTIVELY' specified" test,
> instead it seems your code just always "prompts for query string and
> library interactively".
>

Applied too. I removed command `kiwix-at-point-interactive`.

> More importantly: what do you want to do about `request`?
>
> About this, I really suggest ELPA can include it. Because I hate to write
more complex url requests with `url.el`.
If someone want to adopt kiwix.el request to use `url.el`. I also can't
accept it. Because I still need to write code on it.
Also as you said, a wrapper on `url.el` is good for developer. Emacs will
need it. Really helpful.

At the end, thanks for your patient kind help. Thanks very much!

>
>         Stefan
>
>

[-- Attachment #2: Type: text/html, Size: 10306 bytes --]

  reply	other threads:[~2020-12-20  2:12 UTC|newest]

Thread overview: 85+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-17 12:11 How to contribute new package to GNU ELPA? stardiviner
2020-12-19  6:22 ` Stefan Monnier
2020-12-19  7:08   ` stardiviner
2020-12-19 15:35     ` Stefan Monnier
2020-12-20  2:12       ` stardiviner [this message]
2020-12-20 12:29         ` Emacs HTTP libraries [was: Re: How to contribute new package to GNU ELPA?] Adam Porter
2020-12-20 13:44           ` Daniel Brooks
2021-03-28  1:47             ` T.V Raman
2021-03-28 22:42               ` Vladimir Sedach
2021-03-29  9:00                 ` Sv: " arthur miller
2021-03-29 22:03                   ` Jose E. Marchesi
2021-03-29 22:09                     ` Darshit Shah
2021-03-30 11:12                       ` Arthur Miller
2021-03-30 12:03                         ` Daniel Martín
2021-03-30 12:46                           ` Stefan Kangas
2021-03-30 12:50                           ` Eli Zaretskii
2021-03-30 13:14                           ` Lars Ingebrigtsen
2021-03-30 13:39                             ` Eli Zaretskii
2021-03-30 13:48                               ` Lars Ingebrigtsen
2021-03-30 13:55                                 ` Eli Zaretskii
2021-03-30 14:25                                   ` Eli Zaretskii
2021-03-30 14:34                                     ` Lars Ingebrigtsen
2021-03-30 15:15                                       ` Eli Zaretskii
2021-03-31 13:36                                         ` Lars Ingebrigtsen
2021-03-30 16:13                                     ` Clément Pit-Claudel
2021-03-30 16:21                                       ` Eli Zaretskii
2021-03-30 16:49                                         ` Clément Pit-Claudel
2021-03-30 17:03                                           ` Eli Zaretskii
2021-03-30 19:53                                             ` Clément Pit-Claudel
2021-03-31  1:08                                               ` Stefan Monnier
2021-03-31  6:22                                                 ` Eli Zaretskii
2021-03-31  5:54                                               ` Eli Zaretskii
2021-03-30 20:53                                             ` T.V Raman
2021-03-31  6:02                                               ` Eli Zaretskii
2021-03-31 16:01                                                 ` read-process-output-max (was: Emacs HTTP libraries) Stefan Monnier
2021-03-31 17:13                                                   ` Eli Zaretskii
2021-03-31 23:05                                                     ` read-process-output-max Stefan Monnier
2021-04-01  7:12                                                       ` read-process-output-max Eli Zaretskii
2021-03-30 18:08                             ` Sv: Emacs HTTP libraries [was: Re: How to contribute new package to GNU ELPA?] Arthur Miller
2021-03-31  8:59                               ` Robert Pluim
2021-03-31 17:21                                 ` Daniel Brooks
2021-04-01 14:23                                   ` Robert Pluim
2021-04-01 16:09                                     ` Daniel Brooks
2021-04-02 12:10                                       ` Robert Pluim
2021-04-01 16:57                                     ` tomas
2021-03-29 23:56                     ` Daniel Brooks
2020-12-20 13:56           ` David Engster
2020-12-20 17:27             ` Lars Ingebrigtsen
2020-12-20 14:36           ` Stefan Monnier
2020-12-20 15:17             ` Jean Louis
2020-12-20 15:23             ` Helmut Eller
2020-12-20 16:02               ` Daniel Brooks
2020-12-21  5:47           ` Richard Stallman
2020-12-21 14:17             ` Stefan Monnier
2020-12-22  5:17               ` Richard Stallman
2020-12-21 16:59             ` Philip K.
2020-12-21 17:23               ` Eli Zaretskii
2020-12-21 17:41                 ` Arthur Miller
2020-12-21 18:13                   ` Eli Zaretskii
2020-12-21 18:18                     ` Arthur Miller
2020-12-21 23:51                     ` Philip K.
2020-12-22  3:32                       ` Lars Ingebrigtsen
2020-12-22  3:35                       ` Eli Zaretskii
2020-12-22 10:38                         ` Philip K.
2020-12-22 16:02                           ` Eli Zaretskii
2020-12-22 16:59                             ` Philip K.
2020-12-22 17:15                               ` Eli Zaretskii
2020-12-22  5:20               ` Richard Stallman
2020-12-22  6:42                 ` Arthur Miller
2020-12-22 10:49                 ` Philip K.
2020-12-22 12:03                   ` Jean Louis
2020-12-22 13:23                     ` Philip K.
2020-12-23  4:26                       ` Richard Stallman
2020-12-22 13:04                   ` Arthur Miller
2020-12-23  4:26                     ` Richard Stallman
2020-12-23 11:27                       ` Arthur Miller
2020-12-24  5:51                         ` Richard Stallman
2020-12-24 12:59                           ` Arthur Miller
2020-12-25  4:41                             ` Richard Stallman
2020-12-20 14:18         ` How to contribute new package to GNU ELPA? Stefan Monnier
2020-12-21 14:03           ` stardiviner
2020-12-26  9:09           ` stardiviner
2020-12-26 15:21             ` dick.r.chiang
2020-12-26 20:24               ` Adam Porter
2020-12-26 20:39                 ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAL1eYuLDX8cVOe_k4ASK-p5N2foqO1e6ezg85VYFdDPvg-VTsQ@mail.gmail.com \
    --to=numbchild@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).