help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: How to generate a wordlist for a document


From: Andreas Röhler
Subject: Re: How to generate a wordlist for a document
Date: Tue, 16 Aug 2011 18:45:06 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; de; rv:1.9.2.18) Gecko/20110616 SUSE/3.1.11 Thunderbird/3.1.11

Am 15.08.2011 23:20, schrieb Thorsten:
Hi list,
how do I generate a word list for a document in Emacs (in my case a
multi-file LaTex document)?
(With wordlist I mean a list with all unique words in the document)
Thanks for any hints
Thorsten




Hi,

would export first all into plain texts.

Put all into one file.

than inside Emacs

you could use something like that:

(defun wordlist (&optional beg end)
  (interactive)
  (let ((beg (cond (beg)
                   ((region-active-p)
                    (region-beginning))
                   (t (point-min))))
        (end (cond (end (copy-marker end))
                   ((region-active-p)
                    (copy-marker (region-end)))
                   (t (point-max))))
        (erg '()))
    (goto-char (point-min))
    (while (re-search-forward "\\sw+" nil (quote move) 1)
      (add-to-list 'erg (match-string-no-properties 0))
      (when (interactive-p) (message "%s" erg))
      erg)))

HTH,


Andreas

--
https://launchpad.net/python-mode
https://launchpad.net/s-x-emacs-werkstatt/




reply via email to

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