emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Keywords


From: Juri Linkov
Subject: Re: Keywords
Date: Thu, 11 Mar 2010 23:45:18 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.93 (x86_64-pc-linux-gnu)

A few days ago I got a bug report about numeric keywords displayed by
ee-finder - a package that lists all unknown finder keywords (that are
not registered in `finder-known-keywords').  I already fixed "RFC 2104"
that resulted in two separate keywords "RFC" and "2104" in finder-inf.el.
But I'm not going to hunt for more such keywords.  The problem lies in the
design flaw of keywords handling in finder.el and lisp-mnt.el.

`lm-keywords-list' assumes that keywords are separated by a sequence
of commas and whitespace.  This means that in:

  ;; Keywords: mule, multilingual, character composition

there is 4 keywords: "mule", "multilingual", "character" and "composition".
So a list of all unknown keywords currently is a mess.

To fix this problem I propose the following heuristics: if the keywords
line contains a comma, then split keywords using a comma and not whitespace,
because the presence of a comma means that the author decided to separate
keywords by commas only.

The patch below implements this:

Using parent branch file:///home/work/emacs/bzr/emacs/trunk/
=== modified file 'lisp/emacs-lisp/lisp-mnt.el'
--- lisp/emacs-lisp/lisp-mnt.el 2010-01-13 08:35:10 +0000
+++ lisp/emacs-lisp/lisp-mnt.el 2010-03-11 21:43:07 +0000
@@ -458,7 +458,9 @@ (defun lm-keywords-list (&optional file)
   "Return list of keywords given in file FILE."
   (let ((keywords (lm-keywords file)))
     (if keywords
-       (split-string keywords "[, \t\n]+" t))))
+       (if (string-match-p "," keywords)
+           (split-string keywords ",[ \t\n]*" t)
+         (split-string keywords "[, \t\n]+" t)))))
 
 (defvar finder-known-keywords)
 (defun lm-keywords-finder-p (&optional file)

But there are more problems.  In finder-inf.el multi-word keywords need
to be grouped using Lisp syntax.  Currently they are symbols, and the
entry look like:

    ("composite.el"
        "support character composition"
        (mule multilingual character composition))

There are two ways to group multi-word keywords:

1. Converting symbols to strings:

    ("composite.el"
        "support character composition"
        (mule multilingual "character composition"))

2. Adding some separator to symbols:

    ("composite.el"
        "support character composition"
        (mule multilingual character-composition))

I don't know yet what to prefer.

-- 
Juri Linkov
http://www.jurta.org/emacs/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]