* Can I build a dictionary in my Emacs? @ 2009-11-26 3:12 Water Lin 2009-11-26 11:00 ` Pascal J. Bourguignon ` (3 more replies) 0 siblings, 4 replies; 10+ messages in thread From: Water Lin @ 2009-11-26 3:12 UTC (permalink / raw) To: help-gnu-emacs I want to build a dictionary in my Emacs. So I can put my specific words, expressions and their meanings into it. By doing this, when I need them, I don't need to google them out again. I don't know if it is suitable to call it dictionary, but it likes dictionary. Any good suggestions? Thanks Water Lin -- Water Lin's notes and pencils: http://en.waterlin.org Email: WaterLin@ymail.com ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Can I build a dictionary in my Emacs? 2009-11-26 3:12 Can I build a dictionary in my Emacs? Water Lin @ 2009-11-26 11:00 ` Pascal J. Bourguignon 2009-11-26 11:54 ` Lennart Borgman 2009-11-26 22:14 ` Tim X ` (2 subsequent siblings) 3 siblings, 1 reply; 10+ messages in thread From: Pascal J. Bourguignon @ 2009-11-26 11:00 UTC (permalink / raw) To: help-gnu-emacs Water Lin <WaterLin@ymail.invalid> writes: > I want to build a dictionary in my Emacs. So I can put my specific > words, expressions and their meanings into it. > > By doing this, when I need them, I don't need to google them out again. > > I don't know if it is suitable to call it dictionary, but it likes > dictionary. > > Any good suggestions? Perhaps you could use EBD, the Emacs Data Base? But if you have a persistent internet connection, why don't you just use M-x dictionary RET? Also, using google shouldn't be a big deal from emacs: (require 'cl) (require 'w3m) (setf browse-url-browser-function (lambda (url &rest args) (other-frame 1) ; or (make-frame) (w3m-goto-url url))) (defun google-search (search-string) "Search a string with Google." (interactive "sGoogle Search: ") (setf search-string (shell-command-to-string (format "echo %s|iconv -f ISO8859-1 -t UTF-8" (shell-quote-argument search-string)))) (browse-url (format "http://www.google.com/search?as_q=%s&num=50&hl=en&ie=ISO8869-1&btnG=Google+Search&as_epq=&as_oq=&as_eq=&lr=&as_ft=i&as_filetype=&as_qdr=all&as_nlo=&as_nhi=&as_occt=any&as_dt=i&as_sitesearch=&safe=images" (apply (function concatenate) 'string (mapcar (lambda (ch) (if (or (and (<= ?0 ch) (<= ch ?9)) (and (<= ?A ch) (<= ch ?Z)) (and (<= ?a ch) (<= ch ?z))) (format "%c" ch) (format "%%%02x" ch))) (string-to-sequence search-string 'list)))))) (defun google-search-region (start end) "Search the text in the region with Google." (interactive "r") (google-search (buffer-substring-no-properties start end))) -- __Pascal Bourguignon__ ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Can I build a dictionary in my Emacs? 2009-11-26 11:00 ` Pascal J. Bourguignon @ 2009-11-26 11:54 ` Lennart Borgman 0 siblings, 0 replies; 10+ messages in thread From: Lennart Borgman @ 2009-11-26 11:54 UTC (permalink / raw) Cc: help-gnu-emacs >> I want to build a dictionary in my Emacs. So I can put my specific >> words, expressions and their meanings into it. Isn't there a good dictionary framework in predictive mode? ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Can I build a dictionary in my Emacs? 2009-11-26 3:12 Can I build a dictionary in my Emacs? Water Lin 2009-11-26 11:00 ` Pascal J. Bourguignon @ 2009-11-26 22:14 ` Tim X 2009-11-27 8:32 ` Water Lin 2009-11-27 11:37 ` Colin S. Miller 2009-11-28 3:07 ` Stefan Monnier 2009-11-29 9:43 ` Andreas Röhler 3 siblings, 2 replies; 10+ messages in thread From: Tim X @ 2009-11-26 22:14 UTC (permalink / raw) To: help-gnu-emacs Water Lin <WaterLin@ymail.invalid> writes: > I want to build a dictionary in my Emacs. So I can put my specific > words, expressions and their meanings into it. > > By doing this, when I need them, I don't need to google them out again. > > I don't know if it is suitable to call it dictionary, but it likes > dictionary. > > Any good suggestions? > > Thanks > Emacs lisp has support ofr hashes and essentially, that would provide the basic abstraction you want, but there is considerable work to provide a useful interface etc. This is work that is pretty much already done by other packages, so I feel you would be re-inventing a new wheel. for example, emacs integrates well with spelling checkers, such as ispell and most of these have support for including a personal dictionary and adding words to the dictionary. As this is integrated into things like spell checking and packages like flyspell, you get the benefit of standard funcitons, such as spell checking using your personal dictionary as well as the ones that come built-in. Rather than build/write your own, look into emacs support for spell checking and see if you can add your word definitions to that existing mechanism. Less work and easier to maintain in the long-term. Tim -- tcross (at) rapttech dot com dot au ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Can I build a dictionary in my Emacs? 2009-11-26 22:14 ` Tim X @ 2009-11-27 8:32 ` Water Lin 2009-11-27 11:37 ` Colin S. Miller 1 sibling, 0 replies; 10+ messages in thread From: Water Lin @ 2009-11-27 8:32 UTC (permalink / raw) To: help-gnu-emacs Tim X <timx@nospam.dev.null> writes: > Water Lin <WaterLin@ymail.invalid> writes: > >> I want to build a dictionary in my Emacs. So I can put my specific >> words, expressions and their meanings into it. >> >> By doing this, when I need them, I don't need to google them out again. >> >> I don't know if it is suitable to call it dictionary, but it likes >> dictionary. >> >> Any good suggestions? >> >> Thanks >> > Emacs lisp has support ofr hashes and essentially, that would provide > the basic abstraction you want, but there is considerable work to > provide a useful interface etc. This is work that is pretty much already > done by other packages, so I feel you would be re-inventing a new > wheel. > > for example, emacs integrates well with spelling checkers, such as > ispell and most of these have support for including a personal > dictionary and adding words to the dictionary. As this is integrated > into things like spell checking and packages like flyspell, you get the > benefit of standard funcitons, such as spell checking using your > personal dictionary as well as the ones that come built-in. > > Rather than build/write your own, look into emacs support for spell > checking and see if you can add your word definitions to that existing > mechanism. Less work and easier to maintain in the long-term. > > Tim Ok, Thanks, I will read something about ispell later. Thanks Water Lin -- Water Lin's notes and pencils: http://en.waterlin.org Email: WaterLin@ymail.com ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Can I build a dictionary in my Emacs? 2009-11-26 22:14 ` Tim X 2009-11-27 8:32 ` Water Lin @ 2009-11-27 11:37 ` Colin S. Miller 2009-11-27 22:50 ` Tim X 1 sibling, 1 reply; 10+ messages in thread From: Colin S. Miller @ 2009-11-27 11:37 UTC (permalink / raw) To: help-gnu-emacs Tim X wrote: > > Rather than build/write your own, look into emacs support for spell > checking and see if you can add your word definitions to that existing > mechanism. Less work and easier to maintain in the long-term. I think the OP wanted a dictionary that provides the definition of a word, not just a word-correctly-spelled-p test. Colin S. Miller -- Replace the obvious in my email address with the first three letters of the hostname to reply. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Can I build a dictionary in my Emacs? 2009-11-27 11:37 ` Colin S. Miller @ 2009-11-27 22:50 ` Tim X 0 siblings, 0 replies; 10+ messages in thread From: Tim X @ 2009-11-27 22:50 UTC (permalink / raw) To: help-gnu-emacs "Colin S. Miller" <no-spam-thank-you@csmiller.demon.co.uk> writes: > Tim X wrote: >> >> Rather than build/write your own, look into emacs support for spell >> checking and see if you can add your word definitions to that existing >> mechanism. Less work and easier to maintain in the long-term. > > I think the OP wanted a dictionary that provides the definition of a word, > not just a word-correctly-spelled-p test. > Thats a good point. In that case, I'd look at adding a dictionary to one of the dict servers (don't know if the OP is on windows or Linux, but fairly straight-forward for Linux) and then using one of the emacs interfaces to dictionary servers. This would mean all that needs to be done is generate the definitions file. All the interfaces are then done, including interfaces from other things in addition to emacs. If that is still too far off the mark for what the OP wants, I'd consider looking at edb or even just a simple sexp bassed structure that can easily be read/written to a file and maybe creating an emacs forms front-end to make querying and adding new words easy. A simple sexp based structure will be reasonably efficient for quite a large number of words and definitions. Tim -- tcross (at) rapttech dot com dot au ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Can I build a dictionary in my Emacs? 2009-11-26 3:12 Can I build a dictionary in my Emacs? Water Lin 2009-11-26 11:00 ` Pascal J. Bourguignon 2009-11-26 22:14 ` Tim X @ 2009-11-28 3:07 ` Stefan Monnier 2009-12-03 18:22 ` Drew Adams 2009-11-29 9:43 ` Andreas Röhler 3 siblings, 1 reply; 10+ messages in thread From: Stefan Monnier @ 2009-11-28 3:07 UTC (permalink / raw) To: help-gnu-emacs > I want to build a dictionary in my Emacs. So I can put my specific > words, expressions and their meanings into it. Why not just use a plain text file, with one definition per line. Set it up with (setq word-wrap t) and (setq wrap-prefix " "). Then just search with C-s and add definitions in the obvious way. Stefan ^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: Can I build a dictionary in my Emacs? 2009-11-28 3:07 ` Stefan Monnier @ 2009-12-03 18:22 ` Drew Adams 0 siblings, 0 replies; 10+ messages in thread From: Drew Adams @ 2009-12-03 18:22 UTC (permalink / raw) To: help-gnu-emacs > > I want to build a dictionary in my Emacs. So I can put my specific > > words, expressions and their meanings into it. > > Why not just use a plain text file, with one definition per line. > Set it up with (setq word-wrap t) and (setq wrap-prefix " "). > Then just search with C-s and add definitions in the obvious way. 1. I second that. If this is for your own personal use and you don't expect to have a large number of definitions, then this is a great way to go. It has the advantages of simplicity, easy update, and variety of access/navigation methods. 2. If you will have lots of definitions or you want to create a dictionary for others to use, then you might also want to look at the Emacs tags feature. A tag is essentially just a definition. A tag file is an index to definitions. Tags do not have to be definitions, but they typically are. The definitions are typically code definitions (of function, variables, etc.), but they don't have to be. The advantages of using Emacs tags for definitions are (a) distribution: the definitions can be scattered over any number of files and directories, and (b) performance. The disadvantage is that you will need to create (and maintain/update) the TAGS file, either by hand or by writing some code to do that. http://www.emacswiki.org/emacs/EmacsTags http://www.gnu.org/software/emacs/manual/html_node/emacs/Tags.html#Tags 3. You might also consider using Imenu. In a way, this is halfway between #1 and #2. Imenu parses a buffer, collecting the positions of any definitions contained in it, and then it presents those definitions to users in a menu (or via completion etc.). Again, the definitions are typically code definitions (of functions, variables, etc.), but they do not have to be. To use Imenu, you will need to come up with a regexp that recognizes a definition, which means that you need to decide on a definition format. E.g. `DEFINITION foo = ...' with a regexp that looks for "DEFINITION" followed by the defined term followed by " = ". Or some such. The regexp variable to set is `imenu-generic-expression'. http://www.emacswiki.org/emacs/ImenuMode http://www.gnu.org/software/emacs/manual/html_node/emacs/Imenu.html#Imenu 4. I don't think this is what you want, but I mention it anyway: Library `synonyms.el' provides a navigable thesaurus. It uses a (large) file that defines classes of English synonyms. You can use it to navigate among synonyms in various ways. Dunno if a similar approach would be feasible for a dictionary. http://www.emacswiki.org/emacs/Synonyms ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Can I build a dictionary in my Emacs? 2009-11-26 3:12 Can I build a dictionary in my Emacs? Water Lin ` (2 preceding siblings ...) 2009-11-28 3:07 ` Stefan Monnier @ 2009-11-29 9:43 ` Andreas Röhler 3 siblings, 0 replies; 10+ messages in thread From: Andreas Röhler @ 2009-11-29 9:43 UTC (permalink / raw) To: Water Lin; +Cc: help-gnu-emacs [-- Attachment #1: Type: text/plain, Size: 677 bytes --] Water Lin wrote: > I want to build a dictionary in my Emacs. So I can put my specific > words, expressions and their meanings into it. > > By doing this, when I need them, I don't need to google them out again. > > I don't know if it is suitable to call it dictionary, but it likes > dictionary. > > Any good suggestions? > > Thanks > > Water Lin > Attached an acronym.el, build upon Michael Olson's wtf-is.el. It stores and displays acronyms with their meaning. Maybe it delivers the form you need. Also I send an example data file. HTH Andreas -- https://code.launchpad.net/s-x-emacs-werkstatt/ http://bazaar.launchpad.net/~a-roehler/python-mode/python-mode.el/ [-- Attachment #2: acronym.el.gz --] [-- Type: application/x-gzip, Size: 3821 bytes --] [-- Attachment #3: acronym-alist-comp.el.gz --] [-- Type: application/x-gzip, Size: 12113 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2009-12-03 18:22 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-11-26 3:12 Can I build a dictionary in my Emacs? Water Lin 2009-11-26 11:00 ` Pascal J. Bourguignon 2009-11-26 11:54 ` Lennart Borgman 2009-11-26 22:14 ` Tim X 2009-11-27 8:32 ` Water Lin 2009-11-27 11:37 ` Colin S. Miller 2009-11-27 22:50 ` Tim X 2009-11-28 3:07 ` Stefan Monnier 2009-12-03 18:22 ` Drew Adams 2009-11-29 9:43 ` Andreas Röhler
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).