lilypond-devel
[Top][All Lists]
Advanced

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

Which path for the dictionary? ... auto-completion possible in Emacs.


From: Heikki Johannes Junes
Subject: Which path for the dictionary? ... auto-completion possible in Emacs.
Date: Wed, 13 Nov 2002 03:09:09 +0200 (EET)

Please tell me which path could be best for file "lilypond.words"? The
most preferable place found be me was:

  /usr/share/dict/lilypond.words

I found that a file containing just the keywords can be read with the
following script (paste to Emacs and invoke at EOL with C-x C-e):

Keywords etc. are in lilypond.words,, which may contain lines (maybe
without '\\'-marks):
\\portato
\\portamento
PianoStaff

Then in Emacs it is possible to use that file as basis for completions:

# File name which contains, keywords, identifiers and reserved words
(setq fn "/usr/share/dict/lilypond.words")

# read
(if (file-readable-p fn)
 (progn
  (setq b (find-file-noselect fn))
  (setq m (set-marker (make-marker) 1 (get-buffer b)))
  (defun add-dictionary-word (x)
   (nconc '(("" . 1)) x))
   (setq i 1)
   (while (> (buffer-size b) (marker-position m))
    (setq i (+ i 1))
    (setq copy (copy-alist (list (eval (symbol-name (read m))))))
    (setcdr copy i)
    (add-dictionary-word (list copy))
   )
   (add-dictionary-word ())
))

(all-completions "\\por" (add-dictionary-word ()))

Result will be: ("\\portato" "\\portamento")

So completions are possible. The inclusion of a word list would have the
following benefits:

 - common word list for emacs and vim
 - makes auto-completion possible
 - makes lilypond-font-lock.el shorter

and the following withdraw:

 - path is different in different os:s (mac, win, etc.) -> os-dep path?

All the spec-files should also be updated if this change takes plase.

Please, comment. I think that autocompletion will come in need. It is very
easy to implement in vim, and not so bad to be implemented in emacs.

      Heikki Junes





reply via email to

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