unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Oleh Krehel <ohwoeowho@gmail.com>
To: Drew Adams <drew.adams@oracle.com>
Cc: "Stephen J. Turnbull" <stephen@xemacs.org>,
	Stefan Monnier <monnier@IRO.UMontreal.CA>,
	Artur Malabarba <bruce.connor.am@gmail.com>,
	emacs-devel <emacs-devel@gnu.org>
Subject: Re: Adding a few more finder keywords
Date: Tue, 09 Jun 2015 18:47:51 +0200	[thread overview]
Message-ID: <874mmgygjs.fsf@gmail.com> (raw)
In-Reply-To: <6cb2edd7-dfca-41ab-b3cb-e09e29b39a94@default> (Drew Adams's message of "Tue, 9 Jun 2015 09:05:40 -0700 (PDT)")

Drew Adams <drew.adams@oracle.com> writes:

> If you need something new, then add something new.  Don't
> compromise existing constructs that others have been happily
> using in ways you don't approve of or cannot make use of.
> Share the road.

It seems that a misunderstanding lead you to believe that someone is
enforcing something. I ensure you that this isn't so. There will never
be a warning unless the package author specifically runs an interactive
command because he wants to check if his package will generate a
warning.

Inventing a new section is an option, but it's a cumbersome and
unnecessary path. I can have what I want with just `Keywords:' without
imposing anything on anyone, possibly offering a guideline through a
separate checkdoc utility that so far comes disabled by default.

Let me show you what I have in mind. All the code I wrote just now, I
require nothing more than extending the list of recommended keywords:

(defun finder-add-packages ()
  (let ((keys (delete-dups (package-all-keywords))))
    (dolist (key keys)
      (let ((packages (package-menu--refresh t (list key)))
            (kw (intern key)))
        (puthash kw
                 (delete-dups
                  (append
                   (gethash kw finder-keywords-hash)
                   (mapcar (lambda (x)
                             (package-desc-name (car x)))
                           packages)))
                 finder-keywords-hash)))))

(defun finder-add-keywords ()
  (setq finder-known-keywords
      (mapcar
       (lambda (x)
         (cons x (prin1-to-string x)))
       (hash-table-keys finder-keywords-hash))))

(defun finder-add-good-keywords ()
  (setq finder-known-keywords
        (delete-dups
         (append finder-known-keywords
                 '((python . "Python programming language")
                   (clojure . "Clojure programming language")
                   (ocaml . "OCaml programming language"))))))

Call `finder-add-packages' to add the `package-list-packages' content to
`finder-keywords-hash'.

Now, calling `finder-add-keywords' will cause chaos: "M-x"
`finder-list-keywords' results in a buffer with 1473 lines.

But resetting `finder-known-keywords' to its definition and calling
`finder-add-good-keywords' will extend the amount of sections by 3 to 39
- still a comfortable number.  Now, very conveniently I can browse the
packages available for Python, Clojure and OCaml.  Zero changes in
outside packages. Zero changes to `Keywords:'. Only change is that some
keywords were promoted to `finder-known-keywords', and the package list
was processed into finder (which takes quite long - around 10 seconds).

This is all the functionality that I wanted. Now, I'd like to make this
functionality available to users, with (almost) zero configuration.
What remains to do is to add more than just these 3 keywords to
`finder-add-good-keywords', but not 1200.



  reply	other threads:[~2015-06-09 16:47 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-25 16:59 Adding a few more finder keywords Artur Malabarba
2015-04-25 18:51 ` Drew Adams
2015-04-25 19:23   ` Artur Malabarba
2015-06-08 14:56 ` Oleh Krehel
2015-06-08 15:37   ` Drew Adams
2015-06-08 15:43     ` Oleh Krehel
2015-06-08 16:20       ` Drew Adams
2015-06-08 16:15   ` Artur Malabarba
2015-06-08 16:19     ` Artur Malabarba
2015-06-08 16:27       ` Drew Adams
2015-06-08 20:59   ` Stefan Monnier
2015-06-09  4:39     ` Stephen J. Turnbull
2015-06-09  6:52       ` Oleh Krehel
2015-06-09  8:02         ` Artur Malabarba
2015-06-09  8:54           ` Oleh Krehel
2015-06-09 14:22       ` Drew Adams
2015-06-09 14:47         ` Oleh Krehel
2015-06-09 16:05           ` Drew Adams
2015-06-09 16:47             ` Oleh Krehel [this message]
2015-06-09 17:19               ` Drew Adams
2015-06-09 16:08           ` Stephen J. Turnbull

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=874mmgygjs.fsf@gmail.com \
    --to=ohwoeowho@gmail.com \
    --cc=bruce.connor.am@gmail.com \
    --cc=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@IRO.UMontreal.CA \
    --cc=stephen@xemacs.org \
    /path/to/YOUR_REPLY

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

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

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

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